Update Titlepage with links to individual sections
[matches/MCTX3420.git] / server / bbb_pin_defines.h
1 /**
2  * @file bbb_pin_defines.h
3  * @brief Defines pins on Beaglebone Black
4  */
5
6 #ifndef _BBB_PIN_DEFINES_H
7 #define _BBB_PIN_DEFINES_H
8
9 /** The number of expansion pins on the BBB **/
10 #define BBB_PIN_COUNT 92
11
12 /** GPIO0 defines **/
13
14 #define GPIO0_1 1
15 #define GPIO0_2 2 // Used for PWM
16 #define GPIO0_3 3 // Used for PWM
17 #define GPIO0_4 4 
18 #define GPIO0_5 5
19 #define GPIO0_6 6
20 #define GPIO0_7 7
21 #define GPIO0_8 8
22 #define GPIO0_9 9
23 #define GPIO0_10 10
24 #define GPIO0_11 11
25 #define GPIO0_12 12
26 #define GPIO0_13 13
27 #define GPIO0_14 14
28 #define GPIO0_15 15
29 #define GPIO0_16 16
30 #define GPIO0_17 17
31 #define GPIO0_18 18
32 #define GPIO0_19 19
33 #define GPIO0_20 20
34 #define GPIO0_21 21
35 #define GPIO0_22 22
36 #define GPIO0_23 23
37 #define GPIO0_24 24
38 #define GPIO0_25 25
39 #define GPIO0_26 26
40 #define GPIO0_27 27
41 #define GPIO0_28 28
42 #define GPIO0_29 29
43 #define GPIO0_30 30
44 #define GPIO0_31 31
45 #define GPIO0_32 32
46
47 /** GPIO1 defines **/
48
49 #define GPIO1_1 33
50 #define GPIO1_2 34
51 #define GPIO1_3 35
52 #define GPIO1_4 36
53 #define GPIO1_5 37
54 #define GPIO1_6 38
55 #define GPIO1_7 39
56 #define GPIO1_8 40
57 #define GPIO1_9 41
58 #define GPIO1_10 42
59 #define GPIO1_11 43
60 #define GPIO1_12 44
61 #define GPIO1_13 45
62 #define GPIO1_14 46
63 #define GPIO1_15 47
64 #define GPIO1_16 48
65 #define GPIO1_17 49
66 #define GPIO1_18 50
67 #define GPIO1_19 51
68 #define GPIO1_20 52
69 #define GPIO1_21 53
70 #define GPIO1_22 54
71 #define GPIO1_23 55
72 #define GPIO1_24 56
73 #define GPIO1_25 57
74 #define GPIO1_26 58
75 #define GPIO1_27 59
76 #define GPIO1_28 60
77 #define GPIO1_29 61
78 #define GPIO1_30 62
79 #define GPIO1_31 63
80 #define GPIO1_32 64
81
82 /** GPIO2 defines **/
83
84 #define GPIO2_1 65
85 #define GPIO2_2 66
86 #define GPIO2_3 67
87 #define GPIO2_4 68
88 #define GPIO2_5 69
89 #define GPIO2_6 70
90 #define GPIO2_7 71
91 #define GPIO2_8 72
92 #define GPIO2_9 73
93 #define GPIO2_10 74
94 #define GPIO2_11 75
95 #define GPIO2_12 76
96 #define GPIO2_13 77
97 #define GPIO2_14 78
98 #define GPIO2_15 79
99 #define GPIO2_16 80
100 #define GPIO2_17 81
101 #define GPIO2_18 82
102 #define GPIO2_19 83
103 #define GPIO2_20 84
104 #define GPIO2_21 85
105 #define GPIO2_22 86
106 #define GPIO2_23 87
107 #define GPIO2_24 88
108 #define GPIO2_25 89
109 #define GPIO2_26 90
110 #define GPIO2_27 91
111 #define GPIO2_28 92
112 #define GPIO2_29 93
113 #define GPIO2_30 94
114 #define GPIO2_31 95
115 #define GPIO2_32 96
116
117 /** Export path **/
118 #define GPIO_DEVICE_PATH "/sys/class/gpio"
119
120 /** Number of useable GPIO pins **/
121 #define GPIO_NUM_PINS 43
122 /** The max usable GPIO number **/
123 #define GPIO_MAX_NUMBER 115
124
125 /* Luts */
126 extern const unsigned char g_pin_gpio_to_index[GPIO_MAX_NUMBER+1];
127 extern const unsigned char g_pin_index_to_gpio[GPIO_NUM_PINS];
128
129 #define ADC_BITS 12
130 #define ADC_DIGITS 5
131 #define ADC0 0
132 #define ADC1 1
133 #define ADC2 2
134 #define ADC3 3
135 #define ADC4 4
136 #define ADC5 5
137 #define ADC6 6
138 #define ADC7 7
139 #define ADC_VOLTAGE_MAX 1800
140 #define ADC_RAW_MAX (2 << ADC_BITS)
141 #define ADC_TO_MVOLTS(x) ((double)((x)/2 << ADC_BITS) * (double)ADC_VOLTAGE_MAX)
142
143 /** Number of ADC pins **/
144 #define ADC_NUM_PINS 8
145
146 #define ADC_DEVICE_PATH "/sys/bus/iio/devices/iio:device0/"
147
148 /** PWM names to sysfs numbers **/
149 #define EHRPWM0A 0 //P9_22
150 #define EHRPWM0B 1 //P9_21 - period paired with EHRPWM0A
151 #define EHRPWM1A 3 //P9_14
152 #define EHRPWM1B 4 //P9_16 - period paired with EHRPWM1A
153 #define ECAP0    2 //P9_42
154 #define ECAP2    7 //P9_28
155 #define EHRPWM2A 5 //P8_19
156 #define EHRPWM2B 6 //P8_13 - period paired with EHRPWM2A
157
158 /** Number of PWM pins **/
159 #define PWM_NUM_PINS 8
160
161 /** Path to PWM sysfs **/
162 #define PWM_DEVICE_PATH "/sys/class/pwm"
163
164 #endif //_BBB_PIN_DEFINES_H
165
166

UCC git Repository :: git.ucc.asn.au