From 2623470b67a35ca4107336db6b0fc113362ec0a7 Mon Sep 17 00:00:00 2001 From: Rei Vilo Date: Wed, 20 Sep 2023 18:42:24 +0200 Subject: [PATCH] Release 7.0.0 --- .../BWRY_Contrasts.ino} | 8 +- img/BWRY_Contrasts.png | Bin 1014 -> 7598 bytes library.properties | 2 +- src/Screen_EPD_EXT3.cpp | 354 +++-------- src/Screen_EPD_EXT3.h | 163 ++--- src/hV_Board.cpp | 214 +++++++ src/hV_Board.h | 155 +++++ src/hV_Colours565.h | 6 +- src/hV_Configuration.h | 560 +----------------- src/hV_Documentation.h | 7 +- src/hV_Font.h | 6 +- src/hV_Font_Terminal.cpp | 80 +-- src/hV_Font_Terminal.h | 46 +- src/hV_HAL_Peripherals.h | 53 ++ src/hV_List_Boards.h | 430 ++++++++++++++ src/{hV_Constants.h => hV_List_Constants.h} | 33 +- src/hV_List_Screens.h | 188 ++++++ src/hV_Screen_Buffer.cpp | 87 +-- src/hV_Screen_Buffer.h | 31 +- src/hV_Utilities.cpp | 2 + src/hV_Utilities.h | 12 +- src/hV_Utilities_EPD.cpp | 203 +++++++ src/hV_Utilities_EPD.h | 129 ++++ 23 files changed, 1690 insertions(+), 1079 deletions(-) rename examples/{BWRY_Contrast/BWRY_Contrast.ino => BWRY_Contrasts/BWRY_Contrasts.ino} (97%) mode change 100644 => 100755 img/BWRY_Contrasts.png create mode 100755 src/hV_Board.cpp create mode 100755 src/hV_Board.h create mode 100755 src/hV_HAL_Peripherals.h create mode 100755 src/hV_List_Boards.h rename src/{hV_Constants.h => hV_List_Constants.h} (85%) create mode 100644 src/hV_List_Screens.h create mode 100755 src/hV_Utilities_EPD.cpp create mode 100755 src/hV_Utilities_EPD.h diff --git a/examples/BWRY_Contrast/BWRY_Contrast.ino b/examples/BWRY_Contrasts/BWRY_Contrasts.ino similarity index 97% rename from examples/BWRY_Contrast/BWRY_Contrast.ino rename to examples/BWRY_Contrasts/BWRY_Contrasts.ino index b215ba7..1a1f006 100755 --- a/examples/BWRY_Contrast/BWRY_Contrast.ino +++ b/examples/BWRY_Contrasts/BWRY_Contrasts.ino @@ -1,5 +1,5 @@ /// -/// @file BWRY_Contrast.ino +/// @file BWRY_Contrasts.ino /// @brief Example of features for basic edition /// /// @details Project Pervasive Displays Library Suite @@ -58,10 +58,11 @@ void wait(uint8_t second) // Functions #if (DISPLAY_CONTRASTS_BWRY == 1) + /// /// @brief Palette test screen /// -void displayContrastBWRY() +void displayContrastsBWRY() { const uint8_t grid = 4; // 4 or 5 const uint16_t colours[4] = {myColours.black, myColours.white, myColours.red, myColours.yellow}; @@ -93,6 +94,7 @@ void displayContrastBWRY() myScreen.flush(); } + #endif // DISPLAY_CONTRASTS_BWRY // Add setup code @@ -116,7 +118,7 @@ void setup() Serial.print("DISPLAY_CONTRASTS_BWRY... "); myScreen.clear(); - displayContrastBWRY(); + displayContrastsBWRY(); wait(8); #endif // DISPLAY_CONTRASTS_BWRY diff --git a/img/BWRY_Contrasts.png b/img/BWRY_Contrasts.png old mode 100644 new mode 100755 index f32b411c230fcef10570318ecc91c3a95c4075ad..5a5dcb76bec3ec27320b4e7cd47a88ddb96bc322 GIT binary patch literal 7598 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 F{};JvC=&nx literal 1014 zcmeAS@N?(olHy`uVBq!ia0vp^GeDSw4M<8HQcwg^EX7WqAsj$Z!;#X#z`(rL)5S5Q zV$R#Ux!H3ZB-#SEfBFAE_4h)FX)EDYF@725|%hFoD;I7k#Gc{YQ_3p`EUn=_Ma;}DUPI%;@ z<)1&i{rvUi``vbW*Fnx*k=LlZ-1&OEe3W1N(`VV1vfm`HzdgWG8g%pLsh-oClYpUl zRdvJDU#E`?$wxg~d8cOYtoPqz`FwoTr_NpfX2-9Z80mm-&lYBBxGq0!3Jq=??#B`_ zC@OdDX?=FDdY*H<@7-#{ZLd!6QGP4ChVQayV4oQo}Z8Zt9wQ zwNP|(li*cbgVi^jOQMdxF{%x_YSHaCJy->js!$vcOKOA#cWtr1anbwIV&pzm0lC5$0x%P2j ztZZk_4qyFo_4TCpWw{IX&c4mQsR=oc#Qu{An`?bMY$6cf{Q2rU7joXg^w2B*Wed*< UKB+2;1ZHFgPgg&ebxsLQ0GWTxiU0rr diff --git a/library.properties b/library.properties index c00559e..27afc07 100755 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=PDLS_EXT3_Basic_BWRY -version=6.1.4 +version=7.0.0 author=Rei Vilo for Pervasive Displays maintainer=Rei Vilo sentence=Library for Pervasive Displays iTC red and yellow colour screens and EXT3-1 board diff --git a/src/Screen_EPD_EXT3.cpp b/src/Screen_EPD_EXT3.cpp index c18fea4..63ac4d2 100755 --- a/src/Screen_EPD_EXT3.cpp +++ b/src/Screen_EPD_EXT3.cpp @@ -23,11 +23,9 @@ // Release 609: Added temperature management // Release 610: Removed partial update // Release 611: Added support for red and yellow colour screens -// Release 614: Added support for Arduino Nano ESP32 board // // Library header -#include "SPI.h" #include "Screen_EPD_EXT3.h" #if defined(ENERGIA) @@ -86,32 +84,32 @@ const uint8_t COG_initialData266QS[48] = void Screen_EPD_EXT3::COG_initial() { // Work settings - // _sendIndexData(0x01, &COG_initialData[16], 1); // PWR - _sendCommandData8(0x01, COG_initialData[16]); // PWR - _sendIndexData(0x00, &COG_initialData[17], 2); // PSR - _sendIndexData(0x03, &COG_initialData[30], 3); // PFS - _sendIndexData(0x06, &COG_initialData[23], 7); // BTST_P - // _sendIndexData(0x50, &COG_initialData[39], 1); // CDI - _sendCommandData8(0x50, COG_initialData[39]); // CDI - _sendIndexData(0x60, &COG_initialData[40], 2); // TCON - _sendIndexData(0x61, &COG_initialData[19], 4); // TRES - // _sendIndexData(0xE7, &COG_initialData[33], 1); // - _sendCommandData8(0xE7, COG_initialData[33]); // - // _sendIndexData(0xE3, &COG_initialData[42], 1); // PWS - _sendCommandData8(0xE3, COG_initialData[42]); // PWS - // _sendIndexData(0x4D, &COG_initialData[43], 1); // - _sendCommandData8(0x4D, COG_initialData[43]); // - // _sendIndexData(0xB4, &COG_initialData[44], 1); // - _sendCommandData8(0xB4, COG_initialData[44]); // - // _sendIndexData(0xB5, &COG_initialData[45], 1); // - _sendCommandData8(0xB5, COG_initialData[45]); // + //b_sendIndexData(0x01, &COG_initialData[16], 1); // PWR + b_sendCommandData8(0x01, COG_initialData[16]); // PWR + b_sendIndexData(0x00, &COG_initialData[17], 2); // PSR + b_sendIndexData(0x03, &COG_initialData[30], 3); // PFS + b_sendIndexData(0x06, &COG_initialData[23], 7); // BTST_P + //b_sendIndexData(0x50, &COG_initialData[39], 1); // CDI + b_sendCommandData8(0x50, COG_initialData[39]); // CDI + b_sendIndexData(0x60, &COG_initialData[40], 2); // TCON + b_sendIndexData(0x61, &COG_initialData[19], 4); // TRES + //b_sendIndexData(0xE7, &COG_initialData[33], 1); // + b_sendCommandData8(0xE7, COG_initialData[33]); // + //b_sendIndexData(0xE3, &COG_initialData[42], 1); // PWS + b_sendCommandData8(0xE3, COG_initialData[42]); // PWS + //b_sendIndexData(0x4D, &COG_initialData[43], 1); // + b_sendCommandData8(0x4D, COG_initialData[43]); // + //b_sendIndexData(0xB4, &COG_initialData[44], 1); // + b_sendCommandData8(0xB4, COG_initialData[44]); // + //b_sendIndexData(0xB5, &COG_initialData[45], 1); // + b_sendCommandData8(0xB5, COG_initialData[45]); // // uint8_t index_E9[] = {0x01}; - // _sendIndexData(0xE9, index_E9, 1); // - _sendCommandData8(0xE9, 0x01); // + //b_sendIndexData(0xE9, index_E9, 1); // + b_sendCommandData8(0xE9, 0x01); // // uint8_t index_30[] = {0x08}; - // _sendIndexData(0x30, index_30, 1); // PLL - _sendCommandData8(0x30, 0x08); // PLL + //b_sendIndexData(0x30, index_30, 1); // PLL + b_sendCommandData8(0x30, 0x08); // PLL } void Screen_EPD_EXT3::COG_getUserData() @@ -144,29 +142,29 @@ void Screen_EPD_EXT3::COG_getUserData() void Screen_EPD_EXT3::COG_sendImageDataGlobal() { - _sendIndexData(0x10, _newImage, _frameSize); // First frame, blackBuffer + b_sendIndexData(0x10, _newImage, _frameSize); // First frame, blackBuffer } void Screen_EPD_EXT3::COG_update() { - _sendCommand8(0x04); // Power on + b_sendCommand8(0x04); // Power on digitalWrite(_pin.panelCS, HIGH); // CS# = 1 - _waitBusy(); + b_waitBusy(); // uint8_t data12[] = {0x00}; - // _sendIndexData(0x12, data12, 1); // Display Refresh - _sendCommandData8(0x12, 0x00); // Display Refresh + //b_sendIndexData(0x12, data12, 1); // Display Refresh + b_sendCommandData8(0x12, 0x00); // Display Refresh digitalWrite(_pin.panelCS, HIGH); // CS# = 1 - _waitBusy(); + b_waitBusy(); } void Screen_EPD_EXT3::COG_powerOff() { uint8_t data02[] = {0x00}; - // _sendIndexData(0x02, data02, 1); // Turn off DC/DC - _sendCommandData8(0x02, 0x00); // Turn off DC/DC + //b_sendIndexData(0x02, data02, 1); // Turn off DC/DC + b_sendCommandData8(0x02, 0x00); // Turn off DC/DC digitalWrite(_pin.panelCS, HIGH); // CS# = 1 - _waitBusy(); + b_waitBusy(); } /// @endcond // @@ -334,75 +332,59 @@ void Screen_EPD_EXT3::begin() #endif // ENERGIA // Reset - _reset(10, 10, 20, 40, 10); // specific - _waitBusy(); // specific + b_reset(10, 10, 20, 40, 10); // specific + b_waitBusy(); // specific // Check type and get tables COG_getUserData(); // nothing sent to panel - _screenWidth = _screenSizeH; - _screenHeigth = _screenSizeV; - // Standard hV_Screen_Buffer::begin(); setOrientation(0); - if (_f_fontMax() > 0) + if (f_fontMax() > 0) { - _f_selectFont(0); + f_selectFont(0); } - _f_fontSolid = false; + f_fontSolid = false; _penSolid = false; _invert = false; // Report - Serial.println(formatString("= Screen %s %ix%i", WhoAmI(), screenSizeX(), screenSizeY())); - Serial.println(formatString("= PDLS v%i", SCREEN_EPD_EXT3_RELEASE)); + Serial.println(formatString("= Screen %s %ix%i", WhoAmI().c_str(), screenSizeX(), screenSizeY())); + Serial.println(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)); clear(); } -void Screen_EPD_EXT3::_reset(uint32_t ms1, uint32_t ms2, uint32_t ms3, uint32_t ms4, uint32_t ms5) -{ - delay_ms(ms1); // delay_ms 5ms - digitalWrite(_pin.panelReset, HIGH); // RES# = 1 - delay_ms(ms2); // delay_ms 5ms - digitalWrite(_pin.panelReset, LOW); - delay_ms(ms3); - digitalWrite(_pin.panelReset, HIGH); - delay_ms(ms4); - digitalWrite(_pin.panelCS, HIGH); // CS# = 1 - delay_ms(ms5); -} - String Screen_EPD_EXT3::WhoAmI() { - String text = "iTC "; - text += String(_screenDiagonal / 100); - text += "."; - text += String(_screenDiagonal % 100); - text += "\" -"; + char work[64] = {0}; + u_WhoAmI(work); -#if (FONT_MODE == USE_FONT_HEADER) - - text += "H"; - -#elif (FONT_MODE == USE_FONT_FLASH) - - text += "F"; + return formatString("iTC %i.%02i\"%s", _screenDiagonal / 100, _screenDiagonal % 100, work); +} -#elif (FONT_MODE == USE_FONT_TERMINAL) +uint8_t Screen_EPD_EXT3::flushMode(uint8_t updateMode) +{ + updateMode = checkTemperatureMode(updateMode); - text += "T"; + switch (updateMode) + { + case UPDATE_FAST: + case UPDATE_GLOBAL: -#else + _flushGlobal(); + break; - text += "?"; + default: -#endif // FONT_MODE + Serial.println("* PDLS - UPDATE_NONE invoked"); + break; + } - return text; + return updateMode; } void Screen_EPD_EXT3::flush() @@ -519,21 +501,6 @@ void Screen_EPD_EXT3::clear(uint16_t colour) } } -void Screen_EPD_EXT3::invert(bool flag) -{ - _invert = flag; -} - -void Screen_EPD_EXT3::point(uint16_t x1, uint16_t y1, uint16_t colour) -{ - _setPoint(x1, y1, colour); -} - -uint16_t Screen_EPD_EXT3::readPixel(uint16_t x1, uint16_t y1) -{ - return _getPoint(x1, y1); -} - void Screen_EPD_EXT3::_setPoint(uint16_t x1, uint16_t y1, uint16_t colour) { // Orient and check coordinates are within screen @@ -543,9 +510,6 @@ void Screen_EPD_EXT3::_setPoint(uint16_t x1, uint16_t y1, uint16_t colour) return; } - uint32_t z1 = _getZ(x1, y1); - uint8_t b1 = 6 - 2 * (y1 % 4); - // Convert combined colours into basic colours bool flagOdd = ((x1 + y1) % 2 == 0); @@ -616,6 +580,10 @@ void Screen_EPD_EXT3::_setPoint(uint16_t x1, uint16_t y1, uint16_t colour) } } + // Coordinates + uint32_t z1 = _getZ(x1, y1); + uint16_t b1 = _getB(x1, y1); + // Basic colours if ((colour == myColours.black) xor _invert) { @@ -650,7 +618,7 @@ void Screen_EPD_EXT3::_setOrientation(uint8_t orientation) bool Screen_EPD_EXT3::_orientCoordinates(uint16_t & x, uint16_t & y) { - bool flagError = true; // false = success, true = error + bool _flagError = true; // false = success, true = error switch (_orientation) { case 3: // checked, previously 1 @@ -658,7 +626,7 @@ bool Screen_EPD_EXT3::_orientCoordinates(uint16_t & x, uint16_t & y) if ((x < _screenSizeV) and (y < _screenSizeH)) { x = _screenSizeV - 1 - x; - flagError = false; + _flagError = false; } break; @@ -669,7 +637,7 @@ bool Screen_EPD_EXT3::_orientCoordinates(uint16_t & x, uint16_t & y) x = _screenSizeH - 1 - x; y = _screenSizeV - 1 - y; swap(x, y); - flagError = false; + _flagError = false; } break; @@ -678,7 +646,7 @@ bool Screen_EPD_EXT3::_orientCoordinates(uint16_t & x, uint16_t & y) if ((x < _screenSizeV) and (y < _screenSizeH)) { y = _screenSizeH - 1 - y; - flagError = false; + _flagError = false; } break; @@ -687,12 +655,17 @@ bool Screen_EPD_EXT3::_orientCoordinates(uint16_t & x, uint16_t & y) if ((x < _screenSizeH) and (y < _screenSizeV)) { swap(x, y); - flagError = false; + _flagError = false; } break; } - return flagError; + return _flagError; +} + +uint16_t Screen_EPD_EXT3::_getPoint(uint16_t x1, uint16_t y1) +{ + return 0x0000; } uint32_t Screen_EPD_EXT3::_getZ(uint16_t x1, uint16_t y1) @@ -706,186 +679,23 @@ uint32_t Screen_EPD_EXT3::_getZ(uint16_t x1, uint16_t y1) return z1; } -uint16_t Screen_EPD_EXT3::_getPoint(uint16_t x1, uint16_t y1) -{ - return 0x0000; -} - -// Utilities -void Screen_EPD_EXT3::_sendCommand8(uint8_t command) -{ - digitalWrite(_pin.panelDC, LOW); - digitalWrite(_pin.panelCS, LOW); - - SPI.transfer(command); - - digitalWrite(_pin.panelCS, HIGH); -} - -void Screen_EPD_EXT3::_sendCommandData8(uint8_t command, uint8_t data) +uint16_t Screen_EPD_EXT3::_getB(uint16_t x1, uint16_t y1) { - digitalWrite(_pin.panelDC, LOW); // LOW = command - digitalWrite(_pin.panelCS, LOW); - - SPI.transfer(command); + uint16_t b1 = 0; - digitalWrite(_pin.panelDC, HIGH); // HIGH = data - SPI.transfer(data); + b1 = 6 - 2 * (y1 % 4); - digitalWrite(_pin.panelCS, HIGH); + return b1; } -void Screen_EPD_EXT3::_waitBusy() +void Screen_EPD_EXT3::regenerate() { - // LOW = busy, HIGH = ready - while (digitalRead(_pin.panelBusy) != HIGH) - { - delay(100); - } -} + clear(myColours.black); + flush(); -void Screen_EPD_EXT3::_sendIndexData(uint8_t index, const uint8_t * data, uint32_t size) -{ - digitalWrite(_pin.panelDC, LOW); // DC Low = Command - digitalWrite(_pin.panelCS, LOW); // CS Low = Select - - delayMicroseconds(50); - SPI.transfer(index); - delayMicroseconds(50); + delay(100); - digitalWrite(_pin.panelCS, HIGH); // CS High = Unselect - digitalWrite(_pin.panelDC, HIGH); // DC High = Data - digitalWrite(_pin.panelCS, LOW); // CS Low = Select - - delayMicroseconds(50); - for (uint32_t i = 0; i < size; i++) - { - SPI.transfer(data[i]); - } - delayMicroseconds(50); - - digitalWrite(_pin.panelCS, HIGH); // CS High + clear(myColours.white); + flush(); } -// -// === Miscellaneous section -// -// -// === End of Miscellaneous section -// - -// -// === Temperature section -// -void Screen_EPD_EXT3::setTemperatureC(int8_t temperatureC) -{ - _temperature = temperatureC; - - uint8_t _temperature2; - if (_temperature < 0) - { - _temperature2 = -_temperature; - _temperature2 = (uint8_t)(~_temperature2) + 1; // 2's complement - } - else - { - _temperature2 = _temperature; - } - // indexE5_data[0] = _temperature2; -} - -void Screen_EPD_EXT3::setTemperatureF(int16_t temperatureF) -{ - int8_t temperatureC = ((temperatureF - 32) * 5) / 9; // C = (F - 32) * 5 / 9 - setTemperatureC(temperatureC); -} - -uint8_t Screen_EPD_EXT3::checkTemperatureMode(uint8_t updateMode) -{ - // #define FEATURE_FAST 0x01 ///< With embedded fast update - // #define FEATURE_TOUCH 0x02 ///< With capacitive touch panel - // #define FEATURE_OTHER 0x04 ///< With other feature - // #define FEATURE_WIDE_TEMPERATURE 0x08 ///< With wide operating temperature - // #define FEATURE_RED 0x10 ///< With red colour - // #define FEATURE_RED_YELLOW 0x20 ///< With red and yellow colours - - updateMode = UPDATE_GLOBAL; - - switch (_codeExtra & 0x19) - { - case FEATURE_FAST: // PS series - - // Fast PS Embedded fast update FU: +15 to +30 °C GU: 0 to +50 °C - if ((_temperature < 0) or (_temperature > 50)) - { - updateMode = UPDATE_NONE; - } - break; - - case (FEATURE_FAST | FEATURE_WIDE_TEMPERATURE): // KS series - - // Wide KS Wide temperature and embedded fast update FU: 0 to +50 °C GU: -15 to +60 °C - if ((_temperature < -15) or (_temperature > 60)) - { - updateMode = UPDATE_NONE; - } - break; - - case FEATURE_WIDE_TEMPERATURE: // HS series - - // Freezer HS Global update below 0 °C FU: - GU: -25 to +30 °C - if ((_temperature < -25) or (_temperature > 30)) - { - updateMode = UPDATE_NONE; - } - break; - - case FEATURE_RED: // JS series - case FEATURE_RED_YELLOW: // QS series - - // Red JS Red colour FU: - GU: 0 to +40 °C - // Red QS Red and yellow colours FU: - GU: 0 to +40 °C - if ((_temperature < 0) or (_temperature > 40)) - { - updateMode = UPDATE_NONE; - } - break; - - default: // CS series - - // Normal CS Global update above 0 °C FU: - GU: 0 to +50 °C - updateMode = UPDATE_GLOBAL; - if ((_temperature < 0) or (_temperature > 50)) - { - updateMode = UPDATE_NONE; - } - break; - } - - return updateMode; -} - -uint8_t Screen_EPD_EXT3::flushMode(uint8_t updateMode) -{ - updateMode = checkTemperatureMode(updateMode); - - switch (updateMode) - { - case UPDATE_FAST: - case UPDATE_GLOBAL: - - _flushGlobal(); - break; - - default: - - Serial.println("* PDLS - UPDATE_NONE invoked"); - break; - } - - return updateMode; -} -// -// === End of Temperature section -// - diff --git a/src/Screen_EPD_EXT3.h b/src/Screen_EPD_EXT3.h index 843f902..9cf15bf 100755 --- a/src/Screen_EPD_EXT3.h +++ b/src/Screen_EPD_EXT3.h @@ -18,8 +18,8 @@ /// * 2.66 reference xE2266QS0Fx /// /// @author Rei Vilo -/// @date 31 Aug 2023 -/// @version 614 +/// @date 21 Sep 2023 +/// @version 700 /// /// @copyright (c) Rei Vilo, 2010-2023 /// @copyright Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) @@ -35,31 +35,48 @@ /// // SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +#include "hV_HAL_Peripherals.h" // Configuration #include "hV_Configuration.h" -#if (hV_CONFIGURATION_RELEASE < 611) -#error Required hV_CONFIGURATION_RELEASE 611 +// Other libraries +#include "hV_Screen_Buffer.h" + +// Board +#include "hV_Board.h" + +// EPD utilities +#include "hV_Utilities_EPD.h" + +#if (hV_CONFIGURATION_RELEASE < 700) +#error Required hV_CONFIGURATION_RELEASE 700 #endif // hV_CONFIGURATION_RELEASE +#if (hV_SCREEN_BUFFER_RELEASE < 700) +#error Required hV_SCREEN_BUFFER_RELEASE 700 +#endif // hV_SCREEN_BUFFER_RELEASE + +#if (hV_BOARD_RELEASE < 700) +#error Required hV_BOARD_RELEASE 700 +#endif // hV_BOARD_RELEASE + #ifndef SCREEN_EPD_EXT3_RELEASE /// /// @brief Library release number /// -#define SCREEN_EPD_EXT3_RELEASE 614 +#define SCREEN_EPD_EXT3_RELEASE 700 + +/// +/// @brief Library variant +/// +#define SCREEN_EPD_EXT3_VARIANT "Basic-BWRY" // Other libraries -#include "SPI.h" #include "hV_Screen_Buffer.h" -#if (hV_SCREEN_BUFFER_RELEASE < 612) -#error Required hV_SCREEN_BUFFER_RELEASE 612 +#if (hV_SCREEN_BUFFER_RELEASE < 700) +#error Required hV_SCREEN_BUFFER_RELEASE 700 #endif // hV_SCREEN_BUFFER_RELEASE // Objects @@ -74,7 +91,7 @@ /// @note All commands work on the frame-buffer, /// to be displayed on screen with flush() /// -class Screen_EPD_EXT3 final : public hV_Screen_Buffer +class Screen_EPD_EXT3 final : public hV_Screen_Buffer, public hV_Utilities_EPD { public: /// @@ -105,12 +122,6 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer /// void clear(uint16_t colour = myColours.white); - /// - /// @brief Invert screen - /// @param flag true to invert, false for normal screen - /// - void invert(bool flag); - /// /// @brief Update the display, global update /// @note Send the frame-buffer to the screen and refresh the screen @@ -123,32 +134,6 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer /// void regenerate(); - /// - /// @brief Set temperature in Celsius - /// @details Set the temperature for update - /// @param temperatureC temperature in °C, default = 25 °C - /// @note Refer to data-sheets for authorised operating temperatures - /// - void setTemperatureC(int8_t temperatureC = 25); - - /// - /// @brief Set temperature in Fahrenheit - /// @details Set the temperature for update - /// @param temperatureF temperature in °F, default = 77 °F = 25 °C - /// @note Refer to data-sheets for authorised operating temperatures - /// - void setTemperatureF(int16_t temperatureF = 77); - - /// - /// @brief Check the mode against the temperature - /// - /// @param updateMode expected update mode - /// @return uint8_t recommended mode - /// @note If required, defaulting to UPDATE_NONE - /// @warning Default temperature is 25 °C, otherwise set by setTemperatureC() or setTemperatureF() - /// - uint8_t checkTemperatureMode(uint8_t updateMode = UPDATE_GLOBAL); - /// /// @brief Update the display /// @details Display next frame-buffer on screen and copy next frame-buffer into old frame-buffer @@ -158,50 +143,9 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer /// uint8_t flushMode(uint8_t updateMode = UPDATE_GLOBAL); - /// - /// @brief Draw pixel - /// @param x1 point coordinate, x-axis - /// @param y1 point coordinate, y-axis - /// @param colour 16-bit colour - /// - /// @n @b More: @ref Coordinate, @ref Colour - /// - void point(uint16_t x1, uint16_t y1, uint16_t colour); - - /// - /// @brief Read pixel colour - /// @param x1 point coordinate, x-axis - /// @param y1 point coordinate, y-axis - /// @return 16-bit colour, bits 15-11 red, bits 10-5 green, bits 4-0 blue - /// - /// @n @b More: @ref Coordinate, @ref Colour - /// - uint16_t readPixel(uint16_t x1, uint16_t y1); - protected: /// @cond - /// - /// @brief General reset - /// @param ms1 delay after PNLON_PIN, ms - /// @param ms2 delay after RESET_PIN HIGH, ms - /// @param ms3 delay after RESET_PIN LOW, ms - /// @param ms4 delay after RESET_PIN HIGH, ms - /// @param ms5 delay after CS_PIN CSS_PIN HIGH, ms - /// - void _reset(uint32_t ms1, uint32_t ms2, uint32_t ms3, uint32_t ms4, uint32_t ms5); - - // * Virtual =0 compulsory functions - // Screen-specific - /// - /// @brief Send data through SPI - /// @param index register - /// @param data data - /// @param size number of bytes - /// @note Valid for all except large screens - /// - void _sendIndexData(uint8_t index, const uint8_t * data, uint32_t size); - // Orientation /// /// @brief Set orientation @@ -217,8 +161,6 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer /// bool _orientCoordinates(uint16_t & x, uint16_t & y); // compulsory - // Position - // Write and Read /// @brief Set point /// @param x1 x coordinate @@ -236,6 +178,7 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer /// uint16_t _getPoint(uint16_t x1, uint16_t y1); + // Position /// /// @brief Convert /// @param x1 x-axis coordinate @@ -245,15 +188,20 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer uint32_t _getZ(uint16_t x1, uint16_t y1); /// - /// @brief Wait for ready - /// @details Wait for panelBusy low + /// @brief Convert + /// @param x1 x-axis coordinate + /// @param y1 y-axis coordinate + /// @return bit for _newImage[] /// - void _waitBusy(); - void _sendCommand8(uint8_t command); - void _sendCommandData8(uint8_t command, uint8_t data); + uint16_t _getB(uint16_t x1, uint16_t y1); - // Energy - // No energy + // + // === Energy section + // + + // + // === End of Energy section + // // * Other functions specific to the screen const uint8_t * COG_initialData; @@ -266,25 +214,16 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer // * Flush void _flushGlobal(); - // Screen independent variables - uint8_t * _newImage; - bool _invert = false; - uint16_t _screenSizeV, _screenSizeH; - int8_t _temperature = 25; - - // Screen dependent variables - pins_t _pin; - eScreen_EPD_EXT3_t _eScreen_EPD_EXT3; - uint8_t _codeExtra; - uint8_t _codeSize; - uint8_t _codeType; - uint16_t _bufferSizeV, _bufferSizeH, _bufferDepth; - uint32_t _pageColourSize, _frameSize; + // + // === Touch section + // - // === Touch - // No touch + // + // === End of Touch section + // /// @endcond }; #endif // SCREEN_EPD_EXT3_RELEASE + diff --git a/src/hV_Board.cpp b/src/hV_Board.cpp new file mode 100755 index 0000000..0d56291 --- /dev/null +++ b/src/hV_Board.cpp @@ -0,0 +1,214 @@ +// +// hV_Board.cpp +// Library C++ code +// ---------------------------------- +// +// Project Pervasive Displays Library Suite +// Based on highView technology +// +// Created by Rei Vilo, 16 Aug 2023 +// +// Copyright (c) Rei Vilo, 2010-2023 +// Licence All rights reserved +// + +// Library header +#include "hV_Board.h" + +hV_Board::hV_Board() +{ + ; +} + +void hV_Board::b_begin(pins_t board, uint8_t family, uint16_t delayCS) +{ + _pin = board; + _family = family; + _delayCS = delayCS; +} + +void hV_Board::b_reset(uint32_t ms1, uint32_t ms2, uint32_t ms3, uint32_t ms4, uint32_t ms5) +{ + delay(ms1); // delay 5ms + digitalWrite(_pin.panelReset, HIGH); // RES# = 1 + delay(ms2); // delay 5ms + digitalWrite(_pin.panelReset, LOW); + delay(ms3); + digitalWrite(_pin.panelReset, HIGH); + delay(ms4); + digitalWrite(_pin.panelCS, HIGH); // CS# = 1 + delay(ms5); +} + +void hV_Board::b_waitBusy() +{ + // LOW = busy, HIGH = ready + while (digitalRead(_pin.panelBusy) != HIGH) + { + delay(32); // non-blocking + } +} + +void hV_Board::b_suspend() +{ + // Not implemented +} + +void hV_Board::b_resume() +{ + // Not implemented +} + +void hV_Board::b_sendIndexFixed(uint8_t index, uint8_t data, uint32_t size) +{ + // Not implemented +} + +void hV_Board::b_sendIndexData(uint8_t index, const uint8_t * data, uint32_t size) +{ + digitalWrite(_pin.panelDC, LOW); // DC Low + digitalWrite(_pin.panelCS, LOW); // CS Low + if (_family == FAMILY_LARGE) + { + if (_pin.panelCSS != NOT_CONNECTED) + { + digitalWrite(_pin.panelCSS, LOW); + } + delayMicroseconds(450); // 450 + 50 = 500 + } + delayMicroseconds(50); + SPI.transfer(index); + delayMicroseconds(50); + if (_family == FAMILY_LARGE) + { + if (_pin.panelCSS != NOT_CONNECTED) + { + delayMicroseconds(450); // 450 + 50 = 500 + digitalWrite(_pin.panelCSS, HIGH); + } + } + digitalWrite(_pin.panelCS, HIGH); // CS High + digitalWrite(_pin.panelDC, HIGH); // DC High + digitalWrite(_pin.panelCS, LOW); // CS Low + if (_family == FAMILY_LARGE) + { + if (_pin.panelCSS != NOT_CONNECTED) + { + digitalWrite(_pin.panelCSS, LOW); // CSS Low + delayMicroseconds(450); // 450 + 50 = 500 + } + } + delayMicroseconds(50); + for (uint32_t i = 0; i < size; i++) + { + SPI.transfer(data[i]); + } + delayMicroseconds(50); + if (_family == FAMILY_LARGE) + { + if (_pin.panelCSS != NOT_CONNECTED) + { + delayMicroseconds(450); // 450 + 50 = 500 + digitalWrite(_pin.panelCSS, HIGH); + } + } + digitalWrite(_pin.panelCS, HIGH); // CS High +} + +// Software SPI Master protocol setup +void hV_Board::b_sendIndexDataMaster(uint8_t index, const uint8_t * data, uint32_t size) +{ + if (_pin.panelCSS != NOT_CONNECTED) + { + digitalWrite(_pin.panelCSS, HIGH); // CS slave HIGH + } + digitalWrite(_pin.panelDC, LOW); // DC Low = Command + digitalWrite(_pin.panelCS, LOW); // CS Low = Select + delayMicroseconds(500); + SPI.transfer(index); + delayMicroseconds(500); + digitalWrite(_pin.panelCS, HIGH); // CS High = Unselect + digitalWrite(_pin.panelDC, HIGH); // DC High = Data + digitalWrite(_pin.panelCS, LOW); // CS Low = Select + delayMicroseconds(500); + + for (uint32_t i = 0; i < size; i++) + { + SPI.transfer(data[i]); + } + delayMicroseconds(500); + digitalWrite(_pin.panelCS, HIGH); // CS High= Unselect +} + +// Software SPI Slave protocol setup +void hV_Board::b_sendIndexDataSlave(uint8_t index, const uint8_t * data, uint32_t size) +{ + digitalWrite(_pin.panelCS, HIGH); // CS Master High + digitalWrite(_pin.panelDC, LOW); // DC Low= Command + if (_pin.panelCSS != NOT_CONNECTED) + { + digitalWrite(_pin.panelCSS, LOW); // CS slave LOW + } + + delayMicroseconds(500); + SPI.transfer(index); + delayMicroseconds(500); + + if (_pin.panelCSS != NOT_CONNECTED) + { + digitalWrite(_pin.panelCSS, HIGH); // CS slave HIGH + } + + digitalWrite(_pin.panelDC, HIGH); // DC High = Data + + if (_pin.panelCSS != NOT_CONNECTED) + { + digitalWrite(_pin.panelCSS, LOW); // CS slave LOW + } + + delayMicroseconds(500); + + for (uint32_t i = 0; i < size; i++) + { + SPI.transfer(data[i]); + } + delayMicroseconds(500); + if (_pin.panelCSS != NOT_CONNECTED) + { + digitalWrite(_pin.panelCSS, HIGH); // CS slave HIGH + } +} + +void hV_Board::b_sendCommand8(uint8_t command) +{ + digitalWrite(_pin.panelDC, LOW); + digitalWrite(_pin.panelCS, LOW); + + SPI.transfer(command); + + digitalWrite(_pin.panelCS, HIGH); +} + +void hV_Board::b_sendCommandData8(uint8_t command, uint8_t data) +{ + digitalWrite(_pin.panelDC, LOW); // LOW = command + digitalWrite(_pin.panelCS, LOW); + + SPI.transfer(command); + + digitalWrite(_pin.panelDC, HIGH); // HIGH = data + SPI.transfer(data); + + digitalWrite(_pin.panelCS, HIGH); +} + +// +// === Miscellaneous section +// +pins_t hV_Board::getBoardPins() +{ + return _pin; +} +// +// === End of Miscellaneous section +// diff --git a/src/hV_Board.h b/src/hV_Board.h new file mode 100755 index 0000000..263ace4 --- /dev/null +++ b/src/hV_Board.h @@ -0,0 +1,155 @@ +/// +/// @file hV_Board.h +/// @brief Driver for Pervasive Displays EXT3, EXT3-1 and EXT3-Touch boards +/// +/// @details Project Pervasive Displays Library Suite +/// @n Based on highView technology +/// +/// * Edition: Advanced +/// +/// @author Rei Vilo +/// @date 21 Aug 2023 +/// @version 700 +/// +/// @copyright (c) Rei Vilo, 2010-2023 +/// @copyright All rights reserved +/// +/// * Evaluation edition: for professionals or organisations, no commercial usage +/// * Commercial edition: for professionals or organisations, commercial usage +/// + +// SDK +#include "hV_HAL_Peripherals.h" + +// Configuration +#include "hV_Configuration.h" + +#ifndef hV_BOARD_RELEASE +/// +/// @brief Library release number +/// +#define hV_BOARD_RELEASE 700 + +// Objects +// +/// +/// @brief Class for Pervasive Displays EXT3, EXT3-1 and EXT3-Touch boards +/// @details Functions for EXT3 board +/// * GPIO +/// * SPI for LCD and external Flash and SRAM memory +/// * I2C for touch and haptic feedback +/// +class hV_Board +{ + public: + /// + /// @brief Constructor + /// + hV_Board(); + + /// + /// @brief Get the pins of the board + /// @return pins_t pins of the board + /// + pins_t getBoardPins(); + + /// @cond + protected: + + /// + /// @brief Initialisation + /// @param board board configuration + /// @param family screen family, default = FAMILY_SMALL + /// @param delayCS delay for /CS, default = 50 ms + /// @note Typical values are + /// + FAMILY_SMALL and 0 ms + /// + FAMILY_MEDIUM and 50 ms + /// + FAMILY_LARGE and 50 ms + /// + void b_begin(pins_t board, uint8_t family = FAMILY_SMALL, uint16_t delayCS = 50); + + /// + /// @brief General reset + /// @param ms1 delay after PNLON_PIN, ms + /// @param ms2 delay after RESET_PIN HIGH, ms + /// @param ms3 delay after RESET_PIN LOW, ms + /// @param ms4 delay after RESET_PIN HIGH, ms + /// @param ms5 delay after CS_PIN CSS_PIN HIGH, ms + /// + void b_reset(uint32_t ms1, uint32_t ms2, uint32_t ms3, uint32_t ms4, uint32_t ms5); + + /// + /// @brief Send fixed value through SPI + /// @param index register + /// @param data data, one byte covers 8 pixels + /// @param len number of bytes + /// @note Valid for all except large screens + /// + void b_sendIndexFixed(uint8_t index, uint8_t data, uint32_t len); + + /// + /// @brief Send data through SPI + /// @param index register + /// @param data data + /// @param size number of bytes + /// @note On large screens, b_sendIndexData() sends to both sub-panels + /// + void b_sendIndexData(uint8_t index, const uint8_t * data, uint32_t size); + + /// + /// @brief Send data through SPI to first half of large screens + /// @param index register + /// @param data data + /// @param size number of bytes + /// @note Valid only for 9.7 and 12.20" screens + /// + void b_sendIndexDataMaster(uint8_t index, const uint8_t * data, uint32_t size); + + /// @brief Send data through SPI to second half of large screens + /// @param index register + /// @param data data + /// @param size number of bytes + /// @note Valid only for 9.7 and 12.20" screens + /// + void b_sendIndexDataSlave(uint8_t index, const uint8_t * data, uint32_t size); + + /// + /// @brief Wait for ready + /// @details Wait for panelBusy low + /// + void b_waitBusy(); + + /// + /// @brief Send a command + /// @param command command + /// @note If needed, set panelCS HIGH manually after + /// + void b_sendCommand8(uint8_t command); + + /// + /// @brief Send a command and ane byte of data + /// @param command command + /// @param data uint8_t data + /// @note panelDC is kept high, to be changed manually after + /// + void b_sendCommandData8(uint8_t command, uint8_t data); + + /// + /// @brief Suspend + /// + void b_suspend(); + + /// + /// @brief Resume + /// + void b_resume(); + + pins_t _pin; + uint16_t _delayCS = 50; // ms + uint8_t _family; + + /// @endcond +}; + +#endif // hV_BOARD_RELEASE + diff --git a/src/hV_Colours565.h b/src/hV_Colours565.h index aad4a20..bff1240 100755 --- a/src/hV_Colours565.h +++ b/src/hV_Colours565.h @@ -14,11 +14,7 @@ /// // SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +#include "hV_HAL_Peripherals.h" #ifndef hV_COLOURS_RELEASE /// diff --git a/src/hV_Configuration.h b/src/hV_Configuration.h index 919bbbc..591212f 100755 --- a/src/hV_Configuration.h +++ b/src/hV_Configuration.h @@ -19,8 +19,8 @@ /// * 11. Set storage mode, not implemented /// /// @author Rei Vilo -/// @date 31 Aug 2023 -/// @version 614 +/// @date 21 Sep 2023 +/// @version 700 /// /// @copyright (c) Rei Vilo, 2010-2023 /// @copyright All rights reserved @@ -39,552 +39,45 @@ /// // SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +#include "hV_HAL_Peripherals.h" -// Constants -#include "hV_Constants.h" +// List of constants +#include "hV_List_Constants.h" -#if (hV_CONSTANTS_RELEASE < 607) -#error Required hV_CONSTANTS_RELEASE 607 -#endif // hV_CONSTANTS_RELEASE +// List of boards +#include "hV_List_Boards.h" -#ifndef hV_CONFIGURATION_RELEASE -/// -/// @brief Release -/// -#define hV_CONFIGURATION_RELEASE 614 - -/// -/// @name 1- List of supported Pervasive Displays screens -/// -/// @note Legacy screens are listed in the corresponding screen libraries -/// @{ -/// -#define eScreen_EPD_EXT3_t uint32_t ///< screen type - -/// -/// * Monochrome screens -/// @note Global update mode -/// @see https://www.pervasivedisplays.com/products/ -/// -#define eScreen_EPD_EXT3_154 (uint32_t)0x1500 ///< reference xE2154CSxxx -#define eScreen_EPD_EXT3_213 (uint32_t)0x2100 ///< reference xE2213CSxxx -#define eScreen_EPD_EXT3_266 (uint32_t)0x2600 ///< reference xE2266CSxxx -#define eScreen_EPD_EXT3_271 (uint32_t)0x2700 ///< reference xE2271CSxxx -#define eScreen_EPD_EXT3_287 (uint32_t)0x2800 ///< reference xE2287CSxxx -#define eScreen_EPD_EXT3_290 (uint32_t)0x2900 ///< reference xE2290CSxxx -#define eScreen_EPD_EXT3_370 (uint32_t)0x3700 ///< reference xE2370CSxxx -#define eScreen_EPD_EXT3_417 (uint32_t)0x4100 ///< reference xE2417CSxxx -#define eScreen_EPD_EXT3_437 (uint32_t)0x4300 ///< reference xE2437CSxxx -#define eScreen_EPD_EXT3_565 (uint32_t)0x5600 ///< reference xE2565CSxxx -#define eScreen_EPD_EXT3_581 (uint32_t)0x580B ///< reference xE2581CS0Bx -#define eScreen_EPD_EXT3_741 (uint32_t)0x740B ///< reference xE2741CS0Bx -#define eScreen_EPD_EXT3_969 (uint32_t)0x960B ///< reference xE2969CS0Bx -#define eScreen_EPD_EXT3_B98 (uint32_t)0xB90B ///< reference xE2B98CS0Bx - -/// -/// * Colour black-white-red screens -/// @note Global update mode -/// @see https://www.pervasivedisplays.com/products/ -/// -#define eScreen_EPD_EXT3_154_BWR (uint32_t)0x101500 ///< reference xE2154CSxxx -#define eScreen_EPD_EXT3_213_BWR (uint32_t)0x102100 ///< reference xE2213CSxxx -#define eScreen_EPD_EXT3_266_BWR (uint32_t)0x102600 ///< reference xE2266CSxxx -#define eScreen_EPD_EXT3_271_BWR (uint32_t)0x102700 ///< reference xE2271CSxxx -#define eScreen_EPD_EXT3_287_BWR (uint32_t)0x102800 ///< reference xE2287CSxxx -#define eScreen_EPD_EXT3_290_BWR (uint32_t)0x102900 ///< reference xE2290CSxxx -#define eScreen_EPD_EXT3_370_BWR (uint32_t)0x103700 ///< reference xE2370CSxxx -#define eScreen_EPD_EXT3_417_BWR (uint32_t)0x104100 ///< reference xE2417CSxxx -#define eScreen_EPD_EXT3_437_BWR (uint32_t)0x104300 ///< reference xE2437CSxxx -#define eScreen_EPD_EXT3_565_BWR (uint32_t)0x105600 ///< reference xE2565CSxxx -#define eScreen_EPD_EXT3_581_0B_BWR (uint32_t)0x10580B ///< reference xE2581CS0Bx -#define eScreen_EPD_EXT3_741_0B_BWR (uint32_t)0x10740B ///< reference xE2741CS0Bx -#define eScreen_EPD_EXT3_969_0B_BWR (uint32_t)0x10960B ///< reference xE2969CS0Bx -#define eScreen_EPD_EXT3_B98_0B_BWR (uint32_t)0x10B90B ///< reference xE2B98CS0Bx - -/// -/// * Colour black-white-red-yellow screens -/// @note Global update mode -/// @see https://www.pervasivedisplays.com/products/ -/// -#define eScreen_EPD_EXT3_154_BWRY (uint32_t)0x20150F ///< reference xE2154QS0Fx -#define eScreen_EPD_EXT3_213_BWRY (uint32_t)0x20210F ///< reference xE2213QS0Fx -#define eScreen_EPD_EXT3_266_BWRY (uint32_t)0x20260F ///< reference xE2266QS0Fx +// List of screens +#include "hV_List_Screens.h" -/// * Monochrome touch screens with embedded fast update -/// @note Global and fast update modes -/// @deprecated Partial update is deprecated. Use fast update instead (6.1.0). -/// @see https://www.pervasivedisplays.com/products/?_sft_etc_itc=tp -/// -#define eScreen_EPD_EXT3_271_09_Touch (uint32_t)0x032709 ///< reference xTP271PGH0x -#define eScreen_EPD_EXT3_270_09_Touch (uint32_t)0x032709 ///< reference xTP270PGH0x, legacy name -#define eScreen_EPD_EXT3_370_0C_Touch (uint32_t)0x03370C ///< reference xTP370PGH0x -#define eScreen_EPD_EXT3_270_Touch (uint32_t)0x032709 ///< reference xTP270PGH0x, legacy name -#define eScreen_EPD_EXT3_271_Touch (uint32_t)0x032709 ///< reference xTP271PGH0x, legacy name -#define eScreen_EPD_EXT3_370_Touch (uint32_t)0x03370C ///< reference xTP370PGH0x, legacy name +// Checks +#if (hV_LIST_CONSTANTS_RELEASE < 700) +#error Required hV_LIST_CONSTANTS_RELEASE 700 +#endif // hV_LIST_CONSTANTS_RELEASE -/// * Monochrome screens with embedded fast update -/// @note Global and fast update modes -/// @see https://www.pervasivedisplays.com/products/?_sft_etc_itc=pu -/// -#define eScreen_EPD_EXT3_154_0C_Fast (uint32_t)0x01150C ///< reference xE2154PS0Cx -#define eScreen_EPD_EXT3_213_0E_Fast (uint32_t)0x01210E ///< reference xE2213PS0Ex -#define eScreen_EPD_EXT3_266_0C_Fast (uint32_t)0x01260C ///< reference xE2266PS0Cx -#define eScreen_EPD_EXT3_271_09_Fast (uint32_t)0x012709 ///< reference xE2271PS09x -#define eScreen_EPD_EXT3_270_09_Fast (uint32_t)0x012709 ///< reference xE2271PS09x, legacy name -#define eScreen_EPD_EXT3_287_09_Fast (uint32_t)0x012809 ///< reference xE2287PS09x -#define eScreen_EPD_EXT3_370_0C_Fast (uint32_t)0x01370C ///< reference xE2370PS0Cx -#define eScreen_EPD_EXT3_417_0D_Fast (uint32_t)0x01410D ///< reference xE2417PS0Dx -#define eScreen_EPD_EXT3_437_0C_Fast (uint32_t)0x01430C ///< reference xE2437PS0Cx -/// @todo eScreen_EPD_EXT3_581_0B_Fast not tested -#define eScreen_EPD_EXT3_581_0B_Fast (uint32_t)0x01580B ///< reference xE2581PS0Bx, not tested -/// @todo eScreen_EPD_EXT3_741_0B_Fast not tested -#define eScreen_EPD_EXT3_741_0B_Fast (uint32_t)0x01740B ///< reference xE2741PS0Bx, not tested -/// @todo eScreen_EPD_EXT3_969_0B_Fast not tested -#define eScreen_EPD_EXT3_969_0B_Fast (uint32_t)0x01960B ///< reference xE2969PS0Bx, not tested -/// @todo eScreen_EPD_EXT3_B98_0B_Fast not tested -#define eScreen_EPD_EXT3_B98_0B_Fast (uint32_t)0x01B90B ///< reference xE2B98PS0Bx, not tested +#if (hV_LIST_BOARDS_RELEASE < 700) +#error Required hV_LIST_BOARDS_RELEASE 700 +#endif // hV_LIST_BOARDS_RELEASE -/// * Monochrome screens with embedded fast update and wide temperature -/// @note Global and fast update modes -/// @see https://www.pervasivedisplays.com/products/?_sft_temperature_range=m15c-to-p60c -/// -#define eScreen_EPD_EXT3_154_0C_Wide (uint32_t)0x09150C ///< reference xE2154KS0Cx -#define eScreen_EPD_EXT3_213_0E_Wide (uint32_t)0x09210E ///< reference xE2213KS0Ex -#define eScreen_EPD_EXT3_266_0C_Wide (uint32_t)0x09260C ///< reference xE2266KS0Cx -#define eScreen_EPD_EXT3_271_09_Wide (uint32_t)0x092709 ///< reference xE2271KS09x -/// @todo eScreen_EPD_EXT3_287_09_Wide not tested -#define eScreen_EPD_EXT3_287_09_Wide (uint32_t)0x092809 ///< reference xE2287PS09x, not tested -#define eScreen_EPD_EXT3_370_0C_Wide (uint32_t)0x09370C ///< reference xE2370KS0Cx -#define eScreen_EPD_EXT3_417_0D_Wide (uint32_t)0x09410D ///< reference xE2417KS0Dx -/// @todo eScreen_EPD_EXT3_437_0C_Wide not tested -#define eScreen_EPD_EXT3_437_0C_Wide (uint32_t)0x09430C ///< reference xE2437KS0Cx, not tested -#define eScreen_EPD_EXT3_581_06_Wide (uint32_t)0x09580B ///< reference xE2581KS0Bx -/// @todo eScreen_EPD_EXT3_741_0B_Wide not tested -#define eScreen_EPD_EXT3_741_0B_Wide (uint32_t)0x09740B ///< reference xE2741KS0Bx, not tested -/// @todo eScreen_EPD_EXT3_969_0B_Wide not tested -#define eScreen_EPD_EXT3_969_0B_Wide (uint32_t)0x09960B ///< reference xE2969KS0Bx, not tested -/// @todo eScreen_EPD_EXT3_B98_0B_Wide not tested -#define eScreen_EPD_EXT3_B98_0B_Wide (uint32_t)0x09B90B ///< reference xE2B98KS0Bx, not tested - -/// -/// @brief Frame-buffer sizes -/// @details Frame-buffer size = width * height / 8 * depth, uint32_t -/// @n Depth = 2 for black-white-red screens and monochrome screens -/// -#define frameSize_EPD_EXT3_150 (uint32_t)(10000) -#define frameSize_EPD_EXT3_154 (uint32_t)(5776) -#define frameSize_EPD_EXT3_213 (uint32_t)(5512) -#define frameSize_EPD_EXT3_266 (uint32_t)(11248) -#define frameSize_EPD_EXT3_270 (uint32_t)(11616) ///< legacy name -#define frameSize_EPD_EXT3_271 (uint32_t)(11616) -#define frameSize_EPD_EXT3_287 (uint32_t)(9472) -#define frameSize_EPD_EXT3_370 (uint32_t)(24960) -#define frameSize_EPD_EXT3_417 (uint32_t)(30000) -#define frameSize_EPD_EXT3_437 (uint32_t)(21120) -#define frameSize_EPD_EXT3_565 (uint32_t)(33600) -#define frameSize_EPD_EXT3_581 (uint32_t)(46080) -#define frameSize_EPD_EXT3_741 (uint32_t)(96000) -#define frameSize_EPD_EXT3_969 (uint32_t)(161280) -#define frameSize_EPD_EXT3_B98 (uint32_t)(184320) -/// @} - -/// -/// @name 2- List of pre-configured boards -/// @{ - -/// -/// @brief Not connected pin -/// -#define NOT_CONNECTED (uint8_t)0xff - -/// -/// @brief Board configuration structure -/// -struct pins_t -{ - // ///< EXT3 and EXT3-1 pin 1 Black -> +3.3V - // ///< EXT3 and EXT3-1 pin 2 Brown -> SPI SCK - uint8_t panelBusy; ///< EXT3 and EXT3-1 pin 3 Red - uint8_t panelDC; ///< EXT3 and EXT3-1 pin 4 Orange - uint8_t panelReset; ///< EXT3 and EXT3-1 pin 5 Yellow - // ///< EXT3 and EXT3-1 pin 6 Green -> SPI MISO - // ///< EXT3 and EXT3-1 pin 7 Blue -> SPI MOSI - uint8_t flashCS; ///< EXT3 and EXT3-1 pin 8 Violet - uint8_t panelCS; ///< EXT3 and EXT3-1 pin 9 Grey - // ///< EXT3 and EXT3-1 pin 10 White -> GROUND - uint8_t panelCSS; ///< EXT3 and EXT3-1 pin 12 Grey2 - uint8_t flashCSS; ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 - // ///< EXT3-Touch pin 1 Brown -> I2C SDA - // ///< EXT3-Touch pin 2 Black -> I2C SCL - uint8_t touchInt; ///< EXT3-Touch pin 3 Red - uint8_t touchReset; ///< EXT3-Touch pin 4 Orange - uint8_t panelPower; ///< Optional power circuit - uint8_t cardCS; ///< Separate SD-card board - uint8_t cardDetect; ///< Separate SD-card board -}; - -/// * Recommended boards - -/// -/// @brief Raspberry Pi Pico and Pico W -/// @note Numbers refer to GPIOs, not pins -/// @see https://github.com/earlephilhower/arduino-pico -/// @note Recommended board -/// -const pins_t boardRaspberryPiPico_RP2040 = -{ - ///< EXT3 and EXT3-1 pin 1 Black -> +3.3V - ///< EXT3 and EXT3-1 pin 2 Brown -> SPI SCK GP18 - .panelBusy = 13, ///< EXT3 and EXT3-1 pin 3 Red -> GP13 - .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> GP12 - .panelReset = 11, ///< EXT3 and EXT3-1 pin 5 Yellow -> GP11 - ///< EXT3 and EXT3-1 pin 6 Green -> SPI MISO GP16 - ///< EXT3 and EXT3-1 pin 7 Blue -> SPI MOSI GP19 - .flashCS = 10, ///< EXT3 and EXT3-1 pin 8 Violet -> GP10 - .panelCS = 17, ///< EXT3 and EXT3-1 pin 9 Grey -> GP17 - .panelCSS = 14, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GP14 - .flashCSS = 15, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GP15 - ///< EXT3 and EXT3-1 pin 10 White -> GROUND - ///< EXT3-Touch pin 1 Brown -> I2C SDA GP5 - ///< EXT3-Touch pin 2 Black -> I2C SCL GP4 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GP2 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GP3 - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief Adafruit Feather nRF52840 configuration, tested -/// @note Recommended board -/// -const pins_t boardFeatherNRF52840 = -{ - .panelBusy = 13, ///< EXT3 and EXT3-1 pin 3 Red -> D13 GPIO13 - .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> D12 GPIO12 - .panelReset = 11, ///< EXT3 and EXT3-1 pin 5 Yellow -> D11 GPIO11 - .flashCS = 10, ///< EXT3 and EXT3-1 pin 8 Violet -> D10 GPIO10 - .panelCS = 9, ///< EXT3 and EXT3-1 pin 9 Grey -> D9 GPIO9 - .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 - .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> D5 GPIO5 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> D6 GPIO6 - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief Espressif ESP32-DevKitC -/// @note Numbers refer to GPIOs not pins -/// @note Recommended board -/// @warning Specific SPI port with SCK=14 MISO=12 MOSI=13 -/// -const pins_t boardESP32DevKitC = -{ - ///< EXT3 and EXT3-1 pin 1 Black -> +3.3V - ///< EXT3 and EXT3-1 pin 2 Brown -> SPI SCK GPIO14 - .panelBusy = 27, ///< EXT3 and EXT3-1 pin 3 Red -> GPIO27 - .panelDC = 26, ///< EXT3 and EXT3-1 pin 4 Orange -> GPIO26 - .panelReset = 25, ///< EXT3 and EXT3-1 pin 5 Yellow -> GPIO25 - ///< EXT3 and EXT3-1 pin 6 Green -> SPI MISO GPIO12 - ///< EXT3 and EXT3-1 pin 7 Blue -> SPI MOSI GPIO13 - .flashCS = 33, ///< EXT3 and EXT3-1 pin 8 Violet -> GPIO33 - .panelCS = 32, ///< EXT3 and EXT3-1 pin 9 Grey -> GPIO32 - .panelCSS = 4, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GPIO4 - .flashCSS = 0, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GPIO0 - ///< EXT3 and EXT3-1 pin 10 White -> GROUND - ///< EXT3-Touch pin 1 Brown -> I2C SDA GPIO21 - ///< EXT3-Touch pin 2 Black -> I2C SCL GPIO22 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GPIO10 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GPIO9 - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// * Other boards - -/// -/// @brief Texas Instruments LaunchPad MSP430 and MSP432 LaunchPad configuration, tested -/// -const pins_t boardLaunchPad = -{ - .panelBusy = 11, ///< EXT3 and EXT3-1 pin 3 Red - .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange - .panelReset = 13, ///< EXT3 and EXT3-1 pin 5 Yellow - .flashCS = 18, ///< EXT3 and EXT3-1 pin 8 Violet - .panelCS = 19, ///< EXT3 and EXT3-1 pin 9 Grey - .panelCSS = 39, ///< EXT3 and EXT3-1 pin 12 Grey2 -> 39 - .flashCSS = 38, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> 38 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> 8 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> 6 - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board -> 5 - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief Texas Instruments LaunchPad MSP430FR5994 LaunchPad with SD-card configuration, tested -/// -const pins_t boardMSP430FR5994 = -{ - .panelBusy = 11, ///< EXT3 and EXT3-1 pin 3 Red - .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange - .panelReset = 13, ///< EXT3 and EXT3-1 pin 5 Yellow - .flashCS = 18, ///< EXT3 and EXT3-1 pin 8 Violet - .panelCS = 19, ///< EXT3 and EXT3-1 pin 9 Grey - .panelCSS = 39, ///< EXT3 and EXT3-1 pin 12 Grey2 - .flashCSS = 38, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = 47, ///< Included SD-card - .cardDetect = 51 ///< Included SD-card -}; - -/// -/// @brief Texas Instruments LaunchPad CC1352 configuration, tested -/// -const pins_t boardCC1352 = -{ - .panelBusy = 5, ///< EXT3 and EXT3-1 pin 3 Red - .panelDC = 6, ///< EXT3 and EXT3-1 pin 4 Orange - .panelReset = 19, ///< EXT3 and EXT3-1 pin 5 Yellow - .flashCS = 24, ///< EXT3 and EXT3-1 pin 8 Violet - .panelCS = 26, ///< EXT3 and EXT3-1 pin 9 Grey - .panelCSS = 37, ///< EXT3 and EXT3-1 pin 12 Grey2 -> 37 - .flashCSS = 27, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> 27 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief Raspberry Pi Zero, 2B, 3B, 4B configuration with RasPiArduino, tested -/// @warning Not recommended -/// @see https://github.com/me-no-dev/RasPiArduino -/// -const pins_t boardRaspberryPiZeroB_RasPiArduino = -{ - .panelBusy = 7, ///< EXT3 and EXT3-1 pin 3 Red -> GPIO7 pin 26 - .panelDC = 8, ///< EXT3 and EXT3-1 pin 4 Orange -> GPIO8 pin 24 - .panelReset = 25, ///< EXT3 and EXT3-1 pin 5 Yellow -> GPIO25 pin 22 - .flashCS = 22, ///< EXT3 and EXT3-1 pin 8 Violet -> GPIO22 pin 15 - .panelCS = 27, ///< EXT3 and EXT3-1 pin 9 Grey -> GPIO27 pin 13 - .panelCSS = 23, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GPIO23 pin 16 - .flashCSS = 24, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GPIO24 pin 18 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief Raspberry Pi Pico Arduino mbed configuration, tested -/// @warning Not recommended -/// @see https://github.com/arduino/ArduinoCore-mbed -/// -const pins_t boardRaspberryPiPico_Arduino = -{ - .panelBusy = 13, ///< EXT3 and EXT3-1 pin 3 Red -> GP13 - .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> GP12 - .panelReset = 11, ///< EXT3 and EXT3-1 pin 5 Yellow -> GP11 - .flashCS = 10, ///< EXT3 and EXT3-1 pin 8 Violet -> GP10 - .panelCS = 5, ///< EXT3 and EXT3-1 pin 9 Grey -> GP5 - .panelCSS = 14, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GP14 - .flashCSS = 15, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GP15 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GP9 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GP8 - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief Adafruit Feather M0 and M4 configuration, tested -/// -const pins_t boardFeatherM0M4 = -{ - .panelBusy = 13, ///< EXT3 and EXT3-1 pin 3 Red -> D13 GPIO13 - .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> D12 GPIO12 - .panelReset = 11, ///< EXT3 and EXT3-1 pin 5 Yellow -> D11 GPIO11 - .flashCS = 10, ///< EXT3 and EXT3-1 pin 8 Violet -> D10 GPIO10 - .panelCS = 9, ///< EXT3 and EXT3-1 pin 9 Grey -> D9 GPIO9 - .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 - .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> D5 GPIO5 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> D6 GPIO6 - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief Adafruit Feather nRF52832 configuration, tested -/// -const pins_t boardFeatherNRF52832 = -{ - .panelBusy = 16, ///< EXT3 and EXT3-1 pin 3 Red -> D13 GPIO16 - .panelDC = 15, ///< EXT3 and EXT3-1 pin 4 Orange -> D12 GPIO15 - .panelReset = 7, ///< EXT3 and EXT3-1 pin 5 Yellow -> D11 GPIO7 - .flashCS = 11, ///< EXT3 and EXT3-1 pin 8 Violet -> D10 GPI011 - .panelCS = 31, ///< EXT3 and EXT3-1 pin 9 Grey -> D9 GPIO31 - .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 - .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> D5 GPIO27 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> D6 GPIO30 - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief Arduino Zero configuration, tested -/// @note In case of use of SERCOM -/// @code {.cpp} -/// #define SPI_CLOCK_PIN 13 ///< EXT3 and EXT3-1 pin 2 -> 13 -/// #define SPI_CLOCK_MISO 11 ///< EXT3 and EXT3-1 pin 6 -> 11 -/// #define SPI_CLOCK_MOSI 12 ///< EXT3 and EXT3-1 pin 7 -> 12 -/// @endcode -/// -const pins_t boardArduinoZero = -{ - .panelBusy = 4, ///< EXT3 and EXT3-1 pin 3 Red - // On Arduino Zero, pins D4 and D2 are reversed - .panelDC = 5, ///< EXT3 and EXT3-1 pin 4 Orange - .panelReset = 6, ///< EXT3 and EXT3-1 pin 5 Yellow - .flashCS = 7, ///< EXT3 and EXT3-1 pin 8 Violet - .panelCS = 8, ///< EXT3 and EXT3-1 pin 9 Grey - .panelCSS = 9, ///< EXT3 and EXT3-1 pin 12 Grey2 - .flashCSS = 10, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// -/// @brief ST Nucleo 64, tested -/// -const pins_t boardNucleo64 = boardArduinoZero; - -/// -/// @brief Particle Photon configuration, tested -/// @note D6 also CLK/SWCLK with D7 SWD/SWDIO -/// -const pins_t boardParticlePhoton = -{ - .panelBusy = 5, ///< EXT3 and EXT3-1 pin 3 Red -> D5 - .panelDC = 4, ///< EXT3 and EXT3-1 pin 4 Orange -> D4 - .panelReset = 3, ///< EXT3 and EXT3-1 pin 5 Yellow -> D3 - .flashCS = 2, ///< EXT3 and EXT3-1 pin 8 Violet -> D2 - .panelCS = 1, ///< EXT3 and EXT3-1 pin 9 Grey -> D1 - .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 -> D6 - .flashCSS = 0, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> D0 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; +#if (hV_LIST_SCREENS_RELEASE < 700) +#error Required hV_LIST_SCREENS_RELEASE 700 +#endif // hV_LIST_SCREENS_RELEASE +#ifndef hV_CONFIGURATION_RELEASE /// -/// @brief RedBear Duo configuration, tested +/// @brief Release /// -const pins_t boardRedBearDuo = boardParticlePhoton; +#define hV_CONFIGURATION_RELEASE 700 /// -/// @brief Espressif ESP32-Pico-v4 -/// @note Numbers refer to GPIOs not pins -/// @warning Specific SPI port with SCK=14 MISO=12 MOSI=13 -/// -const pins_t boardESP32PicoKitV4 = -{ - .panelBusy = 27, ///< EXT3 and EXT3-1 pin 3 Red -> GPIO27 - .panelDC = 26, ///< EXT3 and EXT3-1 pin 4 Orange -> GPIO26 - .panelReset = 25, ///< EXT3 and EXT3-1 pin 5 Yellow -> GPIO25 - .flashCS = 33, ///< EXT3 and EXT3-1 pin 8 Violet -> GPIO33 - .panelCS = 32, ///< EXT3 and EXT3-1 pin 9 Grey -> GPIO32 - .panelCSS = 4, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GPIO4 - .flashCSS = 0, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GPIO0 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GPIO10 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GPIO9 - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - +/// @name 1- List of supported Pervasive Displays screens +/// @see hV_List_Screens.h /// -/// @brief Espressif ESP32-Pico-DevKitM-2 -/// @note Numbers refer to GPIOs not pins -/// @warning Specific SPI port with SCK=14 MISO=12 MOSI=13 -/// -const pins_t boardESP32PicoDevKitM2 = -{ - .panelBusy = 25, ///< EXT3 and EXT3-1 pin 3 Red -> GPIO25 - .panelDC = 26, ///< EXT3 and EXT3-1 pin 4 Orange -> GPIO26 - .panelReset = 32, ///< EXT3 and EXT3-1 pin 5 Yellow -> GPIO32 - .flashCS = 33, ///< EXT3 and EXT3-1 pin 8 Violet -> GPIO33 - .panelCS = 27, ///< EXT3 and EXT3-1 pin 9 Grey -> GPIO27 - .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GPIO33 - .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GPIO27 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GPIO19 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GPIO8 - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; /// -/// @brief Seeed Xiao RP240 -/// @note Numbers refer to GPIOs not pins -/// -const pins_t boardXiaoRP2040 -{ - .panelBusy = 26, ///< EXT3 and EXT3-1 pin 3 Red -> D0 GPIO26 - .panelDC = 27, ///< EXT3 and EXT3-1 pin 4 Orange -> D1 GPIO27 - .panelReset = 28, ///< EXT3 and EXT3-1 pin 5 Yellow -> D2 GPIO28 - .flashCS = 6, ///< EXT3 and EXT3-1 pin 8 Violet -> D4 GPIO6 - .panelCS = 29, ///< EXT3 and EXT3-1 pin 9 Grey -> D3 GPIO29 - .panelCSS = 7, ///< EXT3 and EXT3-1 pin 12 Grey2 -> D5 GPIO7 - .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> N/A - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> D6 GPIO0 - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> D7 GPIO1 - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - +/// @name 2- List of pre-configured boards +/// @see hV_List_Boards.h /// -/// @brief Teensy 3.x configuration, tested -/// -const pins_t boardTeensy3x = -{ - .panelBusy = 14, ///< EXT3 and EXT3-1 pin 3 Red - .panelDC = 15, ///< EXT3 and EXT3-1 pin 4 Orange - .panelReset = 16, ///< EXT3 and EXT3-1 pin 5 Yellow - .flashCS = 17, ///< EXT3 and EXT3-1 pin 8 Violet - .panelCS = 18, ///< EXT3 and EXT3-1 pin 9 Grey - .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 - .flashCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 20 Black2 - .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red - .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange - .panelPower = NOT_CONNECTED, ///< Optional power circuit - .cardCS = NOT_CONNECTED, ///< Separate SD-card board - .cardDetect = NOT_CONNECTED, ///< Separate SD-card board -}; - -/// @} /// /// @name 3- Set font mode @@ -709,3 +202,4 @@ const pins_t boardTeensy3x = /// @} #endif // hV_CONFIGURATION_RELEASE + diff --git a/src/hV_Documentation.h b/src/hV_Documentation.h index 368b39f..554374c 100755 --- a/src/hV_Documentation.h +++ b/src/hV_Documentation.h @@ -41,8 +41,8 @@ /// Additionally, the **[Wiki](https://docs.pervasivedisplays.com/)** provides a gradual introduction to the e-paper technology and how to use it. /// /// @author Rei Vilo -/// @date 31 Aug 2023 -/// @version 614 +/// @date 21 Sep 2023 +/// @version 700 /// /// @copyright © Rei Vilo, 2010-2023 /// @copyright All rights reserved @@ -56,6 +56,9 @@ /// * Commercial edition: for professionals or organisations, commercial usage /// @n All rights reserved /// +/// * Viewer edition: for professionals or organisations +/// @n All rights reserved +/// /// * Documentation /// @n All rights reserved /// diff --git a/src/hV_Font.h b/src/hV_Font.h index 3b21fb9..e4f5578 100755 --- a/src/hV_Font.h +++ b/src/hV_Font.h @@ -36,11 +36,7 @@ /// // SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +#include "hV_HAL_Peripherals.h" // Configuration #include "hV_Configuration.h" diff --git a/src/hV_Font_Terminal.cpp b/src/hV_Font_Terminal.cpp index e7808ad..e2e4a9d 100755 --- a/src/hV_Font_Terminal.cpp +++ b/src/hV_Font_Terminal.cpp @@ -29,55 +29,55 @@ // Code // Font functions //hV_Font_Terminal::hV_Font_Terminal() -void hV_Font_Terminal::_f_begin() +void hV_Font_Terminal::f_begin() { - _f_fontSize = 0; - _f_fontNumber = MAX_FONT_SIZE; - _f_fontSolid = true; - _f_fontSpaceX = 1; + f_fontSize = 0; + f_fontNumber = MAX_FONT_SIZE; + f_fontSolid = true; + f_fontSpaceX = 1; // Take first font - _f_selectFont(0); + f_selectFont(0); } -uint8_t hV_Font_Terminal::_f_addFont(font_s fontName) +uint8_t hV_Font_Terminal::f_addFont(font_s fontName) { - return _f_fontNumber; + return f_fontNumber; } -void hV_Font_Terminal::_f_setFontSolid(bool flag) +void hV_Font_Terminal::f_setFontSolid(bool flag) { - _f_fontSolid = flag; + f_fontSolid = flag; } -void hV_Font_Terminal::_f_selectFont(uint8_t size) +void hV_Font_Terminal::f_selectFont(uint8_t size) { if (size < MAX_FONT_SIZE) { - _f_fontSize = size; + f_fontSize = size; } else { - _f_fontSize = MAX_FONT_SIZE - 1; + f_fontSize = MAX_FONT_SIZE - 1; } - switch (_f_fontSize) + switch (f_fontSize) { case 0: // kind, height, maxWidth, first, number - _f_font = { 0x40, 8, 6, 32, 224 }; + f_font = { 0x40, 8, 6, 32, 224 }; break; case 1: - _f_font = { 0x40, 12, 8, 32, 224 }; + f_font = { 0x40, 12, 8, 32, 224 }; break; case 2: - _f_font = { 0x40, 16, 12, 32, 224 }; + f_font = { 0x40, 16, 12, 32, 224 }; break; case 3: - _f_font = { 0x40, 24, 16, 32, 224 }; + f_font = { 0x40, 24, 16, 32, 224 }; break; default: @@ -85,40 +85,40 @@ void hV_Font_Terminal::_f_selectFont(uint8_t size) } } -uint8_t hV_Font_Terminal::_f_fontMax() +uint8_t hV_Font_Terminal::f_fontMax() { return MAX_FONT_SIZE; } -void hV_Font_Terminal::_f_setFontSpaceX(uint8_t number) +void hV_Font_Terminal::f_setFontSpaceX(uint8_t number) { - _f_fontSpaceX = number; + f_fontSpaceX = number; } -void hV_Font_Terminal::_f_setFontSpaceY(uint8_t number) +void hV_Font_Terminal::f_setFontSpaceY(uint8_t number) { - _f_fontSpaceY = number; + f_fontSpaceY = number; } -uint8_t hV_Font_Terminal::_f_getCharacter(uint8_t character, uint16_t index) +uint8_t hV_Font_Terminal::f_getCharacter(uint8_t character, uint16_t index) { #if (MAX_FONT_SIZE > 0) - if (_f_fontSize == 0) + if (f_fontSize == 0) { return Terminal6x8e[character][index]; } #if (MAX_FONT_SIZE > 1) - else if (_f_fontSize == 1) + else if (f_fontSize == 1) { return Terminal8x12e[character][index]; } #if (MAX_FONT_SIZE > 2) - else if (_f_fontSize == 2) + else if (f_fontSize == 2) { return Terminal12x16e[character][index]; } #if (MAX_FONT_SIZE > 3) - else if (_f_fontSize == 3) + else if (f_fontSize == 3) { return Terminal16x24e[character][index]; } @@ -132,27 +132,27 @@ uint8_t hV_Font_Terminal::_f_getCharacter(uint8_t character, uint16_t index) #endif // end MAX_FONT_SIZE > 0 } -uint16_t hV_Font_Terminal::_f_characterSizeX(uint8_t character) +uint16_t hV_Font_Terminal::f_characterSizeX(uint8_t character) { - return _f_font.maxWidth; + return f_font.maxWidth; } -uint16_t hV_Font_Terminal::_f_characterSizeY() +uint16_t hV_Font_Terminal::f_characterSizeY() { - return _f_font.height; + return f_font.height; } -uint16_t hV_Font_Terminal::_f_stringSizeX(String text) +uint16_t hV_Font_Terminal::f_stringSizeX(String text) { - return (uint16_t) text.length() * _f_font.maxWidth; + return (uint16_t) text.length() * f_font.maxWidth; } -uint8_t hV_Font_Terminal::_f_stringLengthToFitX(String text, uint16_t pixels) +uint8_t hV_Font_Terminal::f_stringLengthToFitX(String text, uint16_t pixels) { uint8_t index = 0; // Monospaced font - index = pixels / _f_font.maxWidth - 1; + index = pixels / f_font.maxWidth - 1; if (index > text.length()) { index = text.length(); @@ -160,13 +160,13 @@ uint8_t hV_Font_Terminal::_f_stringLengthToFitX(String text, uint16_t pixels) return index; } -uint8_t hV_Font_Terminal::_f_getFontKind() +uint8_t hV_Font_Terminal::f_getFontKind() { - return _f_font.kind; // monospaced + return f_font.kind; // monospaced } -uint8_t hV_Font_Terminal::_f_getFontMaxWidth() +uint8_t hV_Font_Terminal::f_getFontMaxWidth() { - return _f_font.maxWidth; + return f_font.maxWidth; } #endif // USE_FONT_TERMINAL diff --git a/src/hV_Font_Terminal.h b/src/hV_Font_Terminal.h index d81c2cf..7b2b4df 100755 --- a/src/hV_Font_Terminal.h +++ b/src/hV_Font_Terminal.h @@ -26,11 +26,7 @@ /// // SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +#include "hV_HAL_Peripherals.h" // Configuration #include "hV_Configuration.h" @@ -85,7 +81,7 @@ class hV_Font_Terminal /// /// @brief Initialisation /// - void _f_begin(); + void f_begin(); /// /// @brief Select font @@ -93,7 +89,7 @@ class hV_Font_Terminal /// @warning Definition for this method is compulsory. /// @note Previously _setFontSize() /// - void _f_selectFont(uint8_t font); + void f_selectFont(uint8_t font); /// /// @brief Use a font @@ -103,28 +99,28 @@ class hV_Font_Terminal /// @note Previously setFontSize() /// @n @b More: @ref Fonts /// - uint8_t _f_addFont(font_s fontName); + uint8_t f_addFont(font_s fontName); /// /// @brief Set transparent or opaque text /// @param flag default = 1 = opaque = solid, false = transparent /// @warning Definition for this method is compulsory. /// - void _f_setFontSolid(bool flag = true); + void f_setFontSolid(bool flag = true); /// /// @brief Set additional pixels between two characters, horizontal axis /// @param number of spaces default = 1 pixel /// @warning Definition for this method is compulsory. /// - void _f_setFontSpaceX(uint8_t number = 1); + void f_setFontSpaceX(uint8_t number = 1); /// /// @brief Set additional pixels between two characters, vertical axis /// @param number of spaces default = 1 pixel /// @warning Definition for this method is compulsory. /// - void _f_setFontSpaceY(uint8_t number = 1); + void f_setFontSpaceY(uint8_t number = 1); /// /// @brief Character size, x-axis @@ -135,7 +131,7 @@ class hV_Font_Terminal /// @note Previously fontSizeX() /// @n @b More: @ref Fonts /// - uint16_t _f_characterSizeX(uint8_t character = 0x00); + uint16_t f_characterSizeX(uint8_t character = 0x00); /// /// @brief Character size, y-axis @@ -143,7 +139,7 @@ class hV_Font_Terminal /// @note Previously fontSizeY() /// @n @b More: @ref Fonts /// - uint16_t _f_characterSizeY(); + uint16_t f_characterSizeY(); /// /// @brief String size, x-axis @@ -151,7 +147,7 @@ class hV_Font_Terminal /// @return horizontal size of the string for current font, in pixels /// @n @b More: @ref Fonts /// - uint16_t _f_stringSizeX(String text); + uint16_t f_stringSizeX(String text); /// /// @brief Number of characters to fit a size, x-axis @@ -160,7 +156,7 @@ class hV_Font_Terminal /// @return number of characters to be displayed inside the pixels /// @n @b More: @ref Fonts /// - uint8_t _f_stringLengthToFitX(String text, uint16_t pixels); + uint8_t f_stringLengthToFitX(String text, uint16_t pixels); /// /// @brief Number of fonts @@ -168,19 +164,19 @@ class hV_Font_Terminal /// @note First font is numbered 0, second 1, ... /// @n The latest font is numbered fontMax()-1 /// - uint8_t _f_fontMax(); + uint8_t f_fontMax(); /// /// @brief Get selected font details /// @return font description /// - uint8_t _f_getFontKind(); + uint8_t f_getFontKind(); /// /// @brief Get selected font details /// @return maximum width in pixels from *width array /// - uint8_t _f_getFontMaxWidth(); + uint8_t f_getFontMaxWidth(); protected: /// @@ -189,18 +185,18 @@ class hV_Font_Terminal /// @param index column index /// @return definition for line of character /// - uint8_t _f_getCharacter(uint8_t character, uint16_t index); + uint8_t f_getCharacter(uint8_t character, uint16_t index); /// /// @name Variables for font management /// @{ /// - font_s _f_font; ///< font - uint8_t _f_fontNumber; ///< number of fonts available, 0.._fontNumber-1 - uint8_t _f_fontSize; ///< actual font selected - uint8_t _f_fontSpaceX; ///< pixels between two characters, horizontal axis - uint8_t _f_fontSpaceY; ///< pixels between two characters, vertical axis - bool _f_fontSolid; ///< + font_s f_font; ///< font + uint8_t f_fontNumber; ///< number of fonts available, 0.._fontNumber-1 + uint8_t f_fontSize; ///< actual font selected + uint8_t f_fontSpaceX; ///< pixels between two characters, horizontal axis + uint8_t f_fontSpaceY; ///< pixels between two characters, vertical axis + bool f_fontSolid; ///< }; /// @endcond diff --git a/src/hV_HAL_Peripherals.h b/src/hV_HAL_Peripherals.h new file mode 100755 index 0000000..4de7157 --- /dev/null +++ b/src/hV_HAL_Peripherals.h @@ -0,0 +1,53 @@ +/// +/// @file hV_HAL_Peripherals.h +/// @brief Light hardware abstraction layer for peripherals +/// +/// @details Project Pervasive Displays Library Suite +/// @n Based on highView technology +/// +/// @author Rei Vilo +/// @date 21 Sep 2023 +/// @version 700 +/// +/// @copyright (c) Rei Vilo, 2010-2023 +/// @copyright Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +/// +/// The highView Library Suite is shared under the Creative Commons licence Attribution-ShareAlike 4.0 International (CC BY-SA 4.0). +/// +/// * Basic edition: for hobbyists and for basic usage +/// @n Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +/// +/// @see https://creativecommons.org/licenses/by-sa/4.0/ +/// +/// @n Consider the Evaluation or Commercial editions for professionals or organisations and for commercial usage +/// + +#ifndef hV_HAL_PERIPHERALS_RELEASE +/// +/// @brief Release +/// +#define hV_HAL_PERIPHERALS_RELEASE 700 + +/// +/// @brief SDK library +/// @see References +/// * Arduino SDK https://www.arduino.cc/reference/en/ +/// * Energia SDK https://energia.nu/reference/ +/// +#if defined(ENERGIA) // LaunchPad specific +#include "Energia.h" +#else // Arduino general +#include "Arduino.h" +#endif // SDK + +/// +/// @brief Other libraries +/// +#include +#include +#include + +#include "SPI.h" +#include "Wire.h" + +#endif // hV_HAL_PERIPHERALS_RELEASE \ No newline at end of file diff --git a/src/hV_List_Boards.h b/src/hV_List_Boards.h new file mode 100755 index 0000000..adea26d --- /dev/null +++ b/src/hV_List_Boards.h @@ -0,0 +1,430 @@ +/// +/// @file hV_List_Boards.h +/// @brief List of boards for Pervasive Displays Library Suite +/// +/// @details Project Pervasive Displays Library Suite +/// @n Based on highView technology +/// +/// @author Rei Vilo +/// @date 21 Sep 2023 +/// @version 700 +/// +/// @copyright (c) Rei Vilo, 2010-2023 +/// @copyright All rights reserved +/// +/// * Basic edition: for hobbyists and for basic usage +/// @n Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +/// +/// * Evaluation edition: for professionals or organisations, evaluation only, no commercial usage +/// @n All rights reserved +/// +/// * Commercial edition: for professionals or organisations, commercial usage +/// @n All rights reserved +/// + +// SDK +#include "stdint.h" + +#ifndef hV_LIST_BOARDS_RELEASE +/// +/// @brief Release +/// +#define hV_LIST_BOARDS_RELEASE 700 + +/// +/// @brief Not connected pin +/// +#define NOT_CONNECTED (uint8_t)0xff + +/// +/// @brief Board configuration structure +/// +struct pins_t +{ + // ///< EXT3 and EXT3-1 pin 1 Black -> +3.3V + // ///< EXT3 and EXT3-1 pin 2 Brown -> SPI SCK + uint8_t panelBusy; ///< EXT3 and EXT3-1 pin 3 Red + uint8_t panelDC; ///< EXT3 and EXT3-1 pin 4 Orange + uint8_t panelReset; ///< EXT3 and EXT3-1 pin 5 Yellow + // ///< EXT3 and EXT3-1 pin 6 Green -> SPI MISO + // ///< EXT3 and EXT3-1 pin 7 Blue -> SPI MOSI + uint8_t flashCS; ///< EXT3 and EXT3-1 pin 8 Violet + uint8_t panelCS; ///< EXT3 and EXT3-1 pin 9 Grey + // ///< EXT3 and EXT3-1 pin 10 White -> GROUND + uint8_t panelCSS; ///< EXT3 and EXT3-1 pin 12 Grey2 + uint8_t flashCSS; ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 + // ///< EXT3-Touch pin 1 Brown -> I2C SDA + // ///< EXT3-Touch pin 2 Black -> I2C SCL + uint8_t touchInt; ///< EXT3-Touch pin 3 Red + uint8_t touchReset; ///< EXT3-Touch pin 4 Orange + uint8_t panelPower; ///< Optional power circuit + uint8_t cardCS; ///< Separate SD-card board + uint8_t cardDetect; ///< Separate SD-card board +}; + +/// +/// @name Recommended boards +/// @{ + +/// +/// @brief Raspberry Pi Pico and Pico W +/// @note Numbers refer to GPIOs, not pins +/// @see https://github.com/earlephilhower/arduino-pico +/// @note Recommended board +/// +const pins_t boardRaspberryPiPico_RP2040 = +{ + ///< EXT3 and EXT3-1 pin 1 Black -> +3.3V + ///< EXT3 and EXT3-1 pin 2 Brown -> SPI SCK GP18 + .panelBusy = 13, ///< EXT3 and EXT3-1 pin 3 Red -> GP13 + .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> GP12 + .panelReset = 11, ///< EXT3 and EXT3-1 pin 5 Yellow -> GP11 + ///< EXT3 and EXT3-1 pin 6 Green -> SPI MISO GP16 + ///< EXT3 and EXT3-1 pin 7 Blue -> SPI MOSI GP19 + .flashCS = 10, ///< EXT3 and EXT3-1 pin 8 Violet -> GP10 + .panelCS = 17, ///< EXT3 and EXT3-1 pin 9 Grey -> GP17 + .panelCSS = 14, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GP14 + .flashCSS = 15, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GP15 + ///< EXT3 and EXT3-1 pin 10 White -> GROUND + ///< EXT3-Touch pin 1 Brown -> I2C SDA GP5 + ///< EXT3-Touch pin 2 Black -> I2C SCL GP4 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GP2 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GP3 + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Adafruit Feather nRF52840 configuration, tested +/// @note Recommended board +/// +const pins_t boardFeatherNRF52840 = +{ + .panelBusy = 13, ///< EXT3 and EXT3-1 pin 3 Red -> D13 GPIO13 + .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> D12 GPIO12 + .panelReset = 11, ///< EXT3 and EXT3-1 pin 5 Yellow -> D11 GPIO11 + .flashCS = 10, ///< EXT3 and EXT3-1 pin 8 Violet -> D10 GPIO10 + .panelCS = 9, ///< EXT3 and EXT3-1 pin 9 Grey -> D9 GPIO9 + .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 + .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> D5 GPIO5 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> D6 GPIO6 + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Espressif ESP32-DevKitC +/// @note Numbers refer to GPIOs not pins +/// @note Recommended board +/// @warning Specific SPI port with SCK=14 MISO=12 MOSI=13 +/// +const pins_t boardESP32DevKitC = +{ + ///< EXT3 and EXT3-1 pin 1 Black -> +3.3V + ///< EXT3 and EXT3-1 pin 2 Brown -> SPI SCK GPIO14 + .panelBusy = 27, ///< EXT3 and EXT3-1 pin 3 Red -> GPIO27 + .panelDC = 26, ///< EXT3 and EXT3-1 pin 4 Orange -> GPIO26 + .panelReset = 25, ///< EXT3 and EXT3-1 pin 5 Yellow -> GPIO25 + ///< EXT3 and EXT3-1 pin 6 Green -> SPI MISO GPIO12 + ///< EXT3 and EXT3-1 pin 7 Blue -> SPI MOSI GPIO13 + .flashCS = 33, ///< EXT3 and EXT3-1 pin 8 Violet -> GPIO33 + .panelCS = 32, ///< EXT3 and EXT3-1 pin 9 Grey -> GPIO32 + .panelCSS = 4, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GPIO4 + .flashCSS = 0, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GPIO0 + ///< EXT3 and EXT3-1 pin 10 White -> GROUND + ///< EXT3-Touch pin 1 Brown -> I2C SDA GPIO21 + ///< EXT3-Touch pin 2 Black -> I2C SCL GPIO22 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GPIO10 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GPIO9 + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// @} + +/// +/// @name Other boards +/// @{ + +/// +/// @brief Texas Instruments LaunchPad MSP430 and MSP432 LaunchPad configuration, tested +/// +const pins_t boardLaunchPad = +{ + .panelBusy = 11, ///< EXT3 and EXT3-1 pin 3 Red + .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange + .panelReset = 13, ///< EXT3 and EXT3-1 pin 5 Yellow + .flashCS = 18, ///< EXT3 and EXT3-1 pin 8 Violet + .panelCS = 19, ///< EXT3 and EXT3-1 pin 9 Grey + .panelCSS = 39, ///< EXT3 and EXT3-1 pin 12 Grey2 -> 39 + .flashCSS = 38, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> 38 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> 8 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> 6 + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board -> 5 + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Texas Instruments LaunchPad MSP430FR5994 LaunchPad with SD-card configuration, tested +/// +const pins_t boardMSP430FR5994 = +{ + .panelBusy = 11, ///< EXT3 and EXT3-1 pin 3 Red + .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange + .panelReset = 13, ///< EXT3 and EXT3-1 pin 5 Yellow + .flashCS = 18, ///< EXT3 and EXT3-1 pin 8 Violet + .panelCS = 19, ///< EXT3 and EXT3-1 pin 9 Grey + .panelCSS = 39, ///< EXT3 and EXT3-1 pin 12 Grey2 + .flashCSS = 38, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = 47, ///< Included SD-card + .cardDetect = 51 ///< Included SD-card +}; + +/// +/// @brief Texas Instruments LaunchPad CC1352 configuration, tested +/// +const pins_t boardCC1352 = +{ + .panelBusy = 5, ///< EXT3 and EXT3-1 pin 3 Red + .panelDC = 6, ///< EXT3 and EXT3-1 pin 4 Orange + .panelReset = 19, ///< EXT3 and EXT3-1 pin 5 Yellow + .flashCS = 24, ///< EXT3 and EXT3-1 pin 8 Violet + .panelCS = 26, ///< EXT3 and EXT3-1 pin 9 Grey + .panelCSS = 37, ///< EXT3 and EXT3-1 pin 12 Grey2 -> 37 + .flashCSS = 27, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> 27 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Raspberry Pi Zero, 2B, 3B, 4B configuration with RasPiArduino, tested +/// @warning Not recommended +/// @see https://github.com/me-no-dev/RasPiArduino +/// +const pins_t boardRaspberryPiZeroB_RasPiArduino = +{ + .panelBusy = 7, ///< EXT3 and EXT3-1 pin 3 Red -> GPIO7 pin 26 + .panelDC = 8, ///< EXT3 and EXT3-1 pin 4 Orange -> GPIO8 pin 24 + .panelReset = 25, ///< EXT3 and EXT3-1 pin 5 Yellow -> GPIO25 pin 22 + .flashCS = 22, ///< EXT3 and EXT3-1 pin 8 Violet -> GPIO22 pin 15 + .panelCS = 27, ///< EXT3 and EXT3-1 pin 9 Grey -> GPIO27 pin 13 + .panelCSS = 23, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GPIO23 pin 16 + .flashCSS = 24, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GPIO24 pin 18 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Raspberry Pi Pico Arduino mbed configuration, tested +/// @warning Not recommended +/// @see https://github.com/arduino/ArduinoCore-mbed +/// +const pins_t boardRaspberryPiPico_Arduino = +{ + .panelBusy = 13, ///< EXT3 and EXT3-1 pin 3 Red -> GP13 + .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> GP12 + .panelReset = 11, ///< EXT3 and EXT3-1 pin 5 Yellow -> GP11 + .flashCS = 10, ///< EXT3 and EXT3-1 pin 8 Violet -> GP10 + .panelCS = 5, ///< EXT3 and EXT3-1 pin 9 Grey -> GP5 + .panelCSS = 14, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GP14 + .flashCSS = 15, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GP15 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GP9 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GP8 + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Adafruit Feather M0 and M4 configuration, tested +/// +const pins_t boardFeatherM0M4 = +{ + .panelBusy = 13, ///< EXT3 and EXT3-1 pin 3 Red -> D13 GPIO13 + .panelDC = 12, ///< EXT3 and EXT3-1 pin 4 Orange -> D12 GPIO12 + .panelReset = 11, ///< EXT3 and EXT3-1 pin 5 Yellow -> D11 GPIO11 + .flashCS = 10, ///< EXT3 and EXT3-1 pin 8 Violet -> D10 GPIO10 + .panelCS = 9, ///< EXT3 and EXT3-1 pin 9 Grey -> D9 GPIO9 + .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 + .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> D5 GPIO5 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> D6 GPIO6 + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Adafruit Feather nRF52832 configuration, tested +/// +const pins_t boardFeatherNRF52832 = +{ + .panelBusy = 16, ///< EXT3 and EXT3-1 pin 3 Red -> D13 GPIO16 + .panelDC = 15, ///< EXT3 and EXT3-1 pin 4 Orange -> D12 GPIO15 + .panelReset = 7, ///< EXT3 and EXT3-1 pin 5 Yellow -> D11 GPIO7 + .flashCS = 11, ///< EXT3 and EXT3-1 pin 8 Violet -> D10 GPI011 + .panelCS = 31, ///< EXT3 and EXT3-1 pin 9 Grey -> D9 GPIO31 + .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 + .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> D5 GPIO27 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> D6 GPIO30 + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Arduino Zero configuration, tested +/// @note In case of use of SERCOM +/// @code {.cpp} +/// #define SPI_CLOCK_PIN 13 ///< EXT3 and EXT3-1 pin 2 -> 13 +/// #define SPI_CLOCK_MISO 11 ///< EXT3 and EXT3-1 pin 6 -> 11 +/// #define SPI_CLOCK_MOSI 12 ///< EXT3 and EXT3-1 pin 7 -> 12 +/// @endcode +/// +const pins_t boardArduinoZero = +{ + .panelBusy = 4, ///< EXT3 and EXT3-1 pin 3 Red + // On Arduino Zero, pins D4 and D2 are reversed + .panelDC = 5, ///< EXT3 and EXT3-1 pin 4 Orange + .panelReset = 6, ///< EXT3 and EXT3-1 pin 5 Yellow + .flashCS = 7, ///< EXT3 and EXT3-1 pin 8 Violet + .panelCS = 8, ///< EXT3 and EXT3-1 pin 9 Grey + .panelCSS = 9, ///< EXT3 and EXT3-1 pin 12 Grey2 + .flashCSS = 10, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief ST Nucleo 64, tested +/// +const pins_t boardNucleo64 = boardArduinoZero; + +/// +/// @brief Particle Photon configuration, tested +/// @note D6 also CLK/SWCLK with D7 SWD/SWDIO +/// +const pins_t boardParticlePhoton = +{ + .panelBusy = 5, ///< EXT3 and EXT3-1 pin 3 Red -> D5 + .panelDC = 4, ///< EXT3 and EXT3-1 pin 4 Orange -> D4 + .panelReset = 3, ///< EXT3 and EXT3-1 pin 5 Yellow -> D3 + .flashCS = 2, ///< EXT3 and EXT3-1 pin 8 Violet -> D2 + .panelCS = 1, ///< EXT3 and EXT3-1 pin 9 Grey -> D1 + .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 -> D6 + .flashCSS = 0, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> D0 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief RedBear Duo configuration, tested +/// +const pins_t boardRedBearDuo = boardParticlePhoton; + +/// +/// @brief Espressif ESP32-Pico-v4 +/// @note Numbers refer to GPIOs not pins +/// @warning Specific SPI port with SCK=14 MISO=12 MOSI=13 +/// +const pins_t boardESP32PicoKitV4 = +{ + .panelBusy = 27, ///< EXT3 and EXT3-1 pin 3 Red -> GPIO27 + .panelDC = 26, ///< EXT3 and EXT3-1 pin 4 Orange -> GPIO26 + .panelReset = 25, ///< EXT3 and EXT3-1 pin 5 Yellow -> GPIO25 + .flashCS = 33, ///< EXT3 and EXT3-1 pin 8 Violet -> GPIO33 + .panelCS = 32, ///< EXT3 and EXT3-1 pin 9 Grey -> GPIO32 + .panelCSS = 4, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GPIO4 + .flashCSS = 0, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GPIO0 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GPIO10 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GPIO9 + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Espressif ESP32-Pico-DevKitM-2 +/// @note Numbers refer to GPIOs not pins +/// @warning Specific SPI port with SCK=14 MISO=12 MOSI=13 +/// +const pins_t boardESP32PicoDevKitM2 = +{ + .panelBusy = 25, ///< EXT3 and EXT3-1 pin 3 Red -> GPIO25 + .panelDC = 26, ///< EXT3 and EXT3-1 pin 4 Orange -> GPIO26 + .panelReset = 32, ///< EXT3 and EXT3-1 pin 5 Yellow -> GPIO32 + .flashCS = 33, ///< EXT3 and EXT3-1 pin 8 Violet -> GPIO33 + .panelCS = 27, ///< EXT3 and EXT3-1 pin 9 Grey -> GPIO27 + .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 -> GPIO33 + .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> GPIO27 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> GPIO19 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> GPIO8 + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Seeed Xiao RP240 +/// @note Numbers refer to GPIOs not pins +/// +const pins_t boardXiaoRP2040 +{ + .panelBusy = 26, ///< EXT3 and EXT3-1 pin 3 Red -> D0 GPIO26 + .panelDC = 27, ///< EXT3 and EXT3-1 pin 4 Orange -> D1 GPIO27 + .panelReset = 28, ///< EXT3 and EXT3-1 pin 5 Yellow -> D2 GPIO28 + .flashCS = 6, ///< EXT3 and EXT3-1 pin 8 Violet -> D4 GPIO6 + .panelCS = 29, ///< EXT3 and EXT3-1 pin 9 Grey -> D3 GPIO29 + .panelCSS = 7, ///< EXT3 and EXT3-1 pin 12 Grey2 -> D5 GPIO7 + .flashCSS = NOT_CONNECTED, ///< EXT3 pin 20 or EXT3-1 pin 11 Black2 -> N/A + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red -> D6 GPIO0 + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange -> D7 GPIO1 + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// +/// @brief Teensy 3.x configuration, tested +/// +const pins_t boardTeensy3x = +{ + .panelBusy = 14, ///< EXT3 and EXT3-1 pin 3 Red + .panelDC = 15, ///< EXT3 and EXT3-1 pin 4 Orange + .panelReset = 16, ///< EXT3 and EXT3-1 pin 5 Yellow + .flashCS = 17, ///< EXT3 and EXT3-1 pin 8 Violet + .panelCS = 18, ///< EXT3 and EXT3-1 pin 9 Grey + .panelCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 12 Grey2 + .flashCSS = NOT_CONNECTED, ///< EXT3 and EXT3-1 pin 20 Black2 + .touchInt = NOT_CONNECTED, ///< EXT3-Touch pin 3 Red + .touchReset = NOT_CONNECTED, ///< EXT3-Touch pin 4 Orange + .panelPower = NOT_CONNECTED, ///< Optional power circuit + .cardCS = NOT_CONNECTED, ///< Separate SD-card board + .cardDetect = NOT_CONNECTED, ///< Separate SD-card board +}; + +/// @} + +#endif // hV_LIST_BOARDS_RELEASE + diff --git a/src/hV_Constants.h b/src/hV_List_Constants.h similarity index 85% rename from src/hV_Constants.h rename to src/hV_List_Constants.h index c352a29..16cc155 100755 --- a/src/hV_Constants.h +++ b/src/hV_List_Constants.h @@ -1,13 +1,13 @@ /// -/// @file hV_Constants.h -/// @brief Constants for Pervasive Displays Library Suite +/// @file hV_List_Constants.h +/// @brief List of constants for Pervasive Displays Library Suite /// /// @details Project Pervasive Displays Library Suite /// @n Based on highView technology /// /// @author Rei Vilo -/// @date 21 Jun 2023 -/// @version 611 +/// @date 21 Sep 2023 +/// @version 700 /// /// @copyright (c) Rei Vilo, 2010-2023 /// @copyright All rights reserved @@ -25,17 +25,12 @@ // SDK #include "stdint.h" -#ifndef hV_CONSTANTS_RELEASE +#ifndef hV_LIST_CONSTANTS_RELEASE /// /// @brief Release /// -#define hV_CONSTANTS_RELEASE 611 +#define hV_LIST_CONSTANTS_RELEASE 700 -/// -/// @name 1- List of supported Pervasive Displays screens -/// @ -/// @note Legacy screens are listed in the corresponding screen libraries -/// @{ /// /// * General parameters /// @@ -57,7 +52,7 @@ /// /// @brief Update mode /// @note Numbers are sequential and exclusive -/// @deprecated Partial update is deprecated. Use fast update instead (6.1.0). +/// @deprecated Partial update is removed. Use fast update instead (7.0.0). /// @{ #define UPDATE_NONE 0x00 ///< No update #define UPDATE_GLOBAL 0x01 ///< Global update, default @@ -65,6 +60,15 @@ #define UPDATE_PARTIAL 0x03 ///< Partial update /// @} +/// +/// @brief Screens families +/// @note Numbers are sequential and exclusive +/// @{ +#define FAMILY_SMALL 0x01 ///< Small screens +#define FAMILY_MEDIUM 0x02 ///< Medium-sized screens +#define FAMILY_LARGE 0x03 ///< Large screens with two controllers +/// @} + /// /// @brief Large screens sub-panels selection /// @note Numbers are sequential and exclusive @@ -96,6 +100,7 @@ /// /// @brief Continuity mode state /// @note Numbers are sequential and exclusive +/// /// @{ #define CONTINUITY_OFF 0x00 ///< Non-activated #define CONTINUITY_ON 0x01 ///< Activated but not initialised @@ -105,6 +110,7 @@ /// /// @brief Touch events /// @note Numbers are sequential and exclusive +/// /// @{ #define TOUCH_EVENT_NONE 0 ///< No touch event #define TOUCH_EVENT_PRESS 1 ///< Touch press event @@ -116,6 +122,7 @@ /// /// @brief Results /// @note Numbers are sequential and exclusive +/// /// @{ #define RESULT_SUCCESS 0 ///< Success #define RESULT_ERROR 1 ///< Error @@ -131,5 +138,5 @@ /// @} /// -#endif // hV_CONSTANTS_RELEASE +#endif // hV_LIST_CONSTANTS_RELEASE diff --git a/src/hV_List_Screens.h b/src/hV_List_Screens.h new file mode 100644 index 0000000..98deeed --- /dev/null +++ b/src/hV_List_Screens.h @@ -0,0 +1,188 @@ +/// +/// @file hV_List_Screens.h +/// @brief List of supported Pervasive Displays screens +/// @note Legacy screens are listed in the corresponding screen libraries +/// +/// @details Project Pervasive Displays Library Suite +/// @n Based on highView technology +/// +/// @author Rei Vilo +/// @date 21 Sep 2023 +/// @version 700 +/// +/// @copyright (c) Rei Vilo, 2010-2023 +/// @copyright All rights reserved +/// +/// * Basic edition: for hobbyists and for basic usage +/// @n Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +/// +/// * Evaluation edition: for professionals or organisations, evaluation only, no commercial usage +/// @n All rights reserved +/// +/// * Commercial edition: for professionals or organisations, commercial usage +/// @n All rights reserved +/// + +// SDK +#include "stdint.h" + +#ifndef hV_LIST_SCREENS_RELEASE +/// +/// @brief Release +/// +#define hV_LIST_SCREENS_RELEASE 700 + +/// +/// @brief Screen type +/// +#define eScreen_EPD_EXT3_t uint32_t + +/// +/// @name Monochrome screens +/// @note Global update mode +/// @see https://www.pervasivedisplays.com/products/?_sft_etc_itc=itc&_sft_product_colour=black-white +/// @{ +/// +#define eScreen_EPD_EXT3_154 (uint32_t)0x1500 ///< reference xE2154CSxxx +#define eScreen_EPD_EXT3_213 (uint32_t)0x2100 ///< reference xE2213CSxxx +#define eScreen_EPD_EXT3_266 (uint32_t)0x2600 ///< reference xE2266CSxxx +#define eScreen_EPD_EXT3_271 (uint32_t)0x2700 ///< reference xE2271CSxxx +#define eScreen_EPD_EXT3_287 (uint32_t)0x2800 ///< reference xE2287CSxxx +#define eScreen_EPD_EXT3_290 (uint32_t)0x2900 ///< reference xE2290CSxxx +#define eScreen_EPD_EXT3_370 (uint32_t)0x3700 ///< reference xE2370CSxxx +#define eScreen_EPD_EXT3_417 (uint32_t)0x4100 ///< reference xE2417CSxxx +#define eScreen_EPD_EXT3_437 (uint32_t)0x4300 ///< reference xE2437CSxxx +#define eScreen_EPD_EXT3_565 (uint32_t)0x5600 ///< reference xE2565CSxxx +#define eScreen_EPD_EXT3_581 (uint32_t)0x580B ///< reference xE2581CS0Bx +#define eScreen_EPD_EXT3_741 (uint32_t)0x740B ///< reference xE2741CS0Bx +#define eScreen_EPD_EXT3_969 (uint32_t)0x960B ///< reference xE2969CS0Bx +#define eScreen_EPD_EXT3_B98 (uint32_t)0xB90B ///< reference xE2B98CS0Bx +/// @} + +/// +/// @name Colour black-white-red screens +/// @note Global update mode +/// @see https://www.pervasivedisplays.com/products/?_sft_etc_itc=itc&_sft_product_colour=black-white-red +/// @{ +/// +#define eScreen_EPD_EXT3_154_BWR (uint32_t)0x101500 ///< reference xE2154CSxxx +#define eScreen_EPD_EXT3_213_BWR (uint32_t)0x102100 ///< reference xE2213CSxxx +#define eScreen_EPD_EXT3_266_BWR (uint32_t)0x102600 ///< reference xE2266CSxxx +#define eScreen_EPD_EXT3_271_BWR (uint32_t)0x102700 ///< reference xE2271CSxxx +#define eScreen_EPD_EXT3_287_BWR (uint32_t)0x102800 ///< reference xE2287CSxxx +#define eScreen_EPD_EXT3_290_BWR (uint32_t)0x102900 ///< reference xE2290CSxxx +#define eScreen_EPD_EXT3_370_BWR (uint32_t)0x103700 ///< reference xE2370CSxxx +#define eScreen_EPD_EXT3_417_BWR (uint32_t)0x104100 ///< reference xE2417CSxxx +#define eScreen_EPD_EXT3_437_BWR (uint32_t)0x104300 ///< reference xE2437CSxxx +#define eScreen_EPD_EXT3_565_BWR (uint32_t)0x105600 ///< reference xE2565CSxxx +#define eScreen_EPD_EXT3_581_0B_BWR (uint32_t)0x10580B ///< reference xE2581CS0Bx +#define eScreen_EPD_EXT3_741_0B_BWR (uint32_t)0x10740B ///< reference xE2741CS0Bx +#define eScreen_EPD_EXT3_969_0B_BWR (uint32_t)0x10960B ///< reference xE2969CS0Bx +#define eScreen_EPD_EXT3_B98_0B_BWR (uint32_t)0x10B90B ///< reference xE2B98CS0Bx +/// @} + +/// +/// @name Colour black-white-red-yellow screens +/// @note Global update mode +/// @see https://www.pervasivedisplays.com/products/?_sft_etc_itc=itc&_sft_product_colour=black-white-red-yellow +/// @{ +/// +#define eScreen_EPD_EXT3_154_BWRY (uint32_t)0x20150F ///< reference xE2154QS0Fx +#define eScreen_EPD_EXT3_213_BWRY (uint32_t)0x20210F ///< reference xE2213QS0Fx +#define eScreen_EPD_EXT3_266_BWRY (uint32_t)0x20260F ///< reference xE2266QS0Fx +/// @} + +/// +/// @name Monochrome touch screens with embedded fast update +/// @note Global and fast update modes +/// @deprecated Partial update is removed. Use fast update instead (7.0.0). +/// @see https://www.pervasivedisplays.com/products +/// @{ +/// +#define eScreen_EPD_EXT3_271_09_Touch (uint32_t)0x032709 ///< reference xTP271PGH0x +#define eScreen_EPD_EXT3_270_09_Touch (uint32_t)0x032709 ///< reference xTP270PGH0x, legacy name +#define eScreen_EPD_EXT3_370_0C_Touch (uint32_t)0x03370C ///< reference xTP370PGH0x +#define eScreen_EPD_EXT3_270_Touch (uint32_t)0x032709 ///< reference xTP270PGH0x, legacy name +#define eScreen_EPD_EXT3_271_Touch (uint32_t)0x032709 ///< reference xTP271PGH0x, legacy name +#define eScreen_EPD_EXT3_370_Touch (uint32_t)0x03370C ///< reference xTP370PGH0x, legacy name +/// @} + +/// @name Monochrome screens with embedded fast update +/// @note Global and fast update modes +/// @see https://www.pervasivedisplays.com/products/?_sft_etc_itc=pu+itc +/// @{ +/// +#define eScreen_EPD_EXT3_154_0C_Fast (uint32_t)0x01150C ///< reference xE2154PS0Cx +#define eScreen_EPD_EXT3_213_0E_Fast (uint32_t)0x01210E ///< reference xE2213PS0Ex +#define eScreen_EPD_EXT3_266_0C_Fast (uint32_t)0x01260C ///< reference xE2266PS0Cx +#define eScreen_EPD_EXT3_271_09_Fast (uint32_t)0x012709 ///< reference xE2271PS09x +#define eScreen_EPD_EXT3_270_09_Fast (uint32_t)0x012709 ///< reference xE2271PS09x, legacy name +#define eScreen_EPD_EXT3_287_09_Fast (uint32_t)0x012809 ///< reference xE2287PS09x +#define eScreen_EPD_EXT3_370_0C_Fast (uint32_t)0x01370C ///< reference xE2370PS0Cx +#define eScreen_EPD_EXT3_417_0D_Fast (uint32_t)0x01410D ///< reference xE2417PS0Dx +#define eScreen_EPD_EXT3_437_0C_Fast (uint32_t)0x01430C ///< reference xE2437PS0Cx +/// @todo eScreen_EPD_EXT3_581_0B_Fast not tested +#define eScreen_EPD_EXT3_581_0B_Fast (uint32_t)0x01580B ///< reference xE2581PS0Bx, not tested +/// @todo eScreen_EPD_EXT3_741_0B_Fast not tested +#define eScreen_EPD_EXT3_741_0B_Fast (uint32_t)0x01740B ///< reference xE2741PS0Bx, not tested +/// @todo eScreen_EPD_EXT3_969_0B_Fast not tested +#define eScreen_EPD_EXT3_969_0B_Fast (uint32_t)0x01960B ///< reference xE2969PS0Bx, not tested +/// @todo eScreen_EPD_EXT3_B98_0B_Fast not tested +#define eScreen_EPD_EXT3_B98_0B_Fast (uint32_t)0x01B90B ///< reference xE2B98PS0Bx, not tested +/// @} + +/// @name Monochrome screens with embedded fast update and wide temperature +/// @note Global and fast update modes +/// @see https://www.pervasivedisplays.com/products/?_sft_etc_itc=pu+itc&_sft_temperature_range=m15c-to-p60c +/// @{ +/// +#define eScreen_EPD_EXT3_154_0C_Wide (uint32_t)0x09150C ///< reference xE2154KS0Cx +#define eScreen_EPD_EXT3_213_0E_Wide (uint32_t)0x09210E ///< reference xE2213KS0Ex +#define eScreen_EPD_EXT3_266_0C_Wide (uint32_t)0x09260C ///< reference xE2266KS0Cx +#define eScreen_EPD_EXT3_271_09_Wide (uint32_t)0x092709 ///< reference xE2271KS09x +/// @todo eScreen_EPD_EXT3_287_09_Wide not tested +#define eScreen_EPD_EXT3_287_09_Wide (uint32_t)0x092809 ///< reference xE2287PS09x, not tested +#define eScreen_EPD_EXT3_370_0C_Wide (uint32_t)0x09370C ///< reference xE2370KS0Cx +#define eScreen_EPD_EXT3_417_0D_Wide (uint32_t)0x09410D ///< reference xE2417KS0Dx +/// @todo eScreen_EPD_EXT3_437_0C_Wide not tested +#define eScreen_EPD_EXT3_437_0C_Wide (uint32_t)0x09430C ///< reference xE2437KS0Cx, not tested +#define eScreen_EPD_EXT3_581_06_Wide (uint32_t)0x09580B ///< reference xE2581KS0Bx +/// @todo eScreen_EPD_EXT3_741_0B_Wide not tested +#define eScreen_EPD_EXT3_741_0B_Wide (uint32_t)0x09740B ///< reference xE2741KS0Bx, not tested +/// @todo eScreen_EPD_EXT3_969_0B_Wide not tested +#define eScreen_EPD_EXT3_969_0B_Wide (uint32_t)0x09960B ///< reference xE2969KS0Bx, not tested +/// @todo eScreen_EPD_EXT3_B98_0B_Wide not tested +#define eScreen_EPD_EXT3_B98_0B_Wide (uint32_t)0x09B90B ///< reference xE2B98KS0Bx, not tested +/// @} + +/// +/// @name Frame-buffer sizes +/// @details +/// * Black-white-red screens and monochrome screens +/// @n Frame-buffer size = width * height / 8 * depth, uint32_t +/// @n Depth = 2 +/// * Black-white-red_yellow screens +/// @n Frame-buffer size = width * height / 4 * depth, uint32_t +/// @n Depth = 1 +/// @{ +/// +#define frameSize_EPD_EXT3_150 (uint32_t)(10000) ///< reference xE2150xS0xx +#define frameSize_EPD_EXT3_154 (uint32_t)(5776) ///< reference xE2154xS0xx +#define frameSize_EPD_EXT3_213 (uint32_t)(5512) ///< reference xE2213xS0xx +#define frameSize_EPD_EXT3_266 (uint32_t)(11248) ///< reference xE2266xS0xx +#define frameSize_EPD_EXT3_270 (uint32_t)(11616) ///< reference xE2271xS0xx, legacy name +#define frameSize_EPD_EXT3_271 (uint32_t)(11616) ///< reference xE2271xS0xx +#define frameSize_EPD_EXT3_287 (uint32_t)(9472) ///< reference xE2287xS0xx +#define frameSize_EPD_EXT3_290 (uint32_t)(16128) ///< reference xE2290xS0xx +#define frameSize_EPD_EXT3_370 (uint32_t)(24960) ///< reference xE2370xS0xx +#define frameSize_EPD_EXT3_417 (uint32_t)(30000) ///< reference xE2417xS0xx +#define frameSize_EPD_EXT3_437 (uint32_t)(21120) ///< reference xE2437xS0xx +#define frameSize_EPD_EXT3_565 (uint32_t)(33600) ///< reference xE2565xS0xx +#define frameSize_EPD_EXT3_581 (uint32_t)(46080) ///< reference xE2581xS0xx +#define frameSize_EPD_EXT3_741 (uint32_t)(96000) ///< reference xE2741xS0xx +#define frameSize_EPD_EXT3_969 (uint32_t)(161280) ///< reference xE2969xS0xx +#define frameSize_EPD_EXT3_B98 (uint32_t)(184320) ///< reference xE21198xS0xx +/// @} + +#endif // hV_LIST_SCREENS_RELEASE + diff --git a/src/hV_Screen_Buffer.cpp b/src/hV_Screen_Buffer.cpp index 385d4c2..c585cdd 100755 --- a/src/hV_Screen_Buffer.cpp +++ b/src/hV_Screen_Buffer.cpp @@ -25,16 +25,16 @@ // Code hV_Screen_Buffer::hV_Screen_Buffer() { - _f_fontSize = 0; - _f_fontNumber = 0; - _f_fontSolid = true; + f_fontSize = 0; + f_fontNumber = 0; + f_fontSolid = true; + f_fontSpaceX = 1; _penSolid = false; - _f_fontSpaceX = 1; } void hV_Screen_Buffer::begin() { - _f_begin(); // hV_font_... + f_begin(); // hV_font_... } void hV_Screen_Buffer::clear(uint16_t colour) @@ -99,14 +99,14 @@ uint16_t hV_Screen_Buffer::screenSizeX() case 1: case 3: - return _screenHeigth; // _maxX + return _screenSizeV; // _maxX break; // case 0: // case 2: default: - return _screenWidth; // _maxX + return _screenSizeH; // _maxX break; } return 0; @@ -119,14 +119,14 @@ uint16_t hV_Screen_Buffer::screenSizeY() case 1: case 3: - return _screenWidth; // _maxY + return _screenSizeH; // _maxY break; // case 0: // case 2: default: - return _screenHeigth; // _maxY + return _screenSizeV; // _maxY break; } return 0; @@ -514,39 +514,39 @@ void hV_Screen_Buffer::triangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t // Font functions void hV_Screen_Buffer::setFontSolid(bool flag) { - _f_setFontSolid(flag); + f_setFontSolid(flag); } uint8_t hV_Screen_Buffer::addFont(font_s fontName) { - return _f_addFont(fontName); + return f_addFont(fontName); } void hV_Screen_Buffer::selectFont(uint8_t font) { - _f_selectFont(font); + f_selectFont(font); } uint8_t hV_Screen_Buffer::getFont() { - return _f_fontSize; + return f_fontSize; } uint8_t hV_Screen_Buffer::fontMax() { - return _f_fontMax(); + return f_fontMax(); } uint16_t hV_Screen_Buffer::characterSizeX(uint8_t character) { uint16_t result = 0; - if ((_f_font.kind & 0x40) == 0x40) // Monospaced font + if ((f_font.kind & 0x40) == 0x40) // Monospaced font { - result = _f_font.maxWidth + _f_fontSpaceX; + result = f_font.maxWidth + f_fontSpaceX; } else { - result = _f_characterSizeX(character); + result = f_characterSizeX(character); } return result; @@ -554,32 +554,32 @@ uint16_t hV_Screen_Buffer::characterSizeX(uint8_t character) uint16_t hV_Screen_Buffer::characterSizeY() { - return _f_characterSizeY(); + return f_characterSizeY(); } uint16_t hV_Screen_Buffer::stringSizeX(String text) { - return _f_stringSizeX(text); + return f_stringSizeX(text); } uint8_t hV_Screen_Buffer::stringLengthToFitX(String text, uint16_t pixels) { - return _f_stringLengthToFitX(text, pixels); + return f_stringLengthToFitX(text, pixels); } void hV_Screen_Buffer::setFontSpaceX(uint8_t number) { - _f_setFontSpaceX(number); + f_setFontSpaceX(number); } void hV_Screen_Buffer::setFontSpaceY(uint8_t number) { - _f_setFontSpaceY(number); + f_setFontSpaceY(number); } uint8_t hV_Screen_Buffer::_getCharacter(uint8_t character, uint8_t index) { - return _f_getCharacter(character, index); + return f_getCharacter(character, index); } void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, @@ -593,7 +593,7 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, uint16_t x, y; uint8_t i, j, k; #if (MAX_FONT_SIZE > 0) - if (_f_fontSize == 0) + if (f_fontSize == 0) { for (k = 0; k < text.length(); k++) { @@ -601,14 +601,14 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, for (i = 0; i < 6; i++) { - line = _f_getCharacter(c, i); + line = f_getCharacter(c, i); for (j = 0; j < 8; j++) if (bitRead(line, j)) { point(x0 + 6 * k + i, y0 + j, textColour); } - else if (_f_fontSolid) + else if (f_fontSolid) { point(x0 + 6 * k + i, y0 + j, backColour); } @@ -616,7 +616,7 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, } } #if (MAX_FONT_SIZE > 1) - else if (_f_fontSize == 1) + else if (f_fontSize == 1) { for (k = 0; k < text.length(); k++) { @@ -624,8 +624,8 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, for (i = 0; i < 8; i++) { - line = _f_getCharacter(c, 2 * i); - line1 = _f_getCharacter(c, 2 * i + 1); + line = f_getCharacter(c, 2 * i); + line1 = f_getCharacter(c, 2 * i + 1); for (j = 0; j < 8; j++) { @@ -633,7 +633,7 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, { point(x0 + 8 * k + i, y0 + j, textColour); } - else if (_f_fontSolid) + else if (f_fontSolid) { point(x0 + 8 * k + i, y0 + j, backColour); } @@ -641,7 +641,7 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, { point(x0 + 8 * k + i, y0 + 8 + j, textColour); } - else if ((_f_fontSolid) and (j < 4)) + else if ((f_fontSolid) and (j < 4)) { point(x0 + 8 * k + i, y0 + 8 + j, backColour); } @@ -650,7 +650,7 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, } } #if (MAX_FONT_SIZE > 2) - else if (_f_fontSize == 2) + else if (f_fontSize == 2) { for (k = 0; k < text.length(); k++) @@ -659,8 +659,8 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, for (i = 0; i < 12; i++) { - line = _f_getCharacter(c, 2 * i); - line1 = _f_getCharacter(c, 2 * i + 1); + line = f_getCharacter(c, 2 * i); + line1 = f_getCharacter(c, 2 * i + 1); for (j = 0; j < 8; j++) { @@ -668,7 +668,7 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, { point(x0 + 12 * k + i, y0 + j, textColour); } - else if (_f_fontSolid) + else if (f_fontSolid) { point(x0 + 12 * k + i, y0 + j, backColour); } @@ -676,7 +676,7 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, { point(x0 + 12 * k + i, y0 + 8 + j, textColour); } - else if (_f_fontSolid) + else if (f_fontSolid) { point(x0 + 12 * k + i, y0 + 8 + j, backColour); } @@ -685,23 +685,23 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, } } #if (MAX_FONT_SIZE > 3) - else if (_f_fontSize == 3) + else if (f_fontSize == 3) { for (k = 0; k < text.length(); k++) { c = text.charAt(k) - ' '; for (i = 0; i < 16; i++) { - line = _f_getCharacter(c, 3 * i); - line1 = _f_getCharacter(c, 3 * i + 1); - line2 = _f_getCharacter(c, 3 * i + 2); + line = f_getCharacter(c, 3 * i); + line1 = f_getCharacter(c, 3 * i + 1); + line2 = f_getCharacter(c, 3 * i + 2); for (j = 0; j < 8; j++) { if (bitRead(line, j)) { point(x0 + 16 * k + i, y0 + j, textColour); } - else if (_f_fontSolid) + else if (f_fontSolid) { point(x0 + 16 * k + i, y0 + j, backColour); } @@ -709,7 +709,7 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, { point(x0 + 16 * k + i, y0 + 8 + j, textColour); } - else if (_f_fontSolid) + else if (f_fontSolid) { point(x0 + 16 * k + i, y0 + 8 + j, backColour); } @@ -717,7 +717,7 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, { point(x0 + 16 * k + i, y0 + 16 + j, textColour); } - else if (_f_fontSolid) + else if (f_fontSolid) { point(x0 + 16 * k + i, y0 + 16 + j, backColour); } @@ -731,3 +731,4 @@ void hV_Screen_Buffer::gText(uint16_t x0, uint16_t y0, #endif // end MAX_FONT_SIZE > 0 } #endif // FONT_MODE + diff --git a/src/hV_Screen_Buffer.h b/src/hV_Screen_Buffer.h index 4c9b80d..c943e40 100755 --- a/src/hV_Screen_Buffer.h +++ b/src/hV_Screen_Buffer.h @@ -1,13 +1,13 @@ /// /// @file hV_Screen_Buffer.h -/// @brief Class Generic LCD with buffer class library +/// @brief Generic buffered screen class library /// /// @details Project Pervasive Displays Library Suite /// @n Based on highView technology /// /// @author Rei Vilo -/// @date 21 Jul 2023 -/// @version 612 +/// @date 21 Sep 2023 +/// @version 700 /// /// @copyright (c) Rei Vilo, 2010-2023 /// @copyright Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) @@ -23,11 +23,7 @@ /// // SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +#include "hV_HAL_Peripherals.h" // Configuration #include "hV_Configuration.h" @@ -36,7 +32,7 @@ /// /// @brief Library release number /// -#define hV_SCREEN_BUFFER_RELEASE 612 +#define hV_SCREEN_BUFFER_RELEASE 700 // Other libraries #include "hV_Colours565.h" @@ -50,7 +46,8 @@ #endif // FONT_MODE /// -/// @brief Generic class for buffered LCD +/// @brief Generic buffered screen class +/// @details This class provides the text and graphic primitives for the buffered screen /// #warning USE_hV_SCREEN == USE_hV_SCREEN_SELF #warning FONT_MODE == USE_FONT_TERMINAL @@ -110,15 +107,15 @@ class hV_Screen_Buffer : protected hV_Font_Terminal uint8_t getOrientation(); /// - /// @brief Screen size, x-axis - /// @return horizontal size of the screen, in pixels + /// @brief Screen size, x-axis of logical screen + /// @return x-axis size of the screen, in pixels /// @note 240 means 240 pixels and thus 0..239 coordinates (decimal) /// virtual uint16_t screenSizeX(); /// - /// @brief Screen size, y-axis - /// @return vertical size of the screen, in pixels + /// @brief Screen size, y-axis of logical screen + /// @return y-axis size of the screen, in pixels /// @note 240 means 240 pixels and thus 0..239 coordinates (decimal) /// virtual uint16_t screenSizeY(); @@ -397,9 +394,9 @@ class hV_Screen_Buffer : protected hV_Font_Terminal uint8_t _getCharacter(uint8_t character, uint8_t index); // Variables provided by hV_Screen_Virtual - bool _penSolid; - uint16_t _screenWidth, _screenHeigth, _screenDiagonal; - uint8_t _orientation; + bool _penSolid, _flagRead, _flagStorage, _flagEnergy; + uint16_t _screenSizeH, _screenSizeV, _screenDiagonal, _screenMarginH, _screenMarginV; + uint8_t _orientation, _intensity; uint16_t _screenColourBits; /// @endcond }; diff --git a/src/hV_Utilities.cpp b/src/hV_Utilities.cpp index 78620a2..5c643b6 100755 --- a/src/hV_Utilities.cpp +++ b/src/hV_Utilities.cpp @@ -12,6 +12,8 @@ // // See hV_Utilities.h for references // +// Release 700: Refactored screen and board functions +// // Library header #include "hV_Utilities.h" diff --git a/src/hV_Utilities.h b/src/hV_Utilities.h index 999e255..de3b4ab 100755 --- a/src/hV_Utilities.h +++ b/src/hV_Utilities.h @@ -6,8 +6,8 @@ /// @n Based on highView technology /// /// @author Rei Vilo -/// @date 21 Jun 2023 -/// @version 611 +/// @date 21 Sep 2023 +/// @version 700 /// /// @copyright (c) Rei Vilo, 2010-2023 /// @copyright Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) @@ -23,17 +23,13 @@ /// // SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +#include "hV_HAL_Peripherals.h" #ifndef hV_UTILITIES_RELEASE /// /// @brief Library release number /// -#define hV_UTILITIES_RELEASE 611 +#define hV_UTILITIES_RELEASE 700 #ifndef min #define min(a, b) ((a) < (b) ? (a) : (b)) diff --git a/src/hV_Utilities_EPD.cpp b/src/hV_Utilities_EPD.cpp new file mode 100755 index 0000000..ba100fc --- /dev/null +++ b/src/hV_Utilities_EPD.cpp @@ -0,0 +1,203 @@ +// +// hV_Utilities_EPD.cpp +// Library C++ code +// ---------------------------------- +// +// Project Pervasive Displays Library Suite +// Based on highView technology +// +// Created by Rei Vilo, 16 Aug 2023 +// +// Copyright (c) Rei Vilo, 2010-2023 +// Licence All rights reserved +// + +// Library header +#include "hV_Utilities_EPD.h" + +hV_Utilities_EPD::hV_Utilities_EPD() +{ + ; +} + +void hV_Utilities_EPD::u_begin(pins_t board, uint8_t family, uint16_t delayCS) +{ + b_begin(board, family, delayCS); +} + +void hV_Utilities_EPD::u_WhoAmI(char * answer) +{ + memcpy(answer, 0x00, strlen(answer)); + + if (_codeExtra > 0) + { + strcat(answer, "-"); + if (_codeExtra & FEATURE_FAST) + { + strcat(answer, "F"); + } + if (_codeExtra & FEATURE_TOUCH) + { + strcat(answer, "T"); + } + if (_codeExtra & FEATURE_OTHER) + { + strcat(answer, "b"); + } + if (_codeExtra & FEATURE_WIDE_TEMPERATURE) + { + strcat(answer, "W"); + } + if (_codeExtra & FEATURE_RED) + { + strcat(answer, "BWR"); + } + if (_codeExtra & FEATURE_RED_YELLOW) + { + strcat(answer, "BWRY"); + } + strcat(answer, " "); + } + + strcat(answer, "-"); + +#if (SRAM_MODE == USE_INTERNAL_MCU) + strcat(answer, "i"); +#elif (SRAM_MODE == USE_EXTERNAL_SPI) + strcat(answer, "e"); +#else + strcat(answer, "."); +#endif // SRAM_MODE + +#if (FONT_MODE == USE_FONT_HEADER) + strcat(answer, "H"); +#elif (FONT_MODE == USE_FONT_FLASH) + strcat(answer, "F"); +#elif (FONT_MODE == USE_FONT_TERMINAL) + strcat(answer, "T"); +#else + strcat(answer, "."); +#endif // FONT_MODE +} + +void hV_Utilities_EPD::invert(bool flag) +{ + _invert = flag; +} + +// +// === Temperature section +// +void hV_Utilities_EPD::setTemperatureC(int8_t temperatureC) +{ + _temperature = temperatureC; + + // uint8_t _temperature2; + // if (_temperature < 0) + // { + // _temperature2 = -_temperature; + // _temperature2 = (uint8_t)(~_temperature2) + 1; // 2's complement + // } + // else + // { + // _temperature2 = _temperature; + // } + // indexE5_data[0] = _temperature2; +} + +void hV_Utilities_EPD::setTemperatureF(int16_t temperatureF) +{ + int8_t temperatureC = ((temperatureF - 32) * 5) / 9; // C = (F - 32) * 5 / 9 + setTemperatureC(temperatureC); +} + +uint8_t hV_Utilities_EPD::checkTemperatureMode(uint8_t updateMode) +{ + // #define FEATURE_FAST 0x01 ///< With embedded fast update + // #define FEATURE_TOUCH 0x02 ///< With capacitive touch panel + // #define FEATURE_OTHER 0x04 ///< With other feature + // #define FEATURE_WIDE_TEMPERATURE 0x08 ///< With wide operating temperature + // #define FEATURE_RED 0x10 ///< With red colour + // #define FEATURE_RED_YELLOW 0x20 ///< With red and yellow colours + // #define FEATURE_BW 0x00 ///< Monochrome + // #define FEATURE_BWR 0x10 ///< With red colour + // #define FEATURE_BWRY 0x20 ///< With red and yellow colours + // #define FEATURE_HIGH_DEFINITION 0x40 ///< With high definition + + switch (_codeExtra & 0x19) + { + case FEATURE_FAST: // PS series + + // Fast PS Embedded fast update FU: +15 to +30 °C GU: 0 to +50 °C + if (updateMode == UPDATE_FAST) // Fast update + { + if ((_temperature < 15) or (_temperature > 30)) + { + updateMode = UPDATE_GLOBAL; + } + } + if (updateMode == UPDATE_GLOBAL) // Global update + { + if ((_temperature < 0) or (_temperature > 50)) + { + updateMode = UPDATE_NONE; + } + } + break; + + case (FEATURE_FAST | FEATURE_WIDE_TEMPERATURE): // KS series + + // Wide KS Wide temperature and embedded fast update FU: 0 to +50 °C GU: -15 to +60 °C + if (updateMode == UPDATE_FAST) // Fast update + { + if ((_temperature < 0) or (_temperature > 50)) + { + updateMode = UPDATE_GLOBAL; + } + } + if (updateMode == UPDATE_GLOBAL) // Global update + { + if ((_temperature < -15) or (_temperature > 60)) + { + updateMode = UPDATE_NONE; + } + } + break; + + case FEATURE_WIDE_TEMPERATURE: // HS series + + // Freezer HS Global update below 0 °C FU: - GU: -25 to +30 °C + updateMode = UPDATE_GLOBAL; + if ((_temperature < -25) or (_temperature > 30)) + { + updateMode = UPDATE_NONE; + } + break; + + case FEATURE_BWR: // JS series + // case FEATURE_RED: // JS series + case FEATURE_BWRY: // QS series + // case FEATURE_RED_YELLOW: // QS series + + // BWR JS Red colour FU: - GU: 0 to +40 °C + // BWRY QS Red and yellow colours FU: - GU: 0 to +40 °C + if ((_temperature < 0) or (_temperature > 40)) + { + updateMode = UPDATE_NONE; + } + break; + + default: // CS series + + // Normal CS Global update above 0 °C FU: - GU: 0 to +50 °C + updateMode = UPDATE_GLOBAL; + if ((_temperature < 0) or (_temperature > 50)) + { + updateMode = UPDATE_NONE; + } + break; + } + + return updateMode; +} + diff --git a/src/hV_Utilities_EPD.h b/src/hV_Utilities_EPD.h new file mode 100755 index 0000000..ec456fa --- /dev/null +++ b/src/hV_Utilities_EPD.h @@ -0,0 +1,129 @@ +/// +/// @file hV_Utilities_EPD.h +/// @brief Driver for Pervasive Displays EXT3, EXT3-1 and EXT3-Touch boards +/// +/// @details Project Pervasive Displays Library Suite +/// @n Based on highView technology +/// +/// * Edition: Advanced +/// +/// @author Rei Vilo +/// @date 21 Aug 2023 +/// @version 700 +/// +/// @copyright (c) Rei Vilo, 2010-2023 +/// @copyright All rights reserved +/// +/// * Evaluation edition: for professionals or organisations, no commercial usage +/// * Commercial edition: for professionals or organisations, commercial usage +/// + +// SDK +#include "hV_HAL_Peripherals.h" + +// Configuration +#include "hV_Configuration.h" + +// Board +#include "hV_Board.h" + +// Utilities +#include "hV_Utilities.h" + +// Checks +#if (hV_CONFIGURATION_RELEASE < 700) +#error Required hV_CONFIGURATION_RELEASE 700 +#endif // hV_CONFIGURATION_RELEASE + +#if (hV_BOARD_RELEASE < 700) +#error Required hV_BOARD_RELEASE 700 +#endif // hV_BOARD_RELEASE + +#ifndef hV_UTILITIES_EPD_RELEASE +/// +/// @brief Library release number +/// +#define hV_UTILITIES_EPD_RELEASE 700 + +// Objects +// +/// +/// @brief Class for Pervasive Displays e-paper displays +/// @details Shared common functions and variables +/// +class hV_Utilities_EPD : public hV_Board +{ + public: + hV_Utilities_EPD(); + + /// + /// @brief Set temperature in Celsius + /// @details Set the temperature for update + /// @param temperatureC temperature in °C, default = 25 °C + /// @note Refer to data-sheets for authorised operating temperatures + /// + void setTemperatureC(int8_t temperatureC = 25); + + /// + /// @brief Set temperature in Fahrenheit + /// @details Set the temperature for update + /// @param temperatureF temperature in °F, default = 77 °F = 25 °C + /// @note Refer to data-sheets for authorised operating temperatures + /// + void setTemperatureF(int16_t temperatureF = 77); + + /// + /// @brief Check the mode against the temperature + /// + /// @param updateMode expected update mode + /// @return uint8_t recommended mode + /// @note If required, defaulting to UPDATE_GLOBAL or UPDATE_NONE + /// @warning Default temperature is 25 °C, otherwise set by setTemperatureC() or setTemperatureF() + /// + uint8_t checkTemperatureMode(uint8_t updateMode); + + /// + /// @brief Invert screen + /// @details Invert black and white colours + /// @param flag true to invert, false for normal screen + /// + void invert(bool flag); + + /// @cond + protected: + + /// + /// @brief Initialisation + /// + void u_begin(pins_t board, uint8_t family, uint16_t delayCS); + + /// + /// @brief Screen extra specifications for WhoAmI() + /// @param[out] answer Screen extra specifications + /// + void u_WhoAmI(char * answer); + + // Screen dependent variables +#if (SRAM_MODE == USE_INTERNAL_MCU) + + uint8_t * _newImage; + +#elif (SRAM_MODE == USE_EXTERNAL_SPI) + + uint32_t _newImage; + +#endif // SRAM_MODE + + eScreen_EPD_EXT3_t _eScreen_EPD_EXT3; + int8_t _temperature = 25; + uint8_t _codeExtra; + uint8_t _codeSize; + uint8_t _codeType; + uint16_t _bufferSizeV, _bufferSizeH, _bufferDepth; + uint32_t _pageColourSize, _frameSize; + bool _invert = false; + + /// @endcond +}; + +#endif // hV_UTILITIES_EPD_RELEASE