Hi,
In order to adjust the sound pitch a magnetic buzzer I thought using a PWM could be the right choice.
Looking at the nrf5340dk device tree source I've found a pwmleds resource node, which relyes on the "pwm-leds" driver.
/ { ... pwmleds { compatible = "pwm-leds"; pwm_led1: pwm_led_1 { pwms = <&pwm1 25>; }; }; }; &pwm1 { status = "okay"; ch0-pin = <25>; };
In few minutes I managed to control the buzzer sound nicely.
Now, as the name suggests, I suppose the "pwm-leds" was originally conceived to adjust the brightness of a LED, making it to step from dark to max brightness.
Is it appropriate to use it for a buzzer ?