65 lines
1.4 KiB
C++
65 lines
1.4 KiB
C++
/*
|
|
* hmi.h
|
|
*
|
|
* Created on: 02.03.2016
|
|
* Author: dehottgw
|
|
*/
|
|
|
|
#ifndef HMI_H_
|
|
#define HMI_H_
|
|
|
|
|
|
#include <Adafruit_GFX.h>
|
|
// #include <Adafruit_TFTLCD.h>
|
|
#include "Adafruit_ILI9341.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 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 = 13;
|
|
}
|
|
|
|
|
|
struct MessageSlot {
|
|
char header[HmiNS::BUFFERLEN_MESSAGESLOT+1];
|
|
char body[HmiNS::BUFFERLEN_MESSAGESLOT+1];
|
|
uint32_t timestamp;
|
|
};
|
|
|
|
class Hmi {
|
|
public:
|
|
Hmi();
|
|
void begin();
|
|
void exec();
|
|
void updateMessage();
|
|
void updateMessage(uint8_t slot, char* header, char* body);
|
|
void toggleAlarmState(); // only for debug
|
|
private:
|
|
void drawMessages();
|
|
Adafruit_ILI9341 m_tft;
|
|
uint16_t m_displayIdentifier;
|
|
bool m_messageDrawUpdateRequired;
|
|
bool m_alarmMessageAvailable;
|
|
MessageSlot m_messageSlots[HmiNS::NUM_OF_MESSAGESLOTS];
|
|
};
|
|
|
|
|
|
|
|
#endif /* HMI_H_ */
|