Defines

# board_ibdt.h File Reference

IBDT Ranging Hardware with ATmega644 + AT86RF231. More...

Go to the source code of this file.

## Defines
#define | DDR_KEY DDRD
#define | DDR_SPI (DDRB)
#define | DDR_TRX_RESET DDRD
#define | DDR_TRX_SLPTR DDRD
#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_0
#define | HWTIMER_REG (TCNT1)
#define | HWTIMER_TICK ((1.0*HWTMR_PRESCALE)/F_CPU)
#define | HWTIMER_TICK_NB (0.001/HWTIMER_TICK)
#define | HWTMR_PRESCALE (64)
#define | INVERSE_KEYS (1)
#define | LED_DDR DDRD
#define | LED_MASK (0x30)
#define | LED_NUMBER (2)
#define | LED_PORT PORTD
#define | LED_SHIFT (4)
#define | LEDS_INVERSE (1)
#define | MASK_KEY (0x0C)
#define | MASK_TRX_RESET (_BV(PD6))
#define | MASK_TRX_SLPTR (_BV(PD7))
#define | PIN_KEY PIND
#define | PORT_KEY PORTD
#define | PORT_SPI (PORTB)
#define | PORT_TRX_RESET PORTD
#define | PORT_TRX_SLPTR PORTD
#define | PULLUP_KEYS (1)
#define | SHIFT_KEY (2)
#define | SLEEP_ON_KEY()
#define | SLEEP_ON_KEY_INIT()
#define | SLEEP_ON_KEY_vect PCINT0_vect
#define | SPI_DATA_REG SPDR
#define | SPI_MISO _BV(PB6)
#define | SPI_MOSI _BV(PB5)
#define | SPI_SCK _BV(PB7)
#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_TYPE SPI_TYPE_SPI
#define | SPI_WAITFOR() do { while((SPSR & _BV(SPIF)) == 0);} while(0)
#define | TIMER_INIT()
#define | TIMER_IRQ_vect TIMER0_COMPA_vect
#define | TIMER_POOL_SIZE (8)
#define | TIMER_TICK (HWTIMER_TICK * HWTIMER_TICK_NB)
#define | TRX_IRQ _BV(INT2)
#define | TRX_IRQ_INIT()
#define | TRX_IRQ_vect INT2_vect
#define | TRX_TSTAMP_REG TCNT1

## Detailed Description

IBDT Ranging Hardware with ATmega644 + AT86RF231.

The wiring of the radio and the ATmega is shown below:

         AVR       RF231
         ---       -----

         PD3:2   <--  KEY
         PD5:4 -->  LED

Build Options

Definition in file board_ibdt.h.

## Define Documentation

#define DDR_KEY DDRD

DDR register for keys

Definition at line 174 of file board_ibdt.h.

#define DDR_SPI (DDRB)

DDR register for SPI port

Definition at line 122 of file board_ibdt.h.

#define DDR_TRX_RESET DDRD

DDR register for RESET pin

Definition at line 90 of file board_ibdt.h.

#define DDR_TRX_SLPTR DDRD

PORT register for SLEEP_TR pin

Definition at line 97 of file board_ibdt.h.

#define DEFAULT_SPI_RATE (SPI_RATE_1_2)

ID String for this hardware

Definition at line 85 of file board_ibdt.h.

#define DI_TRX_IRQ | ( |  | ) | {EIMSK &= (~(TRX_IRQ));}

high level INT0 disable TRX interrupt

Definition at line 113 of file board_ibdt.h.

#define EI_TRX_IRQ | ( |  | ) | {EIMSK |= (TRX_IRQ);}

enable TRX interrupt

Definition at line 115 of file board_ibdt.h.

#define HIF_TYPE HIF_UART_0

Type of the host interface.

Definition at line 199 of file board_ibdt.h.

#define HWTIMER_REG (TCNT1)

name of the register where the clock ticks can be read

Definition at line 209 of file board_ibdt.h.

#define HWTIMER_TICK ((1.0*HWTMR_PRESCALE)/F_CPU)

hardware timer clock period in us (usually: prescaler / F_CPU)

Definition at line 204 of file board_ibdt.h.

#define HWTIMER_TICK_NB (0.001/HWTIMER_TICK)

number of hardware timer ticks, when IRQ routine is called, set to 1ms

Definition at line 207 of file board_ibdt.h.

#define INVERSE_KEYS (1)

= 1, if low level at port means KEY pressed

Definition at line 177 of file board_ibdt.h.

#define LED_DDR DDRD

DDR register for LEDs

Definition at line 162 of file board_ibdt.h.

#define LED_MASK (0x30)

MASK value for LEDs (msb aligned)

Definition at line 163 of file board_ibdt.h.

#define LED_NUMBER (2)

number of LEDs for this board

Definition at line 167 of file board_ibdt.h.

