AP_IOMCU: add support for disabled channels

This commit is contained in:
Andy Piper 2024-08-30 14:56:12 +01:00 committed by Andrew Tridgell
parent 48624f189e
commit ff2c64e4b1
2 changed files with 13 additions and 0 deletions

View File

@ -1003,6 +1003,16 @@ AP_HAL::RCOutput::output_mode AP_IOMCU::get_output_mode(uint8_t& mask) const
return AP_HAL::RCOutput::output_mode(reg_status.rcout_mode);
}
uint32_t AP_IOMCU::get_disabled_channels(uint32_t digital_mask) const
{
uint32_t dig_out = reg_status.rcout_mask & (digital_mask & 0xFF);
if (dig_out > 0
&& AP_HAL::RCOutput::is_dshot_protocol(AP_HAL::RCOutput::output_mode(reg_status.rcout_mode))) {
return ~dig_out & 0xFF;
}
return 0;
}
// setup channels
void AP_IOMCU::enable_ch(uint8_t ch)
{

View File

@ -116,6 +116,9 @@ public:
// get output mode
AP_HAL::RCOutput::output_mode get_output_mode(uint8_t& mask) const;
// approximation to disabled channel
uint32_t get_disabled_channels(uint32_t digital_mask) const;
// MCUID
uint32_t get_mcu_id() const { return config.mcuid; }