Add timespec() and channel_override logic -- so we can install a time specification with which the channels are driven, but yet allowing a human override (either by RPC or by Button)

This commit is contained in:
Pim van Pelt
2018-11-04 15:44:17 +01:00
parent d5778c6fba
commit 0ad33f5fbc
3 changed files with 112 additions and 13 deletions

View File

@ -3,6 +3,7 @@
#include "mgos.h"
#include "mgos_gpio.h"
#include "timespec.h"
#define CHANNEL_MAX 16
#define GPIO_INVALID 255
@ -10,13 +11,15 @@
#define GPIO_MAX 16
struct channel_t {
uint8_t button_gpio;
uint8_t led_gpio;
bool led_invert;
uint8_t relay_gpio;
bool relay_invert;
bool relay_state;
double button_last_change;
uint8_t button_gpio;
uint8_t led_gpio;
bool led_invert;
uint8_t relay_gpio;
bool relay_invert;
bool relay_state;
double button_last_change;
bool channel_override;
struct mgos_timespec *timespec;
};
void statusled_blink();
@ -30,5 +33,6 @@ void channel_set_duration(int idx, bool state, uint16_t seconds);
bool channel_get(int idx);
int channel_get_total();
void channel_handler(int gpio, void *arg);
void channel_override_set(int idx);
#endif // __MAIN_H