simple test function
[matches/MCTX3420.git] / server / bbb_pin.c
index 7248c5a..7d500dd 100644 (file)
@@ -55,6 +55,32 @@ static PWM_Pin g_pwm[PWM_NUM_PINS] = {{0}};
 
 static char g_buffer[BUFSIZ] = {0};
 
+/**
+ * Maps a GPIO number to an index into g_gpio (only for use in bbb_pin.c)
+ * If there is no index for that GPIO number, 128 is returned.
+ */
+const unsigned char g_pin_gpio_to_index[GPIO_MAX_NUMBER+1] = {
+       128, 128, 128, 128,   0,   1, 128, 128,   2,   3,   4,   5, 128, 128,
+         6,   7, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,   8,   9,
+       128, 128,  10,  11, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+       128, 128,  12,  13,  14,  15,  16,  17, 128, 128, 128, 128, 128, 128,
+       128, 128, 128, 128,  18,  19, 128, 128, 128,  20,  21,  22,  23,  24,
+        25,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36, 128, 128,
+       128, 128,  37,  38,  39,  40, 128, 128, 128, 128, 128, 128, 128, 128,
+       128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+        41, 128, 128,  42
+};
+
+/**
+ * Maps an index in g_gpio to the corresponding GPIO number.
+ */
+const unsigned char g_pin_index_to_gpio[GPIO_NUM_PINS] = {
+         4,   5,   8,   9,  10,  11,  14,  15,  26,  27,  30,  31,  44,  45,
+        46,  47,  48,  49,  60,  61,  65,  66,  67,  68,  69,  70,  71,  72,
+        73,  74,  75,  76,  77,  78,  79,  80,  81,  86,  87,  88,  89, 112,
+       115
+};
+
 /**
  * Export a GPIO pin and open the file descriptors
  * @param pin The GPIO number to be exported

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