AP_HAL: add helper functions for LEDs

add PRIORITY_LED for led output thread
This commit is contained in:
Andy Piper 2023-02-23 12:35:05 +00:00 committed by Andrew Tridgell
parent c042577827
commit f97cd5c5ab
2 changed files with 13 additions and 0 deletions

View File

@ -222,6 +222,15 @@ public:
// static to allow use in the ChibiOS thread stuff
static bool is_dshot_protocol(const enum output_mode mode);
static bool is_led_protocol(const enum output_mode mode) {
switch (mode) {
case MODE_NEOPIXEL:
case MODE_PROFILED:
return true;
default:
return false;
}
}
// BLHeli32: https://github.com/bitdump/BLHeli/blob/master/BLHeli_32%20ARM/BLHeli_32%20Firmware%20specs/Digital_Cmd_Spec.txt
// BLHeli_S: https://github.com/bitdump/BLHeli/blob/master/BLHeli_S%20SiLabs/Dshotprog%20spec%20BLHeli_S.txt
@ -382,6 +391,9 @@ public:
static constexpr uint32_t PROFI_BIT_0_TICKS = 7;
static constexpr uint32_t PROFI_BIT_1_TICKS = 14;
// suitably long LED output period to support high LED counts
static constexpr uint32_t LED_OUTPUT_PERIOD_US = 10000;
protected:
// helper functions for implementation of get_output_mode_banner

View File

@ -109,6 +109,7 @@ public:
PRIORITY_CAN,
PRIORITY_TIMER,
PRIORITY_RCOUT,
PRIORITY_LED,
PRIORITY_RCIN,
PRIORITY_IO,
PRIORITY_UART,