Skip to content

Commit

Permalink
feature(shields): Add nice!view
Browse files Browse the repository at this point in the history
* Use two shield system, nice_view, and nice_view_adapter
* Build system fixes for interconnect use.
  • Loading branch information
Nicell committed Sep 30, 2022
1 parent 30e9acc commit 3d3c45b
Show file tree
Hide file tree
Showing 25 changed files with 252 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-user-config.yml
Expand Up @@ -61,7 +61,7 @@ jobs:
set -x
if [ -n "${{ matrix.shield }}" ]
then
EXTRA_CMAKE_ARGS="-DSHIELD=${{ matrix.shield }}"
EXTRA_CMAKE_ARGS="-DSHIELD=\"${{ matrix.shield }}\""
ARTIFACT_NAME="${{ matrix.shield }}-${{ matrix.board }}-zmk"
DISPLAY_NAME="${{ matrix.shield }} - ${{ matrix.board }}"
else
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Expand Up @@ -71,7 +71,7 @@ jobs:
for (const shieldArgs of buildShieldArgs) {
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(output.toString());
Expand Down Expand Up @@ -246,6 +246,9 @@ jobs:
return hm.requires.flatMap(i =>
metadata.interconnects[i].boards.flatMap(b => boardAndShield(b, hm))
);
} else {
console.warn("Unhandled shield without keys");
return [];
}
break;
case "interconnect":
Expand Down
22 changes: 22 additions & 0 deletions app/boards/shields/nice_view/Kconfig.defconfig
@@ -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
5 changes: 5 additions & 0 deletions app/boards/shields/nice_view/Kconfig.shield
@@ -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)
5 changes: 5 additions & 0 deletions app/boards/shields/nice_view/README.md
@@ -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.
4 changes: 4 additions & 0 deletions app/boards/shields/nice_view/nice_view.conf
@@ -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
23 changes: 23 additions & 0 deletions app/boards/shields/nice_view/nice_view.overlay
@@ -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;
};
};
8 changes: 8 additions & 0 deletions app/boards/shields/nice_view/nice_view.zmk.yml
@@ -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
2 changes: 2 additions & 0 deletions app/boards/shields/nice_view_adapter/Kconfig.defconfig
@@ -0,0 +1,2 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
5 changes: 5 additions & 0 deletions app/boards/shields/nice_view_adapter/Kconfig.shield
@@ -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)
11 changes: 11 additions & 0 deletions app/boards/shields/nice_view_adapter/README.md
@@ -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"
```
@@ -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";
};
17 changes: 17 additions & 0 deletions app/boards/shields/nice_view_adapter/boards/mikoto_520.overlay
@@ -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";
};
17 changes: 17 additions & 0 deletions app/boards/shields/nice_view_adapter/boards/nice_nano.overlay
@@ -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";
};
17 changes: 17 additions & 0 deletions app/boards/shields/nice_view_adapter/boards/nice_nano_v2.overlay
@@ -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";
};
17 changes: 17 additions & 0 deletions app/boards/shields/nice_view_adapter/boards/nrfmicro_11.overlay
@@ -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";
};
@@ -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";
};
17 changes: 17 additions & 0 deletions app/boards/shields/nice_view_adapter/boards/nrfmicro_13.overlay
@@ -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";
};
17 changes: 17 additions & 0 deletions app/boards/shields/nice_view_adapter/boards/puchi_ble_v1.overlay
@@ -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";
};
2 changes: 2 additions & 0 deletions app/boards/shields/nice_view_adapter/nice_view_adapter.conf
@@ -0,0 +1,2 @@
# Disable OLED
CONFIG_SSD1306=n
@@ -0,0 +1,5 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
@@ -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]
3 changes: 3 additions & 0 deletions app/core-coverage.yml
Expand Up @@ -30,3 +30,6 @@ include:
shield: romac_plus
cmake-args: "-DCONFIG_ZMK_RGB_UNDERGLOW=y -DCONFIG_WS2812_STRIP=y"
nickname: "underglow"
- board: nice_nano_v2
shield: lily58_left nice_view_adapter nice_view
nickname: "niceview"
8 changes: 4 additions & 4 deletions docs/docs/hardware.mdx
Expand Up @@ -21,13 +21,13 @@ export const toc = [
id: "composite",
level: 2,
},
...Object.values(groupedMetadata(Metadata).interconnects).map(
({ interconnect }) => ({
...Object.values(groupedMetadata(Metadata).interconnects)
.filter((ic) => ic.interconnect !== undefined)
.map(({ interconnect }) => ({
value: `${interconnect.name} Interconnect`,
id: interconnect.id,
level: 3,
})
),
})),
{
value: "Other Hardware",
id: "other-hardware",
Expand Down
6 changes: 5 additions & 1 deletion docs/src/components/hardware-utils.ts
Expand Up @@ -41,7 +41,11 @@ function groupedShield(agg: GroupedMetadata, shield: Shield) {
ic.shields.push(shield);
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;
}

Expand Down

0 comments on commit 3d3c45b

Please sign in to comment.