70 lines
1.3 KiB
C
70 lines
1.3 KiB
C
#ifndef BOTTOM_HALF_HPP
|
|
#define BOTTOM_HALF_HPP
|
|
|
|
#include "driver/i2c.h"
|
|
#include "driver/gpio.h"
|
|
#include "esp_log.h"
|
|
|
|
#define BOTTOM_I2C_NUM I2C_NUM_0
|
|
#define BOTTOM_I2C_ADDR 126
|
|
#define BOTTOM_PIN_INTERUPT GPIO_NUM_0
|
|
|
|
#define DELTA_BIT_KP 0
|
|
#define DELTA_BIT_BUTTON 1
|
|
#define DELTA_BIT_TOUCH 2
|
|
|
|
typedef enum {
|
|
k1 = 0,
|
|
k4 = 1,
|
|
k7 = 2,
|
|
star = 3,
|
|
k2 = 4,
|
|
k5 = 5,
|
|
k8 = 6,
|
|
k0 = 7,
|
|
k3 = 8,
|
|
k6 = 9,
|
|
k9 = 10,
|
|
pound = 11,
|
|
ka = 12,
|
|
kb = 13,
|
|
kc = 14,
|
|
kd = 15,
|
|
} KeypadKey;
|
|
|
|
typedef enum {
|
|
b1 = 0,
|
|
b2 = 1,
|
|
b3 = 2,
|
|
b4 = 3,
|
|
} ButtonKey;
|
|
|
|
typedef enum {
|
|
s1 = 0,
|
|
s2 = 1,
|
|
s3 = 2,
|
|
s4 = 3,
|
|
} SwitchKey;
|
|
|
|
void clear_all_pressed_released(void);
|
|
|
|
bool get_pressed_keypad(KeypadKey* kp);
|
|
bool get_released_keypad(KeypadKey* kp);
|
|
char char_of_keypad_key(KeypadKey kp);
|
|
|
|
bool get_pressed_button(ButtonKey* button);
|
|
bool get_released_button(ButtonKey* button);
|
|
uint8_t get_button_state();
|
|
|
|
bool get_flipped_up_switch(SwitchKey* switch_);
|
|
bool get_flipped_down_switch(SwitchKey* switch_);
|
|
bool get_flipped_switch(SwitchKey* switch_);
|
|
uint8_t get_switch_state(uint8_t* switch_flags);
|
|
|
|
bool get_touch_state(void);
|
|
bool get_touch_pressed(void);
|
|
bool get_touch_released(void);
|
|
|
|
void init_bottom_half();
|
|
|
|
#endif /* BOTTOM_HALF_HPP */ |