Skip to content

Commit

Permalink
Initial shield
Browse files Browse the repository at this point in the history
  • Loading branch information
mctechnology17 committed Aug 25, 2024
0 parents commit 05bf62b
Show file tree
Hide file tree
Showing 37 changed files with 2,299 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.dtsi linguist-language=C++
*.keymap linguist-language=C++
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
on: [push, pull_request, workflow_dispatch]

jobs:
build:
uses: zmkfirmware/zmk/.github/workflows/build-user-config.yml@main
86 changes: 86 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# zmk
zmk/

# sketchybar
sketchybar/dotfiles/
sketchybar/dotfiles
sketchybar/dotfiles/*

# MacOS
.DS_Store
vim-tools_notiz.vim
.DS_Store
./*/.DS_Store
.vscode
# .vimspector.json
push.sh
/test
test/

# c, cpp
*.x
*.d
*.dSYM
*.o
*.out

# log
*.log

# cache
*.cache
cache/

# Windows
Thumbs.db
Desktop.ini

# Tags
#TAGS
#!TAGS/
#tags
doc/tags
tags-cn
!tags/
.tags
.tags1
tags.lock
tags.temp
gtags.files
GTAGS
GRTAGS
GPATH
cscope.files
cscope.out
cscope.in.out
cscope.po.out

# Vim
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~

# Test % Tmp
test.*
tmp.*
temp.*

# Java
*.class

# JavaScript
node_modules

# Python
*.pyc
.idea/
/.idea
# build/
__pycache__

