|  | 
|  | 1 | +/// | 
|  | 2 | +/// @file Common_Persistent.ino | 
|  | 3 | +/// @brief Example of features for basic edition | 
|  | 4 | +/// | 
|  | 5 | +/// @details Project Pervasive Displays Library Suite | 
|  | 6 | +/// @n Based on highView technology | 
|  | 7 | +/// | 
|  | 8 | +/// @author Rei Vilo | 
|  | 9 | +/// @date 21 Jan 2023 | 
|  | 10 | +/// @version 704 | 
|  | 11 | +/// | 
|  | 12 | +/// @copyright (c) Rei Vilo, 2010-2024 | 
|  | 13 | +/// @copyright Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) | 
|  | 14 | +/// | 
|  | 15 | +/// @see ReadMe.txt for references | 
|  | 16 | +/// @n | 
|  | 17 | +/// | 
|  | 18 | + | 
|  | 19 | +// Screen | 
|  | 20 | +#include "PDLS_EXT3_Basic_Global.h" | 
|  | 21 | + | 
|  | 22 | +// SDK | 
|  | 23 | +// #include <Arduino.h> | 
|  | 24 | +#include "hV_HAL_Peripherals.h" | 
|  | 25 | + | 
|  | 26 | +// Include application, user and local libraries | 
|  | 27 | +// #include <SPI.h> | 
|  | 28 | + | 
|  | 29 | +// Configuration | 
|  | 30 | +#include "hV_Configuration.h" | 
|  | 31 | + | 
|  | 32 | +// Set parameters | 
|  | 33 | + | 
|  | 34 | +// Define structures and classes | 
|  | 35 | + | 
|  | 36 | +// Define variables and constants | 
|  | 37 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_154, boardRaspberryPiPico_RP2040); | 
|  | 38 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_213, boardRaspberryPiPico_RP2040); | 
|  | 39 | +Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_266, boardRaspberryPiPico_RP2040); | 
|  | 40 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_271, boardRaspberryPiPico_RP2040); | 
|  | 41 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_287, boardRaspberryPiPico_RP2040); | 
|  | 42 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_370, boardRaspberryPiPico_RP2040); | 
|  | 43 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_417, boardRaspberryPiPico_RP2040); | 
|  | 44 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_437, boardRaspberryPiPico_RP2040); | 
|  | 45 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_565, boardRaspberryPiPico_RP2040); | 
|  | 46 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_581, boardRaspberryPiPico_RP2040); | 
|  | 47 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_741, boardRaspberryPiPico_RP2040); | 
|  | 48 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_969, boardRaspberryPiPico_RP2040); | 
|  | 49 | +// Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_B98, boardRaspberryPiPico_RP2040); | 
|  | 50 | + | 
|  | 51 | +// Prototypes | 
|  | 52 | + | 
|  | 53 | +// Utilities | 
|  | 54 | +/// | 
|  | 55 | +/// @brief Wait with countdown | 
|  | 56 | +/// @param second duration, s | 
|  | 57 | +/// | 
|  | 58 | +void wait(uint8_t second) | 
|  | 59 | +{ | 
|  | 60 | +    for (uint8_t i = second; i > 0; i--) | 
|  | 61 | +    { | 
|  | 62 | +        Serial.print(formatString(" > %i  \r", i)); | 
|  | 63 | +        delay(1000); | 
|  | 64 | +    } | 
|  | 65 | +    Serial.print("         \r"); | 
|  | 66 | +} | 
|  | 67 | + | 
|  | 68 | +// Functions | 
|  | 69 | +/// | 
|  | 70 | +/// @brief Who am i? test screen | 
|  | 71 | +/// | 
|  | 72 | +void displayPersistent() | 
|  | 73 | +{ | 
|  | 74 | +    myScreen.setOrientation(ORIENTATION_LANDSCAPE); | 
|  | 75 | +    myScreen.selectFont(Font_Terminal8x12); | 
|  | 76 | +    uint16_t dy = myScreen.characterSizeY(); | 
|  | 77 | +    uint16_t y = 4; | 
|  | 78 | + | 
|  | 79 | +    myScreen.gText(4, y, myScreen.WhoAmI()); | 
|  | 80 | +    y += dy; | 
|  | 81 | + | 
|  | 82 | +    myScreen.gText(4, y, formatString("%i x %i", myScreen.screenSizeX(), myScreen.screenSizeY())); | 
|  | 83 | +    y += dy; | 
|  | 84 | + | 
|  | 85 | +    myScreen.gText(4, y, formatString("PDLS %s v%i.%i.%i", SCREEN_EPD_EXT3_VARIANT, SCREEN_EPD_EXT3_RELEASE / 100, (SCREEN_EPD_EXT3_RELEASE / 10) % 10, SCREEN_EPD_EXT3_RELEASE % 10)); | 
|  | 86 | +    y += dy; | 
|  | 87 | +    y += dy; | 
|  | 88 | + | 
|  | 89 | +    myScreen.selectFont(Font_Terminal6x8); | 
|  | 90 | +    myScreen.gText(4, y, "Unplug when the LED is on"); | 
|  | 91 | + | 
|  | 92 | +    myScreen.flush(); | 
|  | 93 | +} | 
|  | 94 | + | 
|  | 95 | +// Add setup code | 
|  | 96 | +/// | 
|  | 97 | +/// @brief Setup | 
|  | 98 | +/// | 
|  | 99 | +void setup() | 
|  | 100 | +{ | 
|  | 101 | +    Serial.begin(115200); | 
|  | 102 | +    delay(500); | 
|  | 103 | + | 
|  | 104 | +    Serial.println(); | 
|  | 105 | +    Serial.println("=== " __FILE__); | 
|  | 106 | +    Serial.println("=== " __DATE__ " " __TIME__); | 
|  | 107 | +    Serial.println(); | 
|  | 108 | + | 
|  | 109 | +    pinMode(LED_BUILTIN, OUTPUT); | 
|  | 110 | +    for (uint8_t i = 1; i < 7; i += 1) | 
|  | 111 | +    { | 
|  | 112 | +        digitalWrite(LED_BUILTIN, i % 2); | 
|  | 113 | +        delay(250); | 
|  | 114 | +    } | 
|  | 115 | + | 
|  | 116 | +    Serial.println("begin... "); | 
|  | 117 | +    myScreen.begin(); | 
|  | 118 | +    Serial.println(formatString("%s %ix%i", myScreen.WhoAmI().c_str(), myScreen.screenSizeX(), myScreen.screenSizeY())); | 
|  | 119 | + | 
|  | 120 | +    Serial.println("Who Am I... "); | 
|  | 121 | +    myScreen.clear(); | 
|  | 122 | +    displayPersistent(); | 
|  | 123 | +    wait(2); | 
|  | 124 | + | 
|  | 125 | +    /* | 
|  | 126 | +      // To clear the screen | 
|  | 127 | +      myScreen.clear(); | 
|  | 128 | +      myScreen.flush(); | 
|  | 129 | +    */ | 
|  | 130 | + | 
|  | 131 | +    digitalWrite(LED_BUILTIN, HIGH); | 
|  | 132 | +    Serial.println("=== "); | 
|  | 133 | +    Serial.println(); | 
|  | 134 | +} | 
|  | 135 | + | 
|  | 136 | +// Add loop code | 
|  | 137 | +/// | 
|  | 138 | +/// @brief Loop, empty | 
|  | 139 | +/// | 
|  | 140 | +void loop() | 
|  | 141 | +{ | 
|  | 142 | +    delay(1000); | 
|  | 143 | +} | 
0 commit comments