Added default info header.

This commit is contained in:
nitko12 2020-09-24 10:43:08 +02:00
parent 7a40b54df1
commit cb57141976
62 changed files with 1144 additions and 2220 deletions

View File

@ -1,5 +1,5 @@
/*
3_Inkplate_Battery_Voltage_And_Temperature example for e-radionica Inkplate 6
Inkplate_Battery_Voltage_And_Temperature example for e-radionica Inkplate 6
For this example you will need USB cable, Inkplate 6 and a Lithium battery (3.6V) with two pin JST connector.
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it:

View File

@ -1,5 +1,5 @@
/*
2_Inkplate_Low_Power example for e-radionica.com Inkplate 6
Inkplate_Low_Power example for e-radionica.com Inkplate 6
For this example you will need 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:

View File

@ -1,22 +1,23 @@
/*
8_Inkplate_MCP23017 example for e-radionica.com Inkplate 6
Inkplate_MCP23017 example for e-radionica.com Inkplate 6
For this example you will need only a micro USB cable, Inkplate6, 330 Ohm resistor and LED diode.
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
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/
Connect resistor to GPB7 pin on MCP23017 header at bottom right corner on the backside (component side) of Inkplate.
You will have to connect one side of 330 Ohm resistor to GPB7, than other side to anode of LED and finally, cathode pin of LED to GND.
You will have to connect one side of 330 Ohm resistor to GPB7, than other side to anode of LED and finally, cathode
pin of LED to GND.
This example will show you how you can manipulate with I/Os of MCP23017 Expander.
You can only manipulate with Port B of MCP23017 (GPB1-GPB7). Port A is used for epaper panel and TPS65186 PMIC.
GPB0 is used for ESP32 GPIO0 so you can't use it either.
GPB1 is used for enabling battery reading (if Batt solder bridge is bridged between second and third pad)
GPB2, GPB3 and GPB4 are used for reading touchpad (if Touchpad solder bridges are bridged between second pad and third pad).
If every thing is connected ok, after you upload code, LED should blink.
GPB2, GPB3 and GPB4 are used for reading touchpad (if Touchpad solder bridges are bridged between second pad and
third pad). If every thing is connected ok, after you upload code, LED should blink.
DANGER: DO NOT USE GPA0-GPA7 and GPB0. In code those are pins from 0-8!!! Using those, you might permanently damage the screen.
You should only use pins from 9-15.
DANGER: DO NOT USE GPA0-GPA7 and GPB0. In code those are pins from 0-8!!! Using those, you might permanently damage
the screen. You should only use pins from 9-15.
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
@ -25,20 +26,24 @@
#include "Inkplate.h" //Include Inkplate library to the sketch
#define LED_PIN 15 //We are going to use pin GPB7 (remember! GPA0 = 0, GPA1 = 1, ..., GPA7 = 7, GPB0 = 8, GBP1 = 9, ..., GPB7 = 15)
#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 (BW)
Inkplate display(INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1-bit mode (BW)
void setup()
{
display.begin(); //Init Inkplate library (you should call this function ONLY ONCE)
display.pinModeMCP(LED_PIN, OUTPUT); //Set pin 15 (or GPB7) to output. On that pin, we sholud connect LED with current limiting resistor
display.begin(); // Init Inkplate library (you should call this function ONLY ONCE)
display.pinModeMCP(
LED_PIN,
OUTPUT); // Set pin 15 (or GPB7) to output. On that pin, we sholud connect LED with current limiting resistor
}
void loop()
{
display.digitalWriteMCP(LED_PIN, LOW); //Set output to low (LED does not light up)
delay(1000); //Wait for one second
display.digitalWriteMCP(LED_PIN, HIGH); //Set output to high (LED lights up)
delay(1000); //Wait for one second
display.digitalWriteMCP(LED_PIN, LOW); // Set output to low (LED does not light up)
delay(1000); // Wait for one second
display.digitalWriteMCP(LED_PIN, HIGH); // Set output to high (LED lights up)
delay(1000); // Wait for one second
}

View File

@ -1,15 +1,15 @@
/*
6_Inkplate_SD_TXT example for e-radionica.com Inkplate 6
For this example you will need only a micro USB cable, Inkplate 6 and a SD card
Inkplate_SD_TXT example for e-radionica.com Inkplate 6
For this example you will need only a micro USB cable, Inkplate 6 and a SD card
loaded with text.txt file that can be found inside folder of this example.
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it:
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/
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 your own .txt file, but in order to this example works properly it should
You can open your own .txt file, but in order to this example works properly it should
not have more than 200 chars and you should name it text.txt
This example will show you how to open .txt files and display the content of that file on Inkplate epaper display.
@ -21,51 +21,51 @@
#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 (BW)
SdFile file; //Create SdFile object used for accessing files on SD card
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()
{
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
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
//Init SD card. Display if SD card is init propery or not.
if (display.sdCardInit())
{
display.println("SD Card ok! Reading data...");
display.partialUpdate();
// Init SD card. Display if SD card is init propery or not.
if (display.sdCardInit())
{
display.println("SD Card ok! Reading data...");
display.partialUpdate();
//Try to load text with max lenght of 200 chars.
if (!file.open("/text.txt", O_RDONLY))
{ //If it fails to open, send error message to display, otherwise read the file.
display.println("File open error");
display.display();
// Try to load text with max lenght of 200 chars.
if (!file.open("/text.txt", O_RDONLY))
{ // If it fails to open, send error message to display, otherwise read the file.
display.println("File open error");
display.display();
}
else
{
display.clearDisplay(); // Clear everything that is stored in frame buffer of epaper
display.setCursor(0, 0); // Set print position at the begining of the screen
char text[201]; // Array where data from SD card is stored (max 200 chars here)
int len = file.fileSize(); // Read how big is file that we are opening
if (len > 200)
len = 200; // If it's more than 200 bytes (200 chars), limit to max 200 bytes
file.read(text, len); // Read data from file and save it in text array
text[len] = 0; // Put null terminating char at the and of data
display.print(text); // Print data/text
display.display(); // Do a full refresh of display
}
}
else
{
display.clearDisplay(); //Clear everything that is stored in frame buffer of epaper
display.setCursor(0, 0); //Set print position at the begining of the screen
char text[201]; //Array where data from SD card is stored (max 200 chars here)
int len = file.fileSize(); //Read how big is file that we are opening
if (len > 200)
len = 200; //If it's more than 200 bytes (200 chars), limit to max 200 bytes
file.read(text, len); //Read data from file and save it in text array
text[len] = 0; //Put null terminating char at the and of data
display.print(text); //Print data/text
display.display(); //Do a full refresh of display
{ // If card init was not successful, display error on screen and stop the program (using infinite loop)
display.println("SD Card error!");
display.partialUpdate();
while (true)
;
}
}
else
{ //If card init was not successful, display error on screen and stop the program (using infinite loop)
display.println("SD Card error!");
display.partialUpdate();
while (true)
;
}
}
void loop()
{
//Nothing...
// Nothing...
}

View File

@ -1,5 +1,5 @@
/*
5_Inkplate_SD_BMP example for e-radionica Inkplate6
Inkplate_SD_BMP example for e-radionica Inkplate6
For this example you will need a micro USB cable, Inkplate6 and a SD card loaded with
image1.bmp and image2.bmp file that can be found inside folder of this example.
Select "Inkplate 6(ESP32)" from Tools -> Board menu.

View File

@ -1,21 +1,21 @@
/*
4_Inkplate_Touchpads example for e-radionica.com Inkplate 6
Inkplate_Touchpads example for e-radionica.com Inkplate 6
For this example you will need only a micro 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:
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/
This example will show you how you can use built-in touchpads (on PCB marked with numbers 1, 2 and 3).
These are basically touch sensitive switches. You can read state each of these with function readTouchpad()
and the argument you need to pass to this function is PAD1 if you want to read the state of touchpad marked
as "1" on PCB, PAD2 for second touchpad, PAD3 for third. You can also use numbers as arguments.
This example will show you how you can use built-in touchpads (on PCB marked with numbers 1, 2 and 3).
These are basically touch sensitive switches. You can read state each of these with function readTouchpad()
and the argument you need to pass to this function is PAD1 if you want to read the state of touchpad marked
as "1" on PCB, PAD2 for second touchpad, PAD3 for third. You can also use numbers as arguments.
For that you need to pass number 0 for touchpad that is marked as 1 on PCB, 1 for second touchpad and 2 for third.
Function will return 1 if selected touchpad is pressed, zero if not.
In this example, if you touch first pad, ti will decrese number showed on screen, if you touch thirs touch pad,
In this example, if you touch first pad, ti will decrese number showed on screen, if you touch thirs touch pad,
it will increase the number, if you touch second touchpad, it will reset number to zero.
NOTE: You can not use touch pads when enclosure is fitted on the Inkplate - they are not that sensitive!
NOTE: You can not use touch pads when enclosure is fitted on the Inkplate - they are not that sensitive!
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
@ -23,62 +23,63 @@
*/
#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 (BW)
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
int number = 0; // Variable that stores our number
int n = 0; // Variable that keeps track on how many times display is partially updated
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
display.setTextSize(5); //Set text scaling to five (text will be five times bigger)
display.setTextColor(BLACK, WHITE); //Set text color to black and background color to white
displayNumber(); //Call our function to display nubmer on screen
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
display.setTextSize(5); // Set text scaling to five (text will be five times bigger)
display.setTextColor(BLACK, WHITE); // Set text color to black and background color to white
displayNumber(); // Call our function to display nubmer on screen
}
void loop()
{
if (display.readTouchpad(PAD1))
{ //Check if first pad has been touched. If it is, decrement the number and refresh the screen.
number--;
displayNumber();
}
if (display.readTouchpad(PAD1))
{ // Check if first pad has been touched. If it is, decrement the number and refresh the screen.
number--;
displayNumber();
}
if (display.readTouchpad(PAD2))
{ //If you touched second touchpad, set number to zero and refresh screen by calling our displayNumber() function
number = 0;
displayNumber();
}
if (display.readTouchpad(PAD2))
{ // If you touched second touchpad, set number to zero and refresh screen by calling our displayNumber() function
number = 0;
displayNumber();
}
if (display.readTouchpad(PAD3))
{ //If you touched third touchpad, incerement the number and refresh the screen.
number++;
displayNumber();
}
delay(100); //Wait a little bit between readings.
if (display.readTouchpad(PAD3))
{ // If you touched third touchpad, incerement the number and refresh the screen.
number++;
displayNumber();
}
delay(100); // Wait a little bit between readings.
}
//Function that will write you number to screen
// Function that will write you number to screen
void displayNumber()
{
display.clearDisplay(); //First, lets delete everything from frame buffer
display.setCursor(385, 280); //Set print cursor at X=385, Y=280 (roughly in the middle of the screen)
display.print(number, DEC); //Print the number
display.setCursor(255, 560); //Set new print position (right above first touchpad)
display.print('-'); //Print minus sign
display.setCursor(385, 560); //Set new print position (right above second touchpad)
display.print('0'); //Print zero
display.setCursor(520, 560); //Set new print position (right above third touchpad)
display.print('+'); //Print plus sign
if (n > 20)
{ //Chech if screen has been partially refreshed more than 20 times. If it is, do a full refresh. If is not, do a partial refresh
display.display();
n = 0;
}
else
{
display.partialUpdate();
n++;
}
display.clearDisplay(); // First, lets delete everything from frame buffer
display.setCursor(385, 280); // Set print cursor at X=385, Y=280 (roughly in the middle of the screen)
display.print(number, DEC); // Print the number
display.setCursor(255, 560); // Set new print position (right above first touchpad)
display.print('-'); // Print minus sign
display.setCursor(385, 560); // Set new print position (right above second touchpad)
display.print('0'); // Print zero
display.setCursor(520, 560); // Set new print position (right above third touchpad)
display.print('+'); // Print plus sign
if (n > 20)
{ // Chech if screen has been partially refreshed more than 20 times. If it is, do a full refresh. If is not, do a
// partial refresh
display.display();
n = 0;
}
else
{
display.partialUpdate();
n++;
}
}

