Add lightswitch to this firmware
This commit is contained in:
26
include/buttons.h
Normal file
26
include/buttons.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef __BUTTONS_H
|
||||
#define __BUTTONS_H
|
||||
|
||||
#include "mgos.h"
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_BUTTONS 8
|
||||
|
||||
struct button_t {
|
||||
uint8_t gpio;
|
||||
float last_change;
|
||||
};
|
||||
|
||||
int buttons_init(const char *flag);
|
||||
uint8_t buttons_find_by_gpio(uint8_t gpio);
|
||||
bool buttons_touch_by_gpio(uint8_t gpio);
|
||||
float buttons_get_last_change_by_gpio(uint8_t gpio);
|
||||
|
||||
bool buttons_touch_by_idx(uint8_t idx);
|
||||
float buttons_get_last_change_by_idx(uint8_t idx);
|
||||
uint8_t buttons_get_gpio_by_idx(uint8_t idx);
|
||||
|
||||
void buttons_cb(int gpio, void *args);
|
||||
|
||||
#endif // __BUTTONS_H
|
||||
|
Reference in New Issue
Block a user