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
00030
00031
00057 #ifndef BOARD_MUSEII232_H
00058 #define BOARD_MUSEII232_H (1)
00059
00061 # define BOARD_TYPE (BOARD_MUSEII232)
00062 # define BOARD_NAME "MuseII 232"
00063 # define RADIO_TYPE (RADIO_AT86RF232)
00065
00066
00067 #ifndef DEFAULT_SPI_RATE
00068 # define DEFAULT_SPI_RATE (SPI_RATE_1_2)
00069 #endif
00070
00071
00072
00073
00074
00075 #define DDR_TRX_RESET DDRC
00076 #define PORT_TRX_RESET PORTC
00077 #define MASK_TRX_RESET (1<<PC2)
00078
00079
00080
00081 #define PORT_TRX_SLPTR PORTC
00082 #define DDR_TRX_SLPTR DDRC
00083 #define MASK_TRX_SLPTR (1<<PC0)
00084
00085
00086
00087
00088
00089
00090 #define TRX_IRQ_PORT (PORTB)
00091 #define TRX_IRQ_DDR (DDRB)
00092 #define TRX_IRQ_PIN (PINB)
00093 #define TRX_IRQ_bp (PB1)
00094
00095 # define TRX_IRQ 0x00
00096 # define TRX_IRQ_vect PCINT0_vect
00101 # define TRX_IRQ_INIT() do{ PCICR |= (1<<PCIE0); } while(0)
00102
00103 #define DI_TRX_IRQ() { PCMSK0 &= ~(1<<PCINT1); }
00104
00105 #define EI_TRX_IRQ() { PCMSK0 |= (1<<PCINT1); }
00106
00107
00108 #define SPI_TYPE SPI_TYPE_SPI
00109 #define DDR_SPI (DDRB)
00110 #define PORT_SPI (PORTB)
00112 #define SPI_MOSI (1<<PB3)
00113 #define SPI_MISO (1<<PB4)
00114 #define SPI_SCK (1<<PB5)
00115 #define SPI_SS (1<<PB2)
00118 #define SPI_DATA_REG SPDR
00124 static inline void SPI_INIT(uint8_t spirate)
00125 {
00126
00127
00128 PORT_SPI |= SPI_SS | SPI_MISO | SPI_MOSI | SPI_SCK;
00129 DDR_SPI |= SPI_MOSI | SPI_SCK | SPI_SS;
00130 DDR_SPI &= ~SPI_MISO;
00131
00132 SPCR = ((1<<SPE) | (1<<MSTR));
00133
00134 SPCR &= ~((1<<SPR1) | (1<<SPR0) );
00135 SPSR &= ~(1<<SPI2X);
00136
00137 SPCR |= (spirate & 0x03);
00138 SPSR |= ((spirate >> 2) & 0x01);
00139 }
00140
00142 #define SPI_SELN_LOW() uint8_t sreg = SREG; cli(); PORT_SPI &=~SPI_SS
00143
00144 #define SPI_SELN_HIGH() PORT_SPI |= SPI_SS; SREG = sreg
00145
00146 #define SPI_WAITFOR() do { while((SPSR & (1<<SPIF)) == 0);} while(0)
00147
00148
00149
00150 #define LED_PORT PORTD
00151 #define LED_DDR DDRD
00152 #define LED_MASK (0x18)
00153 #define LED_SHIFT (3)
00154 #define LEDS_INVERSE (0)
00156 #define LED_NUMBER (2)
00158
00159 #define LED_PIN PIND
00160 #define LED_ANODE_bp (3)
00161 #define LED_CATHODE_bp (4)
00163
00164 #define NO_KEYS (1)
00166
00167
00168 #define HIF_TYPE HIF_NONE
00169
00170
00171
00172
00173
00174 #define HWTMR_PRESCALE (8)
00175 #define HWTIMER_TICK ((1.0*HWTMR_PRESCALE)/F_CPU)
00176 #define HWTIMER_TICK_NB (1000UL)
00177 #define HWTIMER_REG (TCNT1)
00178 #define TIMER_TICK (HWTIMER_TICK_NB * HWTIMER_TICK)
00179 #define TIMER_POOL_SIZE (4)
00180 #define TIMER_INIT() \
00181 do{ \
00182 TCCR1B = 0; \
00183 OCR1A = HWTIMER_TICK_NB; \
00184 TCCR1B |= ((1<<WGM12) | (1<<CS11)); \
00185 TIMSK1 |= (1<<OCIE1A); \
00186 }while(0)
00187 # define TIMER_IRQ_vect TIMER1_COMPA_vect
00188
00189
00190
00191 #endif