# Rust
target/
**/*.rs.bk
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Marcos Chow Castro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# dongle_display!view
This is a mix between display_dongle by @englmaxi and
[nice!view](https://nicekeyboards.com/nice-view) that allows you to use the
nice!view display with your dongle.

You can find the original version in his [zmk-dongle-display](https://github.com/englmaxi/zmk-dongle-display).

Compatible with all boards with pro micro and seeeduino xiao BLE pinout, like
the Nice!Nano, Puchi, clones and others.

Shields supported:
- dongle_display_view_pro_micro
- dongle_display_view_seeeduino_xiao_ble

[![dongle_display_view_pro_micro](src/dongle_display_view_pro_micro.JPG)](https://github.com/mctechnology17/zmk-config)
[![dongle_display_view_seeeduino_xiao_ble](src/dongle_display_view_seeeduino_xiao_ble.JPG)](https://github.com/mctechnology17/zmk-config)

# Usage
> [!IMPORTANT]
> Keep in mind that you have to have a dongle configured beforehand! Example: [zmk-config](https://github.com/mctechnology17/zmk-config)
- **Example1 using a board with pro_micro pins:**
```bash
west build -b nice_nano_v2 -- -DSHIELD="corne_dongle_pro_micro nice_view_adapter dongle_display_view_pro_micro"
```

- **Example2 using a board with pro_micro pins:**
```bash
west build -b puchi_ble_v1 -- -DSHIELD="corne_dongle_pro_micro nice_view_adapter dongle_display_view_pro_micro"
```

- **Example3 using a board with seeeduino_xiao_ble pins:**
```bash
west build -b seeeduino_xiao_ble -- -DSHIELD="corne_dongle_xiao nice_view_adapter dongle_display_view_seeeduino_xiao_ble"
```

# Configuration
> [!IMPORTANT]
> You can find the original version in his [zmk-dongle-display](https://github.com/englmaxi/zmk-dongle-display).
To also display the battery level of the dongle/central device, use the following configuration property:

```ini
CONFIG_ZMK_DONGLE_DISPLAY_DONGLE_BATTERY=y
```

If you want to use MacOS modifier symbols instead of the Windows modifier symbols, use the following configuration property:

```ini
CONFIG_ZMK_DONGLE_DISPLAY_MAC_MODIFIERS=y
```

To use this module, first add it to your `config/west.yml` by adding a new
entry to `remotes` and `projects`:

```yaml
manifest:
remotes:
- name: zmkfirmware
url-base: https://github.com/zmkfirmware
- name: mctechnology17
url-base: https://github.com/mctechnology17
projects:
- name: zmk
remote: zmkfirmware
revision: main
import: app/west.yml
- name: zmk-dongle-display-view
remote: mctechnology17
revision: main
self:
path: config
```
Now simply indicate in the board and the shield in the `build.yaml` file:

```yaml
---
include:
- board: nice_nano_v2
shield: corne_dongle_pro_micro nice_view_adapter dongle_display_view_pro_micro"
- board: puchi_ble_v1
shield: corne_dongle_pro_micro nice_view_adapter dongle_display_view_pro_micro"
- board: seeeduino_xiao_ble
shield: corne_dongle_xiao nice_view_adapter dongle_display_view_seeeduino_xiao_ble"
```
Empty file added boards/shields/.gitkeep
Empty file.
18 changes: 18 additions & 0 deletions boards/shields/dongle_display_view/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
if(CONFIG_ZMK_DISPLAY AND CONFIG_ZMK_DISPLAY_STATUS_SCREEN_CUSTOM AND ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL))
zephyr_library()
zephyr_library_sources(${ZEPHYR_BASE}/misc/empty_file.c)
zephyr_library_include_directories(${ZEPHYR_LVGL_MODULE_DIR})
zephyr_library_include_directories(${ZEPHYR_BASE}/lib/gui/lvgl/)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
zephyr_library_include_directories(${CMAKE_SOURCE_DIR}/include)
zephyr_library_sources(custom_status_screen.c)
zephyr_library_sources(widgets/battery_status.c)
zephyr_library_sources(widgets/bongo_cat.c)
zephyr_library_sources(widgets/bongo_cat_images.c)
target_sources_ifdef(CONFIG_ZMK_HID_INDICATORS app PRIVATE widgets/hid_indicators.c)
zephyr_library_sources(widgets/layer_status.c)
zephyr_library_sources(widgets/modifiers.c)
zephyr_library_sources(widgets/modifiers_sym.c)
zephyr_library_sources(widgets/output_status.c)
zephyr_library_sources(widgets/output_status_sym.c)
endif()
48 changes: 48 additions & 0 deletions boards/shields/dongle_display_view/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT

if SHIELD_DONGLE_DISPLAY_VIEW_SEEEDUINO_XIAO_BLE || SHIELD_DONGLE_DISPLAY_VIEW_PRO_MICRO

choice ZMK_DISPLAY_STATUS_SCREEN
default ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
endchoice

config ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
select LV_USE_LABEL
select LV_USE_IMG
select LV_USE_CANVAS
select LV_USE_ANIMIMG
select LV_USE_ANIMATION
select LV_USE_LINE
select LV_FONT_UNSCII_8
select ZMK_WPM
imply ZMK_HID_INDICATORS

config ZMK_DONGLE_DISPLAY_DONGLE_BATTERY
bool "Show also the battery level of the dongle"
depends on BT && (!ZMK_SPLIT_BLE || ZMK_SPLIT_ROLE_CENTRAL)

config ZMK_DONGLE_DISPLAY_MAC_MODIFIERS
bool "Use MacOS modifier symbols instead of the Windows symbols"

choice ZMK_DISPLAY_WORK_QUEUE
default ZMK_DISPLAY_WORK_QUEUE_DEDICATED
endchoice

config LV_Z_MEM_POOL_SIZE
default 8192

config LV_Z_VDB_SIZE
default 64

config LV_DPI_DEF
default 148

config LV_Z_BITS_PER_PIXEL
default 1

choice LV_COLOR_DEPTH
default LV_COLOR_DEPTH_1
endchoice

endif
8 changes: 8 additions & 0 deletions boards/shields/dongle_display_view/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT

config SHIELD_DONGLE_DISPLAY_VIEW_PRO_MICRO
def_bool $(shields_list_contains,dongle_display_view_pro_micro)

config SHIELD_DONGLE_DISPLAY_VIEW_SEEEDUINO_XIAO_BLE
def_bool $(shields_list_contains,dongle_display_view_seeeduino_xiao_ble)
15 changes: 15 additions & 0 deletions boards/shields/dongle_display_view/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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` labeled SPI bus is provided with _at least_ MOSI, SCK, and CS pins defined.

## Disable custom widget

The nice!view shield includes a custom vertical widget. To use the built-in ZMK one, add the following item to your `.conf` file:

```
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN=y
CONFIG_ZMK_LV_FONT_DEFAULT_SMALL_MONTSERRAT_26=y
CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26=y
```
63 changes: 63 additions & 0 deletions boards/shields/dongle_display_view/custom_status_screen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include "custom_status_screen.h"
#include "widgets/battery_status.h"
#include "widgets/modifiers.h"
#include "widgets/bongo_cat.h"
#include "widgets/layer_status.h"
#include "widgets/output_status.h"
#include "widgets/hid_indicators.h"

#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);

static struct zmk_widget_output_status output_status_widget;
static struct zmk_widget_layer_status layer_status_widget;
static struct zmk_widget_dongle_battery_status dongle_battery_status_widget;
static struct zmk_widget_modifiers modifiers_widget;
static struct zmk_widget_bongo_cat bongo_cat_widget;

#if IS_ENABLED(CONFIG_ZMK_HID_INDICATORS)
static struct zmk_widget_hid_indicators hid_indicators_widget;
#endif

lv_style_t global_style;

lv_obj_t *zmk_display_status_screen() {
lv_obj_t *screen;

screen = lv_obj_create(NULL);

lv_style_init(&global_style);
lv_style_set_text_font(&global_style, &lv_font_unscii_8);
lv_style_set_text_letter_space(&global_style, 1);
lv_style_set_text_line_space(&global_style, 1);
lv_obj_add_style(screen, &global_style, LV_PART_MAIN);

zmk_widget_output_status_init(&output_status_widget, screen);
lv_obj_align(zmk_widget_output_status_obj(&output_status_widget), LV_ALIGN_TOP_LEFT, 0, 0);

zmk_widget_bongo_cat_init(&bongo_cat_widget, screen);
lv_obj_align(zmk_widget_bongo_cat_obj(&bongo_cat_widget), LV_ALIGN_BOTTOM_RIGHT, 0, -7);

zmk_widget_modifiers_init(&modifiers_widget, screen);
lv_obj_align(zmk_widget_modifiers_obj(&modifiers_widget), LV_ALIGN_BOTTOM_LEFT, 0, 0);

#if IS_ENABLED(CONFIG_ZMK_HID_INDICATORS)
zmk_widget_hid_indicators_init(&hid_indicators_widget, screen);
lv_obj_align_to(zmk_widget_hid_indicators_obj(&hid_indicators_widget), zmk_widget_modifiers_obj(&modifiers_widget), LV_ALIGN_OUT_TOP_LEFT, 0, -2);
#endif

zmk_widget_layer_status_init(&layer_status_widget, screen);
// lv_obj_align(zmk_widget_layer_status_obj(&layer_status_widget), LV_ALIGN_BOTTOM_LEFT, 2, -18);
lv_obj_align_to(zmk_widget_layer_status_obj(&layer_status_widget), zmk_widget_bongo_cat_obj(&bongo_cat_widget), LV_ALIGN_BOTTOM_LEFT, 0, 5);

zmk_widget_dongle_battery_status_init(&dongle_battery_status_widget, screen);
lv_obj_align(zmk_widget_dongle_battery_status_obj(&dongle_battery_status_widget), LV_ALIGN_TOP_RIGHT, 0, 0);

return screen;
}
12 changes: 12 additions & 0 deletions boards/shields/dongle_display_view/custom_status_screen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
*
* Copyright (c) 2024 The ZMK Contributors
* SPDX-License-Identifier: MIT
*
*/

#pragma once

#include <lvgl.h>

lv_obj_t *zmk_display_status_screen();
11 changes: 11 additions & 0 deletions boards/shields/dongle_display_view/dongle_display_view.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
file_format: "1"
id: dongle_display_view
name: dongle_display!view
type: shield
url: https://github.com/mctechnology17/zmk-dongle-display-view
requires: [nice_view_header]
features:
- display
siblings:
- dongle_display_view_pro_micro
- dongle_display_view_seeeduino_xiao_ble
Loading

0 comments on commit 05bf62b

Please sign in to comment.