nrf52840_m2 update

This commit is contained in:
BarbUk 2025-11-17 22:00:04 +01:00
parent 354cff9c36
commit 40f3b3fefa
No known key found for this signature in database
GPG Key ID: B6D01F84A7519939
4 changed files with 110 additions and 6 deletions

View File

@ -13,4 +13,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

View File

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

View File

@ -7,6 +7,7 @@
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include <common/nordic/nrf52840_uf2_boot_mode.dtsi>
#include "nrf52840_m2-pinctrl.dtsi"
/ {
model = "Makerdiary nRF52840 M.2 module";
@ -17,18 +18,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";
};
};
@ -39,6 +45,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 {
@ -57,12 +75,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:

View File

@ -12,10 +12,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