tap: add landing gear capability

This configures the PWM output for the landing gear.
This commit is contained in:
Julian Oes
2016-10-20 23:17:05 +02:00
committed by Lorenz Meier
parent 2fff2ab9ac
commit 78b0d1a01f
10 changed files with 100 additions and 88 deletions
+11 -1
View File
@@ -394,7 +394,7 @@ static int timer_set_rate(unsigned timer, unsigned rate)
}
static int io_timer_init_timer(unsigned timer)
int io_timer_init_timer(unsigned timer)
{
/* Do this only once per timer */
@@ -708,6 +708,10 @@ int io_timer_set_ccr(unsigned channel, uint16_t value)
} else {
/* configure the channel */
#ifdef BOARD_PWM_DRIVE_ACTIVE_LOW
unsigned period = rARR(channels_timer(channel));
value = period - value;
#endif
if (value > 0) {
value--;
@@ -727,6 +731,12 @@ uint16_t io_channel_get_ccr(unsigned channel)
if (io_timer_validate_channel_index(channel) == 0 &&
io_timer_get_channel_mode(channel) == IOTimerChanMode_PWMOut) {
value = REG(channels_timer(channel), timer_io_channels[channel].ccr_offset) + 1;
#ifdef BOARD_PWM_DRIVE_ACTIVE_LOW
unsigned period = rARR(channels_timer(channel));
value = period - value;
#endif
}
return value;