update
This commit is contained in:
18
app/utils.h
18
app/utils.h
@@ -5,4 +5,22 @@ int hex2bytes(const char *str, uint8_t *bytes, int32_t length);
|
||||
void bytes2hex(const uint8_t *bytes, int32_t length, char *str, int32_t strLength);
|
||||
int Rssi2Quality(sint8 rssi);
|
||||
|
||||
class Debounce
|
||||
{
|
||||
static constexpr uint8_t UPPER = 0b10000000;
|
||||
static constexpr uint8_t LOWER = 0b01111111;
|
||||
public:
|
||||
Debounce();
|
||||
Debounce(bool signal);
|
||||
void init(bool signal);
|
||||
/* Return value:
|
||||
* 0: no change
|
||||
* -1: LOW/False (falling edge)
|
||||
* 1: HIGH/True (rising edge)
|
||||
*/
|
||||
int8_t debounce(bool signal);
|
||||
private:
|
||||
uint8_t state;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user