PWM:Add Channel mask to up_pwm_servo_arm & up_pwm_servo_deinit

This commit is contained in:
David Sidrane
2021-05-04 06:53:55 -07:00
committed by Lorenz Meier
parent 19fa5cfe25
commit 3d166d3279
7 changed files with 46 additions and 32 deletions

View File

@@ -104,10 +104,10 @@ int up_pwm_servo_init(uint32_t channel_mask)
return OK;
}
void up_pwm_servo_deinit(void)
void up_pwm_servo_deinit(uint32_t channel_mask)
{
/* disable the timers */
up_pwm_servo_arm(false);
up_pwm_servo_arm(false, channel_mask);
}
int up_pwm_servo_set_rate_group_update(unsigned channel, unsigned rate)
@@ -154,8 +154,8 @@ uint32_t up_pwm_servo_get_rate_group(unsigned group)
}
void
up_pwm_servo_arm(bool armed)
up_pwm_servo_arm(bool armed, uint32_t channel_mask)
{
io_timer_set_enable(armed, IOTimerChanMode_OneShot, IO_TIMER_ALL_MODES_CHANNELS);
io_timer_set_enable(armed, IOTimerChanMode_PWMOut, IO_TIMER_ALL_MODES_CHANNELS);
io_timer_set_enable(armed, IOTimerChanMode_OneShot, channel_mask);
io_timer_set_enable(armed, IOTimerChanMode_PWMOut, channel_mask);
}

View File

@@ -105,10 +105,10 @@ int up_pwm_servo_init(uint32_t channel_mask)
return OK;
}
void up_pwm_servo_deinit(void)
void up_pwm_servo_deinit(uint32_t channel_mask)
{
/* disable the timers */
up_pwm_servo_arm(false);
up_pwm_servo_arm(false, channel_mask);
}
int up_pwm_servo_set_rate_group_update(unsigned group, unsigned rate)
@@ -155,8 +155,8 @@ uint32_t up_pwm_servo_get_rate_group(unsigned group)
}
void
up_pwm_servo_arm(bool armed)
up_pwm_servo_arm(bool armed, uint32_t channel_mask)
{
io_timer_set_enable(armed, IOTimerChanMode_OneShot, IO_TIMER_ALL_MODES_CHANNELS);
io_timer_set_enable(armed, IOTimerChanMode_PWMOut, IO_TIMER_ALL_MODES_CHANNELS);
io_timer_set_enable(armed, IOTimerChanMode_OneShot, channel_mask);
io_timer_set_enable(armed, IOTimerChanMode_PWMOut, channel_mask);
}

View File

@@ -102,10 +102,10 @@ int up_pwm_servo_init(uint32_t channel_mask)
return OK;
}
void up_pwm_servo_deinit(void)
void up_pwm_servo_deinit(uint32_t channel_mask)
{
/* disable the timers */
up_pwm_servo_arm(false);
up_pwm_servo_arm(false, channel_mask);
}
int up_pwm_servo_set_rate_group_update(unsigned group, unsigned rate)
@@ -152,8 +152,8 @@ uint32_t up_pwm_servo_get_rate_group(unsigned group)
}
void
up_pwm_servo_arm(bool armed)
up_pwm_servo_arm(bool armed, uint32_t channel_mask)
{
io_timer_set_enable(armed, IOTimerChanMode_OneShot, IO_TIMER_ALL_MODES_CHANNELS);
io_timer_set_enable(armed, IOTimerChanMode_PWMOut, IO_TIMER_ALL_MODES_CHANNELS);
io_timer_set_enable(armed, IOTimerChanMode_OneShot, channel_mask);
io_timer_set_enable(armed, IOTimerChanMode_PWMOut, channel_mask);
}

View File

@@ -109,10 +109,10 @@ int up_pwm_servo_init(uint32_t channel_mask)
return OK;
}
void up_pwm_servo_deinit(void)
void up_pwm_servo_deinit(uint32_t channel_mask)
{
/* disable the timers */
up_pwm_servo_arm(false);
up_pwm_servo_arm(false, channel_mask);
}
int up_pwm_servo_set_rate_group_update(unsigned group, unsigned rate)
@@ -158,8 +158,8 @@ uint32_t up_pwm_servo_get_rate_group(unsigned group)
}
void
up_pwm_servo_arm(bool armed)
up_pwm_servo_arm(bool armed, uint32_t channel_mask)
{
io_timer_set_enable(armed, IOTimerChanMode_OneShot, IO_TIMER_ALL_MODES_CHANNELS);
io_timer_set_enable(armed, IOTimerChanMode_PWMOut, IO_TIMER_ALL_MODES_CHANNELS);
io_timer_set_enable(armed, IOTimerChanMode_OneShot, channel_mask);
io_timer_set_enable(armed, IOTimerChanMode_PWMOut, channel_mask);
}