Skip to content

Commit

Permalink
rev1350: Add backlight support
Browse files Browse the repository at this point in the history
  • Loading branch information
cyril279 committed Nov 8, 2023
1 parent 2eac7a8 commit ee297a3
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
12 changes: 11 additions & 1 deletion config/boards/shields/rev1350/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,14 @@ if SHIELD_REV1350
config ZMK_KEYBOARD_NAME
default "rev1350"

endif
endif # SHIELD_REV1350

if ZMK_BACKLIGHT

config PWM
default y

config LED_PWM
default y

endif # ZMK_BACKLIGHT
5 changes: 5 additions & 0 deletions config/boards/shields/rev1350/rev1350.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CONFIG_ZMK_BACKLIGHT=y
CONFIG_ZMK_BACKLIGHT_ON_START=y
CONFIG_ZMK_BACKLIGHT_BRT_START=11
CONFIG_ZMK_BACKLIGHT_BRT_STEP=5
CONFIG_ZMK_BACKLIGHT_AUTO_OFF_IDLE=y
4 changes: 2 additions & 2 deletions config/boards/shields/rev1350/rev1350.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/backlight>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/rgb.h>
#include <dt-bindings/zmk/keys.h>

#define DEFAULT 0
#define LOWER 1
Expand Down
30 changes: 30 additions & 0 deletions config/boards/shields/rev1350/rev1350.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
chosen {
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
zmk,backlight = &backlight;
};
backlight: pwmleds {
compatible = "pwm-leds";
pwm_led_0 {
pwms = <&pwm0 0 PWM_MSEC(10) PWM_POLARITY_NORMAL>;
};
};

default_transform: keymap_transform_0 {
Expand Down Expand Up @@ -50,3 +57,26 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(5,0) RC(5,1) RC(5,2) RC(5,3)
;
};
};


&pinctrl {
// Other pinctrl definitions for other hardware
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 9)>;
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 9)>;
low-power-enable;
};
};
};

&pwm0 {
status = "okay";
pinctrl-0 = <&pwm0_default>;
pinctrl-1 = <&pwm0_sleep>;
pinctrl-names = "default", "sleep";
};

0 comments on commit ee297a3

Please sign in to comment.