Skip to content

Commit

Permalink
AP_IOMCU: add support for disabled channels
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per authored and tridge committed Sep 4, 2024
1 parent 48624f1 commit ff2c64e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libraries/AP_IOMCU/AP_IOMCU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_IOMCU/AP_IOMCU.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ class AP_IOMCU
// 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; }

Expand Down

0 comments on commit ff2c64e

Please sign in to comment.