From 265dfdee92aa2fc46344e9313a61326763c59b38 Mon Sep 17 00:00:00 2001 From: Chen Zeng Date: Tue, 19 Nov 2024 22:53:19 +0800 Subject: [PATCH] support nice nano --- README.md | 32 ++++-- .../boards/nice_nano_v2.overlay | 98 +++++++++++++++++++ 2 files changed, 120 insertions(+), 10 deletions(-) create mode 100644 boards/shields/prospector_adapter/boards/nice_nano_v2.overlay diff --git a/README.md b/README.md index 47ef11e..314fb1e 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ All the necessary stuff for [Prospector](https://github.com/carrefinho/prospecto ## Features -- Highest active layer roller -- Peripheral battery bar -- Peripheral connection status -- Caps word indicator +* Highest active layer roller +* Peripheral battery bar +* Peripheral connection status +* Caps word indicator ## Installation @@ -66,15 +66,27 @@ keymap { ## Configuration To customize, add config options to your `config/[YOUR KEYBOARD SHIELD].conf` like so: + ```ini CONFIG_PROSPECTOR_USE_AMBIENT_LIGHT_SENSOR=n CONFIG_PROSPECTOR_FIXED_BRIGHTESS=80 ``` ### Available config options: -| Name | Description | Default | -| ------------------------------------------------- | --------------------------------------------------------------------------| ------------ | -| `CONFIG_PROSPECTOR_USE_AMBIENT_LIGHT_SENSOR` | Use ambient light sensor for auto brightness, set to `n` if building without one | y | -| `CONFIG_PROSPECTOR_FIXED_BRIGHTESS` | Set fixed display brightess when not using ambient light sensor | 50 (1-100) | -| `CONFIG_PROSPECTOR_PROSPECTOR_ROTATE_DISPLAY_180` | Rotate the display 180 degrees | n | -| `CONFIG_PROSPECTOR_LAYER_ROLLER_ALL_CAPS` | Convert layer names to all caps | n | \ No newline at end of file + +| Name | Description | Default | +| ------------------------------------------------- | -------------------------------------------------------------------------------- | ---------- | +| `CONFIG_PROSPECTOR_USE_AMBIENT_LIGHT_SENSOR` | Use ambient light sensor for auto brightness, set to `n` if building without one | y | +| `CONFIG_PROSPECTOR_FIXED_BRIGHTESS` | Set fixed display brightess when not using ambient light sensor | 50 (1-100) | +| `CONFIG_PROSPECTOR_PROSPECTOR_ROTATE_DISPLAY_180` | Rotate the display 180 degrees | n | +| `CONFIG_PROSPECTOR_LAYER_ROLLER_ALL_CAPS` | Convert layer names to all caps | n | + +### Nice!Nano IO connect list: + +| nice*\_nano\_v2.overlay* | display | +| :----------------------- | :------ | +| SPIM\_SCK | SCL | +| SPIM\_MOSI | SDA | +| cmd-data-gpios | DC | +| reset-gpios | RES | + diff --git a/boards/shields/prospector_adapter/boards/nice_nano_v2.overlay b/boards/shields/prospector_adapter/boards/nice_nano_v2.overlay new file mode 100644 index 0000000..c710dac --- /dev/null +++ b/boards/shields/prospector_adapter/boards/nice_nano_v2.overlay @@ -0,0 +1,98 @@ +/ { + pwmleds { + compatible = "pwm-leds"; + disp_bl: pwm_led_1 { + pwms = <&pwm1 0 PWM_MSEC(1) PWM_POLARITY_NORMAL>; + }; + }; +}; + +&spi2 { + status = "disabled"; +}; + +&pinctrl { + spi3_default: spi3_default { + group1 { + psels = , //SCL + , //SDA + ; + }; + }; + + spi3_sleep: spi3_sleep { + group1 { + psels = , + , + ; + low-power-enable; + }; + }; + + pwm1_default: pwm1_default { + group1 { + psels = ; + nordic,invert; + }; + }; + + pwm1_sleep: pwm1_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +}; + +disp_spi: &spi3 { + status = "okay"; + pinctrl-0 = <&spi3_default>; + pinctrl-1 = <&spi3_sleep>; + pinctrl-names = "default", "sleep"; + cs-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; //CS + + st7789: st7789v@0 { + compatible = "sitronix,st7789v"; + spi-max-frequency = <31000000>; + reg = <0>; + cmd-data-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; //DC + reset-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; // RES + width = <240>; + height = <280>; + x-offset = <0>; + y-offset = <20>; + vcom = <0x19>; + gctrl = <0x35>; + vrhs = <0x12>; + vdvs = <0x20>; + mdac = <0x00>; + 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 = [ D0 04 0D 11 13 2B 3F 54 4C 18 0D 0B 1F 23 ]; + nvgam-param = [ D0 04 0C 11 13 2C 3F 44 51 2F 1F 1F 20 23 ]; + ram-param = [ 00 F0 ]; + rgb-param = [ CD 08 14 ]; + }; +}; + +&i2c0 { + status = "okay"; + + apds9960: apds9960@39 { + compatible = "avago,apds9960"; + status = "okay"; + reg = <0x39>; + int-gpios = <&gpio1 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + }; +}; + +&pwm1 { + status = "okay"; + pinctrl-0 = <&pwm1_default>; + pinctrl-1 = <&pwm1_sleep>; + pinctrl-names = "default", "sleep"; +};