diff --git a/boards/arm/nucleo_f091rc/nucleo_f091rc.dts b/boards/arm/nucleo_f091rc/nucleo_f091rc.dts index 0a28bd54aab..54e20faac86 100644 --- a/boards/arm/nucleo_f091rc/nucleo_f091rc.dts +++ b/boards/arm/nucleo_f091rc/nucleo_f091rc.dts @@ -36,9 +36,20 @@ }; }; + pwmleds: pwmleds { + compatible = "pwm-leds"; + /* NOTE: disabled by default, PWM2 conflicts with SPI1 */ + status = "disabled"; + + green_pwm_led: green_pwm_led { + pwms = <&pwm2 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; + aliases { led0 = &green_led_2; sw0 = &user_button; + pwm-led0 = &green_pwm_led; }; }; @@ -139,3 +150,14 @@ &dma1 { status = "okay"; }; + +&timers2 { + st,prescaler = <10000>; + status = "okay"; + + pwm2: pwm { + /* NOTE: disabled by default, PWM2 conflicts with SPI1 */ + pinctrl-0 = <&tim2_ch1_pa5>; + pinctrl-names = "default"; + }; +}; diff --git a/samples/basic/blinky_pwm/boards/nucleo_f091rc.overlay b/samples/basic/blinky_pwm/boards/nucleo_f091rc.overlay index 2852445c490..35bfcfe386e 100644 --- a/samples/basic/blinky_pwm/boards/nucleo_f091rc.overlay +++ b/samples/basic/blinky_pwm/boards/nucleo_f091rc.overlay @@ -4,30 +4,10 @@ * Copyright (c) 2022 STMicroelectronics */ -#include - - -/ { - pwmleds { - compatible = "pwm-leds"; - - green_pwm_led: green_pwm_led { - pwms = <&pwm2 1 4 PWM_POLARITY_NORMAL>; - }; - }; - - aliases { - pwm-led0 = &green_pwm_led; - }; -}; - -&timers2 { - st,prescaler = <10000>; +&pwmleds { + status = "okay"; +}; + +&pwm2 { status = "okay"; - - pwm2: pwm { - status = "okay"; - pinctrl-0 = <&tim2_ch1_pa5>; /* might conflict with SPI1 */ - pinctrl-names = "default"; - }; };