Browse Source

AP_IOMCU: fixed setting of rate masks

this affects layouts which set a subset of channels on a timer
mission-4.1.18
Andrew Tridgell 7 years ago
parent
commit
8c9f2bc79e
  1. 9
      libraries/AP_IOMCU/AP_IOMCU.cpp

9
libraries/AP_IOMCU/AP_IOMCU.cpp

@ -550,8 +550,15 @@ void AP_IOMCU::push(void) @@ -550,8 +550,15 @@ void AP_IOMCU::push(void)
// set output frequency
void AP_IOMCU::set_freq(uint16_t chmask, uint16_t freq)
{
const uint8_t masks[] = { 0x03,0x0C,0xF0 };
// ensure mask is legal for the timer layout
for (uint8_t i=0; i<ARRAY_SIZE_SIMPLE(masks); i++) {
if (chmask & masks[i]) {
chmask |= masks[i];
}
}
rate.freq = freq;
rate.chmask = chmask;
rate.chmask |= chmask;
trigger_event(IOEVENT_SET_RATES);
}

Loading…
Cancel
Save