Renamed monochrome -> BW and grayscale -> gray.

This commit is contained in:
nitko12 2020-09-16 11:55:51 +02:00
parent 49367f07ba
commit 57a406f57a
21 changed files with 137 additions and 123 deletions

View File

@ -1,4 +1,3 @@
# Inkplate 6 Arduino library
![](https://www.crowdsupply.com/img/040a/inkplate-6-angle-01_png_project-main.jpg)
@ -6,22 +5,24 @@
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/).
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!
### Code examples
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.1. Basic BW - use the screen in BW mode (graphics & text)
1.2. Basic Grayscale - use the screen in grayscale 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
@ -54,21 +55,27 @@ There are many examples in the library that you demonstrate how to use any of th
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).
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.
### 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)

View File

@ -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);

View File

@ -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)
}

View File

@ -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! :)";

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -22,7 +22,7 @@
#include <Adafruit_Sensor.h> //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)

View File

@ -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()
{

View File

@ -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;

View File

@ -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

View File

@ -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()

View File

@ -18,12 +18,13 @@
#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
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...
}

View File

@ -26,12 +26,13 @@
#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)
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
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.
// 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)) {
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...
}

View File

@ -24,7 +24,6 @@
#define pgm_read_pointer(addr) ((void *)pgm_read_word(addr))
#endif
class Graphics : public Shapes, public Image
{
public: