X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Fbbb_pin.c;h=7d500dd0e44537e74d5e742adf872cfe3b26ddf0;hb=6f7034fea05d88dcf5a6b06c028b283922575b2a;hp=7248c5abe97786ea139eaa9a2b44f0cebc005a77;hpb=01ea4e1cddca0bbf359739a1fefffdccada60481;p=matches%2FMCTX3420.git diff --git a/server/bbb_pin.c b/server/bbb_pin.c index 7248c5a..7d500dd 100644 --- a/server/bbb_pin.c +++ b/server/bbb_pin.c @@ -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