Screen object¶
The screen object generates the images and calls the driver to display them. It is used by all the other functions and libraries.
The screen object deals with the logical screen, with x-y coordinates, which takes into account the orientation. It is an abstraction of the physical screen with horizontal and vertical coordinates defined by the data-sheet.
Configure¶
Warning
Ensure the peripherals are declared and initialised according to the configuration procedure.
Driver¶
Select the driver corresponding to the film and the size of the screen.
#include "Pervasive_Wide_Small.h"
The pre-processor statement includes the driver library.
Configure the driver according to the screen model and the board configuration.
| 1 2 |  | 
- Pervasive_Wide_Small
- The constructor creates the driver object.
Screen¶
Select the library corresponding to the edition of the PDLS library.
#include "PDLS_Basic.h"
The pre-processor statement includes the screen library.
| 1 |  | 
- Screen_EPD
- The constructor creates the screen object.
The required parameter is
- The first line links to the driver declared just before.
Frame-buffer¶
By default, the frame-buffer is created dynamically at run-time with the MCU internal SRAM.
The size of the frame-buffer corresponds to the number of pixels divided by 4:
- 
1 bit per pixel (or 8 pixels per byte) multiplied by two (previous and next images) for black and white screens; 
- 
1 bit per pixel (or 8 pixels per byte) multiplied by two colours (black and red) for black-white-red screens; 
- 
2 bits per pixel (or 4 pixels per byte) for black-white-red-yellow screens. 
Note
The Evaluation, Commercial and Viewer editions allow to specify the frame-buffer statically at build-time and passed on to the constructor as parameter.
uint8_t frameBuffer[frameSize_EPD_271];
Screen_EPD myScreen(&myDriver, frameBuffer);
The constant for the size of the frame-buffer starts with frameSize_EPD_ and contains the size taken from the product number. 
| Diagonal (inches) | Commercial name | Width (pixels) | Height (pixels) | Frame-buffer (bytes) | Frame-buffer (constant) | 
|---|---|---|---|---|---|
| 1.50 | 1.50 | 200 | 200 | 10,000 | frameSize_EPD_150 | 
| 1.52 | 1.52 | 200 | 200 | 10,000 | frameSize_EPD_152 | 
| 1.54 | 1.54 | 152 | 152 | 5,776 | frameSize_EPD_154 | 
| 2.06 | 2.06 | 128 | 248 | 7,936 | frameSize_EPD_206 | 
| 2.13 | 2.13 | 104 | 212 | 5,512 | frameSize_EPD_213 | 
| 2.66 | 2.66 | 152 | 296 | 11,248 | frameSize_EPD_266 | 
| 2.71 | 2.71 | 176 | 264 | 11,616 | frameSize_EPD_271 | 
| 2.87 | 2.87 | 128 | 296 | 9,472 | frameSize_EPD_287 | 
| 2.90 | 2.90 | 168 | 384 | 16,128 | frameSize_EPD_290 | 
| 3.40 | 3.40 | 456 | 392 | 22,344 | frameSize_EPD_340 | 
| 3.70 | 3.70 | 240 | 416 | 24,960 | frameSize_EPD_370 | 
| 4.17 | 4.2 | 400 | 300 | 30,000 | frameSize_EPD_417 | 
| 4.37 | 4.37 | 176 | 480 | 21,120 | frameSize_EPD_437 | 
| 5.65 | 5.65 | 448 | 600 | 33,600 | frameSize_EPD_565 | 
| 5.81 | 5.81 | 256 | 720 | 46,080 | frameSize_EPD_581 | 
| 7.41 | 7.4 | 480 | 800 | 96,000 | frameSize_EPD_741 | 
| 9.69 | 9.7 | 672 | 960 | 161,280 | frameSize_EPD_969 | 
| 11.98 | 12.0 | 768 | 960 | 184,320 | frameSize_EPD_B98 | 
Use¶
myScreen.begin();
- begin()
- initialises the screen, including the required GPIOs, and the SPI and I²C ports.
Two different update modes are available for the panels:
- 
Normal update for all the monochrome and colour screens; 
- 
Fast update for monochrome screens with embedded fast update and screens with embedded fast update and touch. 
myScreen.gText(4, 4, myScreen.whoAmI());
myScreen.flush();
- whoAmI()
- returns the name of the screen.
- gText()
- prints text on the screen.
- flush()
- uploads the frame-buffer to the screen and performs a normal update of the panel. It can also manage low-power.
myScreen.gText(4, 4, myScreen.whoAmI());
myScreen.flushFast();
- whoAmI()
- returns the name of the screen.
- gText()
- prints text on the screen.
- flushFast()
- uploads the frame-buffer to the screen and performs a fast update of the panel. It can also manage low-power.
When normal update is not available, flush() redirects to flushFast().
Warning
The partial update mode is deprecated. Use fast update instead.
The functions are grouped in eight categories.
Example¶
This is the core of the code from the example WhoAmI.ino.

// SDK and configuration
#include "PDLS_Common.h"
// Set parameters
#define DISPLAY_WHOAMI 1
// Define variables and constants
// Driver
#include "Pervasive_Wide_Small.h"
Pervasive_Wide_Small myDriver(eScreen_EPD_271_KS_09, boardRaspberryPiPico_RP2040);
// Screen
#include "PDLS_Basic.h"
Screen_EPD myScreen(&myDriver);
uint8_t fontSans;
#if (DISPLAY_WHOAMI == 1)
void displayWhoAmI()
{
    myScreen.selectFont(fontMedium);
    myScreen.setOrientation(myOrientation);
    myScreen.gText(4, 4, myScreen.WhoAmI());
    // Normal update
    myScreen.flush();
}
#endif // DISPLAY_WHOAMI
// Add setup code
void setup()
{
    hV_HAL_begin();
    hV_HAL_Serial_crlf();
    hV_HAL_log(LEVEL_INFO, __FILE__);
    hV_HAL_log(LEVEL_INFO, __DATE__ " " __TIME__);
    hV_HAL_Serial_crlf();
    // Initialise screen
    myScreen.begin();
    hV_HAL_Serial_crlf();
    // Fonts
    fontSmall = Font_Terminal6x8;
    fontMedium = Font_Terminal8x12;
    fontLarge = Font_Terminal12x16;
    fontVery = Font_Terminal16x24;
    // Example
#if (DISPLAY_WHOAMI == 1)
    hV_HAL_log(LEVEL_INFO, "DISPLAY_WHOAMI... ");
    myScreen.clear();
    displayWhoAmI();
    hV_HAL_delayMilliseconds(8000);
#endif // DISPLAY_WHOAMI
    // Against possible ghosting
    myScreen.regenerate();
    hV_HAL_exit(RESULT_SUCCESS);
}
// Add loop code
void loop()
{
    hV_HAL_delayMilliseconds(1000);
}