drivers: pwm_nrf5_sw: Correctly use allocated GPIOTE channels
The driver improperly uses the PWM channel index to reference the GPIOTE channel to be used for the PWM signal generation. Consequently, the PWM signal on a given channel can be correctly generated only if both those indexes are by chance the same. Fix this by switching to use the stored index of the actually allocated GPIOTE channel. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
af0158d693
commit
f73618906d
1 changed files with 4 additions and 4 deletions
|
@ -237,11 +237,11 @@ static int pwm_nrf5_sw_pin_set(const struct device *dev, uint32_t pwm,
|
|||
NRF_PPI->CH[ppi_chs[0]].EEP =
|
||||
(uint32_t) &(rtc->EVENTS_COMPARE[channel]);
|
||||
NRF_PPI->CH[ppi_chs[0]].TEP =
|
||||
(uint32_t) &(NRF_GPIOTE->TASKS_OUT[channel]);
|
||||
(uint32_t) &(NRF_GPIOTE->TASKS_OUT[gpiote_ch]);
|
||||
NRF_PPI->CH[ppi_chs[1]].EEP =
|
||||
(uint32_t) &(rtc->EVENTS_COMPARE[config->map_size]);
|
||||
NRF_PPI->CH[ppi_chs[1]].TEP =
|
||||
(uint32_t) &(NRF_GPIOTE->TASKS_OUT[channel]);
|
||||
(uint32_t) &(NRF_GPIOTE->TASKS_OUT[gpiote_ch]);
|
||||
NRF_PPI->CH[ppi_chs[2]].EEP =
|
||||
(uint32_t) &(rtc->EVENTS_COMPARE[config->map_size]);
|
||||
NRF_PPI->CH[ppi_chs[2]].TEP =
|
||||
|
@ -250,11 +250,11 @@ static int pwm_nrf5_sw_pin_set(const struct device *dev, uint32_t pwm,
|
|||
NRF_PPI->CH[ppi_chs[0]].EEP =
|
||||
(uint32_t) &(timer->EVENTS_COMPARE[channel]);
|
||||
NRF_PPI->CH[ppi_chs[0]].TEP =
|
||||
(uint32_t) &(NRF_GPIOTE->TASKS_OUT[channel]);
|
||||
(uint32_t) &(NRF_GPIOTE->TASKS_OUT[gpiote_ch]);
|
||||
NRF_PPI->CH[ppi_chs[1]].EEP =
|
||||
(uint32_t) &(timer->EVENTS_COMPARE[config->map_size]);
|
||||
NRF_PPI->CH[ppi_chs[1]].TEP =
|
||||
(uint32_t) &(NRF_GPIOTE->TASKS_OUT[channel]);
|
||||
(uint32_t) &(NRF_GPIOTE->TASKS_OUT[gpiote_ch]);
|
||||
}
|
||||
NRF_PPI->CHENSET = ppi_mask;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue