#pragma once #include #include #include #include #include #include #include #include #include #include #include struct rtctime_t { uint8_t hours; uint8_t minutes; uint8_t seconds; uint8_t day; uint8_t month; uint16_t year; }; #define FRAM_ADDRESS 0x56 #define INPUT_BANK_A_ADDRESS 0x21 #define INPUT_BANK_B_ADDRESS 0x22 #define PWM_BANK_ADDRESS 0x5F #define RTC_ADDRESS 0x68 class ESPMegaPRO { public: ESPMegaPRO(); void begin(); void loop(); void installCard(uint8_t slot, ExpansionCard* card); bool updateTimeFromNTP(); rtctime_t getTime(); void setTime(int hours, int minutes, int seconds, int day, int month, int year); FRAM fram; private: ExpansionCard* cards[255]; bool cardInstalled[255]; uint8_t cardCount = 0; DigitalInputCard inputs = DigitalInputCard(INPUT_BANK_A_ADDRESS, INPUT_BANK_B_ADDRESS); DigitalOutputCard outputs = DigitalOutputCard(PWM_BANK_ADDRESS); };