Skip to content

Commit

Permalink
boards: efm32pg_stk3402a: Add minimal pwm support
Browse files Browse the repository at this point in the history
With this additions samples/basic/blinky_pwm works.
LED0 is used as pwm output.

Signed-off-by: Christian Taedcke <[email protected]>
  • Loading branch information
chrta authored and carlescufi committed Jul 4, 2022
1 parent a232b1b commit e71c2d1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions boards/arm/efm32pg_stk3402a/efm32pg_stk3402a_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
aliases {
led0 = &led0;
led1 = &led1;
pwm-led0 = &pwm_led0;
sw0 = &button0;
sw1 = &button1;
};
Expand Down Expand Up @@ -50,6 +51,14 @@
label = "User Push Button 1";
};
};

pwmleds {
compatible = "pwm-leds";
status = "okay";
pwm_led0: pwm_led0 {
pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
};
};

&cpu0 {
Expand Down Expand Up @@ -81,6 +90,16 @@
status = "okay";
};

&timer0 {
status = "okay";

pwm0: pwm {
status = "okay";
pin-location = <GECKO_LOCATION(28) GECKO_PORT_F GECKO_PIN(4)>;
prescaler = <1024>;
};
};

&gpio {
location-swo = <0>;
status = "okay";
Expand Down
1 change: 1 addition & 0 deletions dts/arm/silabs/efm32_jg_pg_12b.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <arm/armv7-m.dtsi>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/i2c/i2c.h>
#include <zephyr/dt-bindings/pwm/pwm.h>
#include "gpio_gecko.h"

/ {
Expand Down
4 changes: 4 additions & 0 deletions soc/arm/silabs_exx32/efm32jg12b/Kconfig.defconfig.efm32jg12b
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ config SOC_FLASH_GECKO
config SPI_GECKO
default y
depends on SPI

config PWM_GECKO
default y
depends on PWM
4 changes: 4 additions & 0 deletions soc/arm/silabs_exx32/efm32pg12b/Kconfig.defconfig.efm32pg12b
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ config SOC_FLASH_GECKO
config SPI_GECKO
default y
depends on SPI

config PWM_GECKO
default y
depends on PWM

0 comments on commit e71c2d1

Please sign in to comment.