diff --git a/app/boards/arm/nrf52840_m2/nrf52840_m2-pinctrl.dtsi b/app/boards/arm/nrf52840_m2/nrf52840_m2-pinctrl.dtsi new file mode 100644 index 00000000000..f2348f34172 --- /dev/null +++ b/app/boards/arm/nrf52840_m2/nrf52840_m2-pinctrl.dtsi @@ -0,0 +1,34 @@ +&pinctrl { + /* configuration for pwm device, default state */ + pwm0_default: pwm0_default { + group1 { + psels = , // LED 0 (red) + , // LED 1 (green) + ; // LED 2 (blue) + }; + }; + pwm0_sleep: pwm0_sleep { + group1 { + psels = , // LED 0 + , // LED 1 + ; // LED 2 + low-power-enable; + }; + }; + + /* configuration for i2c0 device, default state */ + i2c0_default: i2c0_default { + group1 { + psels = , + ; + }; + }; + + i2c0_sleep: i2c0_sleep { + group1 { + psels = , + ; + low-power-enable; + }; + }; +}; diff --git a/app/boards/arm/nrf52840_m2/nrf52840_m2.dts b/app/boards/arm/nrf52840_m2/nrf52840_m2.dts index 39569f0b760..1bd19cd964e 100644 --- a/app/boards/arm/nrf52840_m2/nrf52840_m2.dts +++ b/app/boards/arm/nrf52840_m2/nrf52840_m2.dts @@ -6,6 +6,7 @@ /dts-v1/; #include +#include "nrf52840_m2-pinctrl.dtsi" / { model = "Makerdiary nRF52840 M.2 module"; @@ -20,14 +21,17 @@ leds { compatible = "gpio-leds"; - red_led: led_0 { + led1_red: led_1 { gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; + label = "Red LED 1"; }; - green_led: led_1 { + led1_green: led_2 { gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; + label = "Green LED 1"; }; - blue_led: led_2 { + led1_blue: led_3 { gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>; + label = "Blue LED 1"; }; }; @@ -38,6 +42,18 @@ full-ohms = <(1000000 + 1000000)>; }; + pwmleds: pwmleds { + compatible = "pwm-leds"; + red_pwm_led: pwm_led_0 { + pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + green_pwm_led: pwm_led_1 { + pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + blue_pwm_led: pwm_led_2 { + pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + }; + }; }; &adc { @@ -56,12 +72,32 @@ status = "okay"; }; +&pwm0 { + status = "okay"; + pinctrl-0 = <&pwm0_default>; + pinctrl-1 = <&pwm0_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&i2c0 { + compatible = "nordic,nrf-twim"; + status = "okay"; + pinctrl-0 = <&i2c0_default>; + pinctrl-1 = <&i2c0_sleep>; + pinctrl-names = "default", "sleep"; + clock-frequency = ; + is31fl3733: is31fl3733@50 { + compatible = "issi,is31fl3733"; + reg = <0x50>; + sdb-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; + }; +}; + zephyr_udc0: &usbd { compatible = "nordic,nrf-usbd"; status = "okay"; }; - &flash0 { /* * For more information, see: diff --git a/app/boards/arm/nrf52840_m2/nrf52840_m2_defconfig b/app/boards/arm/nrf52840_m2/nrf52840_m2_defconfig index 93eef9e6ef8..5a67ff5ccbc 100644 --- a/app/boards/arm/nrf52840_m2/nrf52840_m2_defconfig +++ b/app/boards/arm/nrf52840_m2/nrf52840_m2_defconfig @@ -16,10 +16,10 @@ CONFIG_BUILD_OUTPUT_UF2=y CONFIG_MPU_ALLOW_FLASH_WRITE=y CONFIG_NVS=y -CONFIG_SETTINGS_NVS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_MAP=y CONFIG_ZMK_USB=y -CONFIG_ZMK_BLE=y \ No newline at end of file +CONFIG_ZMK_BLE=y +CONFIG_PINCTRL=y diff --git a/app/boards/shields/m60/Kconfig.defconfig b/app/boards/shields/m60/Kconfig.defconfig index a46969540c3..5292e36911a 100644 --- a/app/boards/shields/m60/Kconfig.defconfig +++ b/app/boards/shields/m60/Kconfig.defconfig @@ -6,4 +6,14 @@ if SHIELD_M60 config ZMK_KEYBOARD_NAME default "m60" +if ZMK_BACKLIGHT + +config PWM + default y + +config LED_PWM + default y + +endif # ZMK_BACKLIGHT + endif diff --git a/app/boards/shields/m60/m60.keymap b/app/boards/shields/m60/m60.keymap index 7fa07bbb7a5..6471e597368 100644 --- a/app/boards/shields/m60/m60.keymap +++ b/app/boards/shields/m60/m60.keymap @@ -7,6 +7,7 @@ #include #include #include +#include / { keymap0: keymap { @@ -14,13 +15,18 @@ default_layer { display-name = "Default Layer"; -// ------------------------------------------------------------------------------------------ -// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BSPC | -// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | -// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | -// | SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | -// | CTL | WIN | ALT | SPACE | ALT | MO(1) | WIN | CTRL | -// ------------------------------------------------------------------------------------------ + + // ╭─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────────╮ + // | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | ⌫ | + // |─────┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───────| + // | ─>| | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | + // |───────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴───────| + // | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ↵ | + // |────────┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴────────────| + // | ⇧ | Z | X | C | V | B | N | M | , | . | / | ⇧ | + // |──────┬───┴──┬──┴──┬──┴─────┴─────┴─────┴─────┴─────┴───┬─┴─────┼─────┴┬──────┬────────| + // | Ctrl | Win | Alt | | Alt | MO(1)| WIN | Ctrl | + // ╰──────┴──────┴─────┴────────────────────────────────────┴───────┴──────┴──────┴────────╯ bindings = < &kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH @@ -32,9 +38,21 @@ fn_layer { display-name = "Fn Layer"; + + // ╭─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────────╮ + // | ` | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | BOOT | + // |─────┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───────| + // | ─>| | BTc | BLt | BLc | | | | | | | | | | reset | + // |───────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴───────| + // | CAPS | BT0 | BT1 | BT2 | BT3 | BT4 | ← | ↓ | ↑ | → | | | ↵ | + // |────────┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴────────────| + // | ⇧ | | | | | | | | | | | ⇧ | + // |──────┬───┴──┬──┴──┬──┴─────┴─────┴─────┴─────┴─────┴───┬─┴─────┼─────┴┬──────┬────────| + // | Ctrl | Win | alt | | alt | MO(1)| WIN | Ctrl | + // ╰──────┴──────┴─────┴────────────────────────────────────┴───────┴──────┴──────┴────────╯ bindings = < &kp GRAVE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &bootloader -&trans &bt BT_CLR &none &none &none &none &none &none &none &none &none &none &none &sys_reset +&trans &bt BT_CLR &bl BL_TOG &bl BL_CYCLE &none &none &none &none &none &none &none &none &none &sys_reset &trans &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp LEFT &kp DOWN &kp UP &kp RIGHT &none &none &trans &trans &none &none &none &none &none &none &none &none &none &none &trans &trans &trans &trans &trans &trans &trans &trans &trans diff --git a/app/boards/shields/m60/m60.overlay b/app/boards/shields/m60/m60.overlay index 15690f52406..1abbad62530 100644 --- a/app/boards/shields/m60/m60.overlay +++ b/app/boards/shields/m60/m60.overlay @@ -12,6 +12,7 @@ chosen { zmk,kscan = &kscan0; zmk,physical-layout = &layout_60_ansi; + zmk,backlight = &pwmleds; }; kscan0: kscan {