Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mctechnology17 committed Aug 24, 2024
1 parent 9ba47e4 commit 19c86fa
Show file tree
Hide file tree
Showing 26 changed files with 465 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
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Oled Adapter
This module is an adapter for 128x32, 128x64 and 128x128 OLED screens, to be
used on keyboards with ZMK without having to modify the shields of the
keyboards.

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

Shields supported:
- oled_adapter_pro_micro_128x32
- oled_adapter_pro_micro_128x64
- oled_adapter_pro_micro_128x128
- oled_adapter_seeeduino_xiao_ble_128x32
- oled_adapter_seeeduino_xiao_ble_128x64
- oled_adapter_seeeduino_xiao_ble_128x128

[![oled_adapter_example1](src/oled_adapter_example1.jpg)](https://github.com/mctechnology17/zmk-config)
[![oled_adapter_example2](src/oled_adapter_example2.jpg)](https://github.com/mctechnology17/zmk-config)

# Usage
The following commands demonstrate how to overwrite the default 128x32 screen
with different screen sizes for various setups as an example:

- **Overwrite the left screen from 128x32 to 128x128:**
```bash
west build -b nice_nano_v2 -- -DSHIELD="corne_left oled_adapter_pro_micro_128x128"
```

- **Overwrite the right screen from 128x32 to 128x64:**
```bash
west build -b puchi_ble_v1 -- -DSHIELD="corne_right oled_adapter_pro_micro_128x64"
```

- **Using the Xiao as a dongle with the Corne, replacing the screen with 128x128:**
```bash
# This example is from a dongle previously configured using a corne
west build -b seeeduino_xiao_ble -- -DSHIELD="corne_dongle_xiao dongle_display oled_adapter_seeeduino_xiao_ble_128x128"
```

# Configuration
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-config
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_left oled_adapter_pro_micro_128x128
- board: puchi_ble_v1
shield: corne_right oled_adapter_pro_micro_128x64
```
Empty file added boards/shields/.gitkeep
Empty file.
16 changes: 16 additions & 0 deletions boards/shields/oled_adapter/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT

if SHIELD_OLED_ADAPTER_PRO_MICRO_128X32 || SHIELD_OLED_ADAPTER_PRO_MICRO_128X64 || SHIELD_OLED_ADAPTER_PRO_MICRO_128X128 || SHIELD_OLED_ADAPTER_SEEEDUINO_XIAO_BLE_128X32 || SHIELD_OLED_ADAPTER_SEEEDUINO_XIAO_BLE_128X64 || SHIELD_OLED_ADAPTER_SEEEDUINO_XIAO_BLE_128X128

if ZMK_DISPLAY

config I2C
default y

config SSD1306
default y

endif # ZMK_DISPLAY

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

config SHIELD_OLED_ADAPTER_PRO_MICRO_128X32
def_bool $(shields_list_contains,oled_adapter_pro_micro_128x32)

config SHIELD_OLED_ADAPTER_PRO_MICRO_128X64
def_bool $(shields_list_contains,oled_adapter_pro_micro_128x64)

config SHIELD_OLED_ADAPTER_PRO_MICRO_128X128
def_bool $(shields_list_contains,oled_adapter_pro_micro_128x128)

config SHIELD_OLED_ADAPTER_SEEEDUINO_XIAO_BLE_128X32
def_bool $(shields_list_contains,oled_adapter_seeeduino_xiao_ble_128x32)

config SHIELD_OLED_ADAPTER_SEEEDUINO_XIAO_BLE_128X64
def_bool $(shields_list_contains,oled_adapter_seeeduino_xiao_ble_128x64)

config SHIELD_OLED_ADAPTER_SEEEDUINO_XIAO_BLE_128X128
def_bool $(shields_list_contains,oled_adapter_seeeduino_xiao_ble_128x128)
24 changes: 24 additions & 0 deletions boards/shields/oled_adapter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Oled Adapter

This module is an adapter for 128x32, 128x64 and 128x128 OLED screens, to be
used on keyboards with ZMK without having to modify the shields of the
keyboards.

The following commands demonstrate how to overwrite the default 128x32 screen
with different screen sizes for various setups as an example:

- **Overwrite the left screen from 128x32 to 128x128:**
```bash
west build -b nice_nano_v2 -- -DSHIELD="corne_left oled_adapter_pro_micro_128x128"
```

- **Overwrite the right screen from 128x32 to 128x64:**
```bash
west build -b puchi_ble_v1 -- -DSHIELD="corne_right oled_adapter_pro_micro_128x64"
```

- **Using the Xiao as a dongle with the Corne, replacing the screen with 128x128:**
```bash
# This example is from a dongle previously configured using a corne
west build -b seeeduino_xiao_ble -- -DSHIELD="corne_dongle_xiao dongle_display oled_adapter_seeeduino_xiao_ble_128x128"
```
15 changes: 15 additions & 0 deletions boards/shields/oled_adapter/oled_adapter.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
file_format: "1"
id: oled_adapter
name: oled adapter
type: shield
url: https://github.com/mctechnology17/oled_adapter
exposes: [i2c_oled]
features:
- display
siblings:
- oled_adapter_pro_micro_128x32
- oled_adapter_pro_micro_128x64
- oled_adapter_pro_micro_128x128
- oled_adapter_seeeduino_xiao_ble_128x32
- oled_adapter_seeeduino_xiao_ble_128x64
- oled_adapter_seeeduino_xiao_ble_128x128
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ZMK_DISPLAY=y
32 changes: 32 additions & 0 deletions boards/shields/oled_adapter/oled_adapter_pro_micro_128x128.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

/delete-node/ &oled;

&pro_micro_i2c {
status = "okay";
oled_128x128: sh1106@3c {
compatible = "sinowealth,sh1106";
reg = <0x3c>;
width = <120>;
height = <128>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <119>;
segment-remap;
com-invdir;
inversion-on;
prechargep = <0x22>;
};
};

/ {
chosen {
zephyr,display = &oled_128x128;
};
};
// vim: filetype=dts fdm=marker:
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ZMK_DISPLAY=y
34 changes: 34 additions & 0 deletions boards/shields/oled_adapter/oled_adapter_pro_micro_128x32.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

/delete-node/ &oled;

&pro_micro_i2c {
status = "okay";

oled_128x32: ssd1306@3c {
compatible = "solomon,ssd1306fb";
reg = <0x3c>;
width = <128>;
height = <32>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <31>;
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

/ {
chosen {
zephyr,display = &oled_128x32;
};
};
// vim: filetype=dts fdm=marker:
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ZMK_DISPLAY=y
32 changes: 32 additions & 0 deletions boards/shields/oled_adapter/oled_adapter_pro_micro_128x64.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/delete-node/ &oled;

&pro_micro_i2c {
status = "okay";

oled_128x64: ssd1306@3c {
compatible = "solomon,ssd1306fb";
reg = <0x3c>;
width = <128>;
height = <64>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <63>;
segment-remap;
com-invdir;
inversion-on;
prechargep = <0x22>;
};
};

/ {
chosen {
zephyr,display = &oled_128x64;
};
};
// vim: filetype=dts fdm=marker:
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ZMK_DISPLAY=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/delete-node/ &oled;

&xiao_i2c {
status = "okay";
oled_128x128: sh1106@3c {
compatible = "sinowealth,sh1106";
reg = <0x3c>;
width = <120>;
height = <128>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <119>;
segment-remap;
com-invdir;
inversion-on;
prechargep = <0x22>;
};
};

/ {
chosen {
zephyr,display = &oled_128x128;
};
};
// vim: filetype=dts fdm=marker:
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ZMK_DISPLAY=y
Loading

0 comments on commit 19c86fa

Please sign in to comment.