Skip to content

Instantly share code, notes, and snippets.

@guludo
Last active August 27, 2015 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guludo/8103d71ecbd7b82334d7 to your computer and use it in GitHub Desktop.
Save guludo/8103d71ecbd7b82334d7 to your computer and use it in GitHub Desktop.
Example of GPIO Sysfs virtual pins
/*
* This is the cpp file for your board GPIO
*/
const unsigned LinuxGPIO_Sysfs::pin_table[] = {
[MYBOARD_GPIO_A] = 560,
[MYBOARD_GPIO_B] = 569,
[MYBOARD_GPIO_C] = 450,
[MYBOARD_GPIO_D] = 327,
[MYBOARD_GPIO_E] = 328
};
static_assert(ARRAY_SIZE(LinuxGPIO_Sysfs::pin_table) == AP_HAL::GPIO::VirtualPin::MYBOARD_GPIO_MAX,
"LinuxGPIO_Sysfs::pin_table is inconsistent with AP_HAL::GPIO::VirtualPin");
/*
* This is the header for your board GPIO
*/
enum AP_HAL::GPIO::VirtualPin : uint8_t {
MYBOARD_GPIO_A = 0,
MYBOARD_GPIO_B,
MYBOARD_GPIO_C,
MYBOARD_GPIO_D,
MYBOARD_GPIO_E,
MYBOARD_GPIO_MAX
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment