Support für neuen Prototypen
[hackover2013-badge-firmware.git] / badge / pinconfig.h
1 #ifndef INCLUDED_HACKOVER_2013_BADGE_PINCONFIG_H
2 #define INCLUDED_HACKOVER_2013_BADGE_PINCONFIG_H
3
4 #include <lpc134x.h>
5
6 #ifdef HOB_REV2
7
8 #define HOB_BTN_UP (1, 11)
9 #define HOB_BTN_RIGHT (1, 7)
10 #define HOB_BTN_DOWN (1, 6)
11 #define HOB_BTN_LEFT (1, 5)
12 #define HOB_BTN_A (1, 9)
13 #define HOB_BTN_B (1, 8)
14
15 #define HOB_LCD_CS (3, 0)
16 #define HOB_LCD_RST (3, 1)
17 #define HOB_LCD_BACKLIGHT (0, 1)
18
19 #define HOB_DATAFLASH_CS (0, 7)
20
21 #define HOB_RADIO_CE (2, 2)
22 #define HOB_RADIO_CS (2, 10)
23 #define HOB_RADIO_IRQ (2, 9)
24
25 #define HOB_USB_CONNECT (0, 6)
26
27
28 #else
29
30 #define HOB_BTN_UP (3, 2)
31 #define HOB_BTN_RIGHT (1, 5)
32 #define HOB_BTN_DOWN (1, 6)
33 #define HOB_BTN_LEFT (3, 3)
34 #define HOB_BTN_CENTER (1, 7)
35 #define HOB_BTN_A (1, 11)
36 #define HOB_BTN_B (1, 4)
37
38 #define HOB_LCD_CS (1, 0)
39 #define HOB_LCD_RST (1, 1)
40 #define HOB_LCD_BACKLIGHT (0, 1)
41
42 #define HOB_DATAFLASH_CS (0, 7)
43
44 #define HOB_RADIO_CE (2, 10)
45 #define HOB_RADIO_CS (2, 9)
46 #define HOB_RADIO_IRQ (2, 2)
47
48 #define HOB_USB_CONNECT (0, 6)
49
50 #endif
51
52 #define HOB_PIO0_0 nRESET_PIO0_0
53 #define HOB_PIO0_1 PIO0_1
54 #define HOB_PIO0_2 PIO0_2
55 #define HOB_PIO0_3 PIO0_3
56 #define HOB_PIO0_4 PIO0_4
57 #define HOB_PIO0_5 PIO0_5
58 #define HOB_PIO0_6 PIO0_6
59 #define HOB_PIO0_7 PIO0_7
60 #define HOB_PIO0_8 PIO0_8
61 #define HOB_PIO0_9 PIO0_9
62 #define HOB_PIO0_10 JTAG_TCK_PIO0_10
63 #define HOB_PIO0_11 JTAG_TDI_PIO0_11
64
65 #define HOB_PIO1_0 JTAG_TMS_PIO1_0
66 #define HOB_PIO1_1 JTAG_TDO_PIO1_1
67 #define HOB_PIO1_2 JTAG_nTRST_PIO1_2
68 #define HOB_PIO1_3 SWDIO_PIO1_3
69 #define HOB_PIO1_4 PIO1_4
70 #define HOB_PIO1_5 PIO1_5
71 #define HOB_PIO1_6 PIO1_6
72 #define HOB_PIO1_7 PIO1_7
73 #define HOB_PIO1_8 PIO1_8
74 #define HOB_PIO1_9 PIO1_9
75 #define HOB_PIO1_10 PIO1_10
76 #define HOB_PIO1_11 PIO1_11
77
78 #define HOB_PIO2_0 PIO2_0
79 #define HOB_PIO2_1 PIO2_1
80 #define HOB_PIO2_2 PIO2_2
81 #define HOB_PIO2_3 PIO2_3
82 #define HOB_PIO2_4 PIO2_4
83 #define HOB_PIO2_5 PIO2_5
84 #define HOB_PIO2_6 PIO2_6
85 #define HOB_PIO2_7 PIO2_7
86 #define HOB_PIO2_8 PIO2_8
87 #define HOB_PIO2_9 PIO2_9
88 #define HOB_PIO2_10 PIO2_10
89 #define HOB_PIO2_11 PIO2_11
90
91 #define HOB_PIO3_0 PIO3_0
92 #define HOB_PIO3_1 PIO3_1
93 #define HOB_PIO3_2 PIO3_2
94 #define HOB_PIO3_3 PIO3_3
95 #define HOB_PIO3_4 PIO3_4
96 #define HOB_PIO3_5 PIO3_5
97
98 #define HOB_EXPAND(foo) foo
99
100 #define HOB_PORT_I(port, pin) port
101 #define HOB_PIN_I(port, pin) pin
102 #define HOB_PORT(spec) HOB_EXPAND(HOB_PORT_I spec)
103 #define HOB_PIN(spec) HOB_EXPAND(HOB_PIN_I spec)
104
105 #define HOB_BUILD_PIO_SUFFIX_I(port, pin) HOB_PIO ## port ## _ ## pin
106 #define HOB_BUILD_PIO_SUFFIX(port, pin) HOB_BUILD_PIO_SUFFIX_I(port, pin)
107 #define HOB_PIO_SUFFIX(spec) HOB_BUILD_PIO_SUFFIX(HOB_PORT(spec), HOB_PIN(spec))
108
109 #define HOB_BUILD_IOCON_NAME_I(pio) IOCON_ ## pio
110 #define HOB_BUILD_IOCON_NAME(pio) HOB_BUILD_IOCON_NAME_I(pio)
111 #define HOB_IOCON(spec) HOB_BUILD_IOCON_NAME(HOB_PIO_SUFFIX(spec))
112
113 #define HOB_BUILD_IOCON_MASK_I(pio, flag) IOCON_ ## pio ## _ ## flag
114 #define HOB_BUILD_IOCON_MASK(pio, flag) HOB_BUILD_IOCON_MASK_I(pio, flag)
115 #define HOB_IOCON_MASK(spec, flag) HOB_BUILD_IOCON_MASK(HOB_PIO_SUFFIX(spec), flag)
116
117 #define HOB_SET_PIN_FUNC(spec, func) do { \
118 HOB_IOCON(spec) = \
119 (HOB_IOCON(spec) & ~HOB_IOCON_MASK(spec, FUNC_MASK)) \
120 | HOB_IOCON_MASK(spec, FUNC_ ## func); \
121 } while(0)
122
123 #endif
This page took 0.048338 seconds and 5 git commands to generate.