This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
en:iot-open:practical:hardware:sut:stm32:emb6_1 [2024/04/20 13:30] – [Steps] ktokarz | en:iot-open:practical:hardware:sut:stm32:emb6_1 [2024/04/20 13:34] (current) – ktokarz | ||
---|---|---|---|
Line 72: | Line 72: | ||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff | ||
- | }; | ||
- | |||
- | // Total bytes used to store images in PROGMEM = 496 | ||
- | const int epd_bitmap_allArray_LEN = 1; | ||
- | const unsigned char* epd_bitmap_allArray[1] = { | ||
- | epd_bitmap_logo_64 | ||
}; | }; | ||
</ | </ | ||
Line 143: | Line 137: | ||
Declare GPIOs and some configurations needed to handle the ePaper display properly: | Declare GPIOs and some configurations needed to handle the ePaper display properly: | ||
<code c> | <code c> | ||
- | #define GxEPD2_DRIVER_CLASS GxEPD2_213_BN | + | // The epaper display' |
+ | #define GxEPD2_DRIVER_CLASS GxEPD2_213_BN | ||
#define GxEPD2_DISPLAY_CLASS GxEPD2_BW | #define GxEPD2_DISPLAY_CLASS GxEPD2_BW | ||
+ | // Definition of GPIOs except SPI pins | ||
#define EPAPER_DC_PIN D4 | #define EPAPER_DC_PIN D4 | ||
#define EPAPER_CS_PIN D1 | #define EPAPER_CS_PIN D1 | ||
Line 151: | Line 147: | ||
#define EPAPER_BUSY_PIN D7 | #define EPAPER_BUSY_PIN D7 | ||
+ | // Definition of the size of the buffer | ||
#define MAX_DISPLAY_BUFFER_SIZE 65536ul | #define MAX_DISPLAY_BUFFER_SIZE 65536ul | ||
#define MAX_HEIGHT(EPD) (EPD:: | #define MAX_HEIGHT(EPD) (EPD:: | ||
Line 163: | Line 160: | ||
You can also declare a message to display as an array of characters: | You can also declare a message to display as an array of characters: | ||
<code c> | <code c> | ||
- | static const char HelloWorld[] = "Hello IoT World!"; | + | static const char HelloWorldMsg[] = "Hello IoT World!"; |
</ | </ | ||
Line 194: | Line 191: | ||
<code c> | <code c> | ||
int16_t tbx, tby; uint16_t tbw, tbh; | int16_t tbx, tby; uint16_t tbw, tbh; | ||
- | display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh); | + | display.getTextBounds(HelloWorldMsg, 0, 0, &tbx, &tby, &tbw, &tbh); |
uint16_t x = ((display.width() - tbw) / 2) - tbx; //center in x arrow | uint16_t x = ((display.width() - tbw) / 2) - tbx; //center in x arrow | ||
Line 206: | Line 203: | ||
display.fillScreen(GxEPD_WHITE); | display.fillScreen(GxEPD_WHITE); | ||
display.setCursor(x, | display.setCursor(x, | ||
- | display.print(pEpaperText); | + | display.print(HelloWorldMsg); |
display.display(true); | display.display(true); | ||
display.drawImage((uint8_t*)epd_bitmap_logo_64, | display.drawImage((uint8_t*)epd_bitmap_logo_64, |