feature(shields): Add nice!view

* Use two shield system, nice_view, and nice_view_adapter
* Build system fixes for interconnect use.
This commit is contained in:
Nick Winans 2022-09-29 20:11:26 -05:00 committed by GitHub
parent 30e9accc95
commit 3d3c45bc80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 252 additions and 7 deletions

View File

@ -61,7 +61,7 @@ jobs:
set -x set -x
if [ -n "${{ matrix.shield }}" ] if [ -n "${{ matrix.shield }}" ]
then then
EXTRA_CMAKE_ARGS="-DSHIELD=${{ matrix.shield }}" EXTRA_CMAKE_ARGS="-DSHIELD=\"${{ matrix.shield }}\""
ARTIFACT_NAME="${{ matrix.shield }}-${{ matrix.board }}-zmk" ARTIFACT_NAME="${{ matrix.shield }}-${{ matrix.board }}-zmk"
DISPLAY_NAME="${{ matrix.shield }} - ${{ matrix.board }}" DISPLAY_NAME="${{ matrix.shield }} - ${{ matrix.board }}"
else else

View File

@ -71,7 +71,7 @@ jobs:
for (const shieldArgs of buildShieldArgs) { for (const shieldArgs of buildShieldArgs) {
try { try {
const output = execSync(`west build -s app -p -b ${{ matrix.board }} -- ${shieldArgs.shield ? '-DSHIELD=' + shieldArgs.shield : ''} ${shieldArgs['cmake-args'] || ''}`); const output = execSync(`west build -s app -p -b ${{ matrix.board }} -- ${shieldArgs.shield ? '-DSHIELD="' + shieldArgs.shield + '"' : ''} ${shieldArgs['cmake-args'] || ''}`);
console.log(`::group::${{ matrix.board}} ${shieldArgs.shield} Build`) console.log(`::group::${{ matrix.board}} ${shieldArgs.shield} Build`)
console.log(output.toString()); console.log(output.toString());
@ -246,6 +246,9 @@ jobs:
return hm.requires.flatMap(i => return hm.requires.flatMap(i =>
metadata.interconnects[i].boards.flatMap(b => boardAndShield(b, hm)) metadata.interconnects[i].boards.flatMap(b => boardAndShield(b, hm))
); );
} else {
console.warn("Unhandled shield without keys");
return [];
} }
break; break;
case "interconnect": case "interconnect":

View File

@ -0,0 +1,22 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
if SHIELD_NICE_VIEW
config ZMK_DISPLAY
select LVGL_FONT_MONTSERRAT_26
if ZMK_DISPLAY
config SPI
default y
config LS0XX
default y
config ZMK_WIDGET_WPM_STATUS
default y if !ZMK_SPLIT || ZMK_SPLIT_ROLE_CENTRAL
endif # ZMK_DISPLAY
endif

View File

@ -0,0 +1,5 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
config SHIELD_NICE_VIEW
def_bool $(shields_list_contains,nice_view)

View File

@ -0,0 +1,5 @@
# nice!view
The nice!view is a low power, high refresh rate display meant to replace I2C OLEDs traditionally used.
This shield requires that an `&nice_view_spi` labelled SPI bus is provided with *at least* MOSI, SCK, and CS pins defined.

View File

@ -0,0 +1,4 @@
# Enable nice!view
CONFIG_ZMK_DISPLAY=y
CONFIG_LVGL_THEME_DEFAULT_FONT_SMALL_MONTSERRAT_26=y
CONFIG_LVGL_THEME_DEFAULT_FONT_NORMAL_MONTSERRAT_26=y

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
&nice_view_spi {
status = "okay";
nice_view: ls0xx@0 {
compatible = "sharp,ls0xx";
label = "DISPLAY";
spi-max-frequency = <1000000>;
reg = <0>;
width = <160>;
height = <68>;
};
};
/ {
chosen {
zephyr,display = &nice_view;
};
};

View File

@ -0,0 +1,8 @@
file_format: "1"
id: nice_view
name: nice!view
type: shield
url: https://nicekeyboards.com/nice-view
requires: [nice_view_header]
features:
- display

View File

@ -0,0 +1,2 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT

View File

@ -0,0 +1,5 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
config SHIELD_NICE_VIEW_ADAPTER
def_bool $(shields_list_contains,nice_view_adapter)

View File

@ -0,0 +1,11 @@
# nice!view Adapter
This shield is used as an adapter between the nice!view and existing shields/boards that expose an I2C OLED header.
To use this shield, you should add this shield to your list of shields *before* `nice_view`.
The nice!view will use the SDA/SCL pins of the OLED, and then the adapter expects a final pin to be "bodged" from your microcontroller to the nice!view CS pin. This adapter assumes that the CS pin bodged is the `&pro_micro 1` pin or "D1", which is the top left pin when looking at the front of the board. If you can't use this pin, you'll need to override the `cs-gpios` for the `&nice_view_spi` bus (in your `zmk-config` keymap for example) or you will want to define your own `&nice_view_spi` bus without using this adapter.
```
west build -b nice_nano_v2 -- -DSHIELD="lily58_left nice_view_adapter nice_view"
```

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
nice_view_spi: &spi0 {
compatible = "nordic,nrf-spim";
sck-pin = <17>;
mosi-pin = <15>;
miso-pin = <25>;
cs-gpios = <&pro_micro 1 GPIO_ACTIVE_HIGH>;
};
&pro_micro_i2c {
status = "disabled";
};

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
nice_view_spi: &spi0 {
compatible = "nordic,nrf-spim";
sck-pin = <20>;
mosi-pin = <17>;
miso-pin = <5>;
cs-gpios = <&pro_micro 1 GPIO_ACTIVE_HIGH>;
};
&pro_micro_i2c {
status = "disabled";
};

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
nice_view_spi: &spi0 {
compatible = "nordic,nrf-spim";
sck-pin = <20>;
mosi-pin = <17>;
miso-pin = <25>;
cs-gpios = <&pro_micro 1 GPIO_ACTIVE_HIGH>;
};
&pro_micro_i2c {
status = "disabled";
};

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
nice_view_spi: &spi0 {
compatible = "nordic,nrf-spim";
sck-pin = <20>;
mosi-pin = <17>;
miso-pin = <25>;
cs-gpios = <&pro_micro 1 GPIO_ACTIVE_HIGH>;
};
&pro_micro_i2c {
status = "disabled";
};

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
nice_view_spi: &spi0 {
compatible = "nordic,nrf-spim";
sck-pin = <17>;
mosi-pin = <15>;
miso-pin = <25>;
cs-gpios = <&pro_micro 1 GPIO_ACTIVE_HIGH>;
};
&pro_micro_i2c {
status = "disabled";
};

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
nice_view_spi: &spi0 {
compatible = "nordic,nrf-spim";
sck-pin = <31>;
mosi-pin = <30>;
miso-pin = <25>;
cs-gpios = <&pro_micro 1 GPIO_ACTIVE_HIGH>;
};
&pro_micro_i2c {
status = "disabled";
};

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
nice_view_spi: &spi0 {
compatible = "nordic,nrf-spim";
sck-pin = <17>;
mosi-pin = <15>;
miso-pin = <25>;
cs-gpios = <&pro_micro 1 GPIO_ACTIVE_HIGH>;
};
&pro_micro_i2c {
status = "disabled";
};

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
nice_view_spi: &spi0 {
compatible = "nordic,nrf-spim";
sck-pin = <17>;
mosi-pin = <15>;
miso-pin = <25>;
cs-gpios = <&pro_micro 1 GPIO_ACTIVE_HIGH>;
};
&pro_micro_i2c {
status = "disabled";
};

View File

@ -0,0 +1,2 @@
# Disable OLED
CONFIG_SSD1306=n

View File

@ -0,0 +1,5 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

View File

@ -0,0 +1,7 @@
file_format: "1"
id: nice_view_adapter
name: nice!view adapter
type: shield
url: https://nicekeyboards.com/nice-view
requires: [i2c_oled]
exposes: [nice_view_header]

View File

@ -30,3 +30,6 @@ include:
shield: romac_plus shield: romac_plus
cmake-args: "-DCONFIG_ZMK_RGB_UNDERGLOW=y -DCONFIG_WS2812_STRIP=y" cmake-args: "-DCONFIG_ZMK_RGB_UNDERGLOW=y -DCONFIG_WS2812_STRIP=y"
nickname: "underglow" nickname: "underglow"
- board: nice_nano_v2
shield: lily58_left nice_view_adapter nice_view
nickname: "niceview"

View File

@ -21,13 +21,13 @@ export const toc = [
id: "composite", id: "composite",
level: 2, level: 2,
}, },
...Object.values(groupedMetadata(Metadata).interconnects).map( ...Object.values(groupedMetadata(Metadata).interconnects)
({ interconnect }) => ({ .filter((ic) => ic.interconnect !== undefined)
.map(({ interconnect }) => ({
value: `${interconnect.name} Interconnect`, value: `${interconnect.name} Interconnect`,
id: interconnect.id, id: interconnect.id,
level: 3, level: 3,
}) })),
),
{ {
value: "Other Hardware", value: "Other Hardware",
id: "other-hardware", id: "other-hardware",

View File

@ -41,7 +41,11 @@ function groupedShield(agg: GroupedMetadata, shield: Shield) {
ic.shields.push(shield); ic.shields.push(shield);
agg.interconnects[id] = ic; agg.interconnects[id] = ic;
}); });
shield.exposes?.forEach((id) => {
let ic = agg.interconnects[id] ?? { boards: [], shields: [] };
ic.shields.push(shield);
agg.interconnects[id] = ic;
});
return agg; return agg;
} }