#define LED_PORT PORTD

PORT register for LEDs

Definition at line 161 of file board_ibdt.h.

#define LED_SHIFT (4)

SHIFT value for LEDs

Definition at line 164 of file board_ibdt.h.

#define LEDS_INVERSE (1)

= 1, if low level at port means LED on

Definition at line 165 of file board_ibdt.h.

#define MASK_KEY (0x0C)

MASK value for keys (msb aligned)

Definition at line 175 of file board_ibdt.h.

#define MASK_TRX_RESET (_BV(PD6))

PIN mask for RESET pin

Definition at line 92 of file board_ibdt.h.

#define MASK_TRX_SLPTR (_BV(PD7))

PIN mask for SLEEP_TR pin

Definition at line 98 of file board_ibdt.h.

#define PIN_KEY PIND

PIN register for keys

Definition at line 173 of file board_ibdt.h.

#define PORT_KEY PORTD

PORT register for keys

Definition at line 172 of file board_ibdt.h.

#define PORT_SPI (PORTB)

PORT register for SPI port

Definition at line 123 of file board_ibdt.h.

#define PORT_TRX_RESET PORTD

PORT register for RESET pin

Definition at line 91 of file board_ibdt.h.

#define PORT_TRX_SLPTR PORTD

DDR register for SLEEP_TR pin

Definition at line 96 of file board_ibdt.h.

#define SHIFT_KEY (2)

SHIFT value for keys

Definition at line 176 of file board_ibdt.h.

#define SLEEP_ON_KEY | ( |  | ) |

Value:

    do{\
                EIMSK |= _BV(PCIE0);\
                set_sleep_mode(SLEEP_MODE_PWR_DOWN);\
                sleep_mode();\
                EIMSK &= ~_BV(PCIE0);\
            } while(0)

Definition at line 186 of file board_ibdt.h.

#define SLEEP_ON_KEY_INIT | ( |  | ) |

Value:

    do{\
                PCMSK0 |= _BV(PCINT2);\
            }while(0)

Definition at line 181 of file board_ibdt.h.

#define SPI_DATA_REG SPDR

abstraction for SPI data register

Definition at line 130 of file board_ibdt.h.

#define SPI_MISO _BV(PB6)

PIN mask for MISO pin

Definition at line 126 of file board_ibdt.h.

#define SPI_MOSI _BV(PB5)

PIN mask for MOSI pin

Definition at line 125 of file board_ibdt.h.

#define SPI_SCK _BV(PB7)

PIN mask for SCK pin

Definition at line 127 of file board_ibdt.h.

#define SPI_SELN_HIGH | ( |  | ) | PORT_SPI |= SPI_SS; SREG = sreg

set SS line to high level

Definition at line 156 of file board_ibdt.h.

#define SPI_SELN_LOW | ( |  | ) | uint8_t sreg = SREG; cli(); PORT_SPI &=~SPI_SS

set SS line to low level

Definition at line 154 of file board_ibdt.h.

#define SPI_SS _BV(PB4)

PIN mask for SS pin

Definition at line 128 of file board_ibdt.h.

#define SPI_WAITFOR | ( |  | ) | do { while((SPSR & _BV(SPIF)) == 0);} while(0)

wait until SPI transfer is ready

Definition at line 158 of file board_ibdt.h.

#define TIMER_INIT | ( |  | ) |

Value:

    do{\
            TCCR0B = _BV(CS01) | _BV(CS00);\
            TCCR0B |= _BV(WGM02); \
            OCR0A = HWTIMER_TICK_NB; \
            TIMSK0 |= _BV(OCIE0A);\
        }while(0)

Definition at line 218 of file board_ibdt.h.

#define TIMER_IRQ_vect TIMER0_COMPA_vect

symbolic name of the timer interrupt routine that is called

Definition at line 227 of file board_ibdt.h.

#define TIMER_POOL_SIZE (8)

number of software timers running at a time

Definition at line 215 of file board_ibdt.h.

#define TIMER_TICK (HWTIMER_TICK * HWTIMER_TICK_NB)

period in us, when the timer interrupt routine is called

Definition at line 211 of file board_ibdt.h.

#define TRX_IRQ _BV(INT2)

interrupt mask for GICR

Definition at line 103 of file board_ibdt.h.

#define TRX_IRQ_INIT | ( |  | ) |

Value:

    do{\
                                EICRA = _BV(ISC20) | _BV(ISC21);\
                                EIMSK  |= (TRX_IRQ);\
                              } while(0)

configuration of interrupt handling

Definition at line 107 of file board_ibdt.h.

#define TRX_IRQ_vect INT2_vect

interrupt vector name

Definition at line 104 of file board_ibdt.h.

#define TRX_TSTAMP_REG TCNT1

timestamp register for RX_START event

Definition at line 118 of file board_ibdt.h.