|
M5Unit-KEYBOARD 0.1.0 git rev:b58d024
|
Tab5 Keyboard Unit for M5UnitUnified. More...
#include "unit_Keyboard.hpp"#include <array>#include <bitset>#include <memory>#include <string>#include "../utility/bitwise_state.hpp"Go to the source code of this file.
Classes | |
| struct | m5::unit::tab5_keyboard::HidMapping |
| HID Usage Code + base modifier byte for a Tab5 Keyboard matrix position. More... | |
| struct | m5::unit::tab5_keyboard::Event |
| Unified event payload for all 3 operation modes (tagged union, POD) More... | |
| class | m5::unit::UnitTab5Keyboard |
| Tab5 built-in keyboard unit connected via I2C ExtPort1. More... | |
| struct | m5::unit::UnitTab5Keyboard::config_t |
| Settings for begin. More... | |
Namespaces | |
| namespace | m5 |
| Top level namespace of M5Stack. | |
| namespace | tab5_keyboard |
| Constants and types for Tab5 Keyboard. | |
Typedefs | |
| using | m5::unit::tab5_keyboard::key_status_bits_t = std::bitset<KEY_COUNT> |
| Bitset type for tracking per-key state (Normal mode) | |
Enumerations | |
| enum class | m5::unit::tab5_keyboard::EventType : uint8_t { None = 0 , Key = 1 , Hid = 2 , Character = 3 } |
| Discriminator for tab5_keyboard::Event tagged union. More... | |
| enum class | m5::unit::tab5_keyboard::Mode : uint8_t { Normal = 0 , HID = 1 , Character = 2 } |
| Keyboard operation mode (REG_MODE_KEYBOARD 0x10) More... | |
| enum class | m5::unit::tab5_keyboard::RgbMode : uint8_t { Bind = 0 , Custom = 1 } |
| RGB LED operation mode (REG_MODE_RGB 0x11) More... | |
Functions | |
| bool | m5::unit::tab5_keyboard::isModifierKey (const uint8_t row, const uint8_t col) |
| True if the given (row, col) corresponds to a modifier key (Sym/Aa/Ctrl/Alt) | |
| uint8_t | m5::unit::tab5_keyboard::toKeyIndex (const uint8_t row, const uint8_t col) |
| Convert (row, col) to flat key index (0..KEY_COUNT-1) | |
| HidMapping | m5::unit::tab5_keyboard::keyMatrixToHidBase (const uint8_t row, const uint8_t col) |
| Base (no Sym held) HID mapping for the given (row, col) | |
| HidMapping | m5::unit::tab5_keyboard::keyMatrixToHidSym (const uint8_t row, const uint8_t col) |
| Sym-held variant of the HID mapping for the given (row, col) | |
Variables | |
| constexpr uint8_t | m5::unit::tab5_keyboard::KEY_EVENT_EMPTY {0xFF} |
| Sentinel value returned when the Normal-mode event queue is empty. | |
| constexpr uint8_t | m5::unit::tab5_keyboard::CHAR_EVENT_MAX_CHARS {9} |
| Maximum character payload length in one CHAR_EVENT (char0..char8) | |
| constexpr uint32_t | m5::unit::tab5_keyboard::I2C_ADDRESS_WRITE_DELAY_MS {50} |
| Milliseconds to wait after writing I2C address to REG_I2C_ADDRESS (datasheet: Flash erase ~20 ms; use 50 ms margin for hardware/firmware variance) | |
| constexpr uint8_t | m5::unit::tab5_keyboard::RGB_LED_COUNT {2} |
| Number of RGB LEDs on the device. | |
| constexpr uint8_t | m5::unit::tab5_keyboard::KEY_COUNT {70} |
| Total number of keys in the Tab5 Keyboard matrix (5 rows x 14 cols) | |
| constexpr uint8_t | m5::unit::tab5_keyboard::KEY_COL_COUNT {14} |
| Number of columns in the Tab5 Keyboard matrix. | |
| constexpr uint32_t | m5::unit::tab5_keyboard::DEFAULT_STORED_SIZE {16} |
| Default internal CircularBuffer<Event> capacity (~256 bytes total) | |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_INT_CFG {REG_INT_CFG} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_INT_STAT {REG_INT_STAT} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_EVENT_NUM {REG_EVENT_NUM} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_BRIGHTNESS {REG_BRIGHTNESS} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_MODE_KEYBOARD {REG_MODE_KEYBOARD} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_MODE_RGB {REG_MODE_RGB} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_KEY_EVENT {REG_KEY_EVENT} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_HID_EVENT {REG_HID_EVENT} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_CHAR_EVENT_LENGTH {REG_CHAR_EVENT_LENGTH} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_CHAR_EVENT {REG_CHAR_EVENT} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_RGB1_B {REG_RGB1_B} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_FIRMWARE_VERSION {REG_FIRMWARE_VERSION} |
| constexpr uint8_t | m5::unit::tab5_keyboard::command::CMD_I2C_ADDRESS {REG_I2C_ADDRESS} |
Modifier key positions in Normal mode (5x14 matrix) | |
| constexpr uint8_t | m5::unit::tab5_keyboard::MODIFIER_KEY_ROW_SYM {3} |
| Hardware-confirmed (row, col) of the four modifier keys. In Normal mode these arrive as ordinary Key events; the library excludes them from software auto-repeat via isModifierKey(). | |
| constexpr uint8_t | m5::unit::tab5_keyboard::MODIFIER_KEY_COL_SYM {0} |
| Sym key column. | |
| constexpr uint8_t | m5::unit::tab5_keyboard::MODIFIER_KEY_ROW_AA {3} |
| Aa key row. | |
| constexpr uint8_t | m5::unit::tab5_keyboard::MODIFIER_KEY_COL_AA {1} |
| Aa key column. | |
| constexpr uint8_t | m5::unit::tab5_keyboard::MODIFIER_KEY_ROW_CTRL {4} |
| Ctrl key row. | |
| constexpr uint8_t | m5::unit::tab5_keyboard::MODIFIER_KEY_COL_CTRL {0} |
| Ctrl key column. | |
| constexpr uint8_t | m5::unit::tab5_keyboard::MODIFIER_KEY_ROW_ALT {4} |
| Alt key row. | |
| constexpr uint8_t | m5::unit::tab5_keyboard::MODIFIER_KEY_COL_ALT {1} |
| Alt key column. | |
Pre-computed key indices for the modifier keys | |
| constexpr uint8_t | m5::unit::tab5_keyboard::KIDX_SYM = MODIFIER_KEY_ROW_SYM * KEY_COL_COUNT + MODIFIER_KEY_COL_SYM |
| 42 (Sym) | |
| constexpr uint8_t | m5::unit::tab5_keyboard::KIDX_AA = MODIFIER_KEY_ROW_AA * KEY_COL_COUNT + MODIFIER_KEY_COL_AA |
| 43 (Aa) | |
| constexpr uint8_t | m5::unit::tab5_keyboard::KIDX_CTRL = MODIFIER_KEY_ROW_CTRL * KEY_COL_COUNT + MODIFIER_KEY_COL_CTRL |
| 56 (Ctrl) | |
| constexpr uint8_t | m5::unit::tab5_keyboard::KIDX_ALT = MODIFIER_KEY_ROW_ALT * KEY_COL_COUNT + MODIFIER_KEY_COL_ALT |
| 57 (Alt) | |
Tab5 Keyboard Unit for M5UnitUnified.
|
strong |
|
strong |
|
strong |
RGB LED operation mode (REG_MODE_RGB 0x11)
| Enumerator | |
|---|---|
| Bind | Bind mode: LED color is driven by firmware. Observed behavior on real hardware:
|
| Custom | Custom mode: LED color is set via REG_RGB1_B/G/R and REG_RGB2_B/G/R. Use writeRgb()/readRgb() to control. writeRgbMode(Custom) must be called first. |
|
inline |
True if the given (row, col) corresponds to a modifier key (Sym/Aa/Ctrl/Alt)
| row | Matrix row (0-4) |
| col | Matrix column (0-13) |
| HidMapping m5::unit::tab5_keyboard::keyMatrixToHidBase | ( | const uint8_t | row, |
| const uint8_t | col ) |
Base (no Sym held) HID mapping for the given (row, col)
| row | Matrix row (0..4) |
| col | Matrix column (0..13) |
{0, 0} for out-of-range coordinates and for the four modifier keys (Sym/Aa/Ctrl/Alt). | HidMapping m5::unit::tab5_keyboard::keyMatrixToHidSym | ( | const uint8_t | row, |
| const uint8_t | col ) |
Sym-held variant of the HID mapping for the given (row, col)
| row | Matrix row (0..4) |
| col | Matrix column (0..13) |
{0, 0}.
|
inline |
Convert (row, col) to flat key index (0..KEY_COUNT-1)
| row | Matrix row (0..4) |
| col | Matrix column (0..13) |
|
constexpr |
Sentinel value returned when the Normal-mode event queue is empty.
|
constexpr |
Hardware-confirmed (row, col) of the four modifier keys. In Normal mode these arrive as ordinary Key events; the library excludes them from software auto-repeat via isModifierKey().
Sym key row