/* * hmi.h * * Created on: 02.03.2016 * Author: dehottgw */ #ifndef HMI_H_ #define HMI_H_ #include // #include #include "Adafruit_ILI9341.h" #include namespace HmiNS { 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; const static uint16_t RED = 0xF800; const static uint16_t GREEN = 0x07E0; const static uint16_t CYAN = 0x07FF; const static uint16_t MAGENTA = 0xF81F; const static uint16_t YELLOW = 0xFFE0; const static uint16_t WHITE = 0xFFFF; 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; } struct MessageSlot { char header[HmiNS::BUFFERLEN_MESSAGESLOT+1]; char body[HmiNS::BUFFERLEN_MESSAGESLOT+1]; bool updateRequired; uint32_t timestamp; }; class Hmi { public: Hmi(); void begin(); void exec(); Print *tft() { return &m_tft; }; 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]; }; #endif /* HMI_H_ */