feat(board): 添加显示屏和PWM背光支持

- 在CMakeLists.txt中添加display_test_module.c源文件
- 在设备树配置中添加SPI3和PWM0引脚控制定义
- 配置MIPI DBI显示屏驱动,支持ST7789V控制器
- 添加PWM LED背光控制功能
- 启用GPIO复位功能并添加点击检测器配置
- 实现显示测试模块,支持彩色测试图案渲染
This commit is contained in:
2026-04-11 13:41:35 +08:00
parent 39d2962258
commit 76adb3584c
6 changed files with 357 additions and 6 deletions

View File

@@ -30,4 +30,32 @@
bias-pull-up;
};
};
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 1, 13)>,
<NRF_PSEL(SPIM_MOSI, 0, 28)>;
};
};
spi3_sleep: spi3_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 1, 13)>,
<NRF_PSEL(SPIM_MOSI, 0, 28)>;
low-power-enable;
};
};
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 1, 11)>;
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 1, 11)>;
low-power-enable;
};
};
};

View File

@@ -2,6 +2,8 @@
#include <nordic/nrf52840_qiaa.dtsi>
#include "mini_keyboard-pinctrl.dtsi"
#include <zephyr/dt-bindings/adc/adc.h>
#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h>
#include <zephyr/dt-bindings/pwm/pwm.h>
/ {
model = "Mini keyboard";
@@ -11,11 +13,13 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,display = &screen_lcd;
};
aliases {
led0 = &myled0;
qdec0 = &qdec;
backlight = &backlight;
};
hid_kbd: hid_kbd {
@@ -36,12 +40,57 @@
in-polling-period-us = <1000>;
};
leds {
compatible = "gpio-leds";
myled0: led_0 {
gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
myled0: led_0 {
gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
};
};
pwm_leds {
compatible = "pwm-leds";
status = "okay";
backlight: pwm_led_0 {
pwms = <&pwm0 0 PWM_MSEC(10) PWM_POLARITY_INVERTED>;
};
};
mipi_dbi_screen: mipi_dbi_screen {
compatible = "zephyr,mipi-dbi-spi";
spi-dev = <&spi3>;
dc-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
write-only;
#address-cells = <1>;
#size-cells = <0>;
screen_lcd: st7789v@0 {
compatible = "sitronix,st7789v";
status = "okay";
reg = <0>;
mipi-max-frequency = <32000000>;
width = <320>;
height = <172>;
x-offset = <0>;
y-offset = <34>;
vcom = <0x34>;
gctrl = <0x00>;
mdac = <0x70>;
gamma = <0x01>;
colmod = <0x05>;
lcm = <0x2c>;
porch-param = [ 0c 0c 00 33 33 ];
cmd2en-param = [ 5a 69 02 01 ];
pwctrl1-param = [ a4 a1 ];
pvgam-param = [ f0 04 08 0a 0a 05 25 33 3c 24 0e 0f 27 2f ];
nvgam-param = [ f0 02 06 06 04 22 25 32 3b 3a 15 17 2d 37 ];
ram-param = [ 00 f0 ];
rgb-param = [ cd 08 14 ];
ready-time-ms = <120>;
mipi-mode = "MIPI_DBI_MODE_SPI_4WIRE";
};
};
vbatt: vbatt {
compatible = "voltage-divider";
@@ -90,6 +139,7 @@
&uicr {
nfct-pins-as-gpios;
gpio-as-nreset;
};
&adc {
@@ -148,6 +198,21 @@
status = "okay";
};
&spi3 {
status = "okay";
pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
};
&pwm0 {
status = "okay";
pinctrl-0 = <&pwm0_default>;
pinctrl-1 = <&pwm0_sleep>;
pinctrl-names = "default", "sleep";
};
&qdec {
status = "okay";
pinctrl-0 = <&encoder_default>;