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
00077 #ifndef BOARD_RAVRF_H
00078 #define BOARD_RAVRF_H
00079
00080 #if defined(ravrf230a)
00081 # define BOARD_TYPE (BOARD_RAVRF230A)
00082 # define BOARD_NAME "ravrf230a"
00083 # define RADIO_TYPE (RADIO_AT86RF230A)
00084 #elif defined(ravrf230b)
00085 # define BOARD_TYPE (BOARD_RAVRF230B)
00086 # define BOARD_NAME "ravrf230b"
00087 # define RADIO_TYPE (RADIO_AT86RF230B)
00088 #endif
00089
00090
00091 #ifndef DEFAULT_SPI_RATE
00092 # define DEFAULT_SPI_RATE (SPI_RATE_1_2)
00093 #endif
00094
00095
00096 #ifndef RADIO_TYPE
00097 #define RADIO_TYPE (RADIO_AT86RF230A)
00098 #endif
00099
00100
00101
00102 #define DDR_TRX_RESET DDRB
00103 #define PORT_TRX_RESET PORTB
00104 #define MASK_TRX_RESET (_BV(PB1))
00105
00106
00107
00108 #define PORT_TRX_SLPTR PORTB
00109 #define DDR_TRX_SLPTR DDRB
00110 #define MASK_TRX_SLPTR (_BV(PB3))
00111
00112
00113
00114
00115 # define TRX_IRQ _BV(ICIE1)
00116 # define TRX_IRQ_vect TIMER1_CAPT_vect
00119 # define TRX_IRQ_INIT() do{\
00120 TCCR1B |= (_BV(ICNC1) | _BV(ICES1));\
00121 TIFR1 = _BV(ICF1);\
00122 } while(0)
00125 #define DI_TRX_IRQ() {TIMSK1 &= (~(TRX_IRQ));}
00126
00127 #define EI_TRX_IRQ() {TIMSK1 |= (TRX_IRQ);}
00128
00130 #define TRX_TSTAMP_REG ICR1
00131
00132
00133 #define SPI_TYPE SPI_TYPE_SPI
00134 #define DDR_SPI (DDRB)
00135 #define PORT_SPI (PORTB)
00137 #define SPI_MOSI _BV(PB5)
00138 #define SPI_MISO _BV(PB6)
00139 #define SPI_SCK _BV(PB7)
00140 #define SPI_SS _BV(PB4)
00142 #define SPI_DATA_REG SPDR
00148 static inline void SPI_INIT(uint8_t spirate)
00149 {
00150
00151 DDR_SPI |= SPI_MOSI | SPI_SCK | SPI_SS;
00152 DDR_SPI &= ~SPI_MISO;
00153 PORT_SPI |= SPI_SCK | SPI_SS;
00154
00155 SPCR = (_BV(SPE) | _BV(MSTR));
00156
00157 SPCR &= ~(_BV(SPR1) | _BV(SPR0) );
00158 SPSR &= ~_BV(SPI2X);
00159
00160 SPCR |= (spirate & 0x03);
00161 SPSR |= ((spirate >> 2) & 0x01);
00162
00163 }
00164
00166 #define SPI_SELN_LOW() uint8_t sreg = SREG; cli(); PORT_SPI &=~SPI_SS
00167
00168 #define SPI_SELN_HIGH() PORT_SPI |= SPI_SS; SREG = sreg
00169
00170 #define SPI_WAITFOR() do { while((SPSR & _BV(SPIF)) == 0);} while(0)
00171
00172
00173 #define NO_LEDS (1)
00175
00176 #define NO_KEYS (1)
00178
00179
00180 #define HIF_TYPE HIF_UART_0
00181
00182
00183 #define HWTMR_PRESCALE (1)
00184 #define HWTIMER_TICK ((1.0*HWTMR_PRESCALE)/F_CPU)
00185 #define HWTIMER_TICK_NB (0xFFFFUL)
00186 #define HWTIMER_REG (TCNT1)
00187 #define TIMER_TICK (HWTIMER_TICK_NB * HWTIMER_TICK)
00188 #define TIMER_POOL_SIZE (4)
00189 #define TIMER_INIT() \
00190 do{ \
00191 TCCR1B |= (_BV(CS10)); \
00192 TIMSK1 |= _BV(TOIE1); \
00193 }while(0)
00194
00196 #define TIMER_IRQ_vect TIMER1_OVF_vect
00197
00198 #endif