Go to the documentation of this file.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
00068 #ifndef BOARD_DERFA_H
00069 #define BOARD_DERFA_H
00070
00071 #if defined(derfa1)
00072 # define BOARD_TYPE BOARD_DERFA1
00073 # define BOARD_NAME "derfa1"
00074 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00075 #elif defined(radiofaro)
00076 # define BOARD_TYPE BOARD_RADIOFARO
00077 # define BOARD_NAME "radiofaro"
00078 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_D)
00079 #elif defined(radiofaro_v1)
00080 # define BOARD_TYPE BOARD_RADIOFARO_V1
00081 # define BOARD_NAME "radiofaro v1"
00082 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00083 #elif defined(zigduino)
00084 # define BOARD_TYPE BOARD_ZIGDUINO
00085 # define BOARD_NAME "zigduino"
00086 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00087 #elif defined(xxo)
00088 # define BOARD_TYPE BOARD_XXO
00089 # define BOARD_NAME "tic_tac_toe"
00090 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00091 #elif defined(wprog)
00092 # define BOARD_TYPE BOARD_WPROG
00093 # define BOARD_NAME "wprog"
00094 # define RADIO_TYPE (RADIO_ATMEGA128RFA1_D)
00095 #elif defined(pinoccio)
00096 # define BOARD_TYPE BOARD_PINOCCIO
00097 # define BOARD_NAME "pinoccio"
00098 # define RADIO_TYPE (RADIO_ATMEGA128RFA1_D)
00099 #elif defined(raspbee)
00100 # define BOARD_TYPE BOARD_RASPBEE
00101 # define BOARD_NAME "raspbee"
00102 # define RADIO_TYPE (RADIO_ATMEGA256RFR2)
00103 #endif
00104
00105
00106
00107
00109 #define TRX_TSTAMP_REG TCNT1
00110
00111 #if BOARD_TYPE == BOARD_RADIOFARO
00112 # define LED_PORT PORTG
00113 # define LED_DDR DDRG
00114 # define LED_MASK (0x06)
00115 # define LED_SHIFT (1)
00116 # define LEDS_INVERSE (0)
00117 # define LED_NUMBER (2)
00118 #elif BOARD_TYPE == BOARD_WPROG
00119 # define LED_PORT PORTD
00120 # define LED_DDR DDRD
00121 # define LED_MASK (0x40)
00122 # define LED_SHIFT (6)
00123 # define LEDS_INVERSE (1)
00124 # define LED_NUMBER (1)
00125 #elif BOARD_TYPE == BOARD_PINOCCIO
00126 # define LED_PORT PORTB
00127 # define LED_DDR DDRB
00128 # define LED_MASK (0x70)
00129 # define LED_SHIFT (4)
00130 # define LEDS_INVERSE (1)
00131 # define LED_NUMBER (3)
00132 #elif BOARD_TYPE == BOARD_XXO
00133
00134
00135
00136
00137
00138
00139 #define LED_INIT() \
00140 do {\
00141 DDRB |= (_BV(PB0) | _BV(PB1) | _BV(PB2) | _BV(PB3));\
00142 PORTB |= (_BV(PB0) | _BV(PB1) | _BV(PB2) | _BV(PB3));\
00143 } while(0)
00144
00145
00146 #define LED_SET(x) \
00147 switch (x) { \
00148 case 0: PORTB &= ~_BV(0); break; \
00149 case 1: PORTB &= ~_BV(1); break; \
00150 case 2: PORTB &= ~_BV(2); break; \
00151 }
00152
00153 #define LED_CLR(x) \
00154 switch (x) { \
00155 case 0: PORTB |= _BV(0); break; \
00156 case 1: PORTB |= _BV(1); break; \
00157 case 2: PORTB |= _BV(2); break; \
00158 }
00159
00160 #define LED_SET_VALUE(x) \
00161 do { \
00162 if (x & 1) PORTB &= ~_BV(0); else PORTB |= _BV(0); \
00163 if (x & 2) PORTB &= ~_BV(1); else PORTB |= _BV(1); \
00164 if (x & 4) PORTB &= ~_BV(2); else PORTB |= _BV(2); \
00165 } while (0)
00166
00167 #define LED_GET_VALUE() ( \
00168 ((PORTB & _BV(0))? 0: 1) | \
00169 ((PORTB & _BV(1))? 0: 2) | \
00170 ((PORTB & _BV(2))? 0: 4) \
00171 )
00172
00173 #define LED_VAL(msk,val) do{}while(0)
00175 #define LED_TOGGLE(ln) \
00176 switch (ln) { \
00177 case 0: PORTB ^= _BV(5); break; \
00178 case 1: PORTB ^= _BV(7); break; \
00179 case 2: PORTB ^= _BV(6); break; \
00180 }
00181
00182 #define LED_NUMBER (3)
00183 #define LED_ACTIVITY (0)
00184
00185 #elif BOARD_TYPE == BOARD_RASPBEE
00186
00187 # define LED_INIT() \
00188 do { \
00189 DDRD |= _BV(7); \
00190 DDRG |= _BV(2); \
00191 PORTD |= _BV(7); \
00192 PORTG |= _BV(2); \
00193 } while(0)
00194
00195 # define LED_SET(x) \
00196 switch (x) { \
00197 case 0: PORTD |= _BV(7); break; \
00198 case 1: PORTG |= _BV(2); break; \
00199 }
00200
00201 # define LED_CLR(x) \
00202 switch (x) { \
00203 case 0: PORTD &= ~_BV(7); break; \
00204 case 1: PORTG &= ~_BV(2); break; \
00205 }
00206
00207 # define LED_SET_VALUE(x) \
00208 do { \
00209 if (x & 1) PORTD &= ~_BV(7); else PORTD |= _BV(7); \
00210 if (x & 2) PORTG &= ~_BV(2); else PORTG |= _BV(2); \
00211 } while (0)
00212
00213 # define LED_GET_VALUE() ( \
00214 ((PORTD & _BV(7))? 0: 1) | \
00215 ((PORTG & _BV(2))? 0: 2) )
00216
00217 # define LED_VAL(msk,val) do{}while(0)
00219 # define LED_TOGGLE(ln) \
00220 switch (ln) { \
00221 case 0: PORTD ^= _BV(7); break; \
00222 case 1: PORTG ^= _BV(2); break; \
00223 }
00224
00225 # define LED_NUMBER (2)
00226 # define LED_ACTIVITY (0)
00227
00228 #else
00229 # define LED_NUMBER (0)
00230 # define NO_LEDS (1)
00231 #endif
00232
00233 #define NO_KEYS (1)
00234
00235
00236 #if BOARD_TYPE == BOARD_RADIOFARO_V1 || \
00237 BOARD_TYPE == BOARD_ZIGDUINO || \
00238 BOARD_TYPE == BOARD_PINOCCIO || \
00239 BOARD_TYPE == BOARD_RASPBEE
00240 # define HIF_TYPE HIF_UART_0
00241 #else
00242 # define HIF_TYPE HIF_UART_1
00243 #endif
00244
00245 #define TRX_RESET_LOW() do { TRXPR &= ~_BV(TRXRST); } while (0)
00246 #define TRX_RESET_HIGH() do { TRXPR |= _BV(TRXRST); } while (0)
00247 #define TRX_SLPTR_LOW() do { TRXPR &= ~_BV(SLPTR); } while (0)
00248 #define TRX_SLPTR_HIGH() do { TRXPR |= _BV(SLPTR); } while (0)
00249
00250
00251 #define HWTMR_PRESCALE (1)
00252 #define HWTIMER_TICK ((1.0*HWTMR_PRESCALE)/F_CPU)
00253 #define HWTIMER_TICK_NB (0xFFFFUL)
00254 #define HWTIMER_REG (TCNT1)
00255 #define TIMER_TICK (HWTIMER_TICK_NB * HWTIMER_TICK)
00256 #define TIMER_POOL_SIZE (4)
00257 #define TIMER_INIT() \
00258 do{ \
00259 TCCR1B |= (_BV(CS10)); \
00260 TIMSK1 |= _BV(TOIE1); \
00261 }while(0)
00262 #define TIMER_IRQ_vect TIMER1_OVF_vect
00263
00264
00265 #if BOARD_TYPE == BOARD_RASPBEE
00266
00267 # define TRX_PA_LNA_INIT() \
00268 do {\
00269 PORTD &= ~_BV(PD6);\
00270 DDRD |= _BV(PD6);\
00271 } while(0)
00272
00273 # define TRX_TX_PA_EI() do {PORTD |= _BV(PD6);} while(0)
00274 # define TRX_TX_PA_DI() do {PORTD &= ~_BV(PD6);} while(0)
00275 # define TRX_RX_LNA_EI() do {PORTD |= _BV(PD6);} while(0)
00276 # define TRX_RX_LNA_DI() do {PORTD &= ~_BV(PD6);} while(0)
00277 #endif
00278
00279 #endif