Skip to content

Commit b155c0d

Browse files
asmellbykartben
authored andcommitted
boards: silabs: xg24_dk2601b: Add PWM LEDs using TIMER
The TIMER has 3 PWM channels, allowing all 3 RGB leds to be controlled by the same PWM controller instance. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
1 parent fccc0a7 commit b155c0d

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b-pinctrl.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
};
4646
};
4747

48+
timer0_default: timer0_default {
49+
group0 {
50+
pins = <TIMER0_CC0_PD2>, <TIMER0_CC1_PA4>, <TIMER0_CC2_PB0>;
51+
drive-push-pull;
52+
output-high;
53+
};
54+
};
55+
4856
usart0_default: usart0_default {
4957
group0 {
5058
pins = <USART0_TX_PA5>;

boards/silabs/dev_kits/xg24_dk2601b/xg24_dk2601b.dts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <silabs/xg24/efr32mg24b310f1536im48.dtsi>
99
#include <zephyr/dt-bindings/input/input-event-codes.h>
1010
#include <zephyr/dt-bindings/regulator/silabs_dcdc.h>
11+
#include <zephyr/dt-bindings/pwm/pwm.h>
1112
#include "xg24_dk2601b-pinctrl.dtsi"
1213

1314
/ {
@@ -28,6 +29,9 @@
2829
led0 = &red_led;
2930
led1 = &green_led;
3031
led2 = &blue_led;
32+
pwm-led0 = &red_pwm_led;
33+
pwm-led1 = &green_pwm_led;
34+
pwm-led2 = &blue_pwm_led;
3135
sw0 = &button0;
3236
sw1 = &button1;
3337
watchdog0 = &wdog0;
@@ -49,6 +53,25 @@
4953
};
5054
};
5155

56+
pwmleds {
57+
compatible = "pwm-leds";
58+
59+
red_pwm_led: pwm_led_0 {
60+
pwms = <&timer0_pwm 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
61+
label = "red";
62+
};
63+
64+
green_pwm_led: pwm_led_1 {
65+
pwms = <&timer0_pwm 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
66+
label = "green";
67+
};
68+
69+
blue_pwm_led: pwm_led_2 {
70+
pwms = <&timer0_pwm 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
71+
label = "blue";
72+
};
73+
};
74+
5275
buttons {
5376
compatible = "gpio-keys";
5477

@@ -76,6 +99,16 @@
7699
};
77100
};
78101

102+
&timer0 {
103+
status = "okay";
104+
105+
timer0_pwm: pwm {
106+
pinctrl-0 = <&timer0_default>;
107+
pinctrl-names = "default";
108+
status = "okay";
109+
};
110+
};
111+
79112
&cpu0 {
80113
clock-frequency = <78000000>;
81114
};

0 commit comments

Comments
 (0)