Browse Source

AP_HAL: move is_dshot_protocol to AP_HAL

gps-1.3.1
Iampete1 3 years ago committed by Andrew Tridgell
parent
commit
3b8b90d170
  1. 16
      libraries/AP_HAL/RCOutput.cpp
  2. 4
      libraries/AP_HAL/RCOutput.h

16
libraries/AP_HAL/RCOutput.cpp

@ -52,3 +52,19 @@ void AP_HAL::RCOutput::append_to_banner(char banner_msg[], uint8_t banner_msg_le @@ -52,3 +52,19 @@ void AP_HAL::RCOutput::append_to_banner(char banner_msg[], uint8_t banner_msg_le
hal.util->snprintf(banner_msg, banner_msg_len, "%s %s:%u-%u", banner_msg_temp, mode_str, (unsigned)low_ch, (unsigned)high_ch);
}
}
/*
true when the output mode is of type dshot
*/
bool AP_HAL::RCOutput::is_dshot_protocol(const enum output_mode mode)
{
switch (mode) {
case MODE_PWM_DSHOT150:
case MODE_PWM_DSHOT300:
case MODE_PWM_DSHOT600:
case MODE_PWM_DSHOT1200:
return true;
default:
return false;
}
}

4
libraries/AP_HAL/RCOutput.h

@ -202,6 +202,10 @@ public: @@ -202,6 +202,10 @@ public:
MODE_NEOPIXEL, // same as MODE_PWM_DSHOT at 800kHz but it's an LED
MODE_PROFILED, // same as MODE_PWM_DSHOT using separate clock and data
};
// true when the output mode is of type dshot
// static to allow use in the ChibiOS thread stuff
static bool is_dshot_protocol(const enum output_mode mode);
// https://github.com/bitdump/BLHeli/blob/master/BLHeli_32%20ARM/BLHeli_32%20Firmware%20specs/Digital_Cmd_Spec.txt
enum BLHeliDshotCommand : uint8_t {

Loading…
Cancel
Save