#include #include #include #include #include #include "StackPanel.hpp" #include "TextBlock.hpp" PAINT_TIME show_time = {2020, 04, 27, 22, 42, 5}; UBYTE *BlackImage; sFONT * font = &Font8; void setup() { // put your setup code here, to run once: DEV_Module_Init(); EPD_7IN5_V2_Init(); /* 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 / 2)) == NULL) { printf("Failed to apply for black memory...\r\n"); while (1); } Paint_NewImage(BlackImage, EPD_7IN5_V2_WIDTH , EPD_7IN5_V2_HEIGHT / 2, 90, WHITE); Paint_SelectImage(BlackImage); Paint_Clear(WHITE); } void loop() { // put your main code here, to run repeatedly: DEV_Delay_ms(2000); show_time.Sec = show_time.Sec + 1; Paint_DrawTime(100, 10, &show_time, &Font24, WHITE, BLACK); DrawItemCallBack itmes[] = { [](const PositionalProperties & p) -> PositionalProperties { return TextBlock("Hallo Miri :)", {WHITE, BLACK, *font}).draw(p); }, [](const PositionalProperties & p) -> PositionalProperties { return TextBlock("Hallo Welt", {WHITE, BLACK, *font}).draw(p); } }; DrawItemCallBackList list = {2, itmes}; StackPanelStyleProperties style = {WHITE, 1, BLACK, 2, 4}; PositionalProperties p = {50, 200 ,200, 50}; auto panel = StackPanel(style, list, StackPanel::move_right); panel.draw(p); p.top += 150; panel.draw(p); EPD_7IN5_V2_SendHalfImage(0, BlackImage); font = &Font24; style.border_line_width = 2; style.margin = 4; style.padding = 8; p.left = 0; p.top = 400; StackPanel(style, list, StackPanel::move_down).draw(p); EPD_7IN5_V2_SendHalfImage(1, BlackImage); EPD_7IN5_V2_TurnOnDisplay(); EPD_7IN5_V2_Sleep(); }