1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

cpu/nrf52: Don't touch pin modes on PWM startup

Once PWM is running, the active PWM module overrides the PIN_CNF state;
only when PWM is stopped the pin returns into its PIN_CNF state (which,
then, the board may set to whatever idle means there).

(Moreover, the code there only worked for P0 registers, not eg. the
P1.09 of the nrf52840dongle's RGB LED).
This commit is contained in:
chrysn 2020-09-29 14:08:26 +02:00
parent 329a65fb3b
commit 65e63ffbbb

View File

@ -90,9 +90,6 @@ uint32_t pwm_init(pwm_t pwm, pwm_mode_t mode, uint32_t freq, uint16_t res)
/* pin configuration */
for (unsigned i = 0; i < PWM_CHANNELS; i++) {
if (pwm_config[pwm].pin[i] != GPIO_UNDEF) {
NRF_P0->PIN_CNF[pwm_config[pwm].pin[i]] = PIN_CNF_SET;
}
/* either left aligned pol or inverted duty cycle */
pwm_seq[pwm][i] = (POL_MASK & mode) ? POL_MASK : res;
dev(pwm)->PSEL.OUT[i] = pwm_config[pwm].pin[i];