esp32-timed-switch/scheduler.h
2024-04-04 18:58:37 +02:00

96 lines
1.4 KiB
C

#include <sys/_stdint.h>
#define A00 0b000000000000
#define A60 0b111111111111
#define HALF_HOUR 0b000000111111
#define EVERY_2 0b010101010101
#define EVERY_2_INV 0b101010101010
#define HOUR_DEFAULT 16
#define MINUTE_DEFAULT 41
#define EVENT_INC_MINUTE 5
// our scheduler loop every 24 hour.
// one hour is represented by 1 unsigned int
// each bit of the hour represent one BI_MINUTE.
// the output of the scheduler is ON if one bit is set, OFF otherwise.
uint16_t scheduler_1_default[24] = {
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
};
uint16_t scheduler_default_deactivate[24] = {
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
};
uint16_t scheduler_2_default[24] = {
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
};