GY-63_MS5611/libraries/I2CKeyPad8x8/I2CKeyPad8x8.h

54 lines
996 B
C
Raw Normal View History

2022-09-29 10:59:37 -04:00
#pragma once
//
// FILE: I2CKeyPad8x8.h
// AUTHOR: Rob Tillaart
2023-11-11 11:09:31 -05:00
// VERSION: 0.2.0
2022-09-29 10:59:37 -04:00
// PURPOSE: Arduino library for 8x8 or smaller KeyPad connected to an I2C PCF8575.
// URL: https://github.com/RobTillaart/I2CKeyPad
#include "Arduino.h"
#include "Wire.h"
2023-11-11 11:09:31 -05:00
#define I2C_KEYPAD8x8_LIB_VERSION (F("0.2.0"))
2022-09-29 10:59:37 -04:00
2022-11-13 03:44:30 -05:00
#define I2C_KEYPAD8x8_NOKEY 64
#define I2C_KEYPAD8x8_FAIL 65
2022-09-29 10:59:37 -04:00
class I2CKeyPad8x8
{
public:
I2CKeyPad8x8(const uint8_t deviceAddress, TwoWire *wire = &Wire);
bool begin();
2023-11-11 11:09:31 -05:00
bool isConnected();
2022-09-29 10:59:37 -04:00
// get raw key's 0..65
uint8_t getKey();
uint8_t getLastKey();
bool isPressed();
2023-11-11 11:09:31 -05:00
2022-09-29 10:59:37 -04:00
// get 'translated' keys
// user must load KeyMap, there is no check.
uint8_t getChar();
uint8_t getLastChar();
void loadKeyMap(char * keyMap); // char[65]
protected:
uint8_t _address;
uint8_t _lastKey;
uint16_t _read(uint16_t mask);
TwoWire* _wire;
char * _keyMap = NULL;
};
2023-11-11 11:09:31 -05:00
// -- END OF FILE --
2022-09-29 10:59:37 -04:00