Skip to content

Commit

Permalink
AP_HAL: add helper functions for LEDs
Browse files Browse the repository at this point in the history
add PRIORITY_LED for led output thread
  • Loading branch information
andyp1per authored and Davidsastresas committed Apr 21, 2023
1 parent 95b419a commit c5d81c9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libraries/AP_HAL/RCOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ class AP_HAL::RCOutput {
// 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
Expand Down Expand Up @@ -382,6 +391,9 @@ class AP_HAL::RCOutput {
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
Expand Down
1 change: 1 addition & 0 deletions libraries/AP_HAL/Scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class AP_HAL::Scheduler {
PRIORITY_CAN,
PRIORITY_TIMER,
PRIORITY_RCOUT,
PRIORITY_LED,
PRIORITY_RCIN,
PRIORITY_IO,
PRIORITY_UART,
Expand Down

0 comments on commit c5d81c9

Please sign in to comment.