• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

rtc.h

Go to the documentation of this file.
00001 /* declarations for low-frequency timer */
00002 /* Copyright (C) 2009 Holger Dietze
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation; either version 2 of the License, or
00007  *   (at your option) version 3.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License along
00015  *   with this program; if not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef RTC_H
00019 #define RTC_H
00020 
00024 #ifdef HAVE_STDINT_H
00025 #include <stdint.h>
00026 #endif
00027 #include <avr/io.h>
00028 
00040 void hl_rtc_init_osc (void);
00041 
00048 void hl_rtc_init (void);
00049 
00053 void hl_sleep_for_tick (uint16_t ms);
00054 
00056 #define F_RTC_OSC (32768)
00057 
00060 typedef struct hl_time_s {
00061   uint32_t seconds;
00062   uint32_t useconds;
00063   uint16_t ticks;
00064 } hl_time_t;
00065 
00067 hl_time_t hl_get_current_time (void);
00068 
00070 uint16_t hl_get_timer_ticks (void);
00071 
00079 inline void hl_wakeup_memory (void)
00080 {
00081   XMCRB &= ~_BV(XMM1); /* assume XMM2:0 = 010 */
00082 }
00083 
00084 #endif

Generated by  doxygen 1.7.1