adafruit / adafruit/Adafruit_LED_Backpack

[Feature request] Would it be possible to add Keyscan to the library? HT16K33 has Keyscan function

Open
#79 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
317
Forks
194
PR merge metrics
No merged PRs in 30d

Description

Hi, the HT16K33 used in the Quad Alphanumeric breakout board has Keyscan function (up to 39 keys)

- The keyscan logic uses one, two or three of the KS0, KS1and KS2 logic outputs. An interrupt output that flags a key press is optional. The INT flag can be read (polled) through the serial interface, allowing INT/ROW15 to be used as a general purpose logic output or as a ROW open-drain driver.
- One small-signal diode is required per key switch when more than one key is connected to KS0, KS1 or KS2. The diodes prevent two simultaneous key switch depressions from shorting the COM drivers together. For example, if SW1 and SW14 were pressed together and the diodes were not fitted, COM1/KS0 and COM2/KS1 would be shorted together and the LED multiplexing would be incorrect.
- The keyscanning circuit utilises the COM1/KS0 to COM3/KS2 outputs high as the keyscan output drivers. The outputs COM0 to COM7 pulse low sequentially as the displays are multiplexed. The actual low time varies from 64μs to 1024μs due to pulse width modulation from 1/16th to 16/16th for dimming control. The LED drive mode waveforms and scanning shows the typical situation when all eight LED cathode drivers are used.
- The maximum of thirty-nine keys can only be scanned if the scan-limit register is set to scan the maximum KS0 to KS2.
- The keyscan cycle loops continuously over time, with all thirty-nine keys experiencing a full keyscanning debounce over 20ms. A key press is debounced and an interrupt issued if at least one key that was not pressed in a previous cycle is found to be pressed during both sampling periods.
- The keyscan circuit detects any combination of keys pressed during each debounce cycle (n-key rollover)
- The INT output is active-low when the “act” bit of ROW/INT setup register is set to “0”
- The INT output is active-high when the “act” bit of ROW/INT setup register is set to “1”.

Source: HT16K33 [datasheet](https://www.holtek.com/webapi/116711/HT16K33Av100.pdf)

It would be very interesting to be able to use this type of membrane keypad 3x4 with the Quad Alphanumeric board:
(Unfortunately with only 3 common scanning lines, it shouldn't be possible to use the 4x4 keypad)
![img](https://cdn-shop.adafruit.com/970x728/419-07.jpg)

Ref.:
Adafruit 0.54" Quad Alphanumeric FeatherWing Display - Green
Product ID: 3129
https://www.adafruit.com/product/3129

Membrane 3x4 Matrix Keypad + extras - 3x4
Product ID: 419
https://www.adafruit.com/product/419

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the library's existing HT16K33 support and the linked HT16K33 datasheet, since the issue names no source files or tests. Determine how a 3x4 membrane keypad would be exposed through the library, including keyscan configuration and interrupt handling. Done should provide usable keyscan support for up to the requested 3x4 keypad and demonstrate that behavior with tests or an example.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.