This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:iot-open:practical:hardware:sut:stm32:emb6_1 [2024/04/20 11:43] – created ktokarz | en:iot-open:practical:hardware:sut:stm32:emb6_1 [2024/04/20 13:34] (current) – ktokarz | ||
---|---|---|---|
Line 27: | Line 27: | ||
Check if you can see a full ePaper Display in your video stream. Book a device and create a dummy Arduino file with '' | Check if you can see a full ePaper Display in your video stream. Book a device and create a dummy Arduino file with '' | ||
- | Prepare a small bitmap (e.g. 60x60 pixels) and convert it to the byte array with b/w settings.\\ | + | Prepare a small bitmap (e.g. 64x64 pixels) and convert it to the byte array with b/w settings.\\ |
Sample project favicon you can use is present in Figure {{ref> | Sample project favicon you can use is present in Figure {{ref> | ||
<figure iotopenfavicon> | <figure iotopenfavicon> | ||
- | {{ : | + | {{ : |
- | < | + | < |
</ | </ | ||
Line 38: | Line 38: | ||
The corresponding generated C array for the logo in Figure {{ref> | The corresponding generated C array for the logo in Figure {{ref> | ||
<code c> | <code c> | ||
- | // 'logo 60', | + | // 'logo64', |
- | const unsigned char epd_bitmap_logo_60 | + | const unsigned char epd_bitmap_logo_64 |
- | 0xff, 0xff, 0xff, 0x80, 0x1f, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xf8, 0x00, 0x01, 0xff, 0xff, 0xf0, | + | 0xff, 0xff, 0xff, 0xf0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x1f, 0xff, 0xff, |
- | 0xff, 0xff, 0xc0, 0x00, 0x00, 0x3f, 0xff, 0xf0, 0xff, 0xff, 0x01, 0xff, 0xf8, 0x0f, 0xff, 0xf0, | + | 0xff, 0xff, 0xfc, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0x80, 0xff, 0xff, |
- | 0xff, 0xfc, 0x0f, 0xff, 0xff, 0x03, 0xff, 0xf0, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xc1, 0xff, 0xf0, | + | 0xff, 0xff, 0xc0, 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0x83, 0xff, 0xff, 0xfc, 0x1f, 0xff, |
- | 0xff, 0xe0, 0xff, 0xff, 0xff, 0xf0, 0x7f, 0xf0, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xf0, | + | 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xc3, 0xff, |
- | 0xff, 0x87, 0xff, 0xf0, 0xff, 0xfe, 0x1f, 0xf0, 0xff, 0x0f, 0xfe, 0x00, 0x07, 0xff, 0x0f, 0xf0, | + | 0xff, 0xf8, 0x7f, 0xff, 0xef, 0xff, 0xe1, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xe8, 0xff, 0xf0, 0xff, |
- | 0xfe, 0x1f, 0xf8, 0x7f, 0xe1, 0xff, 0x87, 0xf0, 0xfc, 0x3f, 0xe3, 0xff, 0xfc, 0x7f, 0xc3, 0xf0, | + | 0xff, 0xe1, 0xff, 0xff, 0xfe, 0x5f, 0xf8, 0x7f, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xf7, 0xfc, 0x3f, |
- | 0xfc, 0x7f, 0x8f, 0xff, 0xff, 0x1f, 0xe3, 0xf0, 0xf8, 0xff, 0x3f, 0xff, 0xff, 0xcf, 0xf1, 0xf0, | + | 0xff, 0xc7, 0xff, 0xff, 0xff, 0xf3, 0xfe, 0x3f, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x1f, |
- | 0xf1, 0xfe, 0x7f, 0xff, 0xff, 0xe7, 0xf8, 0xf0, 0xf1, 0xfc, 0xff, 0xff, 0xff, 0xf3, 0xf8, 0xf0, | + | 0xff, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x8f, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x8f, |
- | 0xe3, 0xf9, 0xff, 0xfc, 0x7f, 0xf9, 0xfc, 0x70, 0xe3, 0xf3, 0xff, 0xfc, 0x0f, 0xfc, 0xfc, 0x70, | + | 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xc7, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xc7, |
- | 0xc7, 0xf7, 0xff, 0xff, 0xc3, 0xfe, 0xfe, 0x30, 0xc7, 0xe7, 0xff, 0xff, 0xf1, 0xfe, 0x7e, 0x30, | + | 0xfc, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xe3, 0xfc, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xe3, |
- | 0xcf, 0xef, 0xff, 0xff, 0xfc, 0xff, 0x7f, 0x30, 0x8f, 0xcf, 0xff, 0xff, 0xfe, 0x7f, 0x3f, 0x10, | + | 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xf1, |
- | 0x8f, 0xdf, 0xff, 0xff, 0xff, 0x3f, 0xbf, 0x10, 0x9f, 0x9f, 0xff, 0xff, 0xff, 0x3f, 0x9f, 0x90, | + | 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xf1, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xf9, |
- | 0x9f, 0x9f, 0xff, 0xff, 0xff, 0x9f, 0x9f, 0x90, 0x1f, 0xbf, 0xff, 0xff, 0xff, 0x9f, 0xdf, 0x80, | + | 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xf9, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xf8, |
- | 0x1f, 0xbf, 0xff, 0xf9, 0xff, 0xdf, 0xdf, 0x80, 0x1f, 0xbf, 0xff, 0xe0, 0x7f, 0xcf, 0xdf, 0x80, | + | 0xf1, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xfd, 0xf8, 0xf1, 0xff, 0xff, 0xfe, 0x07, 0xff, 0xfd, 0xf8, |
- | 0x1f, 0x3f, 0xff, 0xe0, 0x7f, 0xcf, 0xcf, 0x80, 0x1f, 0x3f, 0xff, 0xc0, 0x3f, 0xcf, 0xcf, 0x80, | + | 0xf1, 0xff, 0xff, 0xfe, 0x07, 0xff, 0xfd, 0xf8, 0xf1, 0xfc, 0x00, 0x1c, 0x03, 0xff, 0xfc, 0xf8, |
- | 0x1f, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0xff, 0xf0, | + | 0xf1, 0xfc, 0x00, 0x1c, 0x03, 0xfe, 0xfe, 0xf8, 0xf1, 0xff, 0xff, 0xfe, 0x07, 0xfe, 0xff, 0xf8, |
- | 0x1f, 0xff, 0xff, 0xe0, 0x7f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xf0, | + | 0xf1, 0xff, 0xff, 0xfe, 0x07, 0xfd, 0xfd, 0xf8, 0xf1, 0xff, 0xff, 0xff, 0x9f, 0xfd, 0xfd, 0xf8, |
- | 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xf0, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xf0, | + | 0xf1, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xfd, 0xf8, 0xf1, 0xff, 0xe1, 0xff, 0xff, 0xfb, 0xfd, 0xf9, |
- | 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xf0, 0x8f, 0xff, 0xff, 0xf9, 0xfc, 0x03, 0xf0, 0x10, | + | 0xf1, 0xff, 0x80, 0x7f, 0xff, 0xfb, 0xf9, 0xf9, 0xf1, 0xff, 0x00, 0x3f, 0xff, 0xf7, 0xfb, 0xf1, |
- | 0x8f, 0xff, 0xff, 0xf9, 0xf8, 0x01, 0xe0, 0x10, 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e7, 0xfc, 0x7f, 0xf1, 0xff, 0xff, 0xff, 0xfe, 0x9f, 0xf8, 0x7f, |
- | 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, | + | 0xf1, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xf0, 0xff, 0xf1, 0xff, 0xff, 0xbf, 0xef, 0xff, 0xe1, 0xff, |
- | 0xff, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, | + | 0xf1, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xc3, 0xff, 0xf1, 0xfe, 0x00, 0x0f, 0xff, 0xff, 0x07, 0xff, |
- | 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, | + | 0xf1, 0xfe, 0x00, 0x03, 0xff, 0xfc, 0x1f, 0xff, 0xf1, 0xfc, 0x7f, 0x9f, 0xff, 0xf0, 0x3f, 0xff, |
- | 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, | + | 0xf1, 0xfc, 0xff, 0x9f, 0xff, 0x80, 0xff, 0xff, 0xf1, 0xfc, 0xff, 0x9f, 0xc0, 0x03, 0xff, 0xff, |
- | 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00 | + | 0xf1, 0xfc, 0x7f, 0x9f, 0xc0, 0x1f, 0xff, 0xff, 0xf1, 0xfe, 0x7f, 0xff, 0xc0, 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_60 | + | |
}; | }; | ||
</ | </ | ||
Line 141: | 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 149: | 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 161: | 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 192: | 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; | + | uint16_t x = ((display.width() - tbw) / 2) - tbx; // |
- | uint16_t y = ((display.height() - tbh) / 2) - tby; | + | uint16_t y = ((display.height() - tbh) / 4) - tby; //one fourth from the top |
</ | </ | ||
Line 202: | Line 201: | ||
<code c> | <code c> | ||
display.setFullWindow(); | display.setFullWindow(); | ||
- | display.firstPage(); | + | display.fillScreen(GxEPD_WHITE); |
- | do | + | display.setCursor(x, y); |
- | { | + | display.print(HelloWorldMsg); |
- | | + | display.display(true); |
- | display.setCursor(x, y); | + | display.drawImage((uint8_t*)epd_bitmap_logo_64, |
- | display.print(HelloWorld); | + | |
- | } | + | |
- | while (display.nextPage()); | + | |
digitalWrite(EPAPER_SPI_CS_PIN, | digitalWrite(EPAPER_SPI_CS_PIN, | ||
</ | </ |