From 57a406f57aeca9fe47a5e1dac0d302ba675b52c0 Mon Sep 17 00:00:00 2001 From: nitko12 Date: Wed, 16 Sep 2020 11:55:51 +0200 Subject: [PATCH] Renamed monochrome -> BW and grayscale -> gray. --- README.md | 79 ++++++++++--------- .../1-Inkplate_basic_BW.ino} | 4 +- .../2-Inkplate_basic_gray.ino} | 14 ++-- .../image.h | 0 .../3-Inkplate-basic_partial_update.ino | 4 +- .../4-Inkplate-basic_custom_font.ino | 2 +- .../01-Inkplate_WiFi_HTTP_request.ino | 2 +- .../02-Inkplate_Low_Power.ino | 2 +- ...kplate_Battery_Voltage_And_Temperature.ino | 2 +- .../04-Inkplate_Touchpads.ino | 2 +- .../05-Inkplate_SD_BMP_pictures.ino | 4 +- .../06-Inkplate_SD_TXT_file.ino | 2 +- .../07-Inkplate_easyC/07-Inkplate_easyC.ino | 2 +- .../08-Inkplate_MCP23017_expander.ino | 2 +- .../09-Inkplate_Web_Server.ino | 2 +- .../10-Inkplate_Web_BMP_pictures.ino | 4 +- .../11-Inkplate_SD_JPEG_pictures.ino | 2 +- .../12-Inkplate_Web_JPEG_pictures.ino | 24 +++--- .../3-Inkplate_VariPass_Graphs.ino | 26 +++--- src/include/Graphics.cpp | 10 +-- src/include/Graphics.h | 71 ++++++++--------- 21 files changed, 137 insertions(+), 123 deletions(-) rename examples/1. Basic Inkplate Functionality/{1-Inkplate_basic_monochrome/1-Inkplate_basic_monochrome.ino => 1-Inkplate_basic_BW/1-Inkplate_basic_BW.ino} (99%) rename examples/1. Basic Inkplate Functionality/{2-Inkplate_basic_grayscale/2-Inkplate_basic_grayscale.ino => 2-Inkplate_basic_gray/2-Inkplate_basic_gray.ino} (96%) rename examples/1. Basic Inkplate Functionality/{2-Inkplate_basic_grayscale => 2-Inkplate_basic_gray}/image.h (100%) diff --git a/README.md b/README.md index 49adc1a..44613d1 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,81 @@ - # Inkplate 6 Arduino library ![](https://www.crowdsupply.com/img/040a/inkplate-6-angle-01_png_project-main.jpg) -Arduino library for all-in-one e-paper display Inkplate 6 can be found in this repo. Inkplate 6 is a powerful, Wi-Fi enabled ESP32 based six-inch e-paper display – recycled from a Kindle e-reader. Its main feature is simplicity. Just plug in a USB cable, open Arduino IDE, and change the contents of the screen with few lines of code. Learn more about Inkplate 6 on [Crowd Supply](https://www.crowdsupply.com/e-radionica/inkplate-6). +Arduino library for all-in-one e-paper display Inkplate 6 can be found in this repo. Inkplate 6 is a powerful, Wi-Fi enabled ESP32 based six-inch e-paper display – recycled from a Kindle e-reader. Its main feature is simplicity. Just plug in a USB cable, open Arduino IDE, and change the contents of the screen with few lines of code. Learn more about Inkplate 6 on [Crowd Supply](https://www.crowdsupply.com/e-radionica/inkplate-6). ### Setting up Inkplate 6 in Arduino IDE + In order to get a head start with Inkplate 6, follow these steps: -1. [Install Inkplate 6 board definition](https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/) - add Inkplate 6 as a board into your Arduino IDE. Follow the instructions on the [link](https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/). + +1. [Install Inkplate 6 board definition](https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/) - add Inkplate 6 as a board into your Arduino IDE. Follow the instructions on the [link](https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/). 2. Install CH340 drivers (if you don't have them yet) - instructions [here](https://e-radionica.com/en/blog/ch340-driver-installation-croduino-basic3-nova2/) 3. Install Inkplate 6 Arduino library - install the library from this repo into your Arduino IDE. If you don't know how, check our [tutorial](https://e-radionica.com/en/blog/arduino-library/#Kako%20instaliraty%20library?). -4. Install [custom SdFat library](https://github.com/e-radionicacom/Inkplate-6-SDFat-Arduino-Library) into your Arduino IDE. -5. You are ready to get started! Select Tools -> Board -> Inkplate 6, as well as correct COM port and upload! - +4. Install [custom SdFat library](https://github.com/e-radionicacom/Inkplate-6-SDFat-Arduino-Library) into your Arduino IDE. +5. You are ready to get started! Select Tools -> Board -> Inkplate 6, as well as correct COM port and upload! ### Code examples -There are many examples in the library that you demonstrate how to use any of the Inkplate functionality. + +There are many examples in the library that you demonstrate how to use any of the Inkplate functionality. 1. **Basic Inkplate Functionality** - 1.1. Basic Monochrome - use the screen in monochrome mode (graphics & text) - - 1.2. Basic Grayscale - use the screen in grayscale mode (graphics & text) - - 1.3. Basic Partial Update - do a partial update of the screen on Inkplate 6 - - 1.4. Basic Custom Fonts - add custom fonts and use them to write text on the screen - + 1.1. Basic BW - use the screen in BW mode (graphics & text) + + 1.2. Basic Gray - use the screen in gray mode (graphics & text) + + 1.3. Basic Partial Update - do a partial update of the screen on Inkplate 6 + + 1.4. Basic Custom Fonts - add custom fonts and use them to write text on the screen + 2. **Advanced Inkplate Functionality** - 2.1. WiFi HTTP Request - make HTTP request while connected too WiFi - - 2.2. Low Power - put Inkplate in sleep in order to save battery - - 2.3. Battery Voltage And Temperature - measure battery voltage and temperature of the board - - 2.4. Touchpads - get readings from onboard touch pads - - 2.5. SD BMP Pictures - show .bmp images from the SD card on the screen - - 2.6. Inkplate SD TXT File - read .txt file from the SD card and show it on the screen - - 2.7. easyC - use easyC ecosystem (I2C) and read a sensor value + 2.1. WiFi HTTP Request - make HTTP request while connected too WiFi - 2.8. MCP23017 Expander - use onboard MCP23017 expander for your own external devices + 2.2. Low Power - put Inkplate in sleep in order to save battery - 2.9. Web Server - make Inkplate a web server + 2.3. Battery Voltage And Temperature - measure battery voltage and temperature of the board + + 2.4. Touchpads - get readings from onboard touch pads + + 2.5. SD BMP Pictures - show .bmp images from the SD card on the screen + + 2.6. Inkplate SD TXT File - read .txt file from the SD card and show it on the screen + + 2.7. easyC - use easyC ecosystem (I2C) and read a sensor value + + 2.8. MCP23017 Expander - use onboard MCP23017 expander for your own external devices + + 2.9. Web Server - make Inkplate a web server 3. **Others** - 3.1. Slave Mode - mode that enables control of the screen from any external device using UART - - 3.2. Screen Cleaning - clean the screen in case of image burn-in + 3.1. Slave Mode - mode that enables control of the screen from any external device using UART + + 3.2. Screen Cleaning - clean the screen in case of image burn-in ### Using Inkplate 6 with another microcontroller -As promised in an [early update](https://www.crowdsupply.com/e-radionica/inkplate-6/updates/successfully-funded-also-third-party-master-controllers-and-partial-updates), Inkplate 6's screen contents can be updated using 3rd controller (such as Raspberry Pi or another microcontroller). The "Slave Mode" (unpopular name right now, we are aware and will change) enables this. All brand new Inkplates come pre-programmed with slave mode and can be used right away. -It is based on UART (serial) communication - connect the Inkplate to "master" board either via USB cable or directly via ESP32 RX and TX pins. Using standard UART at 115200 baud, you can send commands to change screen contents. For example, send *#H(000,000,"/img.bmp")** to show image img.bmp from SD card on the screen. Find very basic documentation for using it [here](https://github.com/e-radionicacom/Inkplate-6-Arduino-library/blob/master/examples/4.%20Others/1-Inkplate_Slave_Mode/Inkplate_slave_mode_documentation.txt). +As promised in an [early update](https://www.crowdsupply.com/e-radionica/inkplate-6/updates/successfully-funded-also-third-party-master-controllers-and-partial-updates), Inkplate 6's screen contents can be updated using 3rd controller (such as Raspberry Pi or another microcontroller). The "Slave Mode" (unpopular name right now, we are aware and will change) enables this. All brand new Inkplates come pre-programmed with slave mode and can be used right away. + +It is based on UART (serial) communication - connect the Inkplate to "master" board either via USB cable or directly via ESP32 RX and TX pins. Using standard UART at 115200 baud, you can send commands to change screen contents. For example, send \*#H(000,000,"/img.bmp")\*\* to show image img.bmp from SD card on the screen. Find very basic documentation for using it [here](https://github.com/e-radionicacom/Inkplate-6-Arduino-library/blob/master/examples/4.%20Others/1-Inkplate_Slave_Mode/Inkplate_slave_mode_documentation.txt). ### Battery power + Inkplate 6 has two options for powering it. First one is obvious - USB port at side of the board. Just plug any micro USB cable and you are good to go. Second option is battery. Supported batteries are standard Li-Ion/Li-Poly batteries with 3.7V nominal voltage. Connector for the battery is standard 2.00mm pitch JST connector. The onboard charger will charge the battery with 500mA when USB is plugged at the same time. You can use battery of any size or capacity if you don't have a enclosure. If you are using our enclosure, battery size shouldn't exceed 90mm x 40mm (3.5 x 1.57 inch) and 5mm (0.19 inch) in height. [This battery](https://e-radionica.com/en/li-ion-baterija-1200mah.html) is good fit for the Inkplate. ### Micropython -If you are looking for micropython support, it is still work in progress - we are new with it! :) When it's ready, we will let you know with new project update. + +If you are looking for micropython support, it is still work in progress - we are new with it! :) When it's ready, we will let you know with new project update. ### License + This repo uses the source code from Adafruit libraries: [MCP23017](https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library), [Adafruit GFX](https://github.com/adafruit/Adafruit-GFX-Library). ### Where to buy & other + Inkplate 6 is available for purchase via: + - [e-radionica.com](https://e-radionica.com/en/inkplate.html) - [Crowd Supply](https://www.crowdsupply.com/e-radionica/inkplate-6) - [Mouser](https://hr.mouser.com/Search/Refine?Keyword=inkplate) diff --git a/examples/1. Basic Inkplate Functionality/1-Inkplate_basic_monochrome/1-Inkplate_basic_monochrome.ino b/examples/1. Basic Inkplate Functionality/1-Inkplate_basic_BW/1-Inkplate_basic_BW.ino similarity index 99% rename from examples/1. Basic Inkplate Functionality/1-Inkplate_basic_monochrome/1-Inkplate_basic_monochrome.ino rename to examples/1. Basic Inkplate Functionality/1-Inkplate_basic_BW/1-Inkplate_basic_BW.ino index e869cde..8d18206 100644 --- a/examples/1. Basic Inkplate Functionality/1-Inkplate_basic_monochrome/1-Inkplate_basic_monochrome.ino +++ b/examples/1. Basic Inkplate Functionality/1-Inkplate_basic_BW/1-Inkplate_basic_BW.ino @@ -146,7 +146,7 @@ void loop() display.clearDisplay(); //Clear everytning that is inside frame buffer in ESP32 displayCurrentAction("Drawing a pixel"); //Function which writes small text at bottom left indicating what's currently done //NOTE: you do not need displayCurrentAction function to use Inkplate! - display.drawPixel(100, 50, BLACK); //Draw one black pixel at X = 100, Y = 50 position in BLACK color (must be black since Inkplate is in monochrome mode) + display.drawPixel(100, 50, BLACK); //Draw one black pixel at X = 100, Y = 50 position in BLACK color (must be black since Inkplate is in BW mode) display.display(); //Send image to display. You need to call this one each time you want to transfer frame buffer to the screen. delay(DELAY_MS); //Wait a little bit @@ -351,7 +351,7 @@ void loop() delay(DELAY_MS); //Write same text on different location, but now invert colors (text is white, text background is black), without cleaning the previous text - display.setTextColor(WHITE, BLACK); //First argument is text color, while second argument is background color. In monochrome, there are + display.setTextColor(WHITE, BLACK); //First argument is text color, while second argument is background color. In BW, there are for (int i = 0; i < 6; i++) { //only two options: BLACK & WHITE display.setTextSize(i + 1); diff --git a/examples/1. Basic Inkplate Functionality/2-Inkplate_basic_grayscale/2-Inkplate_basic_grayscale.ino b/examples/1. Basic Inkplate Functionality/2-Inkplate_basic_gray/2-Inkplate_basic_gray.ino similarity index 96% rename from examples/1. Basic Inkplate Functionality/2-Inkplate_basic_grayscale/2-Inkplate_basic_grayscale.ino rename to examples/1. Basic Inkplate Functionality/2-Inkplate_basic_gray/2-Inkplate_basic_gray.ino index 795f84b..cf7f9b2 100644 --- a/examples/1. Basic Inkplate Functionality/2-Inkplate_basic_grayscale/2-Inkplate_basic_grayscale.ino +++ b/examples/1. Basic Inkplate Functionality/2-Inkplate_basic_gray/2-Inkplate_basic_gray.ino @@ -1,5 +1,5 @@ /* - 2_Basic_grayscale example for e-radionica.com Inkplate 6 + 2_Basic_gray example for e-radionica.com Inkplate 6 For this example you will need only USB cable and Inkplate 6 Select "Inkplate 6(ESP32)" from Tools -> Board menu. Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it: @@ -8,7 +8,7 @@ This example will show you how you can draw some simple graphics using Adafruit GFX functions. Yes, Inkplate library is 100% compatible with GFX lib! Learn more about Adafruit GFX: https://learn.adafruit.com/adafruit-gfx-graphics-library - Inkplate will be used in grayscale mode which is 3 bit, so you can have up to 8 different colors (black, 6 gray + Inkplate will be used in gray mode which is 3 bit, so you can have up to 8 different colors (black, 6 gray colors and white) Color is represented by number, where number 0 means black and number 7 means white, while everything in between are shades of gray. @@ -18,10 +18,10 @@ */ #include "Inkplate.h" //Include Inkplate library to the sketch -#include "image.h" //Include image file that holds grayscale image data. You can see it in next tab inside Arduino IDE. -Inkplate display(INKPLATE_3BIT); // Create object on Inkplate library and set library to work in grayscale mode (3-bit) - // Other option is monochrome mode, which is demonstrated in next example - // "2-Inkplate_basic_monochrome" +#include "image.h" //Include image file that holds gray image data. You can see it in next tab inside Arduino IDE. +Inkplate display(INKPLATE_3BIT); // Create object on Inkplate library and set library to work in gray mode (3-bit) + // Other option is BW mode, which is demonstrated in next example + // "2-Inkplate_basic_BW" #define DELAY_MS \ 5000 //Delay in milliseconds between screen refresh. Refreshing e-paper screens more often than 5s is not recommended \ @@ -359,7 +359,7 @@ void loop() delay(DELAY_MS); } - // Did you know that you can change between monochrome and greyscale mode anytime? + // Did you know that you can change between BW and greyscale mode anytime? // Just call Inkplate display(INKPLATE_1BIT) or Inkplate display(INKPLATE_3BIT) } diff --git a/examples/1. Basic Inkplate Functionality/2-Inkplate_basic_grayscale/image.h b/examples/1. Basic Inkplate Functionality/2-Inkplate_basic_gray/image.h similarity index 100% rename from examples/1. Basic Inkplate Functionality/2-Inkplate_basic_grayscale/image.h rename to examples/1. Basic Inkplate Functionality/2-Inkplate_basic_gray/image.h diff --git a/examples/1. Basic Inkplate Functionality/3-Inkplate-basic_partial_update/3-Inkplate-basic_partial_update.ino b/examples/1. Basic Inkplate Functionality/3-Inkplate-basic_partial_update/3-Inkplate-basic_partial_update.ino index da80419..aa8cf7b 100644 --- a/examples/1. Basic Inkplate Functionality/3-Inkplate-basic_partial_update/3-Inkplate-basic_partial_update.ino +++ b/examples/1. Basic Inkplate Functionality/3-Inkplate-basic_partial_update/3-Inkplate-basic_partial_update.ino @@ -7,7 +7,7 @@ In this example we will show how to use partial update functionality of Inkplate 6 e-paper display. It will scroll text that is saved in char array - NOTE: Partial update is only available on 1 Bit mode (Monochrome) and it is not recommended to use it on first refresh after power up. + NOTE: Partial update is only available on 1 Bit mode (BW) and it is not recommended to use it on first refresh after power up. It is recommended to do a full refresh every 5-10 partial refresh to maintain good picture quality. Want to learn more about Inkplate? Visit www.inkplate.io @@ -16,7 +16,7 @@ */ #include "Inkplate.h" //Include Inkplate library to the sketch -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1-bit mode (Monochrome) +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1-bit mode (BW) //Char array where you can store your text that will be scrolled. const char text[] = "This is partial update on Inkplate 6 e-paper display! :)"; diff --git a/examples/1. Basic Inkplate Functionality/4-Inkplate-basic_custom_font/4-Inkplate-basic_custom_font.ino b/examples/1. Basic Inkplate Functionality/4-Inkplate-basic_custom_font/4-Inkplate-basic_custom_font.ino index cff5fb6..6c11b77 100644 --- a/examples/1. Basic Inkplate Functionality/4-Inkplate-basic_custom_font/4-Inkplate-basic_custom_font.ino +++ b/examples/1. Basic Inkplate Functionality/4-Inkplate-basic_custom_font/4-Inkplate-basic_custom_font.ino @@ -22,7 +22,7 @@ #include "Inkplate.h" //Include Inkplate library to the sketch #include "Not_Just_Groovy20pt7b.h" //Include first .h font file to the sketch #include "DSEG14Classic_Regular20pt7b.h" //Include second font -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1-bit mode (Monochrome) +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1-bit mode (BW) void setup() { diff --git a/examples/2. Advanced Inkplate Features/01-Inkplate_WiFi_HTTP_request/01-Inkplate_WiFi_HTTP_request.ino b/examples/2. Advanced Inkplate Features/01-Inkplate_WiFi_HTTP_request/01-Inkplate_WiFi_HTTP_request.ino index 8c31495..bed4fd4 100644 --- a/examples/2. Advanced Inkplate Features/01-Inkplate_WiFi_HTTP_request/01-Inkplate_WiFi_HTTP_request.ino +++ b/examples/2. Advanced Inkplate Features/01-Inkplate_WiFi_HTTP_request/01-Inkplate_WiFi_HTTP_request.ino @@ -23,7 +23,7 @@ #define pass "" // Password of that WiFi network Inkplate display( - INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1 Bit mode (Monochrome) + INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1 Bit mode (BW) void setup() { diff --git a/examples/2. Advanced Inkplate Features/02-Inkplate_Low_Power/02-Inkplate_Low_Power.ino b/examples/2. Advanced Inkplate Features/02-Inkplate_Low_Power/02-Inkplate_Low_Power.ino index b6eef15..f5c2efb 100644 --- a/examples/2. Advanced Inkplate Features/02-Inkplate_Low_Power/02-Inkplate_Low_Power.ino +++ b/examples/2. Advanced Inkplate Features/02-Inkplate_Low_Power/02-Inkplate_Low_Power.ino @@ -29,7 +29,7 @@ const uint8_t *pictures[] = {pic1, pic2, pic3}; //This array of pinters holds ad #define TIME_TO_SLEEP 20 //How long ESP32 will be in deep sleep (in seconds) RTC_DATA_ATTR int slide = 0; -Inkplate display(INKPLATE_3BIT); //Create an object on Inkplate library and also set library into 3 Bit mode (Grayscale) +Inkplate display(INKPLATE_3BIT); //Create an object on Inkplate library and also set library into 3 Bit mode (gray) void setup() { diff --git a/examples/2. Advanced Inkplate Features/03-Inkplate_Battery_Voltage_And_Temperature/03-Inkplate_Battery_Voltage_And_Temperature.ino b/examples/2. Advanced Inkplate Features/03-Inkplate_Battery_Voltage_And_Temperature/03-Inkplate_Battery_Voltage_And_Temperature.ino index 542bbfa..0ce4f14 100644 --- a/examples/2. Advanced Inkplate Features/03-Inkplate_Battery_Voltage_And_Temperature/03-Inkplate_Battery_Voltage_And_Temperature.ino +++ b/examples/2. Advanced Inkplate Features/03-Inkplate_Battery_Voltage_And_Temperature/03-Inkplate_Battery_Voltage_And_Temperature.ino @@ -18,7 +18,7 @@ #include "Inkplate.h" //Include Inkplate library to the sketch #include "symbols.h" //Include .h file that contains byte array for battery symbol and temperature symbol. //It is in same folder as this sketch. You can even open it (read it) by clicking on symbols.h tab in Arduino IDE -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1-bit mode (Monochrome) +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1-bit mode (BW) void setup() { diff --git a/examples/2. Advanced Inkplate Features/04-Inkplate_Touchpads/04-Inkplate_Touchpads.ino b/examples/2. Advanced Inkplate Features/04-Inkplate_Touchpads/04-Inkplate_Touchpads.ino index 5f6355d..2a5c807 100644 --- a/examples/2. Advanced Inkplate Features/04-Inkplate_Touchpads/04-Inkplate_Touchpads.ino +++ b/examples/2. Advanced Inkplate Features/04-Inkplate_Touchpads/04-Inkplate_Touchpads.ino @@ -23,7 +23,7 @@ */ #include "Inkplate.h" //Include Inkplate library to the sketch -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (Monochrome) +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (BW) int number = 0; //Variable that stores our number int n = 0; //Variable that keeps track on how many times display is partially updated diff --git a/examples/2. Advanced Inkplate Features/05-Inkplate_SD_BMP_pictures/05-Inkplate_SD_BMP_pictures.ino b/examples/2. Advanced Inkplate Features/05-Inkplate_SD_BMP_pictures/05-Inkplate_SD_BMP_pictures.ino index 72c22a9..f0e2108 100644 --- a/examples/2. Advanced Inkplate Features/05-Inkplate_SD_BMP_pictures/05-Inkplate_SD_BMP_pictures.ino +++ b/examples/2. Advanced Inkplate Features/05-Inkplate_SD_BMP_pictures/05-Inkplate_SD_BMP_pictures.ino @@ -9,7 +9,7 @@ To work with SD card on Inkplate, you will need to add one extra library. Download and install it from here: https://github.com/e-radionicacom/Inkplate-6-SDFat-Arduino-Library - You can open .bmp files that have color depth of 1 bit (monochrome bitmap), 4 bit, 8 bit and + You can open .bmp files that have color depth of 1 bit (BW bitmap), 4 bit, 8 bit and 24 bit AND have resoluton smaller than 800x600 or otherwise it won't fit on screen. Format your SD card in standard FAT fileformat. @@ -24,7 +24,7 @@ #include "Inkplate.h" //Include Inkplate library to the sketch #include "SdFat.h" //Include library for SD card Inkplate display( - INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1 Bit mode (Monochrome) + INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1 Bit mode (BW) SdFile file; // Create SdFile object used for accessing files on SD card void setup() diff --git a/examples/2. Advanced Inkplate Features/06-Inkplate_SD_TXT_file/06-Inkplate_SD_TXT_file.ino b/examples/2. Advanced Inkplate Features/06-Inkplate_SD_TXT_file/06-Inkplate_SD_TXT_file.ino index c475041..e502563 100644 --- a/examples/2. Advanced Inkplate Features/06-Inkplate_SD_TXT_file/06-Inkplate_SD_TXT_file.ino +++ b/examples/2. Advanced Inkplate Features/06-Inkplate_SD_TXT_file/06-Inkplate_SD_TXT_file.ino @@ -21,7 +21,7 @@ #include "Inkplate.h" //Include Inkplate library to the sketch #include "SdFat.h" //Include library for SD card -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (Monochrome) +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (BW) SdFile file; //Create SdFile object used for accessing files on SD card void setup() diff --git a/examples/2. Advanced Inkplate Features/07-Inkplate_easyC/07-Inkplate_easyC.ino b/examples/2. Advanced Inkplate Features/07-Inkplate_easyC/07-Inkplate_easyC.ino index 14991cd..9274971 100644 --- a/examples/2. Advanced Inkplate Features/07-Inkplate_easyC/07-Inkplate_easyC.ino +++ b/examples/2. Advanced Inkplate Features/07-Inkplate_easyC/07-Inkplate_easyC.ino @@ -22,7 +22,7 @@ #include //Adafruit library for sensors #include "Adafruit_BME680.h" //Adafruit library for BME680 Sensor -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (Monochrome) +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (BW) Adafruit_BME680 bme; //Create an object on Adafruit BME680 library //(with no arguments sent to constructor, that means we are using I2C communication for BME680 sensor) diff --git a/examples/2. Advanced Inkplate Features/08-Inkplate_MCP23017_expander/08-Inkplate_MCP23017_expander.ino b/examples/2. Advanced Inkplate Features/08-Inkplate_MCP23017_expander/08-Inkplate_MCP23017_expander.ino index 37bb63d..6a25d08 100644 --- a/examples/2. Advanced Inkplate Features/08-Inkplate_MCP23017_expander/08-Inkplate_MCP23017_expander.ino +++ b/examples/2. Advanced Inkplate Features/08-Inkplate_MCP23017_expander/08-Inkplate_MCP23017_expander.ino @@ -27,7 +27,7 @@ #define LED_PIN 15 //We are going to use pin GPB7 (remember! GPA0 = 0, GPA1 = 1, ..., GPA7 = 7, GPB0 = 8, GBP1 = 9, ..., GPB7 = 15) -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1-bit mode (Monochrome) +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1-bit mode (BW) void setup() { diff --git a/examples/2. Advanced Inkplate Features/09-Inkplate_Web_Server/09-Inkplate_Web_Server.ino b/examples/2. Advanced Inkplate Features/09-Inkplate_Web_Server/09-Inkplate_Web_Server.ino index b82f651..049ada1 100644 --- a/examples/2. Advanced Inkplate Features/09-Inkplate_Web_Server/09-Inkplate_Web_Server.ino +++ b/examples/2. Advanced Inkplate Features/09-Inkplate_Web_Server/09-Inkplate_Web_Server.ino @@ -27,7 +27,7 @@ #define ssid "Inkplate6" #define pass "e-radionica" -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (Monochrome) +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (BW) WebServer server(80); //Create Web server on port 80 (HTTP port number) IPAddress serverIP; diff --git a/examples/2. Advanced Inkplate Features/10-Inkplate_Web_BMP_pictures/10-Inkplate_Web_BMP_pictures.ino b/examples/2. Advanced Inkplate Features/10-Inkplate_Web_BMP_pictures/10-Inkplate_Web_BMP_pictures.ino index 4eb1e53..a6bc58e 100644 --- a/examples/2. Advanced Inkplate Features/10-Inkplate_Web_BMP_pictures/10-Inkplate_Web_BMP_pictures.ino +++ b/examples/2. Advanced Inkplate Features/10-Inkplate_Web_BMP_pictures/10-Inkplate_Web_BMP_pictures.ino @@ -5,7 +5,7 @@ Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it: https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/ - You can open .bmp files that have color depth of 1 bit (monochrome bitmap), 4 bit, 8 bit and + You can open .bmp files that have color depth of 1 bit (BW bitmap), 4 bit, 8 bit and 24 bit AND have resoluton smaller than 800x600 or otherwise it won't fit on screen. This example will show you how you can download a .bmp file (picture) from the web and @@ -19,7 +19,7 @@ #include "Inkplate.h" //Include Inkplate library to the sketch #include "HTTPClient.h" //Include library for HTTPClient #include "WiFi.h" //Include library for WiFi -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (Monochrome) +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (BW) const char *ssid = ""; //Your WiFi SSID const char *password = ""; //Your WiFi password diff --git a/examples/2. Advanced Inkplate Features/11-Inkplate_SD_JPEG_pictures/11-Inkplate_SD_JPEG_pictures.ino b/examples/2. Advanced Inkplate Features/11-Inkplate_SD_JPEG_pictures/11-Inkplate_SD_JPEG_pictures.ino index a7fad27..b381d08 100644 --- a/examples/2. Advanced Inkplate Features/11-Inkplate_SD_JPEG_pictures/11-Inkplate_SD_JPEG_pictures.ino +++ b/examples/2. Advanced Inkplate Features/11-Inkplate_SD_JPEG_pictures/11-Inkplate_SD_JPEG_pictures.ino @@ -23,7 +23,7 @@ #include "Inkplate.h" //Include Inkplate library to the sketch #include "SdFat.h" //Include library for SD card -Inkplate display(INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1 Bit mode (Monochrome) +Inkplate display(INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1 Bit mode (BW) SdFile file; // Create SdFile object used for accessing files on SD card void setup() diff --git a/examples/2. Advanced Inkplate Features/12-Inkplate_Web_JPEG_pictures/12-Inkplate_Web_JPEG_pictures.ino b/examples/2. Advanced Inkplate Features/12-Inkplate_Web_JPEG_pictures/12-Inkplate_Web_JPEG_pictures.ino index a002961..52522f2 100644 --- a/examples/2. Advanced Inkplate Features/12-Inkplate_Web_JPEG_pictures/12-Inkplate_Web_JPEG_pictures.ino +++ b/examples/2. Advanced Inkplate Features/12-Inkplate_Web_JPEG_pictures/12-Inkplate_Web_JPEG_pictures.ino @@ -15,15 +15,16 @@ 31 August 2020 by e-radionica.com */ -#include "Inkplate.h" //Include Inkplate library to the sketch -#include "HTTPClient.h" //Include library for HTTPClient -#include "WiFi.h" //Include library for WiFi -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (Monochrome) +#include "Inkplate.h" //Include Inkplate library to the sketch +#include "HTTPClient.h" //Include library for HTTPClient +#include "WiFi.h" //Include library for WiFi +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (BW) -const char* ssid = ""; //Your WiFi SSID -const char* password = ""; //Your WiFi password +const char *ssid = ""; //Your WiFi SSID +const char *password = ""; //Your WiFi password -void setup() { +void setup() +{ Serial.begin(115200); display.begin(); //Init Inkplate library (you should call this function ONLY ONCE) display.clearDisplay(); //Clear frame buffer of display @@ -35,7 +36,8 @@ void setup() { //Connect to the WiFi network. WiFi.mode(WIFI_MODE_STA); WiFi.begin(ssid, password); - while (WiFi.status() != WL_CONNECTED) { + while (WiFi.status() != WL_CONNECTED) + { delay(500); display.print("."); display.partialUpdate(); @@ -48,7 +50,8 @@ void setup() { //NOTE: Both drawJpegFromWeb methods allow for an optional sisxth "invert" parameter. Setting this parameter to true //will flip all colors on the image, making black white and white black. //fifth parameter will dither the image. - if (!display.drawJpegFromWeb(&display, "https://varipass.org/destination.jpg", 0, 100, true, false)) { + if (!display.drawJpegFromWeb(&display, "https://varipass.org/destination.jpg", 0, 100, true, false)) + { //If is something failed (wrong filename or format), write error message on the screen. display.println("Image open error"); display.display(); @@ -58,6 +61,7 @@ void setup() { WiFi.mode(WIFI_OFF); } -void loop() { +void loop() +{ //Nothing... } diff --git a/examples/4. Others/3-Inkplate_VariPass_Graphs/3-Inkplate_VariPass_Graphs.ino b/examples/4. Others/3-Inkplate_VariPass_Graphs/3-Inkplate_VariPass_Graphs.ino index 3dbb5f8..9a0a739 100644 --- a/examples/4. Others/3-Inkplate_VariPass_Graphs/3-Inkplate_VariPass_Graphs.ino +++ b/examples/4. Others/3-Inkplate_VariPass_Graphs/3-Inkplate_VariPass_Graphs.ino @@ -24,14 +24,15 @@ 23 July 2020 by e-radionica.com */ -#include "Inkplate.h" //Include Inkplate library to the sketch -#include "WiFi.h" //Include library for WiFi -Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (Monochrome) +#include "Inkplate.h" //Include Inkplate library to the sketch +#include "WiFi.h" //Include library for WiFi +Inkplate display(INKPLATE_1BIT); //Create an object on Inkplate library and also set library into 1 Bit mode (BW) -const char* ssid = "YourWiFiSSID"; //Your WiFi SSID -const char* password = "YourPass"; //Your WiFi password +const char *ssid = "YourWiFiSSID"; //Your WiFi SSID +const char *password = "YourPass"; //Your WiFi password -void setup() { +void setup() +{ display.begin(); //Init Inkplate library (you should call this function ONLY ONCE) display.clearDisplay(); //Clear frame buffer of display display.display(); //Put clear image on display @@ -42,7 +43,8 @@ void setup() { //Connect to the WiFi network. WiFi.mode(WIFI_MODE_STA); WiFi.begin(ssid, password); - while (WiFi.status() != WL_CONNECTED) { + while (WiFi.status() != WL_CONNECTED) + { delay(500); display.print("."); display.partialUpdate(); @@ -57,9 +59,10 @@ void setup() { // but a "key" parameter should also be specified if not. // width - Width of the generated graph, here set to half the Inkplate's width. // height - Height of the generated graph, here set to half the Inkplate's height. - // eink - Should be set to true to generate a monochrome 1 bit bitmap better suitable for Inkplate. - // For more detailed explanation and more parameters, please visit the docs page: https://varipass.org/docs/ - if(!display.drawBitmapFromWeb("https://api.varipass.org/?action=sgraph&id=kbg3eQfA&width=400&height=300&eink=true", 200, 150)) { + // eink - Should be set to true to generate a BW 1 bit bitmap better suitable for Inkplate. + // For more detailed explanation and more parameters, please visit the docs page: https://varipass.org/docs/ + if (!display.drawBitmapFromWeb("https://api.varipass.org/?action=sgraph&id=kbg3eQfA&width=400&height=300&eink=true", 200, 150)) + { display.println("Image open error"); display.partialUpdate(); } @@ -68,6 +71,7 @@ void setup() { WiFi.mode(WIFI_OFF); } -void loop() { +void loop() +{ //Nothing... } diff --git a/src/include/Graphics.cpp b/src/include/Graphics.cpp index d5bcb4e..c935544 100644 --- a/src/include/Graphics.cpp +++ b/src/include/Graphics.cpp @@ -5,11 +5,11 @@ #endif #ifndef _swap_int16_t -#define _swap_int16_t(a, b) \ - { \ - int16_t t = a; \ - a = b; \ - b = t; \ +#define _swap_int16_t(a, b) \ + { \ + int16_t t = a; \ + a = b; \ + b = t; \ } #endif diff --git a/src/include/Graphics.h b/src/include/Graphics.h index 661eb0b..79672df 100644 --- a/src/include/Graphics.h +++ b/src/include/Graphics.h @@ -24,56 +24,55 @@ #define pgm_read_pointer(addr) ((void *)pgm_read_word(addr)) #endif - class Graphics : public Shapes, public Image { - public: - Graphics(int16_t w, int16_t h) : Adafruit_GFX(w, h), Shapes(w, h), Image(w, h){}; +public: + Graphics(int16_t w, int16_t h) : Adafruit_GFX(w, h), Shapes(w, h), Image(w, h){}; - void setRotation(uint8_t r); - uint8_t getRotation(); + void setRotation(uint8_t r); + uint8_t getRotation(); - void drawPixel(int16_t x, int16_t y, uint16_t color) override; + void drawPixel(int16_t x, int16_t y, uint16_t color) override; - void selectDisplayMode(uint8_t _mode); + void selectDisplayMode(uint8_t _mode); - void setDisplayMode(uint8_t _mode); - uint8_t getDisplayMode(); - int16_t width() override; - int16_t height() override; + void setDisplayMode(uint8_t _mode); + uint8_t getDisplayMode(); + int16_t width() override; + int16_t height() override; - uint8_t *DMemoryNew; - uint8_t *_partial; - uint8_t *D_memory4Bit; - uint8_t *_pBuffer; + uint8_t *DMemoryNew; + uint8_t *_partial; + uint8_t *D_memory4Bit; + uint8_t *_pBuffer; - const uint8_t LUT2[16] = {0xAA, 0xA9, 0xA6, 0xA5, 0x9A, 0x99, 0x96, 0x95, - 0x6A, 0x69, 0x66, 0x65, 0x5A, 0x59, 0x56, 0x55}; - const uint8_t LUTW[16] = {0xFF, 0xFE, 0xFB, 0xFA, 0xEF, 0xEE, 0xEB, 0xEA, - 0xBF, 0xBE, 0xBB, 0xBA, 0xAF, 0xAE, 0xAB, 0xAA}; - const uint8_t LUTB[16] = {0xFF, 0xFD, 0xF7, 0xF5, 0xDF, 0xDD, 0xD7, 0xD5, - 0x7F, 0x7D, 0x77, 0x75, 0x5F, 0x5D, 0x57, 0x55}; + const uint8_t LUT2[16] = {0xAA, 0xA9, 0xA6, 0xA5, 0x9A, 0x99, 0x96, 0x95, + 0x6A, 0x69, 0x66, 0x65, 0x5A, 0x59, 0x56, 0x55}; + const uint8_t LUTW[16] = {0xFF, 0xFE, 0xFB, 0xFA, 0xEF, 0xEE, 0xEB, 0xEA, + 0xBF, 0xBE, 0xBB, 0xBA, 0xAF, 0xAE, 0xAB, 0xAA}; + const uint8_t LUTB[16] = {0xFF, 0xFD, 0xF7, 0xF5, 0xDF, 0xDD, 0xD7, 0xD5, + 0x7F, 0x7D, 0x77, 0x75, 0x5F, 0x5D, 0x57, 0x55}; - const uint8_t pixelMaskLUT[8] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80}; - const uint8_t pixelMaskGLUT[2] = {0xF, 0xF0}; + const uint8_t pixelMaskLUT[8] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80}; + const uint8_t pixelMaskGLUT[2] = {0xF, 0xF0}; - const uint8_t discharge[16] = {0xFF, 0xFC, 0xF3, 0xF0, 0xCF, 0xCC, 0xC3, 0xC0, - 0x3F, 0x3C, 0x33, 0x30, 0xF, 0xC, 0x3, 0x0}; + const uint8_t discharge[16] = {0xFF, 0xFC, 0xF3, 0xF0, 0xCF, 0xCC, 0xC3, 0xC0, + 0x3F, 0x3C, 0x33, 0x30, 0xF, 0xC, 0x3, 0x0}; - uint8_t _blockPartial = 1; + uint8_t _blockPartial = 1; - private: - void startWrite(void) override; - void writePixel(int16_t x, int16_t y, uint16_t color) override; - void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) override; - void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override; - void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override; - void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) override; - void endWrite(void) override; +private: + void startWrite(void) override; + void writePixel(int16_t x, int16_t y, uint16_t color) override; + void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) override; + void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) override; + void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) override; + void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) override; + void endWrite(void) override; - uint8_t _displayMode = 0; + uint8_t _displayMode = 0; - protected: +protected: }; #endif \ No newline at end of file