2 * @file bbb_pin_defines.h
3 * @brief Defines pins on Beaglebone Black
6 #ifndef _BBB_PIN_DEFINES_H
7 #define _BBB_PIN_DEFINES_H
9 /** The number of expansion pins on the BBB **/
10 #define BBB_PIN_COUNT 92
14 #define GPIO0_2 2 // Used for PWM
15 #define GPIO0_3 3 // Used for PWM
117 #define GPIO_DEVICE_PATH "/sys/class/gpio"
119 /** Number of useable GPIO pins **/
120 #define GPIO_NUM_PINS 43
121 /** The max usable GPIO number **/
122 #define GPIO_MAX_NUMBER 115
125 extern const unsigned char g_pin_gpio_to_index[GPIO_MAX_NUMBER+1];
126 extern const unsigned char g_pin_index_to_gpio[GPIO_NUM_PINS];
138 /** The maximum voltage input to the ADC **/
139 #define ADC_VOLTAGE_MAX 1800
140 /** The maximum raw value from the ADC **/
141 #define ADC_RAW_MAX (2 << ADC_BITS)
142 /** Converts the raw ADC value to a voltage in millivolts **/
143 #define ADC_TO_MVOLTS(x) ((double)((x)/2 << ADC_BITS) * (double)ADC_VOLTAGE_MAX)
145 /** Number of ADC pins **/
146 #define ADC_NUM_PINS 8
147 /** The path to the ADCs on the BBB **/
148 #define ADC_DEVICE_PATH "/sys/bus/iio/devices/iio:device0/"
150 /** PWM names to sysfs numbers **/
151 #define EHRPWM0A 0 //P9_22
152 #define EHRPWM0B 1 //P9_21 - period paired with EHRPWM0A
153 #define EHRPWM1A 3 //P9_14
154 #define EHRPWM1B 4 //P9_16 - period paired with EHRPWM1A
155 #define ECAP0 2 //P9_42
156 #define ECAP2 7 //P9_28
157 #define EHRPWM2A 5 //P8_19
158 #define EHRPWM2B 6 //P8_13 - period paired with EHRPWM2A
160 /** Number of PWM pins **/
161 #define PWM_NUM_PINS 8
163 /** Path to PWM sysfs **/
164 #define PWM_DEVICE_PATH "/sys/class/pwm"
166 #endif //_BBB_PIN_DEFINES_H