Browse Source

SRV_Channels: added SRV_Channels::enable_by_mask()

master
Andrew Tridgell 8 years ago
parent
commit
84114d067a
  1. 3
      libraries/SRV_Channel/SRV_Channel.h
  2. 10
      libraries/SRV_Channel/SRV_Channel_aux.cpp

3
libraries/SRV_Channel/SRV_Channel.h

@ -321,6 +321,9 @@ public: @@ -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);

10
libraries/SRV_Channel/SRV_Channel_aux.cpp

@ -161,6 +161,16 @@ void SRV_Channels::enable_aux_servos() @@ -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
*/

Loading…
Cancel
Save