2011-02-10 12:19:55 +02:00
|
|
|
#ifndef BOARD_H
|
|
|
|
#define BOARD_H
|
2011-02-09 00:32:15 +02:00
|
|
|
|
2011-02-10 12:42:34 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
2011-02-09 00:32:15 +02:00
|
|
|
#define LED_PORT B
|
2011-02-10 12:19:55 +02:00
|
|
|
#define LED_BIT 6
|
2011-02-09 00:32:15 +02:00
|
|
|
#define nRST_RF_PORT C
|
2011-02-10 12:19:55 +02:00
|
|
|
#define nRST_RF_BIT 7
|
2011-02-09 00:32:15 +02:00
|
|
|
#define SLP_TR_PORT B
|
2011-02-10 12:19:55 +02:00
|
|
|
#define SLP_TR_BIT 4
|
2011-02-09 00:32:15 +02:00
|
|
|
|
|
|
|
#define SCLK_PORT D
|
2011-02-10 12:19:55 +02:00
|
|
|
#define SCLK_BIT 5
|
2011-02-09 00:32:15 +02:00
|
|
|
#define MOSI_PORT D
|
2011-02-10 12:19:55 +02:00
|
|
|
#define MOSI_BIT 3
|
2011-02-09 00:32:15 +02:00
|
|
|
|
|
|
|
#define MISO_PORT D
|
2011-02-10 12:19:55 +02:00
|
|
|
#define MISO_BIT 2
|
2011-02-09 00:32:15 +02:00
|
|
|
#define nSS_PORT D
|
2011-02-10 12:19:55 +02:00
|
|
|
#define nSS_BIT 1
|
2011-02-09 00:32:15 +02:00
|
|
|
#define IRQ_RF_PORT D
|
2011-02-10 12:19:55 +02:00
|
|
|
#define IRQ_RF_BIT 0
|
2011-02-09 00:32:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
#define SET_2(p, b) PORT##p |= 1 << (b)
|
|
|
|
#define CLR_2(p, b) PORT##p &= ~(1 << (b))
|
|
|
|
#define IN_2(p, b) DDR##p &= ~(1 << (b))
|
|
|
|
#define OUT_2(p, b) DDR##p |= 1 << (b)
|
2011-02-10 12:42:34 +02:00
|
|
|
#define PIN_2(p, b) ((PIN##p >> (b)) & 1)
|
2011-02-09 00:32:15 +02:00
|
|
|
|
|
|
|
#define SET_1(p, b) SET_2(p, b)
|
|
|
|
#define CLR_1(p, b) CLR_2(p, b)
|
|
|
|
#define IN_1(p, b) IN_2(p, b)
|
|
|
|
#define OUT_1(p, b) OUT_2(p, b)
|
2011-02-10 12:42:34 +02:00
|
|
|
#define PIN_1(p, b) PIN_2(p, b)
|
2011-02-09 00:32:15 +02:00
|
|
|
|
|
|
|
#define SET(n) SET_1(n##_PORT, n##_BIT)
|
|
|
|
#define CLR(n) CLR_1(n##_PORT, n##_BIT)
|
|
|
|
#define IN(n) IN_1(n##_PORT, n##_BIT)
|
|
|
|
#define OUT(n) OUT_1(n##_PORT, n##_BIT)
|
2011-02-10 12:42:34 +02:00
|
|
|
#define PIN(n) PIN_1(n##_PORT, n##_BIT)
|
2011-02-10 12:19:55 +02:00
|
|
|
|
|
|
|
void reset_rf(void);
|
2011-02-10 12:42:34 +02:00
|
|
|
uint8_t read_irq(void);
|
2011-02-11 01:49:23 +02:00
|
|
|
void led(int on);
|
|
|
|
void board_init(void);
|
2011-02-10 12:19:55 +02:00
|
|
|
|
|
|
|
#endif /* !BOARD_H */
|