This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:iot-open:practical:hardware:sut:stm32:emb6_1 [2024/04/20 13:24] – 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 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; | + | 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 204: | 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, | ||
</ | </ |