Skip to content

Commit 6816900

Browse files
tejlmandnordicjm
authored andcommitted
boards: Raspberry Pi pico pwm led adjustment
The Raspberry Pi pico defines PWM leds, but on the Raspberry Pi pico w-variant the gpio to the led is routed to the WiFi/Bluetooth module, thus the led is not available. Introduce a HAS_DT_PWM_LED define which allows devicetree overlays for the rpi_pico board to distinguish between board variants with a pwm controlled led, and those without. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent e502675 commit 6816900

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

boards/raspberrypi/rpi_pico/rpi_pico.dts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
#include "rpi_pico-common.dtsi"
1010

11+
/* Only the rpi_pico/rp2040 has a pwm. */
12+
/* This define can be used to avoid sourcing board overlays when the PWM is not available */
13+
#define HAS_DT_PWM_LED 1
14+
1115
/ {
1216
leds {
1317
compatible = "gpio-leds";

samples/basic/blinky_pwm/boards/rpi_pico.overlay

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* The rpi_pico/rp2040/w doesn't have a pwm. */
2+
/* Use the HAS_DT_PWM defined by the based board to identify when this overlay is valid */
3+
#if HAS_DT_PWM_LED
4+
15
&{/pwm_leds} {
26
status = "okay";
37
};
@@ -11,3 +15,5 @@
1115
divider-frac-4 = <15>;
1216
divider-int-4 = <255>;
1317
};
18+
19+
#endif

samples/basic/blinky_pwm/sample.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ tests:
88
- pwm
99
depends_on: pwm
1010
harness: led
11-
platform_exclude: rpi_pico/rp2040/w

0 commit comments

Comments
 (0)