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