Skip to content

Commit 76f107b

Browse files
silabs-bozontdanieldegrasse
authored andcommitted
boards: seeed: add PWM support for the XIAO MG24
The onboard LED is now controllable via PWM. Signed-off-by: Tamas Jozsi <tamas.jozsi@silabs.com>
1 parent c9e697d commit 76f107b

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

boards/seeed/xiao_mg24/xiao_mg24-pinctrl.dtsi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2025 Pete Johanson
3+
* Copyright (c) 2025 Silicon Laboratories Inc.
34
*
45
* SPDX-License-Identifier: Apache-2.0
56
*/
@@ -56,4 +57,12 @@
5657
bias-pull-up;
5758
};
5859
};
60+
61+
timer0_default: timer0_default {
62+
group0 {
63+
pins = <TIMER0_CC0_PA7>;
64+
drive-push-pull;
65+
output-high;
66+
};
67+
};
5968
};

boards/seeed/xiao_mg24/xiao_mg24.dts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/*
22
* Copyright (c) 2025 Pete Johanson
3+
* Copyright (c) 2025 Silicon Laboratories Inc.
34
*
45
* SPDX-License-Identifier: Apache-2.0
56
*/
67

78
/dts-v1/;
89
#include <silabs/xg24/efr32mg24b220f1536im48.dtsi>
10+
#include <zephyr/dt-bindings/pwm/pwm.h>
911
#include "xiao_mg24-pinctrl.dtsi"
1012
#include "seeed_xiao_connector.dtsi"
1113

@@ -26,6 +28,7 @@
2628
/* These aliases are provided for compatibility with samples */
2729
aliases {
2830
led0 = &led0;
31+
pwm-led0 = &pwm_led0;
2932
watchdog0 = &wdog0;
3033
};
3134

@@ -37,6 +40,25 @@
3740
label = "LED 0";
3841
};
3942
};
43+
44+
pwmleds {
45+
compatible = "pwm-leds";
46+
47+
pwm_led0: pwm_led_0 {
48+
pwms = <&timer0_pwm 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
49+
label = "PWM LED 0";
50+
};
51+
};
52+
};
53+
54+
&timer0 {
55+
status = "okay";
56+
57+
timer0_pwm: pwm {
58+
pinctrl-0 = <&timer0_default>;
59+
pinctrl-names = "default";
60+
status = "okay";
61+
};
4062
};
4163

4264
&cpu0 {

0 commit comments

Comments
 (0)