mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 06:13:35 +08:00
Moved Switching IO to the point of ARMing
This commit is contained in:
committed by
Lorenz Meier
parent
1843eea917
commit
5e47ffdaf9
@@ -140,9 +140,6 @@ pwm_channel_init(unsigned channel)
|
|||||||
{
|
{
|
||||||
unsigned timer = pwm_channels[channel].timer_index;
|
unsigned timer = pwm_channels[channel].timer_index;
|
||||||
|
|
||||||
/* configure the GPIO first */
|
|
||||||
stm32_configgpio(pwm_channels[channel].gpio);
|
|
||||||
|
|
||||||
/* configure the channel */
|
/* configure the channel */
|
||||||
switch (pwm_channels[channel].timer_channel) {
|
switch (pwm_channels[channel].timer_channel) {
|
||||||
case 1:
|
case 1:
|
||||||
@@ -333,9 +330,16 @@ up_pwm_servo_arm(bool armed)
|
|||||||
for (unsigned i = 0; i < PWM_SERVO_MAX_TIMERS; i++) {
|
for (unsigned i = 0; i < PWM_SERVO_MAX_TIMERS; i++) {
|
||||||
if (pwm_timers[i].base != 0) {
|
if (pwm_timers[i].base != 0) {
|
||||||
if (armed) {
|
if (armed) {
|
||||||
|
|
||||||
/* force an update to preload all registers */
|
/* force an update to preload all registers */
|
||||||
rEGR(i) = GTIM_EGR_UG;
|
rEGR(i) = GTIM_EGR_UG;
|
||||||
|
|
||||||
|
for (unsigned c = 0; c < PWM_SERVO_MAX_CHANNELS; c++) {
|
||||||
|
if (pwm_channels[c].gpio) {
|
||||||
|
stm32_configgpio(pwm_channels[c].gpio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* arm requires the timer be enabled */
|
/* arm requires the timer be enabled */
|
||||||
rCR1(i) |= GTIM_CR1_CEN | GTIM_CR1_ARPE;
|
rCR1(i) |= GTIM_CR1_CEN | GTIM_CR1_ARPE;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user