Skip to content

Commit ae365e1

Browse files
authored
Merge pull request #205 from SolderedElectronics/dev
Dev to master
2 parents b713faa + 2150299 commit ae365e1

File tree

304 files changed

+39107
-3007
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

304 files changed

+39107
-3007
lines changed

.github/workflows/compile.yml

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
- name: ArduinoJson
6060
- name: Time
6161
- source-url: https://github.com/SolderedElectronics/Soldered-MFRC522-RFID-Reader-Arduino-Library.git
62+
- source-url: https://github.com/SolderedElectronics/Soldered-WS2812-Smart-Leds-Arduino-Library.git
6263
- source-url: https://github.com/SolderedElectronics/Soldered-BME280-BME680-Gas-Sensor-Arduino-Library.git
6364
sketch-paths: |
6465
${{ matrix.additional-sketch-paths }}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Inkplate 6 was crowdfunded on [Crowd Supply](https://www.crowdsupply.com/e-radio
1414
In order to get a head start with Inkplate (any), follow these steps:
1515

1616
1. [Install Inkplate board definition](https://github.com/SolderedElectronics/Dasduino-Board-Definitions-for-Arduino-IDE/blob/master/README.md) - add Inkplate 6/10/6PLUS/6COLOR/2 as a board into your Arduino IDE. Follow the instructions on the [link](https://soldered.com/learn/add-inkplate-6-board-definition-to-arduino-ide/).
17-
2. Install CH340 drivers (if you don't have them yet) - instructions [here](https://soldered.com/learn/ch340-driver-installation-croduino-basic3-nova2/)
17+
2. If you aren't using macOS install CH340 drivers (in case you don't have them yet) - instructions [here](https://soldered.com/learn/ch340-driver-installation-croduino-basic3-nova2/)
1818
3. Install Inkplate Arduino library - Install the library from the Arduino Library Manager (just type "Inkplate" and click "Install") or install it with this repo. If you don't know how, check our [tutorial](https://soldered.com/learn/arduino-library/#Kako%20instaliraty%20library?).
1919
4. You are ready to get started! Select Tools -> Board -> Inkplate Boards and then pick correct one, as well as correct COM port and upload!
2020

@@ -67,7 +67,7 @@ All of Inkplate-related development is open-sourced:
6767

6868
- [Arduino library](https://github.com/SolderedElectronics/Inkplate-Arduino-library)
6969
- Hardware design:
70-
- Soldered Inkplate 2 (comming soon!)
70+
- [Soldered Inkplate 2](https://github.com/SolderedElectronics/Soldered-Inkplate-2-hardware-design)
7171
- Soldered Inkplate 6 (comming soon!)
7272
- Soldered Inkplate 6PLUS (comming soon!)
7373
- [Soldered Inkplate 10](https://github.com/SolderedElectronics/Soldered-Inkplate-10-hardware-design)

examples/Inkplate10/Advanced/DeepSleep/Inkplate10_Wake_Up_On_Touchpads/Inkplate10_Wake_Up_On_Touchpads.ino

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
1010
NOTE: This is an example for the old Inkplates that have touchpads.
1111
12+
IMPORTANT: Some old Inkplate boards require an additional 10k PULL-UP resistor for this to work
13+
For more info, see https://github.com/SolderedElectronics/Inkplate-Arduino-library/issues/179#issuecomment-1562360919
14+
1215
Want to learn more about Inkplate? Visit www.inkplate.io
1316
Looking to get support? Write on our forums: https://forum.soldered.com/
1417
15 March 2023 by Soldered
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
/*
2+
Inkplate10_Show_JPG_With_HTTPClient example for Soldered Inkplate 10
3+
For this example you will need a USB-C cable, Inkplate 10, and an available WiFi connection.
4+
Select "e-radionica Inkplate10" or "Soldered Inkplate10" from Tools -> Board menu.
5+
Don't have "e-radionica Inkplate10" or "Soldered Inkplate10" option? Follow our tutorial and add it:
6+
https://soldered.com/learn/add-inkplate-6-board-definition-to-arduino-ide/
7+
8+
This example will show you how to show JPG image using HTTPClient.
9+
Make sure that you entered WiFi credentials and change the image link if you want any other image.
10+
11+
Want to learn more about Inkplate? Visit www.inkplate.io
12+
Looking to get support? Write on our forums: https://forum.soldered.com/
13+
17 April 2023 by Soldered
14+
*/
15+
16+
// Next 3 lines are a precaution, you can ignore those, and the example would also work without them
17+
#if !defined(ARDUINO_INKPLATE10) && !defined(ARDUINO_INKPLATE10V2)
18+
#error \
19+
"Wrong board selection for this example, please select e-radionica Inkplate10 or Soldered Inkplate10 in the boards menu."
20+
#endif
21+
22+
// Include needed libraries in the sketch
23+
#include "HTTPClient.h"
24+
#include "Inkplate.h"
25+
#include "WiFi.h"
26+
27+
// Create an object on Inkplate library and also set library into 1 Bit mode (BW)
28+
Inkplate display(INKPLATE_1BIT);
29+
30+
/**************** CHANGE HERE ******************/
31+
32+
char *ssid = ""; // Your WiFi SSID
33+
char *pass = ""; // Your WiFi password
34+
35+
// Optionally
36+
String url = "https://raw.githubusercontent.com/SolderedElectronics/Inkplate-Arduino-library/dev/examples/Inkplate10/Advanced/WEB_WiFi/Inkplate10_Show_JPG_With_HTTPClient/image.jpg";
37+
38+
/***********************************************/
39+
40+
void setup()
41+
{
42+
display.begin(); // Init Inkplate library (you should call this function ONLY ONCE)
43+
display.clearDisplay(); // Clear frame buffer of display
44+
display.setTextSize(2); // Set text size to be 2 times bigger than original (5x7 px)
45+
display.setTextColor(BLACK); // Set text color to black
46+
47+
// Let's connect to the WiFi
48+
// Show a connection message
49+
display.print("Connecting to WiFi");
50+
// We can use a partial update because Inkplate is in 1-bit mode
51+
display.partialUpdate();
52+
53+
// Actually connect to the WiFi network
54+
WiFi.mode(WIFI_MODE_STA);
55+
WiFi.begin(ssid, pass);
56+
while (WiFi.status() != WL_CONNECTED)
57+
{
58+
// Print a dot every half second when connecting
59+
delay(500);
60+
display.print(".");
61+
display.partialUpdate();
62+
}
63+
display.println("\nWiFi OK! Downloading...");
64+
display.partialUpdate();
65+
66+
// Switch to 3-bit mode so the image will be of better quality
67+
// NOTE: You can't use partial update when the Inkplate is in the 3-bit mode!
68+
display.setDisplayMode(INKPLATE_3BIT);
69+
70+
// Make an object for the HTTP client
71+
HTTPClient http;
72+
http.begin(url);
73+
74+
// Do a get request to get the image
75+
int httpCode = http.GET();
76+
77+
// If everything is OK
78+
if (httpCode == HTTP_CODE_OK)
79+
{
80+
// Get the size of the image
81+
int32_t size = http.getSize();
82+
int32_t len = size; // Copy whose value we will change, but the original must not be lost
83+
84+
if (size > 0)
85+
{
86+
// Allocate the memory for the image
87+
uint8_t *buffer = (uint8_t *)ps_malloc(size);
88+
uint8_t *buffPtr = buffer; // Copy of the buffer pointer so that the original one is not lost
89+
90+
// Temporary buffer for retrieving parts of the image and storing them in the real buffer
91+
uint8_t buff[512] = {0};
92+
93+
// Let's fetch the data
94+
WiFiClient *stream = http.getStreamPtr(); // We need a stream pointer to know how much data is available
95+
96+
// Repeat as long as we have a connection and while there is data to read
97+
while (http.connected() && (len > 0 || len == -1))
98+
{
99+
// Get the number of available bytes
100+
size_t size = stream->available();
101+
102+
// If there are available bytes, read them
103+
if (size)
104+
{
105+
// Read available bytes from the stream and store them in the buffer
106+
int c = stream->readBytes(buff, ((size > sizeof(buff)) ? sizeof(buff) : size));
107+
memcpy(buffPtr, buff, c);
108+
109+
// As we read the data, we subtract the length we read and the remaining length is in the variable
110+
// len
111+
if (len > 0)
112+
len -= c;
113+
114+
// Likewise for the buffer pointer
115+
buffPtr += c;
116+
}
117+
else if (len == -1)
118+
{
119+
len = 0;
120+
}
121+
}
122+
123+
// Draw image into the frame buffer of Inkplate
124+
display.drawJpegFromBuffer(buffer, size, 0, 0, true, false);
125+
126+
// Free the memory where the image was stored because it is now in the frame buffer
127+
free(buffer);
128+
}
129+
else
130+
{
131+
// Show an error message
132+
display.setCursor(0, 0);
133+
display.println("Invalid response length " + String(size) + " (HTTP " + String(httpCode) + ")");
134+
}
135+
}
136+
else
137+
{
138+
// Show an error message
139+
display.setCursor(0, 0);
140+
display.println("HTTP error" + String(httpCode) + "...");
141+
}
142+
143+
// Draw image on the screen
144+
display.display();
145+
}
146+
147+
void loop()
148+
{
149+
// Nothing
150+
}
Loading

0 commit comments

Comments
 (0)