light off mechanics

This commit is contained in:
hg
2016-07-11 21:51:33 +02:00
parent cb9483e6ff
commit 99e4edf762
8 changed files with 396 additions and 11 deletions

26
hmi.h
View File

@ -12,15 +12,19 @@
#include <Adafruit_GFX.h>
// #include <Adafruit_TFTLCD.h>
#include "Adafruit_ILI9341.h"
#include <Adafruit_FT6206.h>
namespace HmiNS {
// const static uint8_t LCD_CS = A3;
// const static uint8_t LCD_CD = A2;
// const static uint8_t LCD_WR = A1;
// const static uint8_t LCD_RD = A0;
// const static uint8_t LCD_RESET = A4;
const static int8_t TFT_CS = 6;
const static int8_t TFT_DC = 9;
const static int8_t TFT_MOSI = 11;
const static int8_t TFT_SCLK = 13;
const static int8_t TFT_RST = -1;
const static int8_t TFT_MISO = 12;
const static int8_t TFT_BACKLIGHT = 5;
const static uint16_t BLACK = 0x0000;
const static uint16_t BLUE = 0x001F;
@ -33,6 +37,10 @@ namespace HmiNS {
const static uint8_t BUFFERLEN_MESSAGESLOT = 9;
const static uint8_t NUM_OF_MESSAGESLOTS = 10;
const static uint32_t LIGHT_OFF = 79200;
const static uint32_t LIGHT_ON = 25200;
}
@ -52,11 +60,19 @@ public:
void updateMessage(uint8_t slot, char* header, char* body);
void toggleAlarmState(); // only for debug
void clear();
void setSeconds(uint32_t seconds);
private:
void drawMessages();
Adafruit_ILI9341 m_tft;
Adafruit_FT6206 m_ctp;
int8_t m_backLightPin;
bool m_backLightEnable;
uint16_t m_displayIdentifier;
bool m_alarmMessageAvailable;
uint32_t m_seconds;
uint32_t m_lightOn;
uint32_t m_lightOff;
MessageSlot m_messageSlots[HmiNS::NUM_OF_MESSAGESLOTS];
};