From 5351c58512aebf6044aed4b9f4d8b8a368f60927 Mon Sep 17 00:00:00 2001 From: Jan Hilsdorf Date: Mon, 3 Oct 2022 18:15:15 +0200 Subject: [PATCH] =?UTF-8?q?drivers:=20pwm:=20rpi=5Fpico:=20Use=20=E2=80=9C?= =?UTF-8?q?pico=5Fchannel=E2=80=9D=20instead=20of=20=E2=80=9Cch=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pwm_set_chan_level uses slice channels A(=0) or B(=1) and not Zephyr channel (0..15). So PWM doesn't work for channels > 1. There is already a function (pwm_rpi_channel_to_pico_channel) which does the right thing, but it isn't used for pwm_set_chan_level. Signed-off-by: Jan Hilsdorf --- drivers/pwm/pwm_rpi_pico.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm_rpi_pico.c b/drivers/pwm/pwm_rpi_pico.c index d75ee314ebf6..1081035cc76c 100644 --- a/drivers/pwm/pwm_rpi_pico.c +++ b/drivers/pwm/pwm_rpi_pico.c @@ -113,7 +113,7 @@ static int pwm_rpi_set_cycles(const struct device *dev, uint32_t ch, uint32_t pe pwm_rpi_set_channel_polarity(dev, slice, pico_channel, (flags & PWM_POLARITY_MASK) == PWM_POLARITY_INVERTED); pwm_set_wrap(slice, period_cycles); - pwm_set_chan_level(slice, ch, pulse_cycles); + pwm_set_chan_level(slice, pico_channel, pulse_cycles); return 0; };