39 #ifndef PLATFORM_CONF_H_
40 #define PLATFORM_CONF_H_
47 #define PLATFORM_NAME "MicaZ"
48 #define PLATFORM_TYPE MICAZ
50 #define F_CPU 7372800UL
58 #define CLOCK_CONF_SECOND 128
60 typedef uint32_t clock_time_t;
61 #define CLOCK_LT(a,b) ((int32_t)((a)-(b)) < 0)
68 #define LEDS_PxDIR DDRA // port direction register
69 #define LEDS_PxOUT PORTA // port register
70 #define LEDS_CONF_RED 0x04 //red led
71 #define LEDS_CONF_GREEN 0x02 // green led
72 #define LEDS_CONF_YELLOW 0x01 // yellow led
75 #define SLIP_PORT RS232_PORT_0
78 #define MMEM_CONF_SIZE 256
83 #define EEPROMFS_ADDR_CODEPROP 0x8000
85 #define EEPROM_NODE_ID_START 0x00
88 #define NETSTACK_CONF_RADIO cc2420_driver
96 #define SPI_TXBUF SPDR
97 #define SPI_RXBUF SPDR
99 #define BV(bitno) _BV(bitno)
101 #define SPI_WAITFOREOTx() do { while (!(SPSR & BV(SPIF))); } while (0)
102 #define SPI_WAITFOREORx() do { while (!(SPSR & BV(SPIF))); } while (0)
118 #define SPI_FLASH_ENABLE() ( P4OUT &= ~BV(FLASH_CS) )
119 #define SPI_FLASH_DISABLE() ( P4OUT |= BV(FLASH_CS) )
121 #define SPI_FLASH_HOLD() ( P4OUT &= ~BV(FLASH_HOLD) )
122 #define SPI_FLASH_UNHOLD() ( P4OUT |= BV(FLASH_HOLD) )
128 #define CC2420_CONF_SYMBOL_LOOP_COUNT 500
145 #define CC2420_FIFOP_PORT(type) P##type##E
146 #define CC2420_FIFOP_PIN 6
148 #define CC2420_FIFO_PORT(type) P##type##B
149 #define CC2420_FIFO_PIN 7
151 #define CC2420_CCA_PORT(type) P##type##D
152 #define CC2420_CCA_PIN 6
154 #define CC2420_SFD_PORT(type) P##type##D
155 #define CC2420_SFD_PIN 4
157 #define CC2420_CSN_PORT(type) P##type##B
158 #define CC2420_CSN_PIN 0
160 #define CC2420_VREG_PORT(type) P##type##A
161 #define CC2420_VREG_PIN 5
163 #define CC2420_RESET_PORT(type) P##type##A
164 #define CC2420_RESET_PIN 6
166 #define CC2420_IRQ_VECTOR INT6_vect
169 #define CC2420_FIFOP_IS_1 (!!(CC2420_FIFOP_PORT(IN) & BV(CC2420_FIFOP_PIN)))
170 #define CC2420_FIFO_IS_1 (!!(CC2420_FIFO_PORT(IN) & BV(CC2420_FIFO_PIN)))
171 #define CC2420_CCA_IS_1 (!!(CC2420_CCA_PORT(IN) & BV(CC2420_CCA_PIN)))
172 #define CC2420_SFD_IS_1 (!!(CC2420_SFD_PORT(IN) & BV(CC2420_SFD_PIN)))
175 #define SET_RESET_INACTIVE() (CC2420_RESET_PORT(ORT) |= BV(CC2420_RESET_PIN))
176 #define SET_RESET_ACTIVE() (CC2420_RESET_PORT(ORT) &= ~BV(CC2420_RESET_PIN))
179 #define SET_VREG_ACTIVE() (CC2420_VREG_PORT(ORT) |= BV(CC2420_VREG_PIN))
180 #define SET_VREG_INACTIVE() (CC2420_VREG_PORT(ORT) &= ~BV(CC2420_VREG_PIN))
186 #define CC2420_FIFOP_INT_INIT() do {\
188 CC2420_CLEAR_FIFOP_INT(); \
192 #define CC2420_ENABLE_FIFOP_INT() do { EIMSK |= 0x40; } while (0)
193 #define CC2420_DISABLE_FIFOP_INT() do { EIMSK &= ~0x40; } while (0)
194 #define CC2420_CLEAR_FIFOP_INT() do { EIFR = 0x40; } while (0)
200 #define CC2420_SPI_ENABLE() (PORTB &= ~BV(CSN))
201 #define CC2420_SPI_DISABLE() (PORTB |= BV(CSN))
void clock_delay_msec(uint16_t howlong)
Delay up to 65535 milliseconds.
void clock_adjust_ticks(clock_time_t howmany)
Adjust the system current clock time.