Files
Arduino/ESP32_DOMOTICZ_ECRAN/Ecran.cpp
Jérôme Delacotte 7b30d6e298 first commit
2025-03-06 11:15:32 +01:00

136 lines
3.1 KiB
C++

#include "Ecran.h"
Ecran::Ecran()
{
// printf("--------------------------------------");
// printf("Init Ecran");
// ECRAN
// LcdInitialise();
// LcdClear();
// LcdChar(0, 0, "Starting");
//
// FIN ECRAN
}
// ECRAN Methodes
void Ecran::LcdCharacter(char character)
{
}
void Ecran::clear(void)
{
Paint_Clear(WHITE);
}
//void Ecran::fullBlack(void)
//{
// //Create a new image cache
// UBYTE *BlackImage;
// /* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
// UWORD Imagesize = ((EPD_7IN5_V2_WIDTH % 8 == 0) ? (EPD_7IN5_V2_WIDTH / 8 ) : (EPD_7IN5_V2_WIDTH / 8 + 1)) * EPD_7IN5_V2_HEIGHT;
// if ((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
// printf("Failed to apply for black memory...\r\n");
// while (1);
// }
// printf("Paint_NewImage\r\n");
// Paint_NewImage(BlackImage, EPD_7IN5_V2_WIDTH, EPD_7IN5_V2_HEIGHT, 0, WHITE);
//
//}
void Ecran::initialise(void)
{
// printf("EPD_7IN5_V2_test Demo\r\n");
DEV_Module_Init();
// printf("e-Paper Init and Clear...\r\n");
EPD_7IN5_V2_Init();
EPD_7IN5_V2_Clear();
DEV_Delay_ms(500);
//Create a new image cache
// UBYTE *BlackImage;
/* you have to edit the startup_stm32fxxx.s file and set a big enough heap size */
UWORD Imagesize = ((EPD_7IN5_V2_WIDTH % 8 == 0) ? (EPD_7IN5_V2_WIDTH / 8 ) : (EPD_7IN5_V2_WIDTH / 8 + 1)) * EPD_7IN5_V2_HEIGHT;
if ((BlackImage = (UBYTE *)malloc(Imagesize)) == NULL) {
printf("Failed to apply for black memory...\r\n");
while (1);
}
printf("Paint_NewImage\r\n");
Paint_NewImage(BlackImage, EPD_7IN5_V2_WIDTH, EPD_7IN5_V2_HEIGHT, 0, WHITE);
}
void Ecran::LcdChar(int x, int y, char *characters)
{
Paint_DrawString_EN(x, y, "characters", &Font16, BLACK, WHITE);
}
void Ecran::LcdString(int x, int y, String s, int foreground, int color)
{
Paint_DrawString_EN(x, y, s.c_str(), &Font16, foreground, color);
}
void Ecran::LcdWrite(byte dc, byte data)
{
}
void Ecran::setContrast(byte contrast)
{
}
//This takes a large array of bits and sends them to the LCD
void Ecran::LcdBitmap(int x, int y, char my_array[])
{
}
void Ecran::intro()
{
Paint_DrawString_EN(380, 200, "hello world", &Font24, WHITE, BLACK);
Paint_NewImage(BlackImage, EPD_7IN5_V2_WIDTH, EPD_7IN5_V2_HEIGHT, 0, WHITE);
delay(1000);
}
void Ecran::sleep()
{
// printf("Goto Sleep...\r\n");
EPD_7IN5_V2_Sleep();
}
void Ecran::drawLine(int x0, int y0, int x1, int y1, int color, DOT_PIXEL dot, LINE_STYLE style)
{
Paint_DrawLine(x0, y0, x1, y1, color, dot, style);
}
void Ecran::drawCircle(int x0, int y0, int r, int color, DOT_PIXEL dot, DRAW_FILL ifill)
{
Paint_DrawCircle(x0, y0, r, color, dot, ifill);
}
void Ecran::drawRect(int x0, int y0, int x1, int y1, int color, DOT_PIXEL dot, DRAW_FILL ifill)
{
Paint_DrawRectangle(x0, y0, x1, y1, color, dot, ifill);
}
void Ecran::drawJauge(int x0, int y0, int x1, int y1, int val, String text)
{
// drawRect(x0, y0, x1, y1);
// if (val > 100) {
// val = x1;
// }
// u8g2->drawBox(x0, y0, ((x1 - x0) * val) / 100, y1 - y0);
// if (text != "") {
// LcdString(x0, y0, text);
// }
}
void Ecran::drawFace(int x0, int y0, int x1, int y1, int x2, int y2)
{
}