00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00035 #ifndef BOARD_H
00036 #define BOARD_H
00037
00038 #ifndef F_CPU
00039 # error "F_CPU is undefined"
00040 #endif
00041
00042 #include <stdlib.h>
00043 #include <stdint.h>
00044 #include <inttypes.h>
00045 #include <avr/io.h>
00046 #include <avr/sleep.h>
00047 #include <avr/interrupt.h>
00048 #include <util/delay.h>
00049 #include "const.h"
00050 #include "board_cfg.h"
00051
00064 #define DELAY_US(x) _delay_ms(x/1000.0)
00065
00068 #define DELAY_MS(x) _delay_ms(x)
00069
00070 #ifndef PULLUP_KEYS
00071
00074 # define PULLUP_KEYS (0)
00075 #endif
00076
00077
00081 #define SLEEP_ON_IDLE()\
00082 do{\
00083 set_sleep_mode(SLEEP_MODE_IDLE);\
00084 sleep_mode();\
00085 }while(0);
00086
00087
00088 #ifdef NO_TIMER
00089
00091 # define TIMER_POOL_SIZE (0)
00092 # define TIMER_INIT() do{}while(0)
00093 # define TIMER_IRQ TIMER1_OVF_vect
00094 #endif
00095
00096 #ifndef HIF_TYPE
00097
00098 # define NO_HIF (1)
00099 # define HIF_TYPE (HIF_NONE)
00100 #endif
00101
00102 #ifndef HIF_IO_ENABLE
00103
00104 # define HIF_IO_ENABLE() do{}while(0)
00105 #endif
00106
00107 #define HIF_TYPE_IS_UART ((HIF_TYPE >= HIF_UART_0) && ( HIF_TYPE <= HIF_UART_1))
00108 #define HIF_TYPE_IS_USB ((HIF_TYPE == HIF_FT245) || (HIF_TYPE == HIF_AT90USB))
00109
00110
00111 #ifndef TRX_RESET_INIT
00112
00113 # define TRX_RESET_INIT() DDR_TRX_RESET |= MASK_TRX_RESET
00114 #endif
00115
00116 #ifndef TRX_RESET_HIGH
00117
00118 # define TRX_RESET_HIGH() PORT_TRX_RESET |= MASK_TRX_RESET
00119 #endif
00120
00121 #ifndef TRX_RESET_LOW
00122
00123 # define TRX_RESET_LOW() PORT_TRX_RESET &= ~MASK_TRX_RESET
00124 #endif
00125
00126 #ifndef TRX_SLPTR_INIT
00127
00128 # define TRX_SLPTR_INIT() DDR_TRX_SLPTR |= MASK_TRX_SLPTR
00129 #endif
00130
00131 #ifndef TRX_SLPTR_HIGH
00132
00133 # define TRX_SLPTR_HIGH() PORT_TRX_SLPTR |= MASK_TRX_SLPTR
00134 #endif
00135
00136 #ifndef TRX_SLPTR_LOW
00137
00138 # define TRX_SLPTR_LOW() PORT_TRX_SLPTR &= ~MASK_TRX_SLPTR
00139 #endif
00140
00141
00142 #if defined (DBG_PORT) && defined (DBG_DDR) && defined (DBG_PIN)
00143 # define DBG_INIT() do{DBG_DDR |= DBG_PIN; DBG_PORT &= ~DBG_PIN;}while(0)
00144 # define DBG_SET() do{DBG_PORT |= DBG_PIN;}while(0)
00145 # define DBG_CLR() do{DBG_PORT &= ~DBG_PIN;}while(0)
00146 # define DBG_TOGGLE() do{DBG_PORT ^= DBG_PIN;}while(0)
00147 #else
00148 # define DBG_INIT() do{}while(0)
00149 # define DBG_SET() do{}while(0)
00150 # define DBG_CLR() do{}while(0)
00151 # define DBG_TOGGLE() do{}while(0)
00152 #endif
00153
00154 #endif