10#ifndef M5_UNIT_KEYBOARD_UNIT_CARD_KB_HPP
11#define M5_UNIT_KEYBOARD_UNIT_CARD_KB_HPP
14#include <m5_utility/container/circular_buffer.hpp>
36class UnitCardKB :
public UnitKeyboardBitwise {
37 M5_UNIT_COMPONENT_HPP_BUILDER(UnitCardKB, 0x5F);
40 static constexpr uint8_t NUMBER_OF_KEYS{48};
44 static constexpr keyboard::key_index_t KEY_ESC{0};
45 static constexpr keyboard::key_index_t KEY_1{1};
46 static constexpr keyboard::key_index_t KEY_2{2};
47 static constexpr keyboard::key_index_t KEY_3{3};
48 static constexpr keyboard::key_index_t KEY_4{4};
49 static constexpr keyboard::key_index_t KEY_5{5};
50 static constexpr keyboard::key_index_t KEY_6{6};
51 static constexpr keyboard::key_index_t KEY_7{7};
52 static constexpr keyboard::key_index_t KEY_8{8};
53 static constexpr keyboard::key_index_t KEY_9{9};
54 static constexpr keyboard::key_index_t KEY_0{10};
55 static constexpr keyboard::key_index_t KEY_BS{11};
56 static constexpr keyboard::key_index_t KEY_TAB{12};
57 static constexpr keyboard::key_index_t KEY_Q{13};
58 static constexpr keyboard::key_index_t KEY_W{14};
59 static constexpr keyboard::key_index_t KEY_E{15};
60 static constexpr keyboard::key_index_t KEY_R{16};
61 static constexpr keyboard::key_index_t KEY_T{17};
62 static constexpr keyboard::key_index_t KEY_Y{18};
63 static constexpr keyboard::key_index_t KEY_U{19};
64 static constexpr keyboard::key_index_t KEY_I{20};
65 static constexpr keyboard::key_index_t KEY_O{21};
66 static constexpr keyboard::key_index_t KEY_P{22};
67 static constexpr keyboard::key_index_t KEY_NO_KEY{23};
68 static constexpr keyboard::key_index_t KEY_LEFT{24};
69 static constexpr keyboard::key_index_t KEY_UP{25};
70 static constexpr keyboard::key_index_t KEY_A{26};
71 static constexpr keyboard::key_index_t KEY_S{27};
72 static constexpr keyboard::key_index_t KEY_D{28};
73 static constexpr keyboard::key_index_t KEY_F{29};
74 static constexpr keyboard::key_index_t KEY_G{30};
75 static constexpr keyboard::key_index_t KEY_H{31};
76 static constexpr keyboard::key_index_t KEY_J{32};
77 static constexpr keyboard::key_index_t KEY_K{33};
78 static constexpr keyboard::key_index_t KEY_L{34};
79 static constexpr keyboard::key_index_t KEY_ENTER{35};
80 static constexpr keyboard::key_index_t KEY_DOWN{36};
81 static constexpr keyboard::key_index_t KEY_RIGHT{37};
82 static constexpr keyboard::key_index_t KEY_Z{38};
83 static constexpr keyboard::key_index_t KEY_X{39};
84 static constexpr keyboard::key_index_t KEY_C{40};
85 static constexpr keyboard::key_index_t KEY_V{41};
86 static constexpr keyboard::key_index_t KEY_B{42};
87 static constexpr keyboard::key_index_t KEY_N{43};
88 static constexpr keyboard::key_index_t KEY_M{44};
89 static constexpr keyboard::key_index_t KEY_COMMA{45};
90 static constexpr keyboard::key_index_t KEY_PERIOD{46};
91 static constexpr keyboard::key_index_t KEY_SPACE{47};
96 static constexpr char SCHAR_LEFT{
static_cast<char>(180)};
97 static constexpr char SCHAR_UP{
static_cast<char>(181)};
98 static constexpr char SCHAR_DOWN{
static_cast<char>(182)};
99 static constexpr char SCHAR_RIGHT{
static_cast<char>(183)};
124 _repeat_start_at.resize(NUMBER_OF_KEYS);
125 _hold_start_at.resize(NUMBER_OF_KEYS);
128 virtual bool begin()
override;
130 virtual void update(
const bool force =
false)
override;
186 bool update_new_firmware(
const types::elapsed_time_t at);
187 void push_back(m5::container::CircularBuffer<uint8_t>* container,
const uint8_t kidx,
const uint8_t mod8);
189 inline virtual uint8_t to_mode_bits(
const char ch)
const override
202constexpr uint8_t CMD_HARDWARE_TYPE_REG{0xFD};
Card-size 50 key QWERTY keyboard.
void config(const config_t &cfg)
Set the configuration.
Definition unit_CardKB.hpp:140
virtual void update(const bool force=false) override
Definition unit_CardKB.cpp:296
static keyboard::key_index_t character_to_key_index(const char ch)
Character to key index.
Definition unit_CardKB.cpp:227
bool readHardwareType(uint8_t &htype)
Read the hardware type.
Definition unit_CardKB.cpp:376
static uint8_t character_to_mode_bits(const char ch)
Character to mode bits.
Definition unit_CardKB.cpp:243
virtual bool begin() override
Definition unit_CardKB.cpp:263
virtual keyboard::key_index_t toKeyIndex(const char ch) const override
Obtains the key index corresponding to the specified character.
Definition unit_CardKB.hpp:147
uint8_t hardwareType() const
Gets the hardware type.
Definition unit_CardKB.hpp:173
config_t config()
Gets the configuration.
Definition unit_CardKB.hpp:135
Class supporting keyboard state acquisition by key press bits.
Top level namespace of M5stack.
Settings for begin.
Definition unit_CardKB.hpp:106
uint32_t repeating_threshold
Threshold for key repeating (ms)
Definition unit_CardKB.hpp:116
uint32_t interval
Periodic interval.
Definition unit_CardKB.hpp:114
uint32_t holding_threshold
Threshold for key holding (ms)
Definition unit_CardKB.hpp:118
bool start_periodic
Start periodic measurement on begin?
Definition unit_CardKB.hpp:108
keyboard::Mode mode
Definition unit_CardKB.hpp:112
constexpr uint8_t TYPE_CARDKB_V11
V11 SKU:U035-B.
Definition unit_CardKB.hpp:27
constexpr uint8_t TYPE_CARDKB
SKU:U035.
Definition unit_CardKB.hpp:26
uint8_t key_index_t
Key index (Not character)
Definition unit_Keyboard.hpp:24
Mode
Operation mode for M5Unit-KEYBOARD firmware.
Definition unit_Keyboard.hpp:50