From 15e88effa4876898456b237bb20de21cf8bf497a Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Sun, 5 Jan 2025 01:42:51 +0200 Subject: [PATCH] ANAVI Knob 1: Add Support for OLED I2C SSD1306 Display (#1064) * boards/anavi/knob1/README.md: Display Add information about the Display extension for ANAVI Knob 1. Signed-off-by: Leon Anavi * boards/anavi/knob1/code.py: Add display Add a new feature to support a mini OLED I2C SSD1306 display. Signed-off-by: Leon Anavi --------- Signed-off-by: Leon Anavi --- boards/anavi/knob1/README.md | 1 + boards/anavi/knob1/code.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/boards/anavi/knob1/README.md b/boards/anavi/knob1/README.md index 7ca64cbf9..4445c4085 100644 --- a/boards/anavi/knob1/README.md +++ b/boards/anavi/knob1/README.md @@ -8,3 +8,4 @@ Extensions enabled by default: - [Encoder](/docs/en/encoder.md) Twist control for all the things - [RGB](/docs/en/rgb.md) Light it up (for underlighting) - [MediaKeys](/docs/en/media_keys.md) Control volume and other media functions +- [Display](/docs/en/Display.md) Show information on the mini OLED display diff --git a/boards/anavi/knob1/code.py b/boards/anavi/knob1/code.py index 35d02a10c..9ba39b951 100644 --- a/boards/anavi/knob1/code.py +++ b/boards/anavi/knob1/code.py @@ -1,5 +1,7 @@ import board +from kmk.extensions.display import Display, TextEntry +from kmk.extensions.display.ssd1306 import SSD1306 from kmk.extensions.media_keys import MediaKeys from kmk.extensions.RGB import RGB, AnimationModes from kmk.keys import KC @@ -8,6 +10,20 @@ from kmk.scanners.keypad import KeysScanner knob = KMKKeyboard() + +# I2C pins for the mini OLED display +knob.SCL = board.D5 +knob.SDA = board.D4 + +display = Display( + display=SSD1306(sda=board.D4, scl=board.D5), + entries=[ + TextEntry(text='ANAVI Knob 1\n\nKMK Firmware'), + ], + height=64, +) +knob.extensions.append(display) + knob.matrix = KeysScanner([], value_when_pressed=False) media_keys = MediaKeys()