diff --git a/examples/Common_Colours/Common_Colours.ino b/examples/Common_Colours/Common_Colours.ino index 09209b2..d994d5c 100755 --- a/examples/Common_Colours/Common_Colours.ino +++ b/examples/Common_Colours/Common_Colours.ino @@ -16,18 +16,18 @@ /// @n /// -// SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +// Screen +#include "PDLS_EXT3_Basic.h" -// Set parameters +// SDK +// #include +#include "hV_HAL_Peripherals.h" // Include application, user and local libraries -#include "SPI.h" -#include "PDLS_EXT3_Basic.h" +// #include + +// Configuration +#include "hV_Configuration.h" // Define structures and classes @@ -169,10 +169,6 @@ void setup() Serial.println("=== "); Serial.println(); - -#if defined(ARDUINO_ARCH_PIDUINO) - exit(0); -#endif } // Add loop code diff --git a/examples/Common_Fonts/Common_Fonts.ino b/examples/Common_Fonts/Common_Fonts.ino index 58a93e6..4e10d8f 100755 --- a/examples/Common_Fonts/Common_Fonts.ino +++ b/examples/Common_Fonts/Common_Fonts.ino @@ -16,18 +16,20 @@ /// @n /// -// SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +// Screen +#include "PDLS_EXT3_Basic.h" -// Set parameters +// SDK +// #include +#include "hV_HAL_Peripherals.h" // Include application, user and local libraries -#include "SPI.h" -#include "PDLS_EXT3_Basic.h" +// #include + +// Configuration +#include "hV_Configuration.h" + +// Set parameters // Define structures and classes @@ -140,10 +142,6 @@ void setup() Serial.println("=== "); Serial.println(); - -#if defined(ARDUINO_ARCH_PIDUINO) - exit(0); -#endif } // Add loop code diff --git a/examples/Common_Forms/Common_Forms.ino b/examples/Common_Forms/Common_Forms.ino index 18537b9..6c39739 100755 --- a/examples/Common_Forms/Common_Forms.ino +++ b/examples/Common_Forms/Common_Forms.ino @@ -16,18 +16,18 @@ /// @n /// -// SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +// Screen +#include "PDLS_EXT3_Basic.h" -// Set parameters +// SDK +// #include +#include "hV_HAL_Peripherals.h" // Include application, user and local libraries -#include "SPI.h" -#include "PDLS_EXT3_Basic.h" +// #include + +// Configuration +#include "hV_Configuration.h" // Define structures and classes @@ -120,10 +120,6 @@ void setup() Serial.println("=== "); Serial.println(); - -#if defined(ARDUINO_ARCH_PIDUINO) - exit(0); -#endif } // Add loop code diff --git a/examples/Common_Orientation/Common_Orientation.ino b/examples/Common_Orientation/Common_Orientation.ino index 577162c..1fcb59f 100755 --- a/examples/Common_Orientation/Common_Orientation.ino +++ b/examples/Common_Orientation/Common_Orientation.ino @@ -16,18 +16,18 @@ /// @n /// -// SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +// Screen +#include "PDLS_EXT3_Basic.h" -// Set parameters +// SDK +// #include +#include "hV_HAL_Peripherals.h" // Include application, user and local libraries -#include "SPI.h" -#include "PDLS_EXT3_Basic.h" +// #include + +// Configuration +#include "hV_Configuration.h" // Define structures and classes @@ -112,10 +112,6 @@ void setup() Serial.println("=== "); Serial.println(); - -#if defined(ARDUINO_ARCH_PIDUINO) - exit(0); -#endif } // Add loop code diff --git a/examples/Common_Text/Common_Text.ino b/examples/Common_Text/Common_Text.ino index 64f9d33..39abff4 100755 --- a/examples/Common_Text/Common_Text.ino +++ b/examples/Common_Text/Common_Text.ino @@ -16,18 +16,18 @@ /// @n /// -// SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +// Screen +#include "PDLS_EXT3_Basic.h" -// Set parameters +// SDK +// #include +#include "hV_HAL_Peripherals.h" // Include application, user and local libraries -#include "SPI.h" -#include "PDLS_EXT3_Basic.h" +// #include + +// Configuration +#include "hV_Configuration.h" // Define structures and classes @@ -143,10 +143,6 @@ void setup() Serial.println("=== "); Serial.println(); - -#if defined(ARDUINO_ARCH_PIDUINO) - exit(0); -#endif } // Add loop code diff --git a/examples/Common_WhoAmI/Common_WhoAmI.ino b/examples/Common_WhoAmI/Common_WhoAmI.ino index bb633af..74e42f5 100755 --- a/examples/Common_WhoAmI/Common_WhoAmI.ino +++ b/examples/Common_WhoAmI/Common_WhoAmI.ino @@ -16,18 +16,18 @@ /// @n /// -// SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +// Screen +#include "PDLS_EXT3_Basic.h" -// Set parameters +// SDK +// #include +#include "hV_HAL_Peripherals.h" // Include application, user and local libraries -#include "SPI.h" -#include "PDLS_EXT3_Basic.h" +// #include + +// Configuration +#include "hV_Configuration.h" // Define structures and classes @@ -107,10 +107,6 @@ void setup() Serial.println("=== "); Serial.println(); - -#if defined(ARDUINO_ARCH_PIDUINO) - exit(0); -#endif } // Add loop code diff --git a/examples/Example_Global_Speed/Example_Global_Speed.ino b/examples/Example_Global_Speed/Example_Global_Speed.ino old mode 100644 new mode 100755 index 31230ac..f8f2b90 --- a/examples/Example_Global_Speed/Example_Global_Speed.ino +++ b/examples/Example_Global_Speed/Example_Global_Speed.ino @@ -19,24 +19,26 @@ /// Release 604: Global and fast variants /// -// SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // SDK +// Screen +#include "PDLS_EXT3_Basic.h" +// #include "PDLS_EXT3_Basic_Fast.h" -// Set parameters +// SDK +// #include +#include "hV_HAL_Peripherals.h" // Include application, user and local libraries -#include "SPI.h" +// #include + +// Configuration +#include "hV_Configuration.h" // Define structures and classes -#include "PDLS_EXT3_Basic.h" + +// Define constants and variables // Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_271, boardRaspberryPiPico_RP2040); Screen_EPD_EXT3 myScreen(eScreen_EPD_EXT3_370, boardRaspberryPiPico_RP2040); -// #include "PDLS_EXT3_Basic_Fast.h" // Screen_EPD_EXT3_Fast myScreen(eScreen_EPD_EXT3_271_09_Fast, boardRaspberryPiPico_RP2040); // Screen_EPD_EXT3_Fast myScreen(eScreen_EPD_EXT3_370_0C_Fast, boardRaspberryPiPico_RP2040); @@ -93,6 +95,7 @@ void performTest() // 1 dy += dz; text = formatString("Global update= %i ms", chrono); + // text = formatString("Fast update= %i ms", chrono); Serial.println(text); dx = (x - myScreen.stringSizeX(text)) / 2; myScreen.gText(dx, dy, text); @@ -131,10 +134,6 @@ void setup() Serial.println("=== "); Serial.println(); - -#if defined(ARDUINO_ARCH_PIDUINO) - exit(0); -#endif } // Add loop code diff --git a/library.properties b/library.properties index eabddec..b100061 100755 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=PDLS_EXT3_Basic -version=7.0.0 +version=7.0.1 author=Rei Vilo for Pervasive Displays maintainer=Rei Vilo sentence=Library for Pervasive Displays iTC monochrome and colour screens with EXT3-1 board diff --git a/src/PDLS_EXT3_Basic.h b/src/PDLS_EXT3_Basic.h index a2e243d..3696958 100755 --- a/src/PDLS_EXT3_Basic.h +++ b/src/PDLS_EXT3_Basic.h @@ -23,11 +23,7 @@ /// // SDK -#if defined(ENERGIA) // LaunchPad specific -#include "Energia.h" -#else // Arduino general -#include "Arduino.h" -#endif // end SDK +#include #ifndef PDLS_EXT3_BASIC_RELEASE /// diff --git a/src/Screen_EPD_EXT3.cpp b/src/Screen_EPD_EXT3.cpp index abd1d35..7721733 100755 --- a/src/Screen_EPD_EXT3.cpp +++ b/src/Screen_EPD_EXT3.cpp @@ -23,6 +23,7 @@ // Release 609: Added temperature management // Release 613: Improved stability for BWR screens // Release 700: Refactored screen and board functions +// Release 701: Improved functions names consistency // // Library header @@ -55,43 +56,53 @@ SPISettings _settingScreen; #define SPI_CLOCK_MAX 16000000 #endif -// Class +// +// === COG section +// + +// +// === End of COG section +// + +// +// === Class section +// Screen_EPD_EXT3::Screen_EPD_EXT3(eScreen_EPD_EXT3_t eScreen_EPD_EXT3, pins_t board) { - _eScreen_EPD_EXT3 = eScreen_EPD_EXT3; - _pin = board; - _newImage = 0; // nullptr + u_eScreen_EPD_EXT3 = eScreen_EPD_EXT3; + b_pin = board; + u_newImage = 0; // nullptr } void Screen_EPD_EXT3::begin() { - _codeExtra = (_eScreen_EPD_EXT3 >> 16) & 0xff; - _codeSize = (_eScreen_EPD_EXT3 >> 8) & 0xff; - _codeType = _eScreen_EPD_EXT3 & 0xff; + u_codeExtra = (u_eScreen_EPD_EXT3 >> 16) & 0xff; + u_codeSize = (u_eScreen_EPD_EXT3 >> 8) & 0xff; + u_codeType = u_eScreen_EPD_EXT3 & 0xff; _screenColourBits = 2; // BWR and BWRY // Configure board -switch (_codeSize) -{ + switch (u_codeSize) + { case 0x58: // 5.81" case 0x74: // 7.40" - u_begin(_pin, FAMILY_MEDIUM, 50); - break; + u_begin(b_pin, FAMILY_MEDIUM, 50); + break; case 0x96: // 9.69" case 0xB9: // 11.98" - u_begin(_pin, FAMILY_LARGE, 0); - break; + u_begin(b_pin, FAMILY_LARGE, 0); + break; - default: + default: - u_begin(_pin, FAMILY_SMALL, 50); - break; -} + u_begin(b_pin, FAMILY_SMALL, 50); + break; + } - switch (_codeSize) + switch (u_codeSize) { case 0x15: // 1.54" @@ -128,6 +139,13 @@ switch (_codeSize) _screenDiagonal = 287; break; + case 0x29: // 2.92" + + _screenSizeV = 384; // vertical = wide size + _screenSizeH = 168; // horizontal = small size + _screenDiagonal = 292; + break; + case 0x37: // 3.70" and 3.70"-Touch _screenSizeV = 416; // vertical = wide size @@ -187,89 +205,89 @@ switch (_codeSize) default: break; - } // _codeSize + } // u_codeSize - _bufferDepth = _screenColourBits; // 2 colours - _bufferSizeV = _screenSizeV; // vertical = wide size - _bufferSizeH = _screenSizeH / 8; // horizontal = small size 112 / 8; 1 bit per pixel + u_bufferDepth = _screenColourBits; // 2 colours + u_bufferSizeV = _screenSizeV; // vertical = wide size + u_bufferSizeH = _screenSizeH / 8; // horizontal = small size 112 / 8; 1 bit per pixel // Force conversion for two unit16_t multiplication into uint32_t. // Actually for 1 colour; BWR requires 2 pages. - _pageColourSize = (uint32_t)_bufferSizeV * (uint32_t)_bufferSizeH; + u_pageColourSize = (uint32_t)u_bufferSizeV * (uint32_t)u_bufferSizeH; - // _frameSize = _pageColourSize, except for 9.69 and 11.98 + // u_frameSize = u_pageColourSize, except for 9.69 and 11.98 // 9.69 and 11.98 combine two half-screens, hence two frames with adjusted size - switch (_codeSize) + switch (u_codeSize) { case 0x96: // 9.69" case 0xB9: // 11.98" - _frameSize = _pageColourSize / 2; + u_frameSize = u_pageColourSize / 2; break; default: - _frameSize = _pageColourSize; + u_frameSize = u_pageColourSize; break; - } // _codeSize + } // u_codeSize #if defined(BOARD_HAS_PSRAM) // ESP32 PSRAM specific case - if (_newImage == 0) + if (u_newImage == 0) { static uint8_t * _newFrameBuffer; - _newFrameBuffer = (uint8_t *) ps_malloc(_pageColourSize * _bufferDepth); - _newImage = (uint8_t *) _newFrameBuffer; + _newFrameBuffer = (uint8_t *) ps_malloc(u_pageColourSize * u_bufferDepth); + u_newImage = (uint8_t *) _newFrameBuffer; } #else // default case - if (_newImage == 0) + if (u_newImage == 0) { static uint8_t * _newFrameBuffer; - _newFrameBuffer = new uint8_t[_pageColourSize * _bufferDepth]; - _newImage = (uint8_t *) _newFrameBuffer; + _newFrameBuffer = new uint8_t[u_pageColourSize * u_bufferDepth]; + u_newImage = (uint8_t *) _newFrameBuffer; } #endif // ESP32 BOARD_HAS_PSRAM - memset(_newImage, 0x00, _pageColourSize * _bufferDepth); + memset(u_newImage, 0x00, u_pageColourSize * u_bufferDepth); // Initialise the /CS pins - pinMode(_pin.panelCS, OUTPUT); - digitalWrite(_pin.panelCS, HIGH); // CS# = 1 + pinMode(b_pin.panelCS, OUTPUT); + digitalWrite(b_pin.panelCS, HIGH); // CS# = 1 // New generic solution - pinMode(_pin.panelDC, OUTPUT); - pinMode(_pin.panelReset, OUTPUT); - pinMode(_pin.panelBusy, INPUT); // All Pins 0 + pinMode(b_pin.panelDC, OUTPUT); + pinMode(b_pin.panelReset, OUTPUT); + pinMode(b_pin.panelBusy, INPUT); // All Pins 0 // Initialise Flash /CS as HIGH - if (_pin.flashCS != NOT_CONNECTED) + if (b_pin.flashCS != NOT_CONNECTED) { - pinMode(_pin.flashCS, OUTPUT); - digitalWrite(_pin.flashCS, HIGH); + pinMode(b_pin.flashCS, OUTPUT); + digitalWrite(b_pin.flashCS, HIGH); } // Initialise slave panel /CS as HIGH - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { - pinMode(_pin.panelCSS, OUTPUT); - digitalWrite(_pin.panelCSS, HIGH); + pinMode(b_pin.panelCSS, OUTPUT); + digitalWrite(b_pin.panelCSS, HIGH); } // Initialise slave Flash /CS as HIGH - if (_pin.flashCSS != NOT_CONNECTED) + if (b_pin.flashCSS != NOT_CONNECTED) { - pinMode(_pin.flashCSS, OUTPUT); - digitalWrite(_pin.flashCSS, HIGH); + pinMode(b_pin.flashCSS, OUTPUT); + digitalWrite(b_pin.flashCSS, HIGH); } // Initialise SD-card /CS as HIGH - if (_pin.cardCS != NOT_CONNECTED) + if (b_pin.cardCS != NOT_CONNECTED) { - pinMode(_pin.cardCS, OUTPUT); - digitalWrite(_pin.cardCS, HIGH); + pinMode(b_pin.cardCS, OUTPUT); + digitalWrite(b_pin.cardCS, HIGH); } // Initialise SPI @@ -310,7 +328,7 @@ switch (_codeSize) #endif // ENERGIA // Reset - switch (_codeSize) + switch (u_codeSize) { case 0x56: // 5.65" case 0x58: // 5.81" @@ -329,7 +347,7 @@ switch (_codeSize) b_reset(5, 5, 10, 5, 5); // small break; - } // _codeSize + } // u_codeSize // Standard hV_Screen_Buffer::begin(); @@ -342,7 +360,7 @@ switch (_codeSize) f_fontSolid = false; _penSolid = false; - _invert = false; + u_invert = false; // Report Serial.println(formatString("= Screen %s %ix%i", WhoAmI().c_str(), screenSizeX(), screenSizeY())); @@ -387,8 +405,8 @@ void Screen_EPD_EXT3::flush() void Screen_EPD_EXT3::_flushGlobal() { - uint8_t * blackBuffer = _newImage; - uint8_t * redBuffer = _newImage + _pageColourSize; + uint8_t * blackBuffer = u_newImage; + uint8_t * redBuffer = u_newImage + u_pageColourSize; // Three groups: // + small: up to 4.37 included @@ -396,12 +414,12 @@ void Screen_EPD_EXT3::_flushGlobal() // + large: 9.69 and 11,98 // switch..case does not allow variable declarations // - if ((_codeSize == 0x56) or (_codeSize == 0x58) or (_codeSize == 0x74)) + if ((u_codeSize == 0x56) or (u_codeSize == 0x58) or (u_codeSize == 0x74)) { b_reset(200, 20, 200, 50, 5); // Send image data - if (_codeSize == 0x56) + if (u_codeSize == 0x56) { uint8_t data1_565[] = {0x00, 0x37, 0x00, 0x00, 0x57, 0x02}; // DUW b_sendIndexData(0x13, data1_565, 6); // DUW @@ -410,7 +428,7 @@ void Screen_EPD_EXT3::_flushGlobal() uint8_t data3_565[] = {0x37, 0x00, 0x14}; // RAM_RW b_sendIndexData(0x12, data3_565, 3); // RAM_RW } - else if (_codeSize == 0x58) + else if (u_codeSize == 0x58) { uint8_t data1_565[] = {0x00, 0x1f, 0x50, 0x00, 0x1f, 0x03}; // DUW b_sendIndexData(0x13, data1_565, 6); // DUW @@ -419,7 +437,7 @@ void Screen_EPD_EXT3::_flushGlobal() uint8_t data3_565[] = {0x1f, 0x50, 0x14}; // RAM_RW b_sendIndexData(0x12, data3_565, 3); // RAM_RW } - else if (_codeSize == 0x74) + else if (u_codeSize == 0x74) { uint8_t data1_565[] = {0x00, 0x3b, 0x00, 0x00, 0x1f, 0x03}; // DUW b_sendIndexData(0x13, data1_565, 6); // DUW @@ -429,31 +447,31 @@ void Screen_EPD_EXT3::_flushGlobal() b_sendIndexData(0x12, data3_565, 3); // RAM_RW } - if (_codeType == 0x0B) + if (u_codeType == 0x0B) { // y1 = 7 - (y1 % 8); uint8_t dtcl = 0x08; // 0=IST, 8=IST b_sendIndexData(0x01, &dtcl, 1); // DCTL 0x10 of MTP } - b_sendIndexData(0x10, blackBuffer, _frameSize); // First frame + b_sendIndexData(0x10, blackBuffer, u_frameSize); // First frame - if (_codeSize == 0x56) + if (u_codeSize == 0x56) { uint8_t data3_565[] = {0x37, 0x00, 0x14}; // RAM_RW b_sendIndexData(0x12, data3_565, 3); // RAM_RW } - else if (_codeSize == 0x58) + else if (u_codeSize == 0x58) { uint8_t data3_565[] = {0x1f, 0x50, 0x14}; // RAM_RW b_sendIndexData(0x12, data3_565, 3); // RAM_RW } - else if (_codeSize == 0x74) + else if (u_codeSize == 0x74) { uint8_t data3_565[] = {0x3b, 0x00, 0x14}; // RAM_RW b_sendIndexData(0x12, data3_565, 3); // RAM_RW } - b_sendIndexData(0x11, redBuffer, _frameSize); // Second frame + b_sendIndexData(0x11, redBuffer, u_frameSize); // Second frame // Initial COG uint8_t data4_565[] = {0x7d}; @@ -475,17 +493,17 @@ void Screen_EPD_EXT3::_flushGlobal() b_sendIndexData(0xa7, data5_565, 1); delay_ms(100); // uint8_t data10_565[] = {0x00, 0x02 }; - if (_codeSize == 0x56) + if (u_codeSize == 0x56) { uint8_t data10_565[] = {0x00, 0x02}; // OSC b_sendIndexData(0x03, data10_565, 2); // OSC mtp_0x12 } - else if (_codeSize == 0x58) + else if (u_codeSize == 0x58) { uint8_t data10_565[] = {0x00, 0x01}; // OSC b_sendIndexData(0x03, data10_565, 2); // OSC mtp_0x12 } - else if (_codeSize == 0x74) + else if (u_codeSize == 0x74) { uint8_t data10_565[] = {0x00, 0x01}; // OSC b_sendIndexData(0x03, data10_565, 2); // OSC mtp_0x12 @@ -500,7 +518,7 @@ void Screen_EPD_EXT3::_flushGlobal() uint8_t data12_565[] = {0x06}; b_sendIndexData(0x44, data12_565, 1); uint8_t data13_565[] = {0x82}; - data13_565[0] = _temperature * 2 + 0x50; // _temperature + data13_565[0] = u_temperature * 2 + 0x50; // u_temperature b_sendIndexData(0x45, data13_565, 1); // Temperature 0x82@25C b_sendIndexData(0xa7, data9_565, 1); delay_ms(100); @@ -509,17 +527,17 @@ void Screen_EPD_EXT3::_flushGlobal() uint8_t data14_565[] = {0x25}; b_sendIndexData(0x60, data14_565, 1); // TCON mtp_0x0b // uint8_t data15_565[] = {0x01 }; - if (_codeSize == 0x56) + if (u_codeSize == 0x56) { uint8_t data15_565[] = {0x01}; // STV_DIR b_sendIndexData(0x61, data15_565, 1); // STV_DIR mtp_0x1c } - else if (_codeSize == 0x58) + else if (u_codeSize == 0x58) { uint8_t data15_565[] = {0x00}; // STV_DIR b_sendIndexData(0x61, data15_565, 1); // STV_DIR mtp_0x1c } - else if (_codeSize == 0x74) + else if (u_codeSize == 0x74) { uint8_t data15_565[] = {0x00}; // STV_DIR b_sendIndexData(0x61, data15_565, 1); // STV_DIR mtp_0x1c @@ -570,7 +588,7 @@ void Screen_EPD_EXT3::_flushGlobal() delay_ms(10); // Display Refresh Start - while (digitalRead(_pin.panelBusy) != HIGH) + while (digitalRead(b_pin.panelBusy) != HIGH) { delay(100); } @@ -579,7 +597,7 @@ void Screen_EPD_EXT3::_flushGlobal() delay_ms(5); // DC-DC off - while (digitalRead(_pin.panelBusy) != HIGH) + while (digitalRead(b_pin.panelBusy) != HIGH) { delay(100); } @@ -590,89 +608,89 @@ void Screen_EPD_EXT3::_flushGlobal() b_sendIndexData(0x09, data5_565, 1); delay_ms(200); - while (digitalRead(_pin.panelBusy) != HIGH) + while (digitalRead(b_pin.panelBusy) != HIGH) { delay(100); } - digitalWrite(_pin.panelDC, LOW); - digitalWrite(_pin.panelCS, LOW); - digitalWrite(_pin.panelReset, LOW); + digitalWrite(b_pin.panelDC, LOW); + digitalWrite(b_pin.panelCS, LOW); + digitalWrite(b_pin.panelReset, LOW); // digitalWrite(PNLON_PIN, LOW); // PANEL_OFF# = 0 } - else if ((_codeSize == 0x96) or (_codeSize == 0xB9)) + else if ((u_codeSize == 0x96) or (u_codeSize == 0xB9)) { b_reset(200, 20, 200, 200, 5); // Send image data - if (_codeSize == 0x96) + if (u_codeSize == 0x96) { uint8_t data1_970[] = {0x00, 0x3b, 0x00, 0x00, 0x9f, 0x02}; // DUW - b_sendIndexData(0x13, data1_970, 6); // DUW for Both Master and Slave + b_sendIndexDataBoth(0x13, data1_970, 6); // DUW for Both Master and Slave uint8_t data2_970[] = {0x00, 0x3b, 0x00, 0xa9}; // DRFW - b_sendIndexData(0x90, data2_970, 4); // DRFW for Both Master and Slave + b_sendIndexDataBoth(0x90, data2_970, 4); // DRFW for Both Master and Slave } - else if (_codeSize == 0xB9) + else if (u_codeSize == 0xB9) { uint8_t data1_970[] = {0x00, 0x3b, 0x00, 0x00, 0x1f, 0x03}; // DUW - b_sendIndexData(0x13, data1_970, 6); // DUW for Both Master and Slave + b_sendIndexDataBoth(0x13, data1_970, 6); // DUW for Both Master and Slave uint8_t data2_970[] = {0x00, 0x3b, 0x00, 0xc9}; // DRFW - b_sendIndexData(0x90, data2_970, 4); // DRFW for Both Master and Slave + b_sendIndexDataBoth(0x90, data2_970, 4); // DRFW for Both Master and Slave } uint8_t data3_970[] = {0x3b, 0x00, 0x14}; - if (_codeType == 0x0B) + if (u_codeType == 0x0B) { uint8_t dtcl = 0x08; // 0=IST, 8=IST - b_sendIndexData(0x01, &dtcl, 1); // DCTL 0x10 of MTP + b_sendIndexDataBoth(0x01, &dtcl, 1); // DCTL 0x10 of MTP } // Master b_sendIndexDataMaster(0x12, data3_970, 3); // RAM_RW - b_sendIndexDataMaster(0x10, blackBuffer, _frameSize); // First frame + b_sendIndexDataMaster(0x10, blackBuffer, u_frameSize); // First frame b_sendIndexDataMaster(0x12, data3_970, 3); // RAM_RW - b_sendIndexDataMaster(0x11, redBuffer, _frameSize); // Second frame + b_sendIndexDataMaster(0x11, redBuffer, u_frameSize); // Second frame // Slave b_sendIndexDataSlave(0x12, data3_970, 3); // RAM_RW - b_sendIndexDataSlave(0x10, blackBuffer + _frameSize, _frameSize); // First frame + b_sendIndexDataSlave(0x10, blackBuffer + u_frameSize, u_frameSize); // First frame b_sendIndexDataSlave(0x12, data3_970, 3); // RAM_RW - b_sendIndexDataSlave(0x11, redBuffer + _frameSize, _frameSize); // Second frame + b_sendIndexDataSlave(0x11, redBuffer + u_frameSize, u_frameSize); // Second frame // Initial COG uint8_t data4_970[] = {0x7d}; - b_sendIndexData(0x05, data4_970, 1); + b_sendIndexDataBoth(0x05, data4_970, 1); delay_ms(200); uint8_t data5_970[] = {0x00}; - b_sendIndexData(0x05, data5_970, 1); + b_sendIndexDataBoth(0x05, data5_970, 1); delay_ms(10); uint8_t data6_970[] = {0x3f}; - b_sendIndexData(0xc2, data6_970, 1); + b_sendIndexDataBoth(0xc2, data6_970, 1); delay_ms(1); uint8_t data7_970[] = {0x80}; - b_sendIndexData(0xd8, data7_970, 1); // MS_SYNC + b_sendIndexDataBoth(0xd8, data7_970, 1); // MS_SYNC uint8_t data8_970[] = {0x00}; - b_sendIndexData(0xd6, data8_970, 1); // BVSS + b_sendIndexDataBoth(0xd6, data8_970, 1); // BVSS uint8_t data9_970[] = {0x10}; - b_sendIndexData(0xa7, data9_970, 1); + b_sendIndexDataBoth(0xa7, data9_970, 1); delay_ms(100); - b_sendIndexData(0xa7, data5_970, 1); + b_sendIndexDataBoth(0xa7, data5_970, 1); delay_ms(100); // --- 9.69 and 11.9 specific - if (_codeSize == 0x96) + if (u_codeSize == 0x96) { uint8_t data10_970[] = {0x00, 0x11}; // OSC - b_sendIndexData(0x03, data10_970, 2); // OSC + b_sendIndexDataBoth(0x03, data10_970, 2); // OSC } - else if (_codeSize == 0xB9) + else if (u_codeSize == 0xB9) { uint8_t data10_970[] = {0x00, 0x12}; // OSC - b_sendIndexData(0x03, data10_970, 2); // OSC + b_sendIndexDataBoth(0x03, data10_970, 2); // OSC } b_sendIndexDataMaster(0x44, data5_970, 1); // Master @@ -686,7 +704,7 @@ void Screen_EPD_EXT3::_flushGlobal() b_sendIndexDataMaster(0x44, data12_970, 1); // Master uint8_t data13_970[] = {0x82}; // uint8_t data13_970[] = {getTemperature(0x50, 0x82) }; - data13_970[0] = _temperature * 2 + 0x50; // _temperature + data13_970[0] = u_temperature * 2 + 0x50; // u_temperature b_sendIndexDataMaster(0x45, data13_970, 1); // Temperature 0x82@25C 0°C = 0x50, 25°C = 0x82 b_sendIndexDataMaster(0xa7, data9_970, 1); // Master delay_ms(100); @@ -711,88 +729,88 @@ void Screen_EPD_EXT3::_flushGlobal() uint8_t data15_970[] = {0x01}; b_sendIndexDataMaster(0x61, data15_970, 1); // STV_DIR for Master uint8_t data16_970[] = {0x00}; - b_sendIndexData(0x01, data16_970, 1); // DCTL + b_sendIndexDataBoth(0x01, data16_970, 1); // DCTL uint8_t data17_970[] = {0x00}; - b_sendIndexData(0x02, data17_970, 1); // VCOM + b_sendIndexDataBoth(0x02, data17_970, 1); // VCOM // DC-DC soft-start uint8_t index51_970[] = {0x50, 0x01, 0x0a, 0x01}; - b_sendIndexData(0x51, &index51_970[0], 2); + b_sendIndexDataBoth(0x51, &index51_970[0], 2); uint8_t index09_970[] = {0x1f, 0x9f, 0x7f, 0xff}; for (int value = 1; value <= 4; value++) { - b_sendIndexData(0x09, &index09_970[0], 1); + b_sendIndexDataBoth(0x09, &index09_970[0], 1); index51_970[1] = value; - b_sendIndexData(0x51, &index51_970[0], 2); - b_sendIndexData(0x09, &index09_970[1], 1); + b_sendIndexDataBoth(0x51, &index51_970[0], 2); + b_sendIndexDataBoth(0x09, &index09_970[1], 1); delay_ms(2); } for (int value = 1; value <= 10; value++) { - b_sendIndexData(0x09, &index09_970[0], 1); + b_sendIndexDataBoth(0x09, &index09_970[0], 1); index51_970[3] = value; - b_sendIndexData(0x51, &index51_970[2], 2); - b_sendIndexData(0x09, &index09_970[1], 1); + b_sendIndexDataBoth(0x51, &index51_970[2], 2); + b_sendIndexDataBoth(0x09, &index09_970[1], 1); delay_ms(2); } for (int value = 3; value <= 10; value++) { - b_sendIndexData(0x09, &index09_970[2], 1); + b_sendIndexDataBoth(0x09, &index09_970[2], 1); index51_970[3] = value; - b_sendIndexData(0x51, &index51_970[2], 2); - b_sendIndexData(0x09, &index09_970[3], 1); + b_sendIndexDataBoth(0x51, &index51_970[2], 2); + b_sendIndexDataBoth(0x09, &index09_970[3], 1); delay_ms(2); } for (int value = 9; value >= 2; value--) { - b_sendIndexData(0x09, &index09_970[2], 1); + b_sendIndexDataBoth(0x09, &index09_970[2], 1); index51_970[2] = value; - b_sendIndexData(0x51, &index51_970[2], 2); - b_sendIndexData(0x09, &index09_970[3], 1); + b_sendIndexDataBoth(0x51, &index51_970[2], 2); + b_sendIndexDataBoth(0x09, &index09_970[3], 1); delay_ms(2); } - b_sendIndexData(0x09, &index09_970[3], 1); + b_sendIndexDataBoth(0x09, &index09_970[3], 1); delay_ms(10); // Display Refresh Start - while (digitalRead(_pin.panelBusy) != HIGH) + while (digitalRead(b_pin.panelBusy) != HIGH) { delay(100); } uint8_t data18_970[] = {0x3c}; - b_sendIndexData(0x15, data18_970, 1); // Display Refresh + b_sendIndexDataBoth(0x15, data18_970, 1); // Display Refresh delay_ms(5); // DC/DC off - while (digitalRead(_pin.panelBusy) != HIGH) + while (digitalRead(b_pin.panelBusy) != HIGH) { delay(100); } uint8_t data19_970[] = {0x7f}; - b_sendIndexData(0x09, data19_970, 1); + b_sendIndexDataBoth(0x09, data19_970, 1); uint8_t data20_970[] = {0x7d}; - b_sendIndexData(0x05, data20_970, 1); - b_sendIndexData(0x09, data5_970, 1); + b_sendIndexDataBoth(0x05, data20_970, 1); + b_sendIndexDataBoth(0x09, data5_970, 1); delay_ms(200); - while (digitalRead(_pin.panelBusy) != HIGH) + while (digitalRead(b_pin.panelBusy) != HIGH) { delay(100); } - digitalWrite(_pin.panelDC, LOW); - digitalWrite(_pin.panelCS, LOW); + digitalWrite(b_pin.panelDC, LOW); + digitalWrite(b_pin.panelCS, LOW); - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { - digitalWrite(_pin.panelCSS, LOW); + digitalWrite(b_pin.panelCSS, LOW); } - digitalWrite(_pin.panelReset, LOW); + digitalWrite(b_pin.panelReset, LOW); // digitalWrite(PNLON_PIN, LOW); // PANEL_OFF# = 0 - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { - digitalWrite(_pin.panelCSS, HIGH); // CSS# = 1 + digitalWrite(b_pin.panelCSS, HIGH); // CSS# = 1 } } else // small, including 420 and 437 @@ -804,53 +822,63 @@ void Screen_EPD_EXT3::_flushGlobal() delay_ms(5); uint8_t data7[] = {0x19}; - data7[0] = _temperature; // _temperature + data7[0] = u_temperature; // u_temperature b_sendIndexData(0xe5, data7, 1); // Input Temperature 0°C = 0x00, 22°C = 0x16, 25°C = 0x19 uint8_t data6[] = {0x02}; b_sendIndexData(0xe0, data6, 1); // Active Temperature + uint8_t index00_work[2] = {0xcf, 0x8d}; // PSR, all except 4.2" - if (_codeSize == 0x42) + if (u_codeSize == 0x42) { index00_work[0] = 0x0f; index00_work[1] = 0x89; } + + if (u_codeSize == 0x29) + { + b_sendCommandData8(0x4d, 0x55); + b_sendCommandData8(0xe9, 0x02); + } + else + { b_sendIndexData(0x00, index00_work, 2); // PSR + } // Send image data - b_sendIndexData(0x10, blackBuffer, _frameSize); // First frame - b_sendIndexData(0x13, redBuffer, _frameSize); // Second frame + b_sendIndexData(0x10, blackBuffer, u_frameSize); // First frame + b_sendIndexData(0x13, redBuffer, u_frameSize); // Second frame delay_ms(50); uint8_t data8[] = {0x00}; b_sendIndexData(0x04, data8, 1); // Power on delay_ms(5); - while (digitalRead(_pin.panelBusy) != HIGH) + while (digitalRead(b_pin.panelBusy) != HIGH) { delay(100); }; - while (digitalRead(_pin.panelBusy) != HIGH); + while (digitalRead(b_pin.panelBusy) != HIGH); b_sendIndexData(0x12, data8, 1); // Display Refresh delay_ms(5); - while (digitalRead(_pin.panelBusy) != HIGH) + while (digitalRead(b_pin.panelBusy) != HIGH) { delay(100); }; b_sendIndexData(0x02, data8, 1); // Turn off DC/DC delay_ms(5); - while (digitalRead(_pin.panelBusy) != HIGH) + while (digitalRead(b_pin.panelBusy) != HIGH) { delay(100); }; - digitalWrite(_pin.panelDC, LOW); - digitalWrite(_pin.panelCS, LOW); + digitalWrite(b_pin.panelDC, LOW); + digitalWrite(b_pin.panelCS, LOW); - digitalWrite(_pin.panelReset, LOW); + digitalWrite(b_pin.panelReset, LOW); // digitalWrite(PNLON_PIN, LOW); } - digitalWrite(_pin.panelCS, HIGH); // CS# = 1 + digitalWrite(b_pin.panelCS, HIGH); // CS# = 1 } void Screen_EPD_EXT3::clear(uint16_t colour) @@ -858,60 +886,60 @@ void Screen_EPD_EXT3::clear(uint16_t colour) if (colour == myColours.red) { // physical red 01 - memset(_newImage, 0x00, _pageColourSize); - memset(_newImage + _pageColourSize, 0xff, _pageColourSize); + memset(u_newImage, 0x00, u_pageColourSize); + memset(u_newImage + u_pageColourSize, 0xff, u_pageColourSize); } else if (colour == myColours.grey) { - for (uint16_t i = 0; i < _bufferSizeV; i++) + for (uint16_t i = 0; i < u_bufferSizeV; i++) { uint16_t pattern = (i % 2) ? 0b10101010 : 0b01010101; - for (uint16_t j = 0; j < _bufferSizeH; j++) + for (uint16_t j = 0; j < u_bufferSizeH; j++) { - _newImage[i * _bufferSizeH + j] = pattern; + u_newImage[i * u_bufferSizeH + j] = pattern; } } - memset(_newImage + _pageColourSize, 0x00, _pageColourSize); + memset(u_newImage + u_pageColourSize, 0x00, u_pageColourSize); } else if (colour == myColours.darkRed) { // red = 0-1, black = 1-0, white 0-0 - for (uint16_t i = 0; i < _bufferSizeV; i++) + for (uint16_t i = 0; i < u_bufferSizeV; i++) { uint16_t pattern1 = (i % 2) ? 0b10101010 : 0b01010101; // black uint16_t pattern2 = (i % 2) ? 0b01010101 : 0b10101010; // red - for (uint16_t j = 0; j < _bufferSizeH; j++) + for (uint16_t j = 0; j < u_bufferSizeH; j++) { - _newImage[i * _bufferSizeH + j] = pattern1; - _newImage[i * _bufferSizeH + j + _pageColourSize] = pattern2; + u_newImage[i * u_bufferSizeH + j] = pattern1; + u_newImage[i * u_bufferSizeH + j + u_pageColourSize] = pattern2; } } } else if (colour == myColours.lightRed) { // red = 0-1, black = 1-0, white 0-0 - for (uint16_t i = 0; i < _bufferSizeV; i++) + for (uint16_t i = 0; i < u_bufferSizeV; i++) { uint16_t pattern1 = (i % 2) ? 0b00000000 : 0b00000000; // white uint16_t pattern2 = (i % 2) ? 0b01010101 : 0b10101010; // red - for (uint16_t j = 0; j < _bufferSizeH; j++) + for (uint16_t j = 0; j < u_bufferSizeH; j++) { - _newImage[i * _bufferSizeH + j] = pattern1; - _newImage[i * _bufferSizeH + j + _pageColourSize] = pattern2; + u_newImage[i * u_bufferSizeH + j] = pattern1; + u_newImage[i * u_bufferSizeH + j + u_pageColourSize] = pattern2; } } } - else if ((colour == myColours.white) xor _invert) + else if ((colour == myColours.white) xor u_invert) { // physical black 00 - memset(_newImage, 0x00, _pageColourSize); - memset(_newImage + _pageColourSize, 0x00, _pageColourSize); + memset(u_newImage, 0x00, u_pageColourSize); + memset(u_newImage + u_pageColourSize, 0x00, u_pageColourSize); } else { // physical white 10 - memset(_newImage, 0xff, _pageColourSize); - memset(_newImage + _pageColourSize, 0x00, _pageColourSize); + memset(u_newImage, 0xff, u_pageColourSize); + memset(u_newImage + u_pageColourSize, 0x00, u_pageColourSize); } } @@ -935,7 +963,7 @@ void Screen_EPD_EXT3::_setPoint(uint16_t x1, uint16_t y1, uint16_t colour) } else { - colour = _invert ? myColours.white : myColours.black; // white + colour = u_invert ? myColours.white : myColours.black; // white } } else if (colour == myColours.lightRed) @@ -946,7 +974,7 @@ void Screen_EPD_EXT3::_setPoint(uint16_t x1, uint16_t y1, uint16_t colour) } else { - colour = _invert ? myColours.black : myColours.white; // black + colour = u_invert ? myColours.black : myColours.white; // black } } else if (colour == myColours.grey) @@ -969,20 +997,20 @@ void Screen_EPD_EXT3::_setPoint(uint16_t x1, uint16_t y1, uint16_t colour) if (colour == myColours.red) { // physical red 01 - bitClear(_newImage[z1], b1); - bitSet(_newImage[_pageColourSize + z1], b1); + bitClear(u_newImage[z1], b1); + bitSet(u_newImage[u_pageColourSize + z1], b1); } - else if ((colour == myColours.white) xor _invert) + else if ((colour == myColours.white) xor u_invert) { // physical black 00 - bitClear(_newImage[z1], b1); - bitClear(_newImage[_pageColourSize + z1], b1); + bitClear(u_newImage[z1], b1); + bitClear(u_newImage[u_pageColourSize + z1], b1); } - else if ((colour == myColours.black) xor _invert) + else if ((colour == myColours.black) xor u_invert) { // physical white 10 - bitSet(_newImage[z1], b1); - bitClear(_newImage[_pageColourSize + z1], b1); + bitSet(u_newImage[z1], b1); + bitClear(u_newImage[u_pageColourSize + z1], b1); } } @@ -1048,18 +1076,18 @@ uint32_t Screen_EPD_EXT3::_getZ(uint16_t x1, uint16_t y1) uint32_t z1 = 0; // According to 11.98 inch Spectra Application Note // at http:// www.pervasivedisplays.com/LiteratureRetrieve.aspx?ID=245146 - if ((_codeSize == 0x96) or (_codeSize == 0xB9)) + if ((u_codeSize == 0x96) or (u_codeSize == 0xB9)) { if (y1 >= (_screenSizeH >> 1)) { y1 -= (_screenSizeH >> 1); // rebase y1 - z1 += (_pageColourSize >> 1); // buffer second half + z1 += (u_pageColourSize >> 1); // buffer second half } - z1 += (uint32_t)x1 * (_bufferSizeH >> 1) + (y1 >> 3); + z1 += (uint32_t)x1 * (u_bufferSizeH >> 1) + (y1 >> 3); } else { - z1 = (uint32_t)x1 * _bufferSizeH + (y1 >> 3); + z1 = (uint32_t)x1 * u_bufferSizeH + (y1 >> 3); } return z1; } @@ -1083,4 +1111,7 @@ void Screen_EPD_EXT3::regenerate() clear(myColours.white); flush(); } +// +// === End of Class section +// diff --git a/src/Screen_EPD_EXT3.h b/src/Screen_EPD_EXT3.h index b5072f4..df9a035 100755 --- a/src/Screen_EPD_EXT3.h +++ b/src/Screen_EPD_EXT3.h @@ -13,8 +13,8 @@ /// * Temperature: monochrome = 0 to 50 °C, red = 0 to 40 °C /// /// @author Rei Vilo -/// @date 21 Sep 2023 -/// @version 700 +/// @date 21 Oct 2023 +/// @version 701 /// /// @copyright (c) Rei Vilo, 2010-2023 /// @copyright Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) @@ -41,8 +41,13 @@ // Board #include "hV_Board.h" -// EPD utilities -#include "hV_Utilities_EPD.h" +// PDLS utilities +#include "hV_Utilities_PDLS.h" + +// Checks +#if (hV_HAL_PERIPHERALS_RELEASE < 700) +#error Required hV_HAL_PERIPHERALS_RELEASE 700 +#endif // hV_HAL_PERIPHERALS_RELEASE #if (hV_CONFIGURATION_RELEASE < 700) #error Required hV_CONFIGURATION_RELEASE 700 @@ -60,7 +65,7 @@ /// /// @brief Library release number /// -#define SCREEN_EPD_EXT3_RELEASE 700 +#define SCREEN_EPD_EXT3_RELEASE 701 /// /// @brief Library variant @@ -86,13 +91,14 @@ /// @note All commands work on the frame-buffer, /// to be displayed on screen with flush() /// -class Screen_EPD_EXT3 final : public hV_Screen_Buffer, public hV_Utilities_EPD +class Screen_EPD_EXT3 final : public hV_Screen_Buffer, public hV_Utilities_PDLS { public: /// /// @brief Constructor with default pins /// @param eScreen_EPD_EXT3 size and model of the e-screen /// @param board board configuration + /// @note Frame-buffer generated by the class /// @note To be used with begin() with no parameter /// Screen_EPD_EXT3(eScreen_EPD_EXT3_t eScreen_EPD_EXT3, pins_t board); @@ -178,7 +184,7 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer, public hV_Utilities_EPD /// @brief Convert /// @param x1 x-axis coordinate /// @param y1 y-axis coordinate - /// @return index for _newImage[] + /// @return index for u_newImage[] /// uint32_t _getZ(uint16_t x1, uint16_t y1); @@ -186,7 +192,7 @@ class Screen_EPD_EXT3 final : public hV_Screen_Buffer, public hV_Utilities_EPD /// @brief Convert /// @param x1 x-axis coordinate /// @param y1 y-axis coordinate - /// @return bit for _newImage[] + /// @return bit for u_newImage[] /// uint16_t _getB(uint16_t x1, uint16_t y1); diff --git a/src/hV_Board.cpp b/src/hV_Board.cpp index 0d56291..a2d2056 100755 --- a/src/hV_Board.cpp +++ b/src/hV_Board.cpp @@ -22,28 +22,28 @@ hV_Board::hV_Board() void hV_Board::b_begin(pins_t board, uint8_t family, uint16_t delayCS) { - _pin = board; - _family = family; - _delayCS = delayCS; + b_pin = board; + b_family = family; + b_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 + digitalWrite(b_pin.panelReset, HIGH); // RES# = 1 delay(ms2); // delay 5ms - digitalWrite(_pin.panelReset, LOW); + digitalWrite(b_pin.panelReset, LOW); delay(ms3); - digitalWrite(_pin.panelReset, HIGH); + digitalWrite(b_pin.panelReset, HIGH); delay(ms4); - digitalWrite(_pin.panelCS, HIGH); // CS# = 1 + digitalWrite(b_pin.panelCS, HIGH); // CS# = 1 delay(ms5); } -void hV_Board::b_waitBusy() +void hV_Board::b_waitBusy(bool state) { // LOW = busy, HIGH = ready - while (digitalRead(_pin.panelBusy) != HIGH) + while (digitalRead(b_pin.panelBusy) != state) { delay(32); // non-blocking } @@ -66,70 +66,101 @@ void hV_Board::b_sendIndexFixed(uint8_t index, uint8_t data, uint32_t size) 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) + digitalWrite(b_pin.panelDC, LOW); // DC Low + digitalWrite(b_pin.panelCS, LOW); // CS Low + if (b_family == FAMILY_LARGE) { - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { - digitalWrite(_pin.panelCSS, LOW); + digitalWrite(b_pin.panelCSS, LOW); } delayMicroseconds(450); // 450 + 50 = 500 } - delayMicroseconds(50); + delayMicroseconds(b_delayCS); SPI.transfer(index); - delayMicroseconds(50); - if (_family == FAMILY_LARGE) + delayMicroseconds(b_delayCS); + if (b_family == FAMILY_LARGE) { - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { - delayMicroseconds(450); // 450 + 50 = 500 - digitalWrite(_pin.panelCSS, HIGH); + delayMicroseconds(450); // 450 + 50 = 500 + digitalWrite(b_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) + digitalWrite(b_pin.panelCS, HIGH); // CS High + digitalWrite(b_pin.panelDC, HIGH); // DC High + digitalWrite(b_pin.panelCS, LOW); // CS Low + if (b_family == FAMILY_LARGE) { - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { - digitalWrite(_pin.panelCSS, LOW); // CSS Low + digitalWrite(b_pin.panelCSS, LOW); // CSS Low delayMicroseconds(450); // 450 + 50 = 500 } } - delayMicroseconds(50); + delayMicroseconds(b_delayCS); for (uint32_t i = 0; i < size; i++) { SPI.transfer(data[i]); } - delayMicroseconds(50); - if (_family == FAMILY_LARGE) + delayMicroseconds(b_delayCS); + if (b_family == FAMILY_LARGE) { - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { delayMicroseconds(450); // 450 + 50 = 500 - digitalWrite(_pin.panelCSS, HIGH); + digitalWrite(b_pin.panelCSS, HIGH); } } - digitalWrite(_pin.panelCS, HIGH); // CS High + digitalWrite(b_pin.panelCS, HIGH); // CS High } // Software SPI Master protocol setup +void hV_Board::b_sendIndexDataBoth(uint8_t index, const uint8_t * data, uint32_t size) +{ + digitalWrite(b_pin.panelDC, LOW); // DC Low = Command + digitalWrite(b_pin.panelCS, LOW); // CS Low = Select + if (b_pin.panelCSS != NOT_CONNECTED) + { + digitalWrite(b_pin.panelCSS, LOW); // CS Low = Select + } + + delayMicroseconds(b_delayCS); // Longer delay for large screens + SPI.transfer(index); + delayMicroseconds(b_delayCS); // Longer delay for large screens + + // digitalWrite(b_pin.panelCS, HIGH); // CS High = Unselect + digitalWrite(b_pin.panelDC, HIGH); // DC High = Data + // digitalWrite(b_pin.panelCS, LOW); // CS Low = Select + + delayMicroseconds(b_delayCS); // Longer delay for large screens + for (uint32_t i = 0; i < size; i++) + { + SPI.transfer(data[i]); + } + delayMicroseconds(b_delayCS); // Longer delay for large screens + + digitalWrite(b_pin.panelCS, HIGH); // CS High = Unselect + if (b_pin.panelCSS != NOT_CONNECTED) + { + digitalWrite(b_pin.panelCSS, HIGH); // CS High = Unselect + } +} + void hV_Board::b_sendIndexDataMaster(uint8_t index, const uint8_t * data, uint32_t size) { - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { - digitalWrite(_pin.panelCSS, HIGH); // CS slave HIGH + digitalWrite(b_pin.panelCSS, HIGH); // CS slave HIGH } - digitalWrite(_pin.panelDC, LOW); // DC Low = Command - digitalWrite(_pin.panelCS, LOW); // CS Low = Select + digitalWrite(b_pin.panelDC, LOW); // DC Low = Command + digitalWrite(b_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 + digitalWrite(b_pin.panelCS, HIGH); // CS High = Unselect + digitalWrite(b_pin.panelDC, HIGH); // DC High = Data + digitalWrite(b_pin.panelCS, LOW); // CS Low = Select delayMicroseconds(500); for (uint32_t i = 0; i < size; i++) @@ -137,33 +168,33 @@ void hV_Board::b_sendIndexDataMaster(uint8_t index, const uint8_t * data, uint32 SPI.transfer(data[i]); } delayMicroseconds(500); - digitalWrite(_pin.panelCS, HIGH); // CS High= Unselect + digitalWrite(b_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(b_pin.panelCS, HIGH); // CS Master High + digitalWrite(b_pin.panelDC, LOW); // DC Low= Command + if (b_pin.panelCSS != NOT_CONNECTED) { - digitalWrite(_pin.panelCSS, LOW); // CS slave LOW + digitalWrite(b_pin.panelCSS, LOW); // CS slave LOW } delayMicroseconds(500); SPI.transfer(index); delayMicroseconds(500); - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { - digitalWrite(_pin.panelCSS, HIGH); // CS slave HIGH + digitalWrite(b_pin.panelCSS, HIGH); // CS slave HIGH } - digitalWrite(_pin.panelDC, HIGH); // DC High = Data + digitalWrite(b_pin.panelDC, HIGH); // DC High = Data - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { - digitalWrite(_pin.panelCSS, LOW); // CS slave LOW + digitalWrite(b_pin.panelCSS, LOW); // CS slave LOW } delayMicroseconds(500); @@ -173,33 +204,33 @@ void hV_Board::b_sendIndexDataSlave(uint8_t index, const uint8_t * data, uint32_ SPI.transfer(data[i]); } delayMicroseconds(500); - if (_pin.panelCSS != NOT_CONNECTED) + if (b_pin.panelCSS != NOT_CONNECTED) { - digitalWrite(_pin.panelCSS, HIGH); // CS slave HIGH + digitalWrite(b_pin.panelCSS, HIGH); // CS slave HIGH } } void hV_Board::b_sendCommand8(uint8_t command) { - digitalWrite(_pin.panelDC, LOW); - digitalWrite(_pin.panelCS, LOW); + digitalWrite(b_pin.panelDC, LOW); + digitalWrite(b_pin.panelCS, LOW); SPI.transfer(command); - digitalWrite(_pin.panelCS, HIGH); + digitalWrite(b_pin.panelCS, HIGH); } void hV_Board::b_sendCommandData8(uint8_t command, uint8_t data) { - digitalWrite(_pin.panelDC, LOW); // LOW = command - digitalWrite(_pin.panelCS, LOW); + digitalWrite(b_pin.panelDC, LOW); // LOW = command + digitalWrite(b_pin.panelCS, LOW); SPI.transfer(command); - digitalWrite(_pin.panelDC, HIGH); // HIGH = data + digitalWrite(b_pin.panelDC, HIGH); // HIGH = data SPI.transfer(data); - digitalWrite(_pin.panelCS, HIGH); + digitalWrite(b_pin.panelCS, HIGH); } // @@ -207,7 +238,7 @@ void hV_Board::b_sendCommandData8(uint8_t command, uint8_t data) // pins_t hV_Board::getBoardPins() { - return _pin; + return b_pin; } // // === End of Miscellaneous section diff --git a/src/hV_Board.h b/src/hV_Board.h index 263ace4..5f4e763 100755 --- a/src/hV_Board.h +++ b/src/hV_Board.h @@ -34,7 +34,7 @@ // /// /// @brief Class for Pervasive Displays EXT3, EXT3-1 and EXT3-Touch boards -/// @details Functions for EXT3 board +/// @details Functions for EXT3-1 board /// * GPIO /// * SPI for LCD and external Flash and SRAM memory /// * I2C for touch and haptic feedback @@ -96,6 +96,15 @@ class hV_Board /// void b_sendIndexData(uint8_t index, const uint8_t * data, uint32_t size); + /// + /// @brief Send data through SPI to the two halves 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_sendIndexDataBoth(uint8_t index, const uint8_t * data, uint32_t size); + /// /// @brief Send data through SPI to first half of large screens /// @param index register @@ -115,9 +124,11 @@ class hV_Board /// /// @brief Wait for ready - /// @details Wait for panelBusy low + /// @details Wait for panelBusy to reach state + /// @note Signal is busy until reaching state + /// @param state to reach HIGH = default, LOW /// - void b_waitBusy(); + void b_waitBusy(bool state = HIGH); /// /// @brief Send a command @@ -144,9 +155,9 @@ class hV_Board /// void b_resume(); - pins_t _pin; - uint16_t _delayCS = 50; // ms - uint8_t _family; + pins_t b_pin; + uint16_t b_delayCS = 50; // ms + uint8_t b_family; /// @endcond }; diff --git a/src/hV_Colours565.cpp b/src/hV_Colours565.cpp index b754162..cc404ce 100755 --- a/src/hV_Colours565.cpp +++ b/src/hV_Colours565.cpp @@ -13,6 +13,9 @@ // // See hV_Colours565.h for references // +// Release 611: Added support for red and yellow colour screens +// Release 700: Refactored screen and board functions +// // Library header #include "hV_Colours565.h" diff --git a/src/hV_Colours565.h b/src/hV_Colours565.h index bff1240..1757125 100755 --- a/src/hV_Colours565.h +++ b/src/hV_Colours565.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) @@ -16,11 +16,14 @@ // SDK #include "hV_HAL_Peripherals.h" +// Configuration +#include "hV_Configuration.h" + #ifndef hV_COLOURS_RELEASE /// /// @brief Library release number /// -#define hV_COLOURS_RELEASE 611 +#define hV_COLOURS_RELEASE 700 /// /// @class hV_Colours565 diff --git a/src/hV_Common.h b/src/hV_Common.h new file mode 100755 index 0000000..48b4cd4 --- /dev/null +++ b/src/hV_Common.h @@ -0,0 +1,50 @@ +/// +/// @file hV_Common.h +/// @brief Shared low-level libraries for the Pervasive Displays Library Suite +/// +/// @details Project Pervasive Displays Library Suite +/// @n Based on highView technology +/// +/// @author Rei Vilo +/// @date 21 Oct 2023 +/// @version 701 +/// +/// @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, no commercial usage +/// @n All rights reserved +/// +/// * Commercial edition: for professionals or organisations, commercial usage +/// @n All rights reserved +/// + +#ifndef hV_COMMON_RELEASE +/// +/// @brief Library release number +/// +#define hV_COMMON_RELEASE 701 + +// SDK +#include "hV_HAL_Peripherals.h" + +// Configuration +#include "hV_Configuration.h" +#include "hV_List_Constants.h" +#include "hV_List_Options.h" +#include "hV_List_Boards.h" +#include "hV_List_Screens.h" + +#include "hV_Documentation.h" + +#include "hV_Utilities_Common.h" +#include "hV_Colours565.h" + +// Screen +// #include "hV_Screen_Virtual.h" +// #include "hV_Screen_Buffer.h" + +#endif // hV_COMMON_RELEASE diff --git a/src/hV_Configuration.h b/src/hV_Configuration.h index 591212f..fbea970 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 21 Sep 2023 -/// @version 700 +/// @date 21 Oct 2023 +/// @version 701 /// /// @copyright (c) Rei Vilo, 2010-2023 /// @copyright All rights reserved @@ -67,7 +67,7 @@ /// /// @brief Release /// -#define hV_CONFIGURATION_RELEASE 700 +#define hV_CONFIGURATION_RELEASE 701 /// /// @name 1- List of supported Pervasive Displays screens diff --git a/src/hV_Font_Terminal.cpp b/src/hV_Font_Terminal.cpp index e2e4a9d..4b1957d 100755 --- a/src/hV_Font_Terminal.cpp +++ b/src/hV_Font_Terminal.cpp @@ -21,7 +21,7 @@ // #include "hV_Font_Terminal.h" -//#include "hV_Utilities.h" +//#include "hV_Utilities_Common.h" // The Arduino IDE doesn't allow to select the libraries, hence this condition. #if (FONT_MODE == USE_FONT_TERMINAL) diff --git a/src/hV_Font_Terminal.h b/src/hV_Font_Terminal.h index 7b2b4df..5fc2d88 100755 --- a/src/hV_Font_Terminal.h +++ b/src/hV_Font_Terminal.h @@ -40,7 +40,7 @@ /// #define hV_FONT_TERMINAL_RELEASE 507 -#include "hV_Utilities.h" +#include "hV_Utilities_Common.h" #include "hV_Font.h" /// diff --git a/src/hV_HAL_Peripherals.h b/src/hV_HAL_Peripherals.h index 4de7157..3deae1a 100755 --- a/src/hV_HAL_Peripherals.h +++ b/src/hV_HAL_Peripherals.h @@ -34,11 +34,13 @@ /// * 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 +#include + +/// +/// @brief SDK other libraries +/// +#include +#include /// /// @brief Other libraries @@ -47,7 +49,4 @@ #include #include -#include "SPI.h" -#include "Wire.h" - -#endif // hV_HAL_PERIPHERALS_RELEASE \ No newline at end of file +#endif // hV_HAL_PERIPHERALS_RELEASE diff --git a/src/hV_List_Boards.h b/src/hV_List_Boards.h index adea26d..9476ead 100755 --- a/src/hV_List_Boards.h +++ b/src/hV_List_Boards.h @@ -5,6 +5,9 @@ /// @details Project Pervasive Displays Library Suite /// @n Based on highView technology /// +/// @n Content +/// * 2- List of pre-configured boards +/// /// @author Rei Vilo /// @date 21 Sep 2023 /// @version 700 @@ -149,7 +152,7 @@ const pins_t boardESP32DevKitC = /// /// @name Other boards /// @{ - + /// /// @brief Texas Instruments LaunchPad MSP430 and MSP432 LaunchPad configuration, tested /// @@ -210,6 +213,7 @@ const pins_t boardCC1352 = /// /// @brief Raspberry Pi Zero, 2B, 3B, 4B configuration with RasPiArduino, tested /// @warning Not recommended +/// @deprecated Use boardRaspberryPiZeroB_MRAA instead (7.0.0) /// @see https://github.com/me-no-dev/RasPiArduino /// const pins_t boardRaspberryPiZeroB_RasPiArduino = @@ -231,6 +235,7 @@ const pins_t boardRaspberryPiZeroB_RasPiArduino = /// /// @brief Raspberry Pi Pico Arduino mbed configuration, tested /// @warning Not recommended +/// @deprecated Use boardRaspberryPiPico_RP2040 instead (7.0.0) /// @see https://github.com/arduino/ArduinoCore-mbed /// const pins_t boardRaspberryPiPico_Arduino = diff --git a/src/hV_List_Constants.h b/src/hV_List_Constants.h index 16cc155..3f8421a 100755 --- a/src/hV_List_Constants.h +++ b/src/hV_List_Constants.h @@ -52,12 +52,12 @@ /// /// @brief Update mode /// @note Numbers are sequential and exclusive -/// @deprecated Partial update is removed. Use fast update instead (7.0.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 #define UPDATE_FAST 0x02 ///< Fast update -#define UPDATE_PARTIAL 0x03 ///< Partial update +#define UPDATE_PARTIAL 0x03 ///< Partial update, deprecated /// @} /// @@ -131,6 +131,7 @@ /// /// @brief Orientation constants +/// @note Numbers are sequential and exclusive /// @{ /// #define ORIENTATION_PORTRAIT 6 ///< Portrait or vertical, higher than large diff --git a/src/hV_List_Options.h b/src/hV_List_Options.h new file mode 100755 index 0000000..aa71bcb --- /dev/null +++ b/src/hV_List_Options.h @@ -0,0 +1,185 @@ +/// +/// @file hV_List_Options.h +/// @brief List of options for Pervasive Displays Library Suite +/// +/// @details Project Pervasive Displays Library Suite +/// @n Based on highView technology +/// +/// @n Content +/// * 3- Font mode, internal MCU or external SPI Flash +/// * 4- Maximum number of fonts +/// * 5- SRAM memory, internal MCU or external SPI +/// * 6- Use self or virtual object +/// * 7- Touch mode, activated or not +/// * 8- Haptic feedback mode, activated or not +/// * 9. Set GPIO expander mode, not implemented +/// * 10. String object of char array options for string. +/// * 11. Set storage mode, serial console by default +/// +/// @author Rei Vilo +/// @date 21 Oct 2023 +/// @version 701 +/// +/// @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 +/// + +#ifndef hV_LIST_OPTIONS_RELEASE +/// +/// @brief Release +/// +#define hV_LIST_OPTIONS_RELEASE 701 + +/// +/// @name 3- Set font mode +/// @details From header files or from external flash +/// * Basic edition: Terminal font +/// * Evaluation edition: DejaVu font as header +/// * Commercial edition: DejaVu font as either header or external SPI Flash +/// @note USE_FONT_HEADER requires addFont() +/// @note Font Manager requires USE_FONT_HEADER +/// @warning 8- and 16-bit MCUs may limit the size of the fonts. Use 32-bit MCUs for optimal performance. +/// +/// @{ +#define USE_FONT_TERMINAL 1 ///< Use default Terminal fonts +#define USE_FONT_HEADER 2 ///< Use fonts from header files +#define USE_FONT_FLASH 3 ///< Use fonts from external SPI Flash memory +#define USE_FONT_INTERNAL 4 ///< Use fonts from internal CGU + +#define FONT_MODE USE_FONT_HEADER ///< Selected option +/// @} + +/// +/// @brief 4- Maximum number of fonts +/// @details With MCU Flash, based on available memory, check performed at compilation +/// * USE_FONT_TERMINAL: 1..4 +/// * USE_FONT_HEADER: 1..64 +/// +/// With SPI Flash, based on the fonts previously uploaded +/// * USE_FONT_FLASH: eg. 64 +/// +#if (FONT_MODE == USE_FONT_TERMINAL) +#define MAX_FONT_SIZE 4 +#else +#define MAX_FONT_SIZE 64 +#endif + +/// +/// @name 5- Set SRAM memory +/// @details From internal MCU or external SPI +/// * Basic edition: MCU internal SRAM +/// * Commercial edition: MCU internal SRAM +/// * Evaluation edition: MCU internal or SPI external SRAM +/// +/// @{ +#define USE_INTERNAL_MCU 1 ///< Use MCU internal +#define USE_EXTERNAL_SPI 2 ///< Use SPI External + +#define SRAM_MODE USE_INTERNAL_MCU ///< Selected option +/// @} + +/// +/// @name 6- Use virtual object +/// @details From hV_Screen_Virtual.h for extended compability +/// @note Declare additional variables if USE_hV_SCREEN_SELF +/// @n Virtual object requires ~1 kB bytes. +/// * Basic edition: self option +/// * Evaluation edition: virtual option +/// * Commercial edition: self and virtual options +/// @note Recommended: USE_hV_SCREEN_VIRTUAL +/// @warning Issues with virtual function on arm-none-eabi-g++ 4.9.3: use USE_hV_SCREEN_SELF instead. +/// @{ +#define USE_hV_SCREEN_VIRTUAL 1 ///< Use virtual object +#define USE_hV_SCREEN_SELF 2 ///< Do not use virtual object + +#define USE_hV_SCREEN USE_hV_SCREEN_VIRTUAL ///< Selected option +/// @} + +/// +/// @name 7- Set touch mode +/// @details Only two screens are ready for touch +/// * Basic edition: iTC 2.71 BW and iTC 3.70 BW +/// * Evaluation edition: iTC 2.71 BW and iTC 3.70 BW +/// * Commercial edition: iTC 2.71 BW and iTC 3.70 BW +/// @note Touch uses I2C and polling over interrupt +/// @{ +#define USE_TOUCH_NONE 0 ///< Do not use touch +#define USE_TOUCH_YES 1 ///< Use touch + +#define TOUCH_MODE USE_TOUCH_YES ///< Selected option +/// @} + +/// +/// @brief 8- Set haptic feedback mode +/// * Basic edition: no haptic feedback +/// * Evaluation edition: ERM or LRA +/// * Commercial edition: ERM or LRA +/// +/// @{ +#define USE_HAPTICS_NONE 0 ///< No motor +#define USE_DRV2605L_ERM 1 ///< DRV2605L with ERM = eccentric rotating mass +#define USE_DRV2605L_LRA 2 ///< DRV2605L with LRA = linear resonant actuator + +#define HAPTICS_MODE USE_HAPTICS_NONE ///< Selected option +/// @} + +/// +/// @brief 9- Set GPIO expander mode +/// * Basic edition: no expander +/// * Evaluation edition: PCF8574 or PCA9536 +/// * Commercial edition: PCF8574 or PCA9536 +/// +/// @{ +#define USE_EXPANDER_NONE 0 ///< No I2C expander +#define USE_I2C_PCF8574 1 ///< PCF8574 8 ports GPIO I2C 100 kHz expander +#define USE_I2C_PCA9536 2 ///< PCA9536 4 ports GPIO I2C 400 kHz expander +#define USE_I2C_TCA6408 3 ///< TCA6408 8 ports GPIO I2C 400 kHz expander + +#define EXPANDER_MODE USE_EXPANDER_NONE ///< Selected option +/// @} + +/// +/// @brief 10- Set string mode +/// * Basic edition: String object +/// * Evaluation edition: char array +/// * Commercial edition: String object or char array +/// +/// @{ +#define USE_STRING_OBJECT 1 +#define USE_CHAR_ARRAY 2 + +#define STRING_MODE USE_CHAR_ARRAY +/// @} + +/// +/// @brief 11- Storage mode +/// * Basic edition: none +/// * Evaluation edition: none +/// * Commercial edition: option +/// +/// @note Options can be combined +/// @code {.cpp} +/// #define STORAGE_MODE (USE_SD_CARD | USE_SPI_FLASH) +/// #define STORAGE_MODE (USE_LINUX_FILES | USE_SERIAL_CONSOLE) +/// @endcode +/// +/// @{ +#define USE_NONE 0 ///< No storage +#define USE_SD_CARD 1 ///< SD card +#define USE_SPI_FLASH 2 ///< External SPI Flash +#define USE_SERIAL_CONSOLE 4 ///< Serial console for writing only +#define USE_LINUX_FILES 8 ///< For Linux native applications + +#define STORAGE_MODE USE_SERIAL_CONSOLE ///< Selected options +/// @} + +#endif // hV_LIST_OPTIONS_RELEASE diff --git a/src/hV_List_Screens.h b/src/hV_List_Screens.h old mode 100644 new mode 100755 index 98deeed..acc31de --- a/src/hV_List_Screens.h +++ b/src/hV_List_Screens.h @@ -6,6 +6,9 @@ /// @details Project Pervasive Displays Library Suite /// @n Based on highView technology /// +/// @n Content +/// * 1- List of supported Pervasive Displays screens +/// /// @author Rei Vilo /// @date 21 Sep 2023 /// @version 700 @@ -60,7 +63,7 @@ /// @} /// -/// @name Colour black-white-red screens +/// @name Colour black-white-red Spectra screens /// @note Global update mode /// @see https://www.pervasivedisplays.com/products/?_sft_etc_itc=itc&_sft_product_colour=black-white-red /// @{ @@ -82,7 +85,7 @@ /// @} /// -/// @name Colour black-white-red-yellow screens +/// @name Colour black-white-red-yellow Spectra 4 screens /// @note Global update mode /// @see https://www.pervasivedisplays.com/products/?_sft_etc_itc=itc&_sft_product_colour=black-white-red-yellow /// @{ @@ -95,7 +98,7 @@ /// /// @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). +/// @deprecated Partial update is removed. Use fast update instead (7.0.0). /// @see https://www.pervasivedisplays.com/products /// @{ /// @@ -142,6 +145,7 @@ #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_290_0F_Wide (uint32_t)0x09290F ///< reference xE2290KS0Fx #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 @@ -157,10 +161,10 @@ /// /// @name Frame-buffer sizes -/// @details +/// @details /// * Black-white-red screens and monochrome screens /// @n Frame-buffer size = width * height / 8 * depth, uint32_t -/// @n Depth = 2 +/// @n Depth = 2 /// * Black-white-red_yellow screens /// @n Frame-buffer size = width * height / 4 * depth, uint32_t /// @n Depth = 1 diff --git a/src/hV_Screen_Buffer.cpp b/src/hV_Screen_Buffer.cpp index c585cdd..fa69c49 100755 --- a/src/hV_Screen_Buffer.cpp +++ b/src/hV_Screen_Buffer.cpp @@ -16,6 +16,7 @@ // Release 520: Added use of hV_HAL_Peripherals // Release 523: Fixed rounded rectangles // Release 526: Improved touch management +// Release 700: Refactored screen and board functions // // Library header diff --git a/src/hV_Screen_Buffer.h b/src/hV_Screen_Buffer.h index c943e40..208130e 100755 --- a/src/hV_Screen_Buffer.h +++ b/src/hV_Screen_Buffer.h @@ -36,7 +36,9 @@ // Other libraries #include "hV_Colours565.h" -#include "hV_Utilities.h" + +// Common utilities +#include "hV_Utilities_Common.h" #if (FONT_MODE == USE_FONT_TERMINAL) #include "hV_Font_Terminal.h" @@ -93,6 +95,7 @@ class hV_Screen_Buffer : protected hV_Font_Terminal /// * 3 = left rotated /// * ORIENTATION_PORTRAIT = 6 = check portrait /// * ORIENTATION_LANDSCAPE = 7 = check landscape + /// @note Run the Common_Orientation.ino example to identify the options /// virtual void setOrientation(uint8_t orientation); diff --git a/src/hV_Utilities.cpp b/src/hV_Utilities_Common.cpp similarity index 98% rename from src/hV_Utilities.cpp rename to src/hV_Utilities_Common.cpp index 5c643b6..e58b649 100755 --- a/src/hV_Utilities.cpp +++ b/src/hV_Utilities_Common.cpp @@ -1,5 +1,5 @@ // -// hV_Utilities.cpp +// hV_Utilities_Common.cpp // Library C++ code // ---------------------------------- // @@ -10,13 +10,13 @@ // Copyright (c) Rei Vilo, 2010-2023 // Licence Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) // -// See hV_Utilities.h for references +// See hV_Utilities_Common.h for references // // Release 700: Refactored screen and board functions // // Library header -#include "hV_Utilities.h" +#include "hV_Utilities_Common.h" #include "stdarg.h" #include "stdio.h" diff --git a/src/hV_Utilities.h b/src/hV_Utilities_Common.h similarity index 99% rename from src/hV_Utilities.h rename to src/hV_Utilities_Common.h index de3b4ab..4024db4 100755 --- a/src/hV_Utilities.h +++ b/src/hV_Utilities_Common.h @@ -1,5 +1,5 @@ /// -/// @file hV_Utilities.h +/// @file hV_Utilities_Common.h /// @brief Utilities for highView Library Suite /// /// @details Project Pervasive Displays Library Suite diff --git a/src/hV_Utilities_EPD.cpp b/src/hV_Utilities_PDLS.cpp similarity index 72% rename from src/hV_Utilities_EPD.cpp rename to src/hV_Utilities_PDLS.cpp index ba100fc..32b5fd9 100755 --- a/src/hV_Utilities_EPD.cpp +++ b/src/hV_Utilities_PDLS.cpp @@ -1,5 +1,5 @@ // -// hV_Utilities_EPD.cpp +// hV_Utilities_PDLS.cpp // Library C++ code // ---------------------------------- // @@ -13,46 +13,46 @@ // // Library header -#include "hV_Utilities_EPD.h" +#include "hV_Utilities_PDLS.h" -hV_Utilities_EPD::hV_Utilities_EPD() +hV_Utilities_PDLS::hV_Utilities_PDLS() { ; } -void hV_Utilities_EPD::u_begin(pins_t board, uint8_t family, uint16_t delayCS) +void hV_Utilities_PDLS::u_begin(pins_t board, uint8_t family, uint16_t delayCS) { b_begin(board, family, delayCS); } -void hV_Utilities_EPD::u_WhoAmI(char * answer) +void hV_Utilities_PDLS::u_WhoAmI(char * answer) { memcpy(answer, 0x00, strlen(answer)); - if (_codeExtra > 0) + if (u_codeExtra > 0) { strcat(answer, "-"); - if (_codeExtra & FEATURE_FAST) + if (u_codeExtra & FEATURE_FAST) { strcat(answer, "F"); } - if (_codeExtra & FEATURE_TOUCH) + if (u_codeExtra & FEATURE_TOUCH) { strcat(answer, "T"); } - if (_codeExtra & FEATURE_OTHER) + if (u_codeExtra & FEATURE_OTHER) { strcat(answer, "b"); } - if (_codeExtra & FEATURE_WIDE_TEMPERATURE) + if (u_codeExtra & FEATURE_WIDE_TEMPERATURE) { strcat(answer, "W"); } - if (_codeExtra & FEATURE_RED) + if (u_codeExtra & FEATURE_RED) { strcat(answer, "BWR"); } - if (_codeExtra & FEATURE_RED_YELLOW) + if (u_codeExtra & FEATURE_RED_YELLOW) { strcat(answer, "BWRY"); } @@ -80,38 +80,38 @@ void hV_Utilities_EPD::u_WhoAmI(char * answer) #endif // FONT_MODE } -void hV_Utilities_EPD::invert(bool flag) +void hV_Utilities_PDLS::invert(bool flag) { - _invert = flag; + u_invert = flag; } // // === Temperature section // -void hV_Utilities_EPD::setTemperatureC(int8_t temperatureC) +void hV_Utilities_PDLS::setTemperatureC(int8_t temperatureC) { - _temperature = temperatureC; + u_temperature = temperatureC; - // uint8_t _temperature2; - // if (_temperature < 0) + // uint8_t u_temperature2; + // if (u_temperature < 0) // { - // _temperature2 = -_temperature; - // _temperature2 = (uint8_t)(~_temperature2) + 1; // 2's complement + // u_temperature2 = -u_temperature; + // u_temperature2 = (uint8_t)(~_temperature2) + 1; // 2's complement // } // else // { - // _temperature2 = _temperature; + // u_temperature2 = u_temperature; // } - // indexE5_data[0] = _temperature2; + // indexE5_data[0] = u_temperature2; } -void hV_Utilities_EPD::setTemperatureF(int16_t temperatureF) +void hV_Utilities_PDLS::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) +uint8_t hV_Utilities_PDLS::checkTemperatureMode(uint8_t updateMode) { // #define FEATURE_FAST 0x01 ///< With embedded fast update // #define FEATURE_TOUCH 0x02 ///< With capacitive touch panel @@ -124,21 +124,21 @@ uint8_t hV_Utilities_EPD::checkTemperatureMode(uint8_t updateMode) // #define FEATURE_BWRY 0x20 ///< With red and yellow colours // #define FEATURE_HIGH_DEFINITION 0x40 ///< With high definition - switch (_codeExtra & 0x19) + switch (u_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)) + if ((u_temperature < 15) or (u_temperature > 30)) { updateMode = UPDATE_GLOBAL; } } if (updateMode == UPDATE_GLOBAL) // Global update { - if ((_temperature < 0) or (_temperature > 50)) + if ((u_temperature < 0) or (u_temperature > 50)) { updateMode = UPDATE_NONE; } @@ -150,14 +150,14 @@ uint8_t hV_Utilities_EPD::checkTemperatureMode(uint8_t updateMode) // 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)) + if ((u_temperature < 0) or (u_temperature > 50)) { updateMode = UPDATE_GLOBAL; } } if (updateMode == UPDATE_GLOBAL) // Global update { - if ((_temperature < -15) or (_temperature > 60)) + if ((u_temperature < -15) or (u_temperature > 60)) { updateMode = UPDATE_NONE; } @@ -168,7 +168,7 @@ uint8_t hV_Utilities_EPD::checkTemperatureMode(uint8_t updateMode) // Freezer HS Global update below 0 °C FU: - GU: -25 to +30 °C updateMode = UPDATE_GLOBAL; - if ((_temperature < -25) or (_temperature > 30)) + if ((u_temperature < -25) or (u_temperature > 30)) { updateMode = UPDATE_NONE; } @@ -181,7 +181,7 @@ uint8_t hV_Utilities_EPD::checkTemperatureMode(uint8_t updateMode) // 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)) + if ((u_temperature < 0) or (u_temperature > 40)) { updateMode = UPDATE_NONE; } @@ -191,7 +191,7 @@ uint8_t hV_Utilities_EPD::checkTemperatureMode(uint8_t updateMode) // Normal CS Global update above 0 °C FU: - GU: 0 to +50 °C updateMode = UPDATE_GLOBAL; - if ((_temperature < 0) or (_temperature > 50)) + if ((u_temperature < 0) or (u_temperature > 50)) { updateMode = UPDATE_NONE; } diff --git a/src/hV_Utilities_EPD.h b/src/hV_Utilities_PDLS.h similarity index 79% rename from src/hV_Utilities_EPD.h rename to src/hV_Utilities_PDLS.h index ec456fa..c796d3f 100755 --- a/src/hV_Utilities_EPD.h +++ b/src/hV_Utilities_PDLS.h @@ -1,5 +1,5 @@ /// -/// @file hV_Utilities_EPD.h +/// @file hV_Utilities_PDLS.h /// @brief Driver for Pervasive Displays EXT3, EXT3-1 and EXT3-Touch boards /// /// @details Project Pervasive Displays Library Suite @@ -28,9 +28,13 @@ #include "hV_Board.h" // Utilities -#include "hV_Utilities.h" +#include "hV_Utilities_Common.h" // Checks +#if (hV_HAL_PERIPHERALS_RELEASE < 700) +#error Required hV_HAL_PERIPHERALS_RELEASE 700 +#endif // hV_HAL_PERIPHERALS_RELEASE + #if (hV_CONFIGURATION_RELEASE < 700) #error Required hV_CONFIGURATION_RELEASE 700 #endif // hV_CONFIGURATION_RELEASE @@ -39,11 +43,11 @@ #error Required hV_BOARD_RELEASE 700 #endif // hV_BOARD_RELEASE -#ifndef hV_UTILITIES_EPD_RELEASE +#ifndef hV_UTILITIES_PDLS_RELEASE /// /// @brief Library release number /// -#define hV_UTILITIES_EPD_RELEASE 700 +#define hV_UTILITIES_PDLS_RELEASE 700 // Objects // @@ -51,10 +55,10 @@ /// @brief Class for Pervasive Displays e-paper displays /// @details Shared common functions and variables /// -class hV_Utilities_EPD : public hV_Board +class hV_Utilities_PDLS : public hV_Board { public: - hV_Utilities_EPD(); + hV_Utilities_PDLS(); /// /// @brief Set temperature in Celsius @@ -106,24 +110,24 @@ class hV_Utilities_EPD : public hV_Board // Screen dependent variables #if (SRAM_MODE == USE_INTERNAL_MCU) - uint8_t * _newImage; + uint8_t * u_newImage; #elif (SRAM_MODE == USE_EXTERNAL_SPI) - uint32_t _newImage; + uint32_t u_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; + eScreen_EPD_EXT3_t u_eScreen_EPD_EXT3; + int8_t u_temperature = 25; + uint8_t u_codeExtra; + uint8_t u_codeSize; + uint8_t u_codeType; + uint16_t u_bufferSizeV, u_bufferSizeH, u_bufferDepth; + uint32_t u_pageColourSize, u_frameSize; + bool u_invert = false; /// @endcond }; -#endif // hV_UTILITIES_EPD_RELEASE +#endif // hV_UTILITIES_PDLS_RELEASE