Skip to content

Commit

Permalink
ANAVI Knobs 3: Support SSD1306 I2C OLED Display (#1070)
Browse files Browse the repository at this point in the history
* boards/anavi/knobs3/code.py: Add display

Add a new feature to support a mini OLED I2C SSD1306 display.

Signed-off-by: Leon Anavi <leon@anavi.org>

* boards/anavi/knobs3/README.md: Display

Add information about the Display extension for ANAVI Knobs 3.

Signed-off-by: Leon Anavi <leon@anavi.org>

---------

Signed-off-by: Leon Anavi <leon@anavi.org>
  • Loading branch information
leon-anavi authored Jan 10, 2025
1 parent 0b26d06 commit aeebb9e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions boards/anavi/knobs3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 16 additions & 2 deletions boards/anavi/knobs3/code.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 Knobs 3\n\nKMK Firmware'),
],
height=64,
)
knob.extensions.append(display)

knob.matrix = KeysScanner([], value_when_pressed=False)

media_keys = MediaKeys()
Expand All @@ -26,8 +42,6 @@
)
knob.modules.append(encoder_handler)

print('ANAVI Knobs 3')

rgb = RGB(
pixel_pin=board.NEOPIXEL,
num_pixels=1,
Expand Down

0 comments on commit aeebb9e

Please sign in to comment.