Cardputer-Adv keyboard
A keyboard driver for the M5Stack Cardputer-Adv, built on top of the tca8418 driver. Handles press/release events, shift/Fn layer resolution and modifier tracking.
Getting started
use Keyboard;
let mut keyboard = new.unwrap;
Usage
If you are only interested in inputs, use .inputs() to get the resolved inputs of the current key presses in the buffer.
These are what the key press produces, not which physical key was pressed.
This means pressing Aa + G maps to an uppercase G whereas pressing just G maps to a lowercase g.
Pressing Fn + ; maps to an up arrow, etc.
In short: What you see on the keyboard is what you get.
Here is a simple example on how to capture user input:
use KeyInput;
for input in keyboard.inputs.unwrap
Advanced usage
If you are interested in the raw key press and release events, you can use .events() which returns full KeyboardEvents
with physical key identity, press/release state, and a current modifiers:
This allows you to track when a key is released or define custom Modifier + Key combinations
use PhysicalKey;
for event in keyboard.events.unwrap
See the docs for more details.