arch/{nrf52|nrf53}/pwm: fix compilation for MULTICHAN not set

This commit is contained in:
raiden00pl 2023-06-15 15:12:42 +02:00 committed by Xiang Xiao
parent cb3abc48d7
commit ade23b92d1
2 changed files with 29 additions and 6 deletions

View file

@ -66,6 +66,9 @@ struct nrf52_pwm_s
uint32_t ch1_pin; /* Channel 2 pin */
uint32_t ch2_pin; /* Channel 3 pin */
uint32_t ch3_pin; /* Channel 4 pin */
#ifndef CONFIG_PWM_MULTICHAN
uint8_t channel; /* Assigned channel */
#endif
/* Sequence 0 */
@ -143,6 +146,9 @@ struct nrf52_pwm_s g_nrf52_pwm0 =
#ifdef CONFIG_NRF52_PWM0_CH3
.ch3_pin = NRF52_PWM0_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF52_PWM0_CHANNEL
#endif
};
#endif
@ -165,6 +171,9 @@ struct nrf52_pwm_s g_nrf52_pwm1 =
#ifdef CONFIG_NRF52_PWM1_CH3
.ch3_pin = NRF52_PWM1_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF52_PWM1_CHANNEL
#endif
};
#endif
@ -187,6 +196,9 @@ struct nrf52_pwm_s g_nrf52_pwm2 =
#ifdef CONFIG_NRF52_PWM2_CH3
.ch3_pin = NRF52_PWM2_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF52_PWM2_CHANNEL
#endif
};
#endif
@ -209,6 +221,9 @@ struct nrf52_pwm_s g_nrf52_pwm3 =
#ifdef CONFIG_NRF52_PWM3_CH3
.ch3_pin = NRF52_PWM3_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF52_PWM3_CHANNEL
#endif
};
#endif
@ -592,9 +607,7 @@ static int nrf52_pwm_start(struct pwm_lowerhalf_s *dev,
}
#else
ret = nrf52_pwm_duty(dev,
(info->channels[0].channel - 1),
info->duty);
ret = nrf52_pwm_duty(priv, priv->channel, info->duty);
#endif /* CONFIG_PWM_MULTICHAN */
/* Start sequence 0 */

View file

@ -66,6 +66,9 @@ struct nrf53_pwm_s
uint32_t ch1_pin; /* Channel 2 pin */
uint32_t ch2_pin; /* Channel 3 pin */
uint32_t ch3_pin; /* Channel 4 pin */
#ifndef CONFIG_PWM_MULTICHAN
uint8_t channel; /* Assigned channel */
#endif
/* Sequence 0 */
@ -143,6 +146,9 @@ struct nrf53_pwm_s g_nrf53_pwm0 =
#ifdef CONFIG_NRF53_PWM0_CH3
.ch3_pin = NRF53_PWM0_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF53_PWM0_CHANNEL
#endif
};
#endif
@ -165,6 +171,9 @@ struct nrf53_pwm_s g_nrf53_pwm1 =
#ifdef CONFIG_NRF53_PWM1_CH3
.ch3_pin = NRF53_PWM1_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF53_PWM1_CHANNEL
#endif
};
#endif
@ -187,6 +196,9 @@ struct nrf53_pwm_s g_nrf53_pwm2 =
#ifdef CONFIG_NRF53_PWM2_CH3
.ch3_pin = NRF53_PWM2_CH3_PIN,
#endif
#ifndef CONFIG_PWM_MULTICHAN
.channel = CONFIG_NRF53_PWM2_CHANNEL
#endif
};
#endif
@ -570,9 +582,7 @@ static int nrf53_pwm_start(struct pwm_lowerhalf_s *dev,
}
#else
ret = nrf53_pwm_duty(dev,
(info->channels[0].channel - 1),
info->duty);
ret = nrf53_pwm_duty(priv, priv->channel, info->duty);
#endif /* CONFIG_PWM_MULTICHAN */
/* Start sequence 0 */