boards: arm: nucleo_f091rc: define PWM LEDs
The board had PWM LEDs defined in the blinky_pwm sample, mainly because it conflicts with SPI1 pinmux. A better approach is to still define the PWM LEDs in the board but keep the PWM controller disabled by default. Then, samples just need to enable the PWM controller (and disable SPI if used simultaneously). Also updated period to 20ms (reasonable value for a PWM-driven LED). Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
5c61e4444b
commit
a65cec3042
2 changed files with 27 additions and 25 deletions
|
@ -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 {
|
aliases {
|
||||||
led0 = &green_led_2;
|
led0 = &green_led_2;
|
||||||
sw0 = &user_button;
|
sw0 = &user_button;
|
||||||
|
pwm-led0 = &green_pwm_led;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -139,3 +150,14 @@
|
||||||
&dma1 {
|
&dma1 {
|
||||||
status = "okay";
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -4,30 +4,10 @@
|
||||||
* Copyright (c) 2022 STMicroelectronics
|
* Copyright (c) 2022 STMicroelectronics
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <dt-bindings/pwm/pwm.h>
|
&pwmleds {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
/ {
|
|
||||||
pwmleds {
|
&pwm2 {
|
||||||
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>;
|
|
||||||
status = "okay";
|
status = "okay";
|
||||||
|
|
||||||
pwm2: pwm {
|
|
||||||
status = "okay";
|
|
||||||
pinctrl-0 = <&tim2_ch1_pa5>; /* might conflict with SPI1 */
|
|
||||||
pinctrl-names = "default";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue