|
|
|
@ -201,6 +201,25 @@ void RC_Channels::read_mode_switch()
@@ -201,6 +201,25 @@ void RC_Channels::read_mode_switch()
|
|
|
|
|
c->read_mode_switch(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
get the RC input PWM value given a channel number. Note that |
|
|
|
|
channel numbers start at 1, as this API is designed for use in |
|
|
|
|
LUA |
|
|
|
|
*/ |
|
|
|
|
bool RC_Channels::get_pwm(uint8_t c, uint16_t &pwm) const |
|
|
|
|
{ |
|
|
|
|
if (c < 1 || c > NUM_RC_CHANNELS) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
RC_Channel *chan = rc_channel(c-1); |
|
|
|
|
int16_t pwm_signed = chan->get_radio_in(); |
|
|
|
|
if (pwm_signed < 0) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
pwm = (uint16_t)pwm_signed; |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// singleton instance
|
|
|
|
|
RC_Channels *RC_Channels::_singleton; |
|
|
|
|