SRV_Channels: added SRV_Channels::enable_by_mask()

This commit is contained in:
Andrew Tridgell 2017-04-29 18:33:49 +10:00
parent 2c4975ba31
commit 84114d067a
2 changed files with 13 additions and 0 deletions

View File

@ -321,6 +321,9 @@ public:
// assign and enable auxiliary channels
static void enable_aux_servos(void);
// enable channels by mask
static void enable_by_mask(uint16_t mask);
// return the current function for a channel
static SRV_Channel::Aux_servo_function_t channel_function(uint8_t channel);

View File

@ -161,6 +161,16 @@ void SRV_Channels::enable_aux_servos()
}
}
/// enable output channels using a channel mask
void SRV_Channels::enable_by_mask(uint16_t mask)
{
for (uint8_t i = 0; i < 16; i++) {
if (mask & (1U<<i)) {
hal.rcout->enable_ch(i);
}
}
}
/*
set radio_out for all channels matching the given function type
*/