Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
digital_gpio_mapping.h
1 #ifndef DIGITAL_MAPPING_H
2 #define DIGITAL_MAPPING_H
3 
4 enum {NUM_DIGITALS = 16};
5 //GPIO_INPUT and GPIO_OUTPUT values when calling the setDigitalDirection() macro.
6 //TODO: these are inverted with respect to INPUT_PIN and OUTPUT_PIN defined in GPIOcontrol.h,
7 //which might lead to unexpected results in case someone uses those in place of these or viceversa
8 #define GPIO_INPUT 1
9 #define GPIO_OUTPUT 0
10 #define GPIO_HIGH 1
11 #define GPIO_LOW 0
12 //mapping GPIO numbers to header pins
13 //if you want to use different pins/ordering, define here new pins. The ordering here is NOT binding
14 enum
15 {
16  // these are for PocketBeagle (BelaMini)
17  P2_01_GPIO_NO = 50,
18  P2_02_GPIO_NO = 59,
19  P2_04_GPIO_NO = 58,
20  P2_06_GPIO_NO = 57,
21  P2_08_GPIO_NO = 60,
22  P2_10_GPIO_NO = 52,
23  P2_18_GPIO_NO = 47,
24  P2_20_GPIO_NO = 64,
25  P2_22_GPIO_NO = 46,
26  P2_24_GPIO_NO = 44,
27  P2_25_GPIO_NO = 41,
28  P2_27_GPIO_NO = 40,
29  P2_35_GPIO_NO = 86,
30  P1_35_GPIO_NO = 88,
31  P1_32_GPIO_NO = 42,
32  P1_30_GPIO_NO = 43,
33 };
34 
35 enum
36 {
37  // these are for BeagleBone (Everything else)
38  P8_07_GPIO_NO = 66,
39  P8_08_GPIO_NO = 67,
40  P8_09_GPIO_NO = 69,
41  P8_10_GPIO_NO = 68,
42  P8_11_GPIO_NO = 45,
43  P8_12_GPIO_NO = 44,
44  P9_12_GPIO_NO = 60,
45  P9_14_GPIO_NO = 50,
46  P8_15_GPIO_NO = 47,
47  P8_16_GPIO_NO = 46,
48  P9_16_GPIO_NO = 51,
49  P8_18_GPIO_NO = 65,
50  P8_27_GPIO_NO = 86,
51  P8_28_GPIO_NO = 88,
52  P8_29_GPIO_NO = 87,
53  P8_30_GPIO_NO = 89,
54 };
55 
56 //mapping pin headers to bits in the digital word.
57 //used in the declaration of short int digitalPins[NUM_DIGITALS] below, which is used in PRU::prepareGPIO to export the pins
58 //if you want to use different pins, declare them above and use them here
59 //The ordering here is NOT binding, but if you want to use a different ordering, please change it here as well as below and in the PRU, for consistency
60 static unsigned int digitalPinsPocketBeagle[NUM_DIGITALS] = {
61  P2_01_GPIO_NO,
62  P2_02_GPIO_NO,
63  P2_04_GPIO_NO,
64  P2_06_GPIO_NO,
65  P2_08_GPIO_NO,
66  P2_10_GPIO_NO,
67  P2_18_GPIO_NO,
68  P2_20_GPIO_NO,
69  P2_22_GPIO_NO,
70  P2_24_GPIO_NO,
71  P2_25_GPIO_NO,
72  P2_27_GPIO_NO,
73  P2_35_GPIO_NO,
74  P1_35_GPIO_NO,
75  P1_32_GPIO_NO,
76  P1_30_GPIO_NO,
77 };
78 
79 static unsigned int digitalPinsBeagleBone[NUM_DIGITALS] = {
80  P8_07_GPIO_NO,
81  P8_08_GPIO_NO,
82  P8_09_GPIO_NO,
83  P8_10_GPIO_NO,
84  P8_11_GPIO_NO,
85  P8_12_GPIO_NO,
86  P9_12_GPIO_NO,
87  P9_14_GPIO_NO,
88  P8_15_GPIO_NO,
89  P8_16_GPIO_NO,
90  P9_16_GPIO_NO,
91  P8_18_GPIO_NO,
92  P8_27_GPIO_NO,
93  P8_28_GPIO_NO,
94  P8_29_GPIO_NO,
95  P8_30_GPIO_NO,
96 };
97 
98 //mapping bits in the digital word to pin headers, so that pin header name can be used instead of but number
99 //The ordering here IS binding. If you want to use different pins/ordering, please do it above as well as here and in the PRU, for consistency
100 
101 enum {
102  P2_01 = 0,
103  P2_02 = 1,
104  P2_04 = 2,
105  P2_06 = 3,
106  P2_08 = 4,
107  P2_10 = 5,
108  P2_18 = 6,
109  P2_20 = 7,
110  P2_22 = 8,
111  P2_24 = 9,
112  P2_25 = 10,
113  P2_27 = 11,
114  P2_35 = 12,
115  P1_35 = 13,
116  P1_32 = 14,
117  P1_30 = 15,
118 };
119 enum {
120  P8_07 = 0,
121  P8_08 = 1,
122  P8_09 = 2,
123  P8_10 = 3,
124  P8_11 = 4,
125  P8_12 = 5,
126  P9_12 = 6,
127  P9_14 = 7,
128  P8_15 = 8,
129  P8_16 = 9,
130  P9_16 = 10,
131  P8_18 = 11,
132  P8_27 = 12,
133  P8_28 = 13,
134  P8_29 = 14,
135  P8_30 = 15,
136 };
137 
138 #endif