View File

@ -1,3 +1,17 @@
/*
Inkplate_Wake_up_on_touchpads example for e-radionica.com Inkplate 6
For this example you will need USB cable and an Inkplate 6
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
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/
Here is shown how to use MCP and ESP interrupts to wake up the MCU from deepsleep when touchpad is pressed.
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
15 July 2020 by e-radionica.com
*/
#include <Inkplate.h>
// Conversion factor for micro seconds to seconds
@ -55,7 +69,7 @@ void displayInfo()
display.setTextSize(2);
display.print(F("Boot count: "));
display.println(bootCount, DEC); //Print the number
display.println(bootCount, DEC); // Print the number
// Set next line cursor position
display.setCursor(10, 320);

View File

@ -1,5 +1,5 @@
/*
10_Web_BMP_pictures example for e-radionica Inkplate6
Web_BMP_pictures example for e-radionica Inkplate6
For this example you will need a micro USB cable, Inkplate6, and an available WiFi connection.
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it:

View File

@ -1,99 +1,102 @@
/*
10_Inkplate_Web_Server example for e-radionica.com Inkplate 6
For this example you will need a micro USB cable, Inkplate 6 and a device with WiFi and Internet brower (PC, Laptop, Smartphone, ...).
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
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/
Inkplate_Web_Server example for e-radionica.com Inkplate 6
For this example you will need a micro USB cable, Inkplate 6 and a device with WiFi and Internet brower (PC, Laptop,
Smartphone, ...). Select "Inkplate 6(ESP32)" from Tools -> Board menu. 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/
This example will show you how you can use Inkplate as a small and simple standlone Web Server.
This example will show you how you can use Inkplate as a small and simple standlone Web Server.
You need to connect to Inkplate with WiFi and open IP address shown on Inkplate display.
After opening IP address, you will se text box where you can type some text and after that you press "Send to display".
Text will apper on Inkplate display!
This is just simple example what you can do with it and of course, you can create much more complex stuff.
After opening IP address, you will se text box where you can type some text and after that you press "Send to
display". Text will apper on Inkplate display! This is just simple example what you can do with it and of course, you
can create much more complex stuff.
HINT: You can change WiFi name and password of your Inkplate WIFi Access point by changing ssid and pass in #define macros!
HINT: You can change WiFi name and password of your Inkplate WIFi Access point by changing ssid and pass in #define
macros!
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
15 July 2020 by e-radionica.com
*/
#include <WiFi.h> //Include ESP32 WiFi library
#include <WiFiClient.h> //Include ESP32 WiFi library for AP
#include <WebServer.h> //Include ESP32 library for Web server
#include "Inkplate.h" //Include Inkplate library to the sketch
#include "htmlCode.h" //Include .h file where we stored out html code of our web page
#include <WebServer.h> //Include ESP32 library for Web server
#include <WiFi.h> //Include ESP32 WiFi library
#include <WiFiClient.h> //Include ESP32 WiFi library for AP
#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 (BW)
WebServer server(80); //Create Web server on port 80 (HTTP port number)
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;
String txt;
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
display.setTextSize(3); //Scale text to be two times bigger then original (5x7 px)
display.setTextColor(BLACK, WHITE); //Set text color to black and background color to white
display.setTextWrap(true); //If text does not fit on screen, send it to new line
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
display.setTextSize(3); // Scale text to be two times bigger then original (5x7 px)
display.setTextColor(BLACK, WHITE); // Set text color to black and background color to white
display.setTextWrap(true); // If text does not fit on screen, send it to new line
WiFi.begin(); //Init. WiFi library
WiFi.mode(WIFI_AP); //Set WiFi to Access point mode
WiFi.softAP(ssid, pass); //Set SSID (WiFi name) and password for Access point
WiFi.begin(); // Init. WiFi library
WiFi.mode(WIFI_AP); // Set WiFi to Access point mode
WiFi.softAP(ssid, pass); // Set SSID (WiFi name) and password for Access point
serverIP = WiFi.softAPIP(); //Get the server IP address
serverIP = WiFi.softAPIP(); // Get the server IP address
server.on("/", handleRoot); //If you open homepage, go to handle root function
server.on("/string/{}", handleString); //If you send some text to Inkplate, go to handleString function. Note that {} brackets at the end of address. That means that web address has some arguments (our text!).
server.begin(); //Start the web server
updatePaper();
server.on("/", handleRoot); // If you open homepage, go to handle root function
server.on("/string/{}",
handleString); // If you send some text to Inkplate, go to handleString function. Note that {} brackets at
// the end of address. That means that web address has some arguments (our text!).
server.begin(); // Start the web server
updatePaper();
}
void loop()
{
server.handleClient(); //You have to constantly read if there is any new client connected to web server
server.handleClient(); // You have to constantly read if there is any new client connected to web server
}
void updateHTML()
{ //This function will send response to client and send HTML code of our web page
server.send(200, "text/html", s);
{ // This function will send response to client and send HTML code of our web page
server.send(200, "text/html", s);
}
void handleRoot()
{ //This function will send response to client if client open a root (homepage) of our web page
updateHTML();
{ // This function will send response to client if client open a root (homepage) of our web page
updateHTML();
}
void handleString()
{ //This function will send response to client, send HTML code of web page, get the text from argument sent in web page address and refresh screen with new text
txt = server.arg(0);
updateHTML();
updatePaper();
{ // This function will send response to client, send HTML code of web page, get the text from argument sent in web page
// address and refresh screen with new text
txt = server.arg(0);
updateHTML();
updatePaper();
}
void updatePaper()
{ //This function updates screen with new data (text)
display.clearDisplay(); //Clear everything from epaper frame buffer
display.setCursor(20, 40); //Print out instruction on how to connect to Inkplate WiFi and how to open a web page
display.print("Connect to ");
display.print(ssid);
display.println(" WiFi with pass: ");
display.setCursor(240, 100);
display.println(pass);
display.setCursor(100, 150);
display.print("Open Your web browser and open");
display.setCursor(240, 210);
display.print("http://");
display.print(serverIP);
display.println('/');
display.println();
display.fillRect(10, 240, 780, 4, BLACK);
display.println("User text:"); //Print out what user typed in web page
display.print(txt);
display.display(); //Send everything to screen (refresh the screen)
{ // This function updates screen with new data (text)
display.clearDisplay(); // Clear everything from epaper frame buffer
display.setCursor(20, 40); // Print out instruction on how to connect to Inkplate WiFi and how to open a web page
display.print("Connect to ");
display.print(ssid);
display.println(" WiFi with pass: ");
display.setCursor(240, 100);
display.println(pass);
display.setCursor(100, 150);
display.print("Open Your web browser and open");
display.setCursor(240, 210);
display.print("http://");
display.print(serverIP);
display.println('/');
display.println();
display.fillRect(10, 240, 780, 4, BLACK);
display.println("User text:"); // Print out what user typed in web page
display.print(txt);
display.display(); // Send everything to screen (refresh the screen)
}

View File

@ -1,5 +1,5 @@
/*
1_Inkplate_WiFi_HTTP example for e-radionica.com Inkplate 6
Inkplate_WiFi_HTTP example for e-radionica.com Inkplate 6
For this example you will need USB cable, Inkplate 6 and stable WiFi Internet connection
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it:
@ -22,8 +22,7 @@
#define ssid "" // Name of the WiFi network (SSID) that you want to connect Inkplate to
#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 (BW)
Inkplate display(INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1 Bit mode (BW)
void setup()
{

View File

@ -1,16 +1,16 @@
/*
7_Inkplate_easyC example for e-radionica.com Inkplate 6
For this example you will need a micro USB cable, Inkplate 6,
Inkplate_easyC example for e-radionica.com Inkplate 6
For this example you will need a micro USB cable, Inkplate 6,
BME680 sensor with easyC connector on it: https://e-radionica.com/en/bme680-breakout-made-by-e-radionica.html
and a easyC cable: https://e-radionica.com/en/easyc-cable-20cm.html
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it:
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/
This example will show you how you can read temperature, humidity, air pressure and gas data from BME680.
In order to compile this example successfuly, you will also need to download and install
In order to compile this example successfuly, you will also need to download and install
Adafruit BME680 library: https://github.com/adafruit/Adafruit_BME680
and Adafruit Sensor library ( https://github.com/adafruit/Adafruit_Sensor ).
and Adafruit Sensor library ( https://github.com/adafruit/Adafruit_Sensor ).
If you don't know how to install library you can read our tutorial https://e-radionica.com/en/blog/arduino-library/
Want to learn more about Inkplate? Visit www.inkplate.io
@ -18,78 +18,80 @@
15 July 2020 by e-radionica.com
*/
#include "Adafruit_BME680.h" //Adafruit library for BME680 Sensor
#include "Inkplate.h" //Include Inkplate library to the sketch
#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 (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)
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)
int n = 0; //Variable that keep track on how many times screen has been partially updated
int n = 0; // Variable that keep track on how many times screen has been partially updated
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
display.setTextSize(2); //Set text scaling to two (text will be two times bigger than normal)
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
display.setTextSize(2); // Set text scaling to two (text will be two times bigger than normal)
if (!bme.begin(0x76))
{ //Init. BME680 library. e-radionica.com BME680 sensor board uses 0x76 I2C address for sensor
display.println("Sensor init failed!");
display.println("Check sensor wiring/connection!");
display.partialUpdate();
while (1)
;
}
if (!bme.begin(0x76))
{ // Init. BME680 library. e-radionica.com BME680 sensor board uses 0x76 I2C address for sensor
display.println("Sensor init failed!");
display.println("Check sensor wiring/connection!");
display.partialUpdate();
while (1)
;
}
//Set up oversampling and filter initialization for the sensor
bme.setTemperatureOversampling(BME680_OS_8X);
bme.setHumidityOversampling(BME680_OS_2X);
bme.setPressureOversampling(BME680_OS_4X);
bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
bme.setGasHeater(320, 150); // 320*C for 150 ms
// Set up oversampling and filter initialization for the sensor
bme.setTemperatureOversampling(BME680_OS_8X);
bme.setHumidityOversampling(BME680_OS_2X);
bme.setPressureOversampling(BME680_OS_4X);
bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
bme.setGasHeater(320, 150); // 320*C for 150 ms
}
void loop()
{
if (!bme.performReading())
{ //If sending command to start reading data fails, send error message to display
display.clearDisplay();
display.setCursor(0, 0);
display.print("Failed to read data from sensor");
display.partialUpdate();
}
else
{ //Otherwise, clear frame buffer of epaper display
display.clearDisplay(); //Print out new data
display.setCursor(0, 0);
display.print("Air temperature: ");
display.print(bme.temperature);
display.println(" *C");
display.print("Air pressure: ");
display.print(bme.pressure / 100.0);
display.println(" hPa");
display.print("Air humidity: ");
display.print(bme.humidity);
display.println(" %");
display.print("Gas sensor resistance: ");
display.print(bme.gas_resistance / 1000.0);
display.println(" kOhms");
if (n > 20)
{ //If display has been partially updated more than 20 times, do a full refresh, otherwise, perform a partial update.
display.display();
n = 0;
if (!bme.performReading())
{ // If sending command to start reading data fails, send error message to display
display.clearDisplay();
display.setCursor(0, 0);
display.print("Failed to read data from sensor");
display.partialUpdate();
}
else
{
display.partialUpdate();
n++;
{ // Otherwise, clear frame buffer of epaper display
display.clearDisplay(); // Print out new data
display.setCursor(0, 0);
display.print("Air temperature: ");
display.print(bme.temperature);
display.println(" *C");
display.print("Air pressure: ");
display.print(bme.pressure / 100.0);
display.println(" hPa");
display.print("Air humidity: ");
display.print(bme.humidity);
display.println(" %");
display.print("Gas sensor resistance: ");
display.print(bme.gas_resistance / 1000.0);
display.println(" kOhms");
if (n > 20)
{ // If display has been partially updated more than 20 times, do a full refresh, otherwise, perform a partial
// update.
display.display();
n = 0;
}
else
{
display.partialUpdate();
n++;
}
}
}
delay(2000); //Wait a little bit between readings
delay(2000); // Wait a little bit between readings
}

View File

@ -1,56 +1,56 @@
/*
4_Basic_custom_font example for e-radionica.com Inkplate 6
Basic_custom_font 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:
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/
This example will show you how to use custom fonts on Inkplate 6 thanks to Adafruit GFX
More on custom fonts in Adafruit GFX: https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts
In this example, we will use already prebuilt .h font file.
If you want use your own fonts, you first need to convert it from .ttf to .h using online converter: https://rop.nl/truetype2gfx/
When you convert it, download .h file and put it inside sketch folder.
Include that file using #include macro and set font using setFont() function.
NOTE: When using custom fonts, you can't use background color. Also, start position of text is not in top left corner!
If you want use your own fonts, you first need to convert it from .ttf to .h using online converter:
https://rop.nl/truetype2gfx/ When you convert it, download .h file and put it inside sketch folder. Include that file
using #include macro and set font using setFont() function. NOTE: When using custom fonts, you can't use background
color. Also, start position of text is not in top left corner!
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
15 July 2020 by e-radionica.com
*/
#include "DSEG14Classic_Regular20pt7b.h" //Include second font
#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 (BW)
Inkplate display(INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1-bit mode (BW)
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
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
display.setFont(&Not_Just_Groovy20pt7b); //Select new font
display.setTextSize(2); //Set font scaling to two (font will be 2 times bigger)
display.setCursor(0, 60); //Set print cursor on X = 0, Y = 60
display.println("Inkplate 6"); //Print some text
display.setTextSize(1); //Set font scaling to one (font is now original size)
display.print("by e-radionica.com"); //Print text
display.setFont(&Not_Just_Groovy20pt7b); // Select new font
display.setTextSize(2); // Set font scaling to two (font will be 2 times bigger)
display.setCursor(0, 60); // Set print cursor on X = 0, Y = 60
display.println("Inkplate 6"); // Print some text
display.setTextSize(1); // Set font scaling to one (font is now original size)
display.print("by e-radionica.com"); // Print text
display.setFont(&DSEG14Classic_Regular20pt7b); //Select second font
display.setCursor(0, 250); //Set print position on X = 0, Y = 250
display.println("Some old-school 14 segment"); //Print text
display.println("display font on e-paper");
display.print("display");
display.setFont(&DSEG14Classic_Regular20pt7b); // Select second font
display.setCursor(0, 250); // Set print position on X = 0, Y = 250
display.println("Some old-school 14 segment"); // Print text
display.println("display font on e-paper");
display.print("display");
display.setFont(); //Use original 5x7 pixel fonts
display.setCursor(0, 550); //Set new print position at X = 0, Y = 550
display.setTextSize(3); //Set font scaling to three (font will be 3 times bigger)
display.print("Classic 5x7 px fonts"); //Print text
display.display(); //Display everything on display
display.setFont(); // Use original 5x7 pixel fonts
display.setCursor(0, 550); // Set new print position at X = 0, Y = 550
display.setTextSize(3); // Set font scaling to three (font will be 3 times bigger)
display.print("Classic 5x7 px fonts"); // Print text
display.display(); // Display everything on display
}
void loop()
{
//Nothing...
// Nothing...
}

View File

@ -1,14 +1,14 @@
/*
3_Basic_partial_update example for e-radionica Inkplate 6
Basic_partial_update example for e-radionica 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:
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/
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 (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.
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
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
@ -16,43 +16,43 @@
*/
#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 (BW)
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.
// 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! :)";
//This variable is used for moving the text (scrolling)
// This variable is used for moving the text (scrolling)
int offset = 800;
//Variable that keeps count on how much screen has been partially updated
// Variable that keeps count on how much screen has been partially updated
int n = 0;
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
display.setTextColor(BLACK, WHITE); //Set text color to be black and background color to be white
display.setTextSize(4); //Set text to be 4 times bigger than classic 5x7 px text
display.setTextWrap(false); //Disable text wraping
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
display.setTextColor(BLACK, WHITE); // Set text color to be black and background color to be white
display.setTextSize(4); // Set text to be 4 times bigger than classic 5x7 px text
display.setTextWrap(false); // Disable text wraping
}
void loop()
{
display.clearDisplay(); //Clear content in frame buffer
display.setCursor(offset, 300); //Set new position for text
display.print(text); //Write text at new position
if (n > 9)
{ //Check if you need to do full refresh or you can do partial update
display.display(); //Do a full refresh
n = 0;
}
else
{
display.partialUpdate(); //Do partial update
n++; //Keep track on how many times screen has been partially updated
}
offset -= 20; //Move text into new position
if (offset < 0)
offset = 800; //Text is scrolled till the end of the screen? Get it back on the start!
delay(500); //Delay between refreshes.
display.clearDisplay(); // Clear content in frame buffer
display.setCursor(offset, 300); // Set new position for text
display.print(text); // Write text at new position
if (n > 9)
{ // Check if you need to do full refresh or you can do partial update
display.display(); // Do a full refresh
n = 0;
}
else
{
display.partialUpdate(); // Do partial update
n++; // Keep track on how many times screen has been partially updated
}
offset -= 20; // Move text into new position
if (offset < 0)
offset = 800; // Text is scrolled till the end of the screen? Get it back on the start!
delay(500); // Delay between refreshes.
}

View File

@ -1,5 +1,5 @@
/*
1_Basic_monochorme example for e-radionica.com Inkplate 6
Basic_monochorme 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:
@ -16,7 +16,7 @@
#include "Inkplate.h" //Include Inkplate library to the sketch
Inkplate display(INKPLATE_1BIT); // Create object on Inkplate library and set library to work in monochorme mode
// Other option is greyscale mode, which is demonstrated in next example "2-Inkplate_basic_greyscale"
// Other option is gray mode, which is demonstrated in next example "Inkplate_basic_gray"
#define DELAY_MS \
5000 // Delay in milliseconds between screen refresh. Refreshing e-paper screens more often than 5s is not

View File

@ -1,5 +1,5 @@
/*
2_Basic_gray example for e-radionica.com Inkplate 6
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:
@ -21,11 +21,11 @@
#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"
// "Inkplate_basic_BW"
#define DELAY_MS \
5000 //Delay in milliseconds between screen refresh. Refreshing e-paper screens more often than 5s is not recommended \
//Want to refresh faster? Use partial update! Find example in "3-Inkplate-basic_partial_update"
//Want to refresh faster? Use partial update! Find example in "Inkplate-basic_partial_update"
void setup()
{

View File

@ -1,6 +1,18 @@
/** Example "Game of Life" program for the InkPlate 6 by Chris Knight
* https://github.com/claud9999
*/
/*
Game_Of_Life_by_claud9999 example for e-radionica 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:
https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/
Our first community created example, made by: https://github.com/claud9999
To run it, jut upload the code and watch Conways game of life animation!
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
24 September 2020 by e-radionica.com
*/
#include <Inkplate.h>

View File

@ -1,5 +1,5 @@
/*
2_Inkplate_Clean_Screen sketch for e-radionica.com Inkplate 6
Inkplate_Clean_Screen sketch for e-radionica.com Inkplate 6
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
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/
@ -12,7 +12,7 @@
The sketch didn't help? Refrigerate your Inkplate for 60 minutes!
NOTE: burn-in effect is much stronger at the direct sun of when exposed to heat source.
e-paper screens are not intedted to be used at strong sun and in hot enviroments.
e-paper screens are not intented to be used at strong sun and in hot enviroments.
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/

View File

@ -1,3 +1,17 @@
/*
Inkplate_Mandelbrot_set sketch for e-radionica.com Inkplate 6
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
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/
This example renders the mandelbrot set to coordiantes to Inkplate.
Due to the nature of Mandelbrot set, it is quite slow on low powered MCUs, so please be patient :)
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
15 July 2020 by e-radionica.com
*/
#include "Inkplate.h"
#define MAXITERATIONS 150

View File

@ -1,17 +1,38 @@
/*
Inkplate_Maze_Generator sketch for e-radionica.com Inkplate 6
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
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/
This example renders a random maze every time!
You can write on it with a whiteboard marker or a graphite pen to solve it.
Just be sure not to use pernament markers!
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
15 July 2020 by e-radionica.com
*/
#include "Inkplate.h"
// Initialise Inkplate object
Inkplate display(INKPLATE_1BIT);
// Here we define one cell size
const int cellSize = 10;
// Calculate screen width and height
const int w = 790 / cellSize, h = 590 / cellSize;
char maze[w * h];
// Move direction difference array
int dx[] = {-1, 0, 0, 1};
int dy[] = {0, -1, 1, 0};
void setup()
{
// Initialise Inkplate
Serial.begin(115200);
display.begin();

View File

@ -1,8 +1,8 @@
/*
3-Inkplate_VariPass_Graphs example for e-radionica Inkplate6
Inkplate_VariPass_Graphs example for e-radionica Inkplate6
For this example you will need a micro USB cable, Inkplate6, and an available WiFi connection.
Select "Inkplate 6(ESP32)" from Tools -> Board menu.
Don't have "Inkplate 6(ESP32)" option? Follow our tutorial and add it:
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/
This example will show you how you can use the API on the VariPass website to download and display
@ -26,52 +26,53 @@
#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)
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()
{
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
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
display.print("Connecting to WiFi...");
display.partialUpdate();
//Connect to the WiFi network.
WiFi.mode(WIFI_MODE_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
display.print(".");
display.print("Connecting to WiFi...");
display.partialUpdate();
}
display.println("\nWiFi OK! Downloading...");
display.partialUpdate();
//Use a HTTP get request to fetch the graph from VariPass.
//The API expects a few parameters in the URL to allow it to work.
// action - Should be set to "sgraph" or "graph" in order to generate a compatible image.
// id - ID of the variable. It is enough to specify just the ID if the variable is public,
// 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 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");
// Connect to the WiFi network.
WiFi.mode(WIFI_MODE_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
display.print(".");
display.partialUpdate();
}
display.println("\nWiFi OK! Downloading...");
display.partialUpdate();
}
display.partialUpdate();
WiFi.mode(WIFI_OFF);
// Use a HTTP get request to fetch the graph from VariPass.
// The API expects a few parameters in the URL to allow it to work.
// action - Should be set to "sgraph" or "graph" in order to generate a compatible image.
// id - ID of the variable. It is enough to specify just the ID if the variable is public,
// 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 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();
}
display.partialUpdate();
WiFi.mode(WIFI_OFF);
}
void loop()
{
//Nothing...
// Nothing...
}

View File

@ -1,28 +1,44 @@
/*
Network.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Network.h"
#include <WiFi.h>
#include <HTTPClient.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include "Inkplate.h"
//Must be installed for this example to work
// Must be installed for this example to work
#include <ArduinoJson.h>
//external parameters from our main file
// external parameters from our main file
extern char *ssid;
extern char *pass;
extern char *currency;
//Get our Inkplate object from main file to draw debug info on
// Get our Inkplate object from main file to draw debug info on
extern Inkplate display;
//Static Json from ArduinoJson library
// Static Json from ArduinoJson library
StaticJsonDocument<30000> doc;
void Network::begin()
{
//Initiating wifi, like in BasicHttpClient example
// Initiating wifi, like in BasicHttpClient example
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, pass);
@ -43,30 +59,30 @@ void Network::begin()
}
Serial.println(F(" connected"));
//Find internet time
// Find internet time
setTime();
}
//Gets time from ntp server
// Gets time from ntp server
void Network::getTime(char *timeStr)
{
//Get seconds since 1.1.1970.
// Get seconds since 1.1.1970.
time_t nowSecs = time(nullptr);
//Used to store time
// Used to store time
struct tm timeinfo;
gmtime_r(&nowSecs, &timeinfo);
//Copies time string into timeStr
// Copies time string into timeStr
strncpy(timeStr, asctime(&timeinfo) + 4, 12);
//Setting time string timezone
// Setting time string timezone
int hr = 10 * timeStr[7] + timeStr[8] + timeZone;
//Better defined modulo, in case timezone makes hours to go below 0
// Better defined modulo, in case timezone makes hours to go below 0
hr = (hr % 24 + 24) % 24;
//Adding time to '0' char makes it into whatever time char, for both digits
// Adding time to '0' char makes it into whatever time char, for both digits
timeStr[7] = hr / 10 + '0';
timeStr[8] = hr % 10 + '0';
}
@ -100,30 +116,30 @@ bool Network::getData(double *data)
}
}
//Wake up if sleeping and save inital state
// Wake up if sleeping and save inital state
bool sleep = WiFi.getSleep();
WiFi.setSleep(false);
//Http object used to make get request
// Http object used to make get request
HTTPClient http;
http.getStream().setTimeout(10);
http.getStream().flush();
//Initiate http
// Initiate http
char temp[128];
sprintf(temp, "https://api.coingecko.com/api/v3/coins/%s/market_chart?vs_currency=usd&days=92", currency);
http.begin(temp);
//Actually do request
// Actually do request
int httpCode = http.GET();
if (httpCode == 200)
{
while (http.getStream().available() && http.getStream().peek() != '{')
(void)http.getStream().read();
//Try parsing JSON object
// Try parsing JSON object
DeserializationError error = deserializeJson(doc, http.getStream());
if (error)
@ -134,23 +150,23 @@ bool Network::getData(double *data)
}
else if (doc["prices"].size() > 31)
{
//Set all data got from internet using formatTemp and formatWind defined above
//This part relies heavily on ArduinoJson library
// Set all data got from internet using formatTemp and formatWind defined above
// This part relies heavily on ArduinoJson library
Serial.println("Success");
//Save our data to data pointer from main file
// Save our data to data pointer from main file
for (int i = 0; i < 31; ++i)
{
data[i] = doc["prices"][92 - 31 + i][1].as<double>();
//Serial.println(data[i]);
// Serial.println(data[i]);
}
f = 0;
}
}
else if (httpCode == 404)
{
//Coin id not found
// Coin id not found
display.clearDisplay();
display.setCursor(50, 230);
display.setTextSize(2);
@ -164,20 +180,20 @@ bool Network::getData(double *data)
f = 1;
}
//Clear document and end http
// Clear document and end http
doc.clear();
http.end();
//Return to initial state
// Return to initial state
WiFi.setSleep(sleep);
return !f;
}
//Function for initial time setting ovet the ntp server
// Function for initial time setting ovet the ntp server
void Network::setTime()
{
//Used for setting correct time
// Used for setting correct time
configTime(0, 0, "pool.ntp.org", "time.nist.gov");
Serial.print(F("Waiting for NTP time sync: "));
@ -192,7 +208,7 @@ void Network::setTime()
Serial.println();
//Used to store time info
// Used to store time info
struct tm timeinfo;
gmtime_r(&nowSecs, &timeinfo);

View File

@ -1,7 +1,23 @@
/*
Network.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Arduino.h"
#include <WiFi.h>
#include <HTTPClient.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
// To get timeZone from main file
@ -18,13 +34,13 @@ extern char *pass;
class Network
{
public:
public:
// Functions we can access in main file
void begin();
void getTime(char *timeStr);
bool getData(double *data);
private:
private:
// Functions called from within our class
void setTime();
};

View File

@ -1,9 +1,25 @@
/*
Network.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
// Network.cpp contains various functions and classes that enable Weather station
// They have been declared in seperate file to increase readability
#include "Network.h"
#include <WiFi.h>
#include <HTTPClient.h>
#include <WiFi.h>
#include <ArduinoJson.h>
@ -12,13 +28,7 @@ StaticJsonDocument<6000> doc;
// Declared week days
char weekDays[8][8] = {
"Mon",
"Tue",
"Wed",
"Thr",
"Fri",
"Sat",
"Sun",
"Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sun",
};
void Network::begin(char *city)
@ -61,7 +71,7 @@ void Network::getTime(char *timeStr)
struct tm timeinfo;
gmtime_r(&nowSecs, &timeinfo);
//Copies time string into timeStr
// Copies time string into timeStr
strncpy(timeStr, asctime(&timeinfo) + 11, 5);
// Setting time string timezone
@ -87,7 +97,9 @@ void formatWind(char *str, float wind)
dtostrf(wind, 2, 0, str);
}
void Network::getData(char *city, char *temp1, char *temp2, char *temp3, char *temp4, char *currentTemp, char *currentWind, char *currentTime, char *currentWeather, char *currentWeatherAbbr, char *abbr1, char *abbr2, char *abbr3, char *abbr4)
void Network::getData(char *city, char *temp1, char *temp2, char *temp3, char *temp4, char *currentTemp,
char *currentWind, char *currentTime, char *currentWeather, char *currentWeatherAbbr, char *abbr1,
char *abbr2, char *abbr3, char *abbr4)
{
// If not connected to wifi reconnect wifi
if (WiFi.status() != WL_CONNECTED)

View File

@ -1,9 +1,23 @@
/*
Network.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Arduino.h"
#include <WiFi.h>
#include <HTTPClient.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
// To get timeZone from main file
@ -20,17 +34,19 @@ extern char *pass;
class Network
{
public:
public:
// Functions we can access in main file
void begin(char *city);
void getTime(char *timeStr);
void getData(char *city, char *temp1, char *temp2, char *temp3, char *temp4, char *currentTemp, char *currentWind, char *currentTime, char *currentWeather, char *currentWeatherAbbr, char* abbr1, char* abbr2, char* abbr3, char* abbr4);
void getData(char *city, char *temp1, char *temp2, char *temp3, char *temp4, char *currentTemp, char *currentWind,
char *currentTime, char *currentWeather, char *currentWeatherAbbr, char *abbr1, char *abbr2,
char *abbr3, char *abbr4);
void getDays(char *day, char *day1, char *day2, char *day3);
// Used to store loaction woeid (world id), set in findCity()
int location = -1;
private:
private:
// Functions called from within our class
void setTime();
void findCity(char *city);

View File

@ -1,7 +1,23 @@
/*
Network.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Network.h"
#include <WiFi.h>
#include <HTTPClient.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
void Network::begin()

View File

@ -1,7 +1,23 @@
/*
Network.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Arduino.h"
#include <WiFi.h>
#include <HTTPClient.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
// To get timeZone from main file
@ -20,13 +36,13 @@ extern char *calendarURL;
class Network
{
public:
public:
// Functions we can access in main file
void begin();
void getTime(char *timeStr, long offset = 0);
bool getData(char *data);
private:
private:
// Functions called from within our class
void setTime();
};

View File

@ -1,3 +1,19 @@
/*
Network.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
// Network.cpp contains various functions and classes that enable Weather station
// They have been declared in seperate file to increase readability
#include "Network.h"

View File

@ -1,3 +1,19 @@
/*
Network.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Arduino.h"
#include "Inkplate.h"
@ -7,10 +23,10 @@
#include <WiFiClientSecure.h>
//To get timeZone from main file
// To get timeZone from main file
extern int timeZone;
//wifi ssid and password
// wifi ssid and password
extern char *ssid;
extern char *pass;
@ -24,22 +40,24 @@ extern Inkplate display;
#ifndef NETWORK_H
#define NETWORK_H
//All functions defined in Network.cpp
// All functions defined in Network.cpp
class Network
{
public:
//Functions we can access in main file
public:
// Functions we can access in main file
void begin(char *city);
void getTime(char *timeStr);
bool getData(char *city, char *temp1, char *temp2, char *temp3, char *temp4, char *currentTemp, char *currentWind, char *currentTime, char *currentWeather, char *currentWeatherAbbr, char *abbr1, char *abbr2, char *abbr3, char *abbr4);
bool getData(char *city, char *temp1, char *temp2, char *temp3, char *temp4, char *currentTemp, char *currentWind,
char *currentTime, char *currentWeather, char *currentWeatherAbbr, char *abbr1, char *abbr2,
char *abbr3, char *abbr4);
void getHours(char *hour1, char *hour2, char *hour3, char *hour4);
//Used for storing retrieved data timestamp
// Used for storing retrieved data timestamp
time_t dataEpoch = 0;
private:
//Functions called from within our class
private:
// Functions called from within our class
void setTime();
};

View File

@ -1,3 +1,21 @@
/*
Spotify_api_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:
https://e-radionica.com/en/blog/add-inkplate-6-to-arduino-ide/
This project shows you how Inkplate 6 can be used to display
your spotify real time activity.
To get this working, see https://inkplate.readthedocs.io/en/latest/examples.html#spotify-api
It is quite complicated, but were sure you'll get it working!
Want to learn more about Inkplate? Visit www.inkplate.io
Looking to get support? Write on our forums: http://forum.e-radionica.com/en/
3 August 2020 by e-radionica.com
*/
#include "Inkplate.h"
#include <ArduinoJson.h>

View File

@ -1,3 +1,19 @@
/*
generatedUI.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Arduino.h"
#include "Fonts/Roboto_Condensed_24.h"
#include "Fonts/Roboto_Condensed_32.h"

View File

@ -1,3 +1,19 @@
/*
Inkplate.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Inkplate.h"
#define CL 0x01

View File

@ -1,3 +1,19 @@
/*
Inkplate.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#ifndef __INKPLATE_H__
#define __INKPLATE_H__

View File

@ -1,3 +1,19 @@
/*
SdFat.h
Inkplate 6 Arduino library
Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "libs/SdFat/SdFat.h"
// backwards compatibility file

View File

@ -1 +1,19 @@
/*
Esp.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Esp.h"
// Maybe add something in the future

View File

@ -1,3 +1,19 @@
/*
Esp.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#ifndef __ESP_H__
#define __ESP_H__

View File

@ -1,3 +1,19 @@
/*
Graphics.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Graphics.h"
#ifndef min
@ -5,11 +21,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

View File

@ -1,3 +1,19 @@
/*
Graphics.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#ifndef __GRAPHICS_H__
#define __GRAPHICS_H__
@ -26,53 +42,53 @@
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

View File

@ -1,3 +1,19 @@
/*
Image.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Image.h"
#include "../libs/TJpeg/TJpg_Decoder.h"

View File

@ -1,3 +1,19 @@
/*
Image.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#ifndef __IMAGE_H__
#define __IMAGE_H__

View File

@ -1,3 +1,19 @@
/*
ImageBMP.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Image.h"
bool Image::legalBmp(bitmapHeader *bmpHeader)

View File

@ -1,3 +1,19 @@
/*
ImageDither.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Image.h"
uint8_t Image::ditherGetPixelBmp(uint8_t px, int i, int w, bool paletted)

View File

@ -1,3 +1,19 @@
/*
ImageJPEG.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Image.h"
#include "../libs/TJpeg/TJpg_Decoder.h"

View File

@ -1,3 +1,19 @@
/*
ImagePNG.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Image.h"
#include "../libs/pngle/pngle.h"

View File

@ -1,3 +1,19 @@
/*
Mcp.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Mcp.h"
// LOW LEVEL:

View File

@ -1,3 +1,19 @@
/*
Mcp.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#ifndef __MCP_H__
#define __MCP_H__

View File

@ -1,3 +1,19 @@
/*
NetworkClient.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "NetworkClient.h"
bool NetworkClient::joinAP(const char *ssid, const char *pass)

View File

@ -1,3 +1,19 @@
/*
NetworkClient.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#ifndef __NETWORKCLIENT_H__
#define __NETWORKCLIENT_H__

View File

@ -1,3 +1,19 @@
/*
Shapes.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Shapes.h"
#ifndef min
@ -5,11 +21,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

View File

@ -1,3 +1,19 @@
/*
Shapes.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#ifndef __SHAPES_H__
#define __SHAPES_H__
@ -5,56 +21,56 @@
#include "Arduino.h"
#define maxVer 100
#define maxHt 600
#define maxHt 600
class Shapes : virtual public Adafruit_GFX
{
public:
Shapes(int16_t w, int16_t h) : Adafruit_GFX(w, h){};
public:
Shapes(int16_t w, int16_t h) : Adafruit_GFX(w, h){};
virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
virtual void selectDisplayMode(uint8_t _mode) = 0;
virtual uint8_t getDisplayMode() = 0;
virtual void selectDisplayMode(uint8_t _mode) = 0;
virtual uint8_t getDisplayMode() = 0;
void drawElipse(int rx, int ry, int xc, int yc, int c);
void fillElipse(int rx, int ry, int xc, int yc, int c);
void drawPolygon(int *x, int *y, int n, int color);
void fillPolygon(int *x, int *y, int n, int color);
void drawThickLine(int x1, int y1, int x2, int y2, int color, float thickness);
void drawGradientLine(int x1, int y1, int x2, int y2, int color1, int color2, float thickness = -1);
void drawElipse(int rx, int ry, int xc, int yc, int c);
void fillElipse(int rx, int ry, int xc, int yc, int c);
void drawPolygon(int *x, int *y, int n, int color);
void fillPolygon(int *x, int *y, int n, int color);
void drawThickLine(int x1, int y1, int x2, int y2, int color, float thickness);
void drawGradientLine(int x1, int y1, int x2, int y2, int color1, int color2, float thickness = -1);
private:
struct EdgeBucket
{
int ymax;
float xofymin;
float slopeinverse;
};
private:
struct EdgeBucket
{
int ymax;
float xofymin;
float slopeinverse;
};
struct edgeTableTuple
{
int countEdgeBucket;
EdgeBucket buckets[maxVer];
};
struct edgeTableTuple
{
int countEdgeBucket;
EdgeBucket buckets[maxVer];
};
void initedgeTable();
void insertionSort(edgeTableTuple *ett);
void storeEdgeInTuple(edgeTableTuple *receiver, int ym, int xm, float slopInv);
void storeEdgeInTable(int x1, int y1, int x2, int y2);
void removeEdgeByYmax(edgeTableTuple *tup, int yy);
void updatexbyslopeinv(edgeTableTuple *tup);
void scanlineFill(uint8_t c);
void initedgeTable();
void insertionSort(edgeTableTuple *ett);
void storeEdgeInTuple(edgeTableTuple *receiver, int ym, int xm, float slopInv);
void storeEdgeInTable(int x1, int y1, int x2, int y2);
void removeEdgeByYmax(edgeTableTuple *tup, int yy);
void updatexbyslopeinv(edgeTableTuple *tup);
void scanlineFill(uint8_t c);
virtual void startWrite(void) = 0;
virtual void writePixel(int16_t x, int16_t y, uint16_t color) = 0;
virtual void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) = 0;
virtual void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) = 0;
virtual void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) = 0;
virtual void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) = 0;
virtual void endWrite(void) = 0;
virtual void startWrite(void) = 0;
virtual void writePixel(int16_t x, int16_t y, uint16_t color) = 0;
virtual void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) = 0;
virtual void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) = 0;
virtual void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) = 0;
virtual void writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) = 0;
virtual void endWrite(void) = 0;
edgeTableTuple *edgeTable, activeEdgeTuple;
edgeTableTuple *edgeTable, activeEdgeTuple;
};
#endif

View File

@ -1,3 +1,19 @@
/*
ShapesPolygon.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Shapes.h"
void Shapes::initedgeTable()
@ -47,7 +63,7 @@ void Shapes::storeEdgeInTuple(edgeTableTuple *receiver, int ym, int xm, float sl
void Shapes::storeEdgeInTable(int x1, int y1, int x2, int y2)
{
float m, minv;
int ymaxTS, xwithyminTS, scanline; //ts stands for to store
int ymaxTS, xwithyminTS, scanline; // ts stands for to store
if (x2 == x1)
{

View File

@ -1,3 +1,19 @@
/*
System.cpp
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "System.h"
SPIClass spi2(HSPI);

View File

@ -1,3 +1,19 @@
/*
System.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#ifndef __SYSTEM_H__
#define __SYSTEM_H__
@ -11,7 +27,7 @@
class System : public Esp, public Mcp, virtual public NetworkClient
{
public:
public:
void setPanelState(uint8_t s);
uint8_t getPanelState();
@ -29,7 +45,7 @@ public:
SdFat getSdFat();
SPIClass getSPI();
private:
private:
uint8_t _panelOn = 0;
int8_t _temperature;
int16_t _sdCardOk = 0;

View File

@ -1,3 +1,19 @@
/*
defines.h
Inkplate 6 Arduino library
David Zovko, Borna Biro, Denis Vajak, Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#ifndef __DEFINES_H__
#define __DEFINES_H__

View File

@ -1,3 +1,20 @@
/*
bitmaps.ino
Inkplate 6 Arduino library
Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Inkplate.h"
#include "SdFat.h"

View File

@ -1,3 +1,20 @@
/*
drawImage.ino
Inkplate 6 Arduino library
Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Inkplate.h"
#include "SdFat.h"

View File

@ -1 +0,0 @@
#include "Inkplate.h"

View File

@ -1,19 +0,0 @@
#include "Inkplate.h"
#include "generatedUI.h"
Inkplate display(INKPLATE_3BIT);
void setup()
{
display.begin();
mainDraw();
int x[] = {600, 700, 800, 700, 600}, y[] = {200, 100, 400, 500, 300};
int x2[] = {600, 700, 800, 700, 600}, y2[] = {400, 300, 600, 600, 500};
display.drawPolygon(x, y, 5, 0);
display.fillPolygon(x2, y2, 5, 0);
display.display();
}
void loop()
{
}

View File

@ -1,300 +0,0 @@
#include "Arduino.h"
#include "Inkplate.h"
#include "../res/Fonts/FreeSansBold24pt7b.h"
extern Inkplate display;
String text0_content = "Hello there!";
int text0_cursor_x = 15;
int text0_cursor_y = 33;
const GFXfont *text0_font = &FreeSansBold24pt7b;
int pixel0_x = 17;
int pixel0_y = 56;
int pixel0_color = 0;
int line0_start_x = 17;
int line0_start_y = 75;
int line0_end_x = 171;
int line0_end_y = 72;
int line0_color = 0;
int line0_thickness = 1;
int line0_gradient = 0;
int rect0_a_x = 18;
int rect0_a_y = 91;
int rect0_b_x = 170;
int rect0_b_y = 136;
int rect0_fill = -1;
int rect0_radius = -1;
int rect0_color = 0;
int rect1_a_x = 20;
int rect1_a_y = 153;
int rect1_b_x = 171;
int rect1_b_y = 201;
int rect1_fill = -1;
int rect1_radius = 15;
int rect1_color = 0;
int rect2_a_x = 22;
int rect2_a_y = 220;
int rect2_b_x = 174;
int rect2_b_y = 269;
int rect2_fill = 1;
int rect2_radius = -1;
int rect2_color = 3;
int rect3_a_x = 22;
int rect3_a_y = 290;
int rect3_b_x = 175;
int rect3_b_y = 336;
int rect3_fill = 1;
int rect3_radius = 20;
int rect3_color = 2;
int line1_start_x = 197;
int line1_start_y = 10;
int line1_end_x = 200;
int line1_end_y = 334;
int line1_color = 4;
int line1_thickness = 5;
int line1_gradient = 0;
int line2_start_x = 222;
int line2_start_y = 12;
int line2_end_x = 228;
int line2_end_y = 410;
int line2_color = 0;
int line2_thickness = 10;
int line2_gradient = 7;
int circle0_center_x = 110;
int circle0_center_y = 455;
int circle0_fill = -1;
int circle0_radius = 100;
int circle0_color = 0;
int circle1_center_x = 109;
int circle1_center_y = 454;
int circle1_fill = 1;
int circle1_radius = 50;
int circle1_color = 3;
int triangle0_a_x = 226;
int triangle0_a_y = 424;
int triangle0_b_x = 361;
int triangle0_b_y = 491;
int triangle0_c_x = 228;
int triangle0_c_y = 581;
int triangle0_fill = 1;
int triangle0_radius = -1;
int triangle0_color = 4;
int triangle1_a_x = 257;
int triangle1_a_y = 409;
int triangle1_b_x = 374;
int triangle1_b_y = 479;
int triangle1_c_x = 252;
int triangle1_c_y = 194;
int triangle1_fill = -1;
int triangle1_radius = -1;
int triangle1_color = 0;
int digital_clock0_h = 9;
int digital_clock0_m = 41;
int digital_clock0_location_x = 248;
int digital_clock0_location_y = 12;
int digital_clock0_size = 64;
int digital_clock0_bitmask[] = {119, 48, 93, 121, 58, 107, 111, 49, 127, 59};
int digital_clock0_triangleX[] = {83, 101, 108, 101, 108, 277, 101, 108, 277, 257, 277, 108, 257, 277, 286, 76, 60, 98, 60, 98, 80, 80, 39, 60, 80, 39, 55, 31, 55, 73, 31, 73, 52, 31, 9, 52, 9, 52, 20, 61, 86, 80, 86, 80, 233, 233, 227, 80, 233, 227, 252, 260, 292, 305, 305, 260, 240, 305, 281, 240, 240, 281, 260, 259, 234, 276, 234, 276, 256, 256, 214, 234, 214, 256, 237, 38, 27, 60, 38, 60, 207, 207, 38, 212, 212, 207, 230};
int digital_clock0_triangleY[] = {30, 13, 60, 13, 60, 14, 13, 60, 14, 57, 14, 60, 57, 14, 29, 36, 47, 61, 47, 61, 198, 198, 201, 47, 198, 201, 219, 252, 232, 253, 252, 253, 390, 252, 406, 390, 406, 390, 416, 227, 202, 249, 202, 249, 203, 203, 247, 249, 203, 247, 224, 60, 35, 49, 49, 60, 200, 50, 201, 200, 200, 201, 220, 231, 252, 252, 252, 252, 403, 403, 390, 252, 390, 403, 415, 439, 424, 392, 439, 392, 394, 394, 439, 439, 439, 394, 424};
int digital_clock0_maxX = 310;
int digital_clock0_maxY = 440;
int widget1_h = 9;
int widget1_m = 41;
int widget1_center_x = 290;
int widget1_center_y = 126;
int widget1_size = 64;
int widget1_r0 = (double)widget1_size / 2 * 0.55;
int widget1_r1 = (double)widget1_size / 2 * 0.65;
int widget1_r2 = (double)widget1_size / 2 * 0.9;
int widget1_r3 = (double)widget1_size / 2 * 1.0;
int widget2_h = 9;
int widget2_m = 41;
int widget2_center_x = 386;
int widget2_center_y = 231;
int widget2_size = 151;
int widget2_r0 = (double)widget2_size / 2 * 0.55;
int widget2_r1 = (double)widget2_size / 2 * 0.65;
int widget2_r2 = (double)widget2_size / 2 * 0.9;
int widget2_r3 = (double)widget2_size / 2 * 1.0;
void mainDraw()
{
display.setFont(text0_font);
display.setTextColor(0, 7);
display.setTextSize(1);
display.setCursor(text0_cursor_x, text0_cursor_y);
display.print(text0_content);
display.drawPixel(pixel0_x, pixel0_y, pixel0_color);
if (line0_gradient <= line0_color && line0_thickness == 1)
display.drawLine(line0_start_x, line0_start_y, line0_end_x, line0_end_y, line0_color);
else if (line0_gradient <= line0_color && line0_thickness != 1)
display.drawThickLine(line0_start_x, line0_start_y, line0_end_x, line0_end_y, line0_color, line0_thickness);
else if (line0_gradient > line0_color && line0_thickness == 1)
display.drawGradientLine(line0_start_x, line0_start_y, line0_end_x, line0_end_y, line0_color, line0_gradient, 1);
else if (line0_gradient > line0_color && line0_thickness != 1)
display.drawGradientLine(line0_start_x, line0_start_y, line0_end_x, line0_end_y, line0_color, line0_gradient, line0_thickness);
if (rect0_radius != -1 && rect0_fill != -1)
display.fillRoundRect(rect0_a_x, rect0_a_y, rect0_b_x - rect0_a_x, rect0_b_y - rect0_a_y, rect0_radius, rect0_color);
else if (rect0_radius != -1 && rect0_fill == -1)
display.drawRoundRect(rect0_a_x, rect0_a_y, rect0_b_x - rect0_a_x, rect0_b_y - rect0_a_y, rect0_radius, rect0_color);
else if (rect0_radius == -1 && rect0_fill != -1)
display.fillRect(rect0_a_x, rect0_a_y, rect0_b_x - rect0_a_x, rect0_b_y - rect0_a_y, rect0_color);
else if (rect0_radius == -1 && rect0_fill == -1)
display.drawRect(rect0_a_x, rect0_a_y, rect0_b_x - rect0_a_x, rect0_b_y - rect0_a_y, rect0_color);
if (rect1_radius != -1 && rect1_fill != -1)
display.fillRoundRect(rect1_a_x, rect1_a_y, rect1_b_x - rect1_a_x, rect1_b_y - rect1_a_y, rect1_radius, rect1_color);
else if (rect1_radius != -1 && rect1_fill == -1)
display.drawRoundRect(rect1_a_x, rect1_a_y, rect1_b_x - rect1_a_x, rect1_b_y - rect1_a_y, rect1_radius, rect1_color);
else if (rect1_radius == -1 && rect1_fill != -1)
display.fillRect(rect1_a_x, rect1_a_y, rect1_b_x - rect1_a_x, rect1_b_y - rect1_a_y, rect1_color);
else if (rect1_radius == -1 && rect1_fill == -1)
display.drawRect(rect1_a_x, rect1_a_y, rect1_b_x - rect1_a_x, rect1_b_y - rect1_a_y, rect1_color);
if (rect2_radius != -1 && rect2_fill != -1)
display.fillRoundRect(rect2_a_x, rect2_a_y, rect2_b_x - rect2_a_x, rect2_b_y - rect2_a_y, rect2_radius, rect2_color);
else if (rect2_radius != -1 && rect2_fill == -1)
display.drawRoundRect(rect2_a_x, rect2_a_y, rect2_b_x - rect2_a_x, rect2_b_y - rect2_a_y, rect2_radius, rect2_color);
else if (rect2_radius == -1 && rect2_fill != -1)
display.fillRect(rect2_a_x, rect2_a_y, rect2_b_x - rect2_a_x, rect2_b_y - rect2_a_y, rect2_color);
else if (rect2_radius == -1 && rect2_fill == -1)
display.drawRect(rect2_a_x, rect2_a_y, rect2_b_x - rect2_a_x, rect2_b_y - rect2_a_y, rect2_color);
if (rect3_radius != -1 && rect3_fill != -1)
display.fillRoundRect(rect3_a_x, rect3_a_y, rect3_b_x - rect3_a_x, rect3_b_y - rect3_a_y, rect3_radius, rect3_color);
else if (rect3_radius != -1 && rect3_fill == -1)
display.drawRoundRect(rect3_a_x, rect3_a_y, rect3_b_x - rect3_a_x, rect3_b_y - rect3_a_y, rect3_radius, rect3_color);
else if (rect3_radius == -1 && rect3_fill != -1)
display.fillRect(rect3_a_x, rect3_a_y, rect3_b_x - rect3_a_x, rect3_b_y - rect3_a_y, rect3_color);
else if (rect3_radius == -1 && rect3_fill == -1)
display.drawRect(rect3_a_x, rect3_a_y, rect3_b_x - rect3_a_x, rect3_b_y - rect3_a_y, rect3_color);
if (line1_gradient <= line1_color && line1_thickness == 1)
display.drawLine(line1_start_x, line1_start_y, line1_end_x, line1_end_y, line1_color);
else if (line1_gradient <= line1_color && line1_thickness != 1)
display.drawThickLine(line1_start_x, line1_start_y, line1_end_x, line1_end_y, line1_color, line1_thickness);
else if (line1_gradient > line1_color && line1_thickness == 1)
display.drawGradientLine(line1_start_x, line1_start_y, line1_end_x, line1_end_y, line1_color, line1_gradient, 1);
else if (line1_gradient > line1_color && line1_thickness != 1)
display.drawGradientLine(line1_start_x, line1_start_y, line1_end_x, line1_end_y, line1_color, line1_gradient, line1_thickness);
if (line2_gradient <= line2_color && line2_thickness == 1)
display.drawLine(line2_start_x, line2_start_y, line2_end_x, line2_end_y, line2_color);
else if (line2_gradient <= line2_color && line2_thickness != 1)
display.drawThickLine(line2_start_x, line2_start_y, line2_end_x, line2_end_y, line2_color, line2_thickness);
else if (line2_gradient > line2_color && line2_thickness == 1)
display.drawGradientLine(line2_start_x, line2_start_y, line2_end_x, line2_end_y, line2_color, line2_gradient, 1);
else if (line2_gradient > line2_color && line2_thickness != 1)
display.drawGradientLine(line2_start_x, line2_start_y, line2_end_x, line2_end_y, line2_color, line2_gradient, line2_thickness);
if (circle0_fill != -1)
display.fillCircle(circle0_center_x, circle0_center_y, circle0_radius, circle0_color);
else
display.drawCircle(circle0_center_x, circle0_center_y, circle0_radius, circle0_color);
if (circle1_fill != -1)
display.fillCircle(circle1_center_x, circle1_center_y, circle1_radius, circle1_color);
else
display.drawCircle(circle1_center_x, circle1_center_y, circle1_radius, circle1_color);
if (triangle0_fill != -1)
display.fillTriangle(triangle0_a_x, triangle0_a_y, triangle0_b_x, triangle0_b_y, triangle0_c_x, triangle0_c_y, triangle0_color);
else
display.drawTriangle(triangle0_a_x, triangle0_a_y, triangle0_b_x, triangle0_b_y, triangle0_c_x, triangle0_c_y, triangle0_color);
if (triangle1_fill != -1)
display.fillTriangle(triangle1_a_x, triangle1_a_y, triangle1_b_x, triangle1_b_y, triangle1_c_x, triangle1_c_y, triangle1_color);
else
display.drawTriangle(triangle1_a_x, triangle1_a_y, triangle1_b_x, triangle1_b_y, triangle1_c_x, triangle1_c_y, triangle1_color);
for (int i = 0; i < 4; ++i)
{
for (int j = 0; j < sizeof(digital_clock0_triangleX) / sizeof(digital_clock0_triangleX[0]); j += 3)
{
int temp[4] = {digital_clock0_h / 10 % 10, digital_clock0_h % 10, digital_clock0_m / 10 % 10, digital_clock0_m % 10};
int b = digital_clock0_bitmask[temp[i]];
if (b & (1 << ((j - 1) / (3 * 4))))
{
display.fillTriangle(
(int)((float)i * (float)digital_clock0_maxX / (float)digital_clock0_maxY * (float)digital_clock0_size * 1.1 + (float)digital_clock0_location_x + (float)digital_clock0_maxX / (float)digital_clock0_maxY * (float)digital_clock0_size * (float)digital_clock0_triangleX[j + 0] / (float)digital_clock0_maxX),
(int)((float)digital_clock0_location_y + (float)digital_clock0_size * (float)digital_clock0_triangleY[j + 0] / (float)digital_clock0_maxY),
(int)((float)i * (float)digital_clock0_maxX / (float)digital_clock0_maxY * (float)digital_clock0_size * 1.1 + (float)digital_clock0_location_x + (float)digital_clock0_maxX / (float)digital_clock0_maxY * (float)digital_clock0_size * (float)digital_clock0_triangleX[j + 1] / (float)digital_clock0_maxX),
(int)((float)digital_clock0_location_y + (float)digital_clock0_size * (float)digital_clock0_triangleY[j + 1] / (float)digital_clock0_maxY),
(int)((float)i * (float)digital_clock0_maxX / (float)digital_clock0_maxY * (float)digital_clock0_size * 1.1 + (float)digital_clock0_location_x + (float)digital_clock0_maxX / (float)digital_clock0_maxY * (float)digital_clock0_size * (float)digital_clock0_triangleX[j + 2] / (float)digital_clock0_maxX),
(int)((float)digital_clock0_location_y + (float)digital_clock0_size * (float)digital_clock0_triangleY[j + 2] / (float)digital_clock0_maxY),
0);
}
}
}
int digital_clock0_r = 0.05 * (float)digital_clock0_size;
display.fillCircle((int)((float)digital_clock0_location_x + 4.0 * (float)digital_clock0_maxX / (float)digital_clock0_maxY * (float)digital_clock0_size * 1.075 / 2.0), (int)((float)digital_clock0_location_y + (float)digital_clock0_size * 0.4), digital_clock0_r, 0);
display.fillCircle((int)((float)digital_clock0_location_x + 4.0 * (float)digital_clock0_maxX / (float)digital_clock0_maxY * (float)digital_clock0_size * 1.075 / 2.0), (int)((float)digital_clock0_location_y + (float)digital_clock0_size * 0.6), digital_clock0_r, 0);
for (int i = 0; i < 60; ++i)
{
if (i % 5 == 0)
display.drawThickLine(widget1_center_x + widget1_r1 * cos((double)i / 60.0 * 2.0 * 3.14159265),
widget1_center_y + widget1_r1 * sin((double)i / 60.0 * 2.0 * 3.14159265),
widget1_center_x + widget1_r3 * cos((double)i / 60.0 * 2.0 * 3.14159265),
widget1_center_y + widget1_r3 * sin((double)i / 60.0 * 2.0 * 3.14159265), 0, 3);
else if (widget1_size > 150)
display.drawLine(widget1_center_x + widget1_r1 * cos((double)i / 60.0 * 2.0 * 3.14159265),
widget1_center_y + widget1_r1 * sin((double)i / 60.0 * 2.0 * 3.14159265),
widget1_center_x + widget1_r2 * cos((double)i / 60.0 * 2.0 * 3.14159265),
widget1_center_y + widget1_r2 * sin((double)i / 60.0 * 2.0 * 3.14159265), 2);
}
display.drawThickLine(widget1_center_x,
widget1_center_y,
widget1_center_x + widget1_r0 * cos((double)(widget1_h - 3.0 + widget1_m / 60.0) / 12.0 * 2.0 * 3.14159265),
widget1_center_y + widget1_r0 * sin((double)(widget1_h - 3.0 + widget1_m / 60.0) / 12.0 * 2.0 * 3.14159265), 2, 2);
display.drawThickLine(widget1_center_x,
widget1_center_y,
widget1_center_x + widget1_r2 * cos((double)(widget1_m - 15.0) / 60.0 * 2.0 * 3.14159265),
widget1_center_y + widget1_r2 * sin((double)(widget1_m - 15.0) / 60.0 * 2.0 * 3.14159265), 2, 2);
for (int i = 0; i < 60; ++i)
{
if (i % 5 == 0)
display.drawThickLine(widget2_center_x + widget2_r1 * cos((double)i / 60.0 * 2.0 * 3.14159265),
widget2_center_y + widget2_r1 * sin((double)i / 60.0 * 2.0 * 3.14159265),
widget2_center_x + widget2_r3 * cos((double)i / 60.0 * 2.0 * 3.14159265),
widget2_center_y + widget2_r3 * sin((double)i / 60.0 * 2.0 * 3.14159265), 0, 3);
else if (widget2_size > 150)
display.drawLine(widget2_center_x + widget2_r1 * cos((double)i / 60.0 * 2.0 * 3.14159265),
widget2_center_y + widget2_r1 * sin((double)i / 60.0 * 2.0 * 3.14159265),
widget2_center_x + widget2_r2 * cos((double)i / 60.0 * 2.0 * 3.14159265),
widget2_center_y + widget2_r2 * sin((double)i / 60.0 * 2.0 * 3.14159265), 2);
}
display.drawThickLine(widget2_center_x,
widget2_center_y,
widget2_center_x + widget2_r0 * cos((double)(widget2_h - 3.0 + widget2_m / 60.0) / 12.0 * 2.0 * 3.14159265),
widget2_center_y + widget2_r0 * sin((double)(widget2_h - 3.0 + widget2_m / 60.0) / 12.0 * 2.0 * 3.14159265), 2, 2);
display.drawThickLine(widget2_center_x,
widget2_center_y,
widget2_center_x + widget2_r2 * cos((double)(widget2_m - 15.0) / 60.0 * 2.0 * 3.14159265),
widget2_center_y + widget2_r2 * sin((double)(widget2_m - 15.0) / 60.0 * 2.0 * 3.14159265), 2, 2);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
#include "Inkplate.h"
#include "bck_day.h"
Inkplate display(INKPLATE_1BIT);
int offSet = 0;
void setup()
{
Serial.begin(115200);
display.begin();
display.display();
}
void loop()
{
display.drawBitmap(offSet, 0, (uint8_t *)bck_day, bck_day_w, bck_day_h, BLACK);
int32_t t = millis();
display.partialUpdate();
Serial.println(millis() - t);
display.clearDisplay();
offSet += 70;
offSet %= 300;
}

View File

@ -1,3 +1,19 @@
/*
jpegs.ino
Inkplate 6 Arduino library
Zvonimir Haramustek @ e-radionica.com
September 24, 2020
https://github.com/e-radionicacom/Inkplate-6-Arduino-library
For support, please reach over forums: forum.e-radionica.com/en
For more info about the product, please check: www.inkplate.io
This code is released under the GNU Lesser General Public License v3.0: https://www.gnu.org/licenses/lgpl-3.0.en.html
Please review the LICENSE file included with this example.
If you have any questions about licensing, please contact techsupport@e-radionica.com
Distributed as-is; no warranty is given.
*/
#include "Inkplate.h"
#include "SdFat.h"

View File

@ -1,21 +0,0 @@
#include "Inkplate.h"
Inkplate display(INKPLATE_1BIT);
void setup()
{
Serial.begin(115200);
pinMode(12, INPUT);
pinMode(13, INPUT);
display.begin();
delay(500);
}
void loop()
{
Serial.println(analogRead(12));
Serial.println(analogRead(13));
Serial.println();
delay(1000);
}