add EEPROM stuff, save last relay state in EEPROM

This commit is contained in:
hg
2015-05-31 14:57:32 +02:00
parent bf179114cc
commit 0fc11af5e0
9 changed files with 236 additions and 20 deletions

View File

@ -9,12 +9,12 @@
#define HARDWARE_H_
const uint8_t NUM_OF_LINES = 4;
const uint8_t NUM_OF_LINES = 8;
const uint8_t FEEDBACK_PIN[NUM_OF_LINES] = { 22, 23, 24, 25 };
const uint8_t BUTTON_PIN[NUM_OF_LINES] = { 30, 31, 32, 33 };
const uint8_t RELAY_PIN[NUM_OF_LINES] = { 38, 39, 40, 41 };
const uint8_t LED_PIN[NUM_OF_LINES] = { 46, 47, 48, 49 };
const uint8_t FEEDBACK_PIN[NUM_OF_LINES] = { 22, 23, 24, 25, 26, 27, 28, 29 };
const uint8_t BUTTON_PIN[NUM_OF_LINES] = { 30, 31, 32, 33, 34, 35, 36, 37 };
const uint8_t RELAY_PIN[NUM_OF_LINES] = { 38, 39, 40, 42, 41, 44, 43, 45 };
const uint8_t LED_PIN[NUM_OF_LINES] = { 46, 47, 48, 49, 50, 51, 52, 53 };
const uint32_t BUTTON_TIME = 1000;
const uint32_t BUTTON_COOL_TIME = 5000;
@ -23,7 +23,7 @@ const uint32_t BLINK_TIME = 100;
class Switch {
public:
Switch();
void begin(const uint8_t feedbackPin, const uint8_t buttonPin, const uint8_t relayPin, const uint8_t ledPin);
void begin(const uint8_t feedbackPin, const uint8_t buttonPin, const uint8_t relayPin, const uint8_t ledPin, uint8_t index);
void exec();
void toggle();
void on();
@ -49,6 +49,8 @@ private:
bool m_ledState;
uint32_t m_ledTimestamp;
uint8_t m_index;