Example¶
To open the example,
- Call the menu Files > Examples > Pervasive_Wide_Small > Demo_NEW on the Arduino IDE;
or
- Double-click on the
Demo_NEW.ino
file under theArduino/libraries/Pervasive_Wide_Small/examples/Demo_NEW
folder.
Configure¶
SDK and configuration¶
```cpp // SDK and configuration
include “PDLS_Common.h”¶
```
The pre-processor statement calls the shared libraries.
The PDLS_Common
umbrella header file includes the SDK with the peripherals library, and the configuration with the common library.
Driver¶
```cpp // Driver
include “Pervasive_Wide_Small.h”¶
Pervasive_Wide_Small myDriver(eScreen_EPD_152_KS_0J, boardRaspberryPiPico_RP2040); ```
The pre-processor statement includes the driver library.
Pervasive_Wide_Small
- The constructor creates the driver object.
The required parameters are
-
The first line sets the model of the screen;
-
The second line selects the configuration of the main controller board connected to the EXT3, EXT3.1 or EXT4 extension board.
Use¶
Initialisation¶
cpp
hV_HAL_begin();
myDriver.begin();
hV_HAL_begin()
- proceeds with the general initialisation. It configures and starts the peripherals GPIO, UART, SPI, and I²C if needed.
begin()
- initialises the driver, including the required GPIOs, and the SPI and I²C ports.
Temperature¶
cpp
myDriver.setTemperatureC(25);
myDriver.setTemperatureF(77);
setTemperatureC()
- sets the temperature in degrees Celsius, with default value 25 °C.
setTemperatureF()
- sets the temperature in degrees Fahrenheit, with default value 77 °F.
Update¶
cpp
myDriver.updateNormal(Image_BW, frameSize);
myDriver.updateFast(Image_BW_Next, Image_BW_Previous, frameSize);
updateNormal()
- performs the update of the screen in normal mode. It requires one image and the size of the frame.
updateFast()
- performs the update of the screen in fast mode. It requires two images, the next and the previous, and the size of the frame.
Terminate¶
cpp
hV_HAL_exit();
hV_HAL_exit()
- enters an endless loop for micro-controllers.
Example¶
Each driver includes the code of an example under the folder Pervasive_Wide_Small/examples/Demo_NEW
, like the project below.
```cpp // SDK and configuration
include “PDLS_Common.h”¶
// Driver
include “Pervasive_Wide_Small.h”¶
Pervasive_Wide_Small myDriver(eScreen_EPD_152_KS_0J, boardRaspberryPiPico_RP2040);
// DEMO Image Set
define SCRN 152¶
include “globalupdate_src/demoImageData.h”¶
include “fastupdate_src/demoImageData.h”¶
void setup() { hV_HAL_begin();
myDriver.begin();
myDriver.updateNormal(BW_monoBuffer, frameSize);
myDriver.updateFast(FastPic_w, FastPic_1, frameSize);
myDriver.updateFast(FastPic_b, FastPic_w, frameSize);
myDriver.updateFast(FastPic_2, FastPic_b, frameSize);
myDriver.updateFast(FastPic_3, FastPic_2, frameSize);
myDriver.updateFast(FastPic_4, FastPic_3, frameSize);
myDriver.updateFast(FastPic_b, FastPic_4, frameSize);
myDriver.updateFast(FastPic_w, FastPic_b, frameSize);
hV_HAL_exit();
}
void loop() { hV_HAL_delayMilliseconds(1000); } ```