Root/atusb/fw2/io.h

Source at commit ec21e4ba4756379934fc24635438040f66d2ab7c created 9 years 3 months ago.
By Werner Almesberger, atusb/fw2: support device -> host side of the ATUSB EP0 protocol
1#ifndef IO_H
2#define IO_H
3
4#define LED_PORT B
5#define LED_BIT 6
6#define nRST_RF_PORT C
7#define nRST_RF_BIT 7
8#define SLP_TR_PORT B
9#define SLP_TR_BIT 4
10
11#define SCLK_PORT D
12#define SCLK_BIT 5
13#define MOSI_PORT D
14#define MOSI_BIT 3
15
16#define MISO_PORT D
17#define MISO_BIT 2
18#define nSS_PORT D
19#define nSS_BIT 1
20#define IRQ_RF_PORT D
21#define IRQ_RF_BIT 0
22
23
24#define SET_2(p, b) PORT##p |= 1 << (b)
25#define CLR_2(p, b) PORT##p &= ~(1 << (b))
26#define IN_2(p, b) DDR##p &= ~(1 << (b))
27#define OUT_2(p, b) DDR##p |= 1 << (b)
28
29#define SET_1(p, b) SET_2(p, b)
30#define CLR_1(p, b) CLR_2(p, b)
31#define IN_1(p, b) IN_2(p, b)
32#define OUT_1(p, b) OUT_2(p, b)
33
34#define SET(n) SET_1(n##_PORT, n##_BIT)
35#define CLR(n) CLR_1(n##_PORT, n##_BIT)
36#define IN(n) IN_1(n##_PORT, n##_BIT)
37#define OUT(n) OUT_1(n##_PORT, n##_BIT)
38
39#endif /* !IO_H */
40

Archive Download this file



interactive