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
00067 #ifndef BOARD_DERFA_H
00068 #define BOARD_DERFA_H
00069
00070 #if defined(derfa1)
00071 # define BOARD_TYPE BOARD_DERFA1
00072 # define BOARD_NAME "derfa1"
00073 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00074 #elif defined(radiofaro)
00075 # define BOARD_TYPE BOARD_RADIOFARO
00076 # define BOARD_NAME "radiofaro"
00077 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_D)
00078 #elif defined(radiofaro_v1)
00079 # define BOARD_TYPE BOARD_RADIOFARO_V1
00080 # define BOARD_NAME "radiofaro v1"
00081 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00082 #elif defined(zigduino)
00083 # define BOARD_TYPE BOARD_ZIGDUINO
00084 # define BOARD_NAME "zigduino"
00085 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00086 #elif defined(xxo)
00087 # define BOARD_TYPE BOARD_XXO
00088 # define BOARD_NAME "tic_tac_toe"
00089 #define RADIO_TYPE (RADIO_ATMEGA128RFA1_C)
00090 #elif defined(wprog)
00091 # define BOARD_TYPE BOARD_WPROG
00092 # define BOARD_NAME "wprog"
00093 # define RADIO_TYPE (RADIO_ATMEGA128RFA1_D)
00094 #elif defined(pinoccio)
00095 # define BOARD_TYPE BOARD_PINOCCIO
00096 # define BOARD_NAME "pinoccio"
00097 # define RADIO_TYPE (RADIO_ATMEGA128RFA1_D)
00098 #endif
00099
00100
00101
00102
00104 #define TRX_TSTAMP_REG TCNT1
00105 #if BOARD_TYPE == BOARD_RADIOFARO
00106 # define LED_PORT PORTG
00107 # define LED_DDR DDRG
00108 # define LED_MASK (0x06)
00109 # define LED_SHIFT (1)
00110 # define LEDS_INVERSE (0)
00111 # define LED_NUMBER (2)
00112 #elif BOARD_TYPE == BOARD_WPROG
00113 # define LED_PORT PORTD
00114 # define LED_DDR DDRD
00115 # define LED_MASK (0x40)
00116 # define LED_SHIFT (6)
00117 # define LEDS_INVERSE (1)
00118 # define LED_NUMBER (1)
00119 #elif BOARD_TYPE == BOARD_PINOCCIO
00120 # define LED_PORT PORTB
00121 # define LED_DDR DDRB
00122 # define LED_MASK (0x70)
00123 # define LED_SHIFT (4)
00124 # define LEDS_INVERSE (1)
00125 # define LED_NUMBER (3)
00126 #elif BOARD_TYPE == BOARD_XXO
00127
00128
00129
00130
00131
00132
00133 #define LED_INIT() \
00134 do {\
00135 DDRB |= (_BV(PB0) | _BV(PB1) | _BV(PB2) | _BV(PB3));\
00136 PORTB |= (_BV(PB0) | _BV(PB1) | _BV(PB2) | _BV(PB3));\
00137 } while(0)
00138
00139
00140 #define LED_SET(x) \
00141 switch (x) { \
00142 case 0: PORTB &= ~_BV(0); break; \
00143 case 1: PORTB &= ~_BV(1); break; \
00144 case 2: PORTB &= ~_BV(2); break; \
00145 }
00146
00147 #define LED_CLR(x) \
00148 switch (x) { \
00149 case 0: PORTB |= _BV(0); break; \
00150 case 1: PORTB |= _BV(1); break; \
00151 case 2: PORTB |= _BV(2); break; \
00152 }
00153
00154 #define LED_SET_VALUE(x) \
00155 do { \
00156 if (x & 1) PORTB &= ~_BV(0); else PORTB |= _BV(0); \
00157 if (x & 2) PORTB &= ~_BV(1); else PORTB |= _BV(1); \
00158 if (x & 4) PORTB &= ~_BV(2); else PORTB |= _BV(2); \
00159 } while (0)
00160
00161 #define LED_GET_VALUE() ( \
00162 ((PORTB & _BV(0))? 0: 1) | \
00163 ((PORTB & _BV(1))? 0: 2) | \
00164 ((PORTB & _BV(2))? 0: 4) \
00165 )
00166
00167 #define LED_VAL(msk,val) do{}while(0)
00169 #define LED_TOGGLE(ln) \
00170 switch (ln) { \
00171 case 0: PORTB ^= _BV(5); break; \
00172 case 1: PORTB ^= _BV(7); break; \
00173 case 2: PORTB ^= _BV(6); break; \
00174 }
00175
00176 #define LED_NUMBER (3)
00177 #define LED_ACTIVITY (0)
00178
00179 #else
00180 # define LED_NUMBER (0)
00181 # define NO_LEDS (1)
00182 #endif
00183
00184 #define NO_KEYS (1)
00185
00186
00187 #if BOARD_TYPE == BOARD_RADIOFARO_V1 || \
00188 BOARD_TYPE == BOARD_ZIGDUINO || \
00189 BOARD_TYPE == BOARD_PINOCCIO
00190 # define HIF_TYPE HIF_UART_0
00191 #else
00192 # define HIF_TYPE HIF_UART_1
00193 #endif
00194
00195 #define TRX_RESET_LOW() do { TRXPR &= ~_BV(TRXRST); } while (0)
00196 #define TRX_RESET_HIGH() do { TRXPR |= _BV(TRXRST); } while (0)
00197 #define TRX_SLPTR_LOW() do { TRXPR &= ~_BV(SLPTR); } while (0)
00198 #define TRX_SLPTR_HIGH() do { TRXPR |= _BV(SLPTR); } while (0)
00199
00200
00201 #define HWTMR_PRESCALE (1)
00202 #define HWTIMER_TICK ((1.0*HWTMR_PRESCALE)/F_CPU)
00203 #define HWTIMER_TICK_NB (0xFFFFUL)
00204 #define HWTIMER_REG (TCNT1)
00205 #define TIMER_TICK (HWTIMER_TICK_NB * HWTIMER_TICK)
00206 #define TIMER_POOL_SIZE (4)
00207 #define TIMER_INIT() \
00208 do{ \
00209 TCCR1B |= (_BV(CS10)); \
00210 TIMSK1 |= _BV(TOIE1); \
00211 }while(0)
00212 #define TIMER_IRQ_vect TIMER1_OVF_vect
00213
00214 #endif