Automatic commit of irc logs
[matches/MCTX3420.git] / server / bbb_pin_defines.h
index 05eb5a9..7ccda87 100644 (file)
@@ -6,8 +6,10 @@
 #ifndef _BBB_PIN_DEFINES_H
 #define _BBB_PIN_DEFINES_H
 
-/** GPIO0 defines **/
+/** The number of expansion pins on the BBB **/
+#define BBB_PIN_COUNT 92
 
+/** GPIO0 defines **/
 #define GPIO0_1 1
 #define GPIO0_2 2 // Used for PWM
 #define GPIO0_3 3 // Used for PWM
 #define GPIO2_31 95
 #define GPIO2_32 96
 
+/** Export path **/
+#define GPIO_DEVICE_PATH "/sys/class/gpio"
+
 /** Number of useable GPIO pins **/
-#define GPIO_NUM_PINS 50
+#define GPIO_NUM_PINS 43
+/** The max usable GPIO number **/
+#define GPIO_MAX_NUMBER 115
 
 /* Luts */
-#define GPIO_LUT_SIZE 93
-#define GPIO_INDEX_SIZE 128
-extern const unsigned char g_pin_to_gpio[GPIO_LUT_SIZE];
-extern const unsigned char g_gpio_to_index[GPIO_INDEX_SIZE];
-extern const unsigned char g_index_to_gpio[GPIO_NUM_PINS];
-
-/** Export path **/
-#define GPIO_DEVICE_PATH "/sys/class/gpio"
+extern const unsigned char g_pin_gpio_to_index[GPIO_MAX_NUMBER+1];
+extern const unsigned char g_pin_index_to_gpio[GPIO_NUM_PINS];
 
 #define ADC_BITS 12
 #define ADC_DIGITS 5
@@ -134,10 +135,16 @@ extern const unsigned char g_index_to_gpio[GPIO_NUM_PINS];
 #define ADC5 5
 #define ADC6 6
 #define ADC7 7
+/** The maximum voltage input to the ADC **/
+#define ADC_VOLTAGE_MAX 1800
+/** The maximum raw value from the ADC **/
+#define ADC_RAW_MAX (2 << ADC_BITS)
+/** Converts the raw ADC value to a voltage in millivolts **/
+#define ADC_TO_MVOLTS(x) ((double)((x)/2 << ADC_BITS) * (double)ADC_VOLTAGE_MAX)
 
 /** Number of ADC pins **/
 #define ADC_NUM_PINS 8
-
+/** The path to the ADCs on the BBB **/
 #define ADC_DEVICE_PATH "/sys/bus/iio/devices/iio:device0/"
 
 /** PWM names to sysfs numbers **/
@@ -153,15 +160,9 @@ extern const unsigned char g_index_to_gpio[GPIO_NUM_PINS];
 /** Number of PWM pins **/
 #define PWM_NUM_PINS 8
 
-/** Number of PWM pins which are guaranteed not to interfere with one another **/
-#define PWM_NUM_SAFE_PINS 5
-
 /** Path to PWM sysfs **/
 #define PWM_DEVICE_PATH "/sys/class/pwm"
 
-/** Maps internal pin number to safe 'pwmX' number **/
-extern const unsigned char g_pin_safe_pwm[PWM_NUM_SAFE_PINS];
-
 #endif //_BBB_PIN_DEFINES_H
 
 

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