Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/boards/arm/nrf52840_m2/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,14 @@ endif # USB_DEVICE_STACK
config BT_CTLR
default BT

if ZMK_BACKLIGHT

config PWM
default y

config LED_PWM
default y

endif # ZMK_BACKLIGHT

endif # BOARD_NRF52840_M2
56 changes: 56 additions & 0 deletions app/boards/arm/nrf52840_m2/nrf52840_m2-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
&pinctrl {
/* configuration for spi0 device, default state */
spi0_default: spi0_default {
/* node name is arbitrary */
group1 {
/* main role: configure P1.11 as SPI clock, P0.02 as SPI MOSI, P0.03 as SPI MISO */
psels = <NRF_PSEL(SPIM_SCK, 1, 11)>,
<NRF_PSEL(SPIM_MOSI, 1, 10)>,
<NRF_PSEL(SPIM_MISO, 1, 12)>;
};
};

/* configuration for spi0 device, sleep state */
spi0_sleep: spi0_sleep {
group1 {
/* main role: configure P1.11 as SPI clock, P0.02 as SPI MOSI, P0.03 as SPI MISO */
psels = <NRF_PSEL(SPIM_SCK, 1, 11)>,
<NRF_PSEL(SPIM_MOSI, 1, 10)>,
<NRF_PSEL(SPIM_MISO, 1, 12)>;
low-power-enable;
};
};

/* configuration for pwm device, default state */
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 30)>, // LED 0 (red)
<NRF_PSEL(PWM_OUT1, 0, 29)>, // LED 1 (green)
<NRF_PSEL(PWM_OUT2, 0, 31)>; // LED 2 (blue)
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 30)>, // LED 0
<NRF_PSEL(PWM_OUT1, 0, 29)>, // LED 1
<NRF_PSEL(PWM_OUT2, 0, 31)>; // LED 2
low-power-enable;
};
};

/* configuration for i2c0 device, default state */
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 5)>,
<NRF_PSEL(TWIM_SCL, 1, 6)>;
};
};

i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 5)>,
<NRF_PSEL(TWIM_SCL, 1, 6)>;
low-power-enable;
};
};
};
46 changes: 42 additions & 4 deletions app/boards/arm/nrf52840_m2/nrf52840_m2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "nrf52840_m2-pinctrl.dtsi"

/ {
model = "Makerdiary nRF52840 M.2 module";
Expand All @@ -16,18 +17,23 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,battery = &vbatt;
zmk,backlight = &backlight;
zmk,led = &is31fl3733;
};

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";
};
};

Expand All @@ -38,6 +44,18 @@
full-ohms = <(1000000 + 1000000)>;
};

backlight: 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 {
Expand All @@ -56,12 +74,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 = <I2C_BITRATE_FAST>;
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:
Expand Down
4 changes: 2 additions & 2 deletions app/boards/arm/nrf52840_m2/nrf52840_m2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
CONFIG_ZMK_BLE=y
CONFIG_PINCTRL=y