00001 /* definitions for low-frequency timer interface */ 00002 /* Copyright (C) 2009 Thomas Klosa 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 00026 #ifndef ASYNC32KHZ_H 00027 #define ASYNC32KHZ_H 00028 00029 #include "cb_list.h" 00030 #include "xpal_err_log.h" 00031 00034 #define ASYNC_IDLE 0x00 00035 00038 #define ASYNC_SLOW_ACTIVE 0x01 00039 00042 #define ASYNC_FAST_ACTIVE 0x02 00043 00046 #define ASYNC_FAST_STOP 0x02 00047 00050 #define ASYNC_SLOW_OVERRUN 0x10 00051 00054 #define ASYNC_FAST_OVERRUN 0x20 00055 00061 #define ASYNC_FAST_BLOCK 0x40 00062 00068 #define ASYNC_SLOW_BLOCK 0x80 00069 00078 void hl_asyn_init(void); 00079 00082 void hl_asyn_init_osc(void); 00083 00086 void hl_asyn_init_timer (void); 00087 00093 void hl_asyn_StartSysTimer(void); 00094 00100 void hl_asyn_StopSysTimer(void); 00101 00102 00110 void hl_asyn_Register1sTimer(cb_function_t fkt2call, void *arg); 00111 00112 00120 void hl_asyn_RegisterFastTimer(cb_function_t fkt2call, void *arg); 00121 00122 00126 void hl_asyn_ReportErrors(errString_t errMsg); 00127 00139 inline void hl_asyn_Sync1sTimer(void){ 00140 OCR2B = TCNT2 - ((uint8_t)1); 00141 00142 } 00143 00144 #endif