|
Emakefun Matrix Keyboard Arduino 库 1.0.1
|
MatrixKeyboard是用于矩阵键盘模块的驱动类。 更多...
#include <matrix_keyboard.h>
Public 类型 | |
| enum class | ErrorCode : uint32_t { kOK = 0 , kI2cDataTooLongToFitInTransmitBuffer = 1 , kI2cReceivedNackOnTransmitOfAddress = 2 , kI2cReceivedNackOnTransmitOfData = 3 , kI2cOtherError = 4 , kI2cTimeout = 5 , kInvalidParameter = 6 , kUnknownError = 7 } |
| 错误码。 更多... | |
| enum | Key : uint16_t { kKeyNone = static_cast<Key>(0) , kKey0 = static_cast<Key>(1) << 7 , kKey1 = static_cast<Key>(1) << 0 , kKey2 = static_cast<Key>(1) << 4 , kKey3 = static_cast<Key>(1) << 8 , kKey4 = static_cast<Key>(1) << 1 , kKey5 = static_cast<Key>(1) << 5 , kKey6 = static_cast<Key>(1) << 9 , kKey7 = static_cast<Key>(1) << 2 , kKey8 = static_cast<Key>(1) << 6 , kKey9 = static_cast<Key>(1) << 10 , kKeyA = static_cast<Key>(1) << 12 , kKeyB = static_cast<Key>(1) << 13 , kKeyC = static_cast<Key>(1) << 14 , kKeyD = static_cast<Key>(1) << 15 , kKeyAsterisk = static_cast<Key>(1) << 3 , kKeyNumberSign = static_cast<Key>(1) << 11 } |
| 键值。 更多... | |
| enum class | KeyState : uint8_t { kKeyStateIdle , kKeyStatePressed , kKeyStatePressing , kKeyStateReleased } |
| 按键状态。 更多... | |
Public 成员函数 | |
| MatrixKeyboard (TwoWire &wire, const uint8_t i2c_address) | |
| 构造函数 | |
| ErrorCode | Initialize () |
| 初始化。 | |
| void | Tick () |
| 扫描按键,在函数loop中调用,每次循环先调用该函数再查询按键状态。 | |
| bool | Pressed (const Key key) const |
| 查询按键是否被按下。 | |
| bool | Pressing (const Key key) const |
| 查询按键是否被按住。 | |
| bool | Released (const Key key) const |
| 查询按键是否被释放。 | |
| bool | Idle (const Key key) const |
| 查询按键是否空闲。 | |
| KeyState | GetKeyState (const Key key) const |
| 查询按键状态。 | |
| char | GetCurrentPressedKey () const |
| 获取当前按下的按键。 | |
静态 Public 属性 | |
| static constexpr uint8_t | kDefaultI2cAddress = 0x65 |
| 默认I2C地址。 | |
MatrixKeyboard是用于矩阵键盘模块的驱动类。
在文件 matrix_keyboard.h 第 27 行定义.
|
strong |
错误码。
在文件 matrix_keyboard.h 第 49 行定义.
| enum emakefun::MatrixKeyboard::Key : uint16_t |
键值。
在文件 matrix_keyboard.h 第 134 行定义.
|
strong |
按键状态。
| 枚举值 | |
|---|---|
| kKeyStateIdle | 按键空闲。 |
| kKeyStatePressed | 按键被按下。 |
| kKeyStatePressing | 按键被按住。 |
| kKeyStateReleased | 按键被弹起。 |
在文件 matrix_keyboard.h 第 300 行定义.
|
explicit |
| char emakefun::MatrixKeyboard::GetCurrentPressedKey | ( | ) | const |
获取当前按下的按键。
在文件 matrix_keyboard.cpp 第 53 行定义.
| MatrixKeyboard::KeyState emakefun::MatrixKeyboard::GetKeyState | ( | const Key | key | ) | const |
| bool emakefun::MatrixKeyboard::Idle | ( | const Key | key | ) | const |
| MatrixKeyboard::ErrorCode emakefun::MatrixKeyboard::Initialize | ( | ) |
| bool emakefun::MatrixKeyboard::Pressed | ( | const Key | key | ) | const |
| bool emakefun::MatrixKeyboard::Pressing | ( | const Key | key | ) | const |
| bool emakefun::MatrixKeyboard::Released | ( | const Key | key | ) | const |
| void emakefun::MatrixKeyboard::Tick | ( | ) |
扫描按键,在函数loop中调用,每次循环先调用该函数再查询按键状态。
在文件 matrix_keyboard.cpp 第 20 行定义.
|
staticconstexpr |
默认I2C地址。
在文件 matrix_keyboard.h 第 37 行定义.