3#ifndef _EMAKEFUN_MATRIX_KEY_BOARD_H_
4#define _EMAKEFUN_MATRIX_KEY_BOARD_H_
351 explicit MatrixKeyboard(TwoWire& wire,
const uint8_t i2c_address);
429 bool Idle(
const Key key)
const;
465 TwoWire& wire_ = Wire;
MatrixKeyboard is a driver class for the Matrix Keyboard module.
char GetCurrentPressedKey() const
Get the currently pressed key.
@ kI2cOtherError
Other I2C errors.
@ kUnknownError
Unknown error.
@ kI2cTimeout
I2C communication timed out.
@ kI2cReceivedNackOnTransmitOfAddress
NACK received on I2C transmit of address.
@ kInvalidParameter
Invalid parameter.
@ kI2cReceivedNackOnTransmitOfData
NACK received on I2C transmit of data.
@ kI2cDataTooLongToFitInTransmitBuffer
I2C data too long to fit in transmit buffer.
bool Idle(const Key key) const
Check whether the key is idle.
static constexpr uint8_t kDefaultI2cAddress
Default I2C address.
MatrixKeyboard(TwoWire &wire, const uint8_t i2c_address)
构造函数
@ kKeyAsterisk
Key asterisk.
@ kKeyNumberSign
Key number sign.
bool Pressing(const Key key) const
Check whether the key is held down.
bool Pressed(const Key key) const
Check whether the button is pressed.
ErrorCode Initialize()
Initialize.
@ kKeyStatePressed
Key is pressed.
@ kKeyStateReleased
Key is released.
@ kKeyStateIdle
Key is idle.
@ kKeyStatePressing
Key is pressing.
KeyState GetKeyState(const Key key) const
Query key state.
bool Released(const Key key) const
Check whether the key has been released.
void Tick()
Scan keys, call this function in the loop function, and then query the key state each time the loop i...