MqttMonitor/hmi.h

65 lines
1.4 KiB
C
Raw Normal View History

2016-03-02 17:30:46 +01:00
/*
* hmi.h
*
* Created on: 02.03.2016
* Author: dehottgw
*/
#ifndef HMI_H_
#define HMI_H_
#include <Adafruit_GFX.h>
2016-03-03 23:19:56 +01:00
// #include <Adafruit_TFTLCD.h>
#include "Adafruit_ILI9341.h"
2016-03-02 17:30:46 +01:00
namespace HmiNS {
2016-03-03 23:19:56 +01:00
// 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;
2016-03-02 17:30:46 +01:00
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;
2016-03-04 14:30:30 +01:00
const static uint8_t BUFFERLEN_MESSAGESLOT = 9;
const static uint8_t NUM_OF_MESSAGESLOTS = 13;
2016-03-02 17:30:46 +01:00
}
struct MessageSlot {
2016-03-04 14:30:30 +01:00
char header[HmiNS::BUFFERLEN_MESSAGESLOT+1];
char body[HmiNS::BUFFERLEN_MESSAGESLOT+1];
2016-03-02 17:30:46 +01:00
uint32_t timestamp;
};
class Hmi {
public:
Hmi();
void begin();
void exec();
2016-03-03 23:19:56 +01:00
void updateMessage();
2016-03-04 14:30:30 +01:00
void updateMessage(uint8_t slot, char* header, char* body);
2016-03-03 23:19:56 +01:00
void toggleAlarmState(); // only for debug
2016-03-02 17:30:46 +01:00
private:
2016-03-03 23:19:56 +01:00
void drawMessages();
Adafruit_ILI9341 m_tft;
2016-03-02 17:30:46 +01:00
uint16_t m_displayIdentifier;
2016-03-03 23:19:56 +01:00
bool m_messageDrawUpdateRequired;
bool m_alarmMessageAvailable;
2016-03-02 17:30:46 +01:00
MessageSlot m_messageSlots[HmiNS::NUM_OF_MESSAGESLOTS];
};
#endif /* HMI_H_ */