Definition 2.4G Module from In-Circquit with AT86RF230 and Atmega1281 (V1.0). More...
Go to the source code of this file.
Defines | |
#define | BOARD_NAME "ict230" |
#define | BOARD_TYPE (BOARD_ICT230) |
#define | CUSTOM_RESET_TIME_MS (10) |
#define | DDR_KEY DDRD |
#define | DDR_SPI (DDRB) |
#define | DDR_TRX_RESET DDRB |
#define | DDR_TRX_SLPTR DDRB |
#define | DEFAULT_SPI_RATE (SPI_RATE_1_2) |
#define | DI_TRX_IRQ() {EIMSK &= (~(TRX_IRQ));} |
#define | EI_TRX_IRQ() {EIMSK |= (TRX_IRQ);} |
#define | HIF_TYPE HIF_UART_1 |
#define | HWTIMER_REG (TCNT1) |
#define | HWTIMER_TICK ((1.0*HWTMR_PRESCALE)/F_CPU) |
#define | HWTIMER_TICK_NB (1000UL) |
#define | HWTMR_PRESCALE (8) |
#define | INVERSE_KEYS (1) |
#define | LED_DDR DDRD |
#define | LED_MASK (0xc0) |
#define | LED_NUMBER (2) |
#define | LED_PORT PORTD |
#define | LED_SHIFT (6) |
#define | LEDS_INVERSE (1) |
#define | MASK_KEY (0x01) |
#define | MASK_TRX_RESET (_BV(PB6)) |
#define | MASK_TRX_SLPTR (_BV(PB5)) |
#define | PB0 (0) |
#define | PB1 (1) |
#define | PB2 (2) |
#define | PB3 (3) |
#define | PB4 (4) |
#define | PB5 (5) |
#define | PB6 (6) |
#define | PB7 (7) |
#define | PIN_KEY PIND |
#define | PORT_KEY PORTD |
#define | PORT_SPI (PORTB) |
#define | PORT_TRX_RESET PORTB |
#define | PORT_TRX_SLPTR PORTB |
#define | PULLUP_KEYS (1) |
#define | RADIO_TYPE (RADIO_AT86RF230) |
#define | SHIFT_KEY (0) |
#define | SPI_DATA_REG SPDR |
#define | SPI_MISO _BV(PB3) |
#define | SPI_MOSI _BV(PB2) |
#define | SPI_SCK _BV(PB1) |
#define | SPI_SELN_HIGH() PORT_SPI |= SPI_SS; SREG = sreg |
#define | SPI_SELN_LOW() uint8_t sreg = SREG; cli(); PORT_SPI &=~SPI_SS |
#define | SPI_SS _BV(PB4) |
#define | SPI_WAITFOR() do { while((SPSR & _BV(SPIF)) == 0);} while(0) |
#define | TIMER_INIT() |
Initialisation of TIMER1 (16bit timer). | |
#define | TIMER_IRQ_vect TIMER1_COMPA_vect |
#define | TIMER_POOL_SIZE (4) |
#define | TIMER_TICK (HWTIMER_TICK_NB * HWTIMER_TICK) |
#define | TRX_IRQ _BV(INT4) |
#define | TRX_IRQ_INIT() |
#define | TRX_IRQ_vect INT4_vect |
#define | TRX_TSTAMP_REG TCNT1 |
Definition 2.4G Module from In-Circquit with AT86RF230 and Atmega1281 (V1.0).
The wiring of the radio and the ATmega is shown below:
ATmega1281 AT86RF230 ---------- --------- PB1 --> SCK PB2 <-- MOSI PB3 --> MISO PB0/PB4 --> SEL (you need to drive both pins) PB5 --> SLP_TR PB6 --> TRX_RESET INT4/PE4 --> IRQ XTAL2 <-- CLKM
PD0 --> KEY Interface PD6:7 --> LED Interface
Fuses: LF: 0xe2 - 8MHz internal RC Osc. HF: 0x11 - without boot loader HF: 0x10 - with boot loader EF: 0xff LOCK: 0xef - protection of boot section
Bootloader: Start at byte=0x1e000, address=0xf000, size = 4096 instructions/ 8192 bytes
#define CUSTOM_RESET_TIME_MS (10) |
additional delay needed by hardware
#define DDR_SPI (DDRB) |
DDR register for SPI port
#define DDR_TRX_RESET DDRB |
DDR register for RESET pin
#define DDR_TRX_SLPTR DDRB |
PORT register for SLP_TR pin
#define DI_TRX_IRQ | ( | ) | {EIMSK &= (~(TRX_IRQ));} |
rising edge triggers INT4 disable TRX interrupt
#define EI_TRX_IRQ | ( | ) | {EIMSK |= (TRX_IRQ);} |
enable TRX interrupt
#define MASK_TRX_RESET (_BV(PB6)) |
PIN mask for RESET pin
#define MASK_TRX_SLPTR (_BV(PB5)) |
PIN mask for SLP_TR pin
#define PORT_SPI (PORTB) |
PORT register for SPI port
#define PORT_TRX_RESET PORTB |
PORT register for RESET pin
#define PORT_TRX_SLPTR PORTB |
DDR register for SLP_TR pin
#define RADIO_TYPE (RADIO_AT86RF230) |
used radiio (see const.h)
#define SPI_DATA_REG SPDR |
abstraction for SPI data register
#define SPI_MISO _BV(PB3) |
PIN mask for MISO pin
#define SPI_MOSI _BV(PB2) |
PIN mask for MOSI pin
#define SPI_SCK _BV(PB1) |
PIN mask for SCK pin
#define SPI_SELN_HIGH | ( | ) | PORT_SPI |= SPI_SS; SREG = sreg |
set SS line to high level
#define SPI_SELN_LOW | ( | ) | uint8_t sreg = SREG; cli(); PORT_SPI &=~SPI_SS |
set SS line to low level
#define SPI_SS _BV(PB4) |
PIN mask for SS pin
#define SPI_WAITFOR | ( | ) | do { while((SPSR & _BV(SPIF)) == 0);} while(0) |
wait until SPI transfer is ready
#define TIMER_INIT | ( | ) |
do{ \ TCCR1B |= (_BV(CS11) | _BV(WGM12)); \ TIMSK1 |= _BV(OCIE1A); \ OCR1A = 1000; \ }while(0)
Initialisation of TIMER1 (16bit timer).
#define TRX_IRQ _BV(INT4) |
interrupt mask for GICR
#define TRX_IRQ_INIT | ( | ) |
do{\ EICRB |= (_BV(ISC41)|_BV(ISC40));\ } while(0)
configuration of interrupt handling
#define TRX_IRQ_vect INT4_vect |
interrupt vector name
#define TRX_TSTAMP_REG TCNT1 |
timestamp register for RX_START event