diff --git a/extras/Image Flowchart.drawio b/extras/Image Flowchart.drawio new file mode 100644 index 0000000..77a3e1b --- /dev/null +++ b/extras/Image Flowchart.drawio @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/jpegs/Lenna.jpg b/test/jpegs/Lenna.jpg new file mode 100755 index 0000000..2d7679d Binary files /dev/null and b/test/jpegs/Lenna.jpg differ diff --git a/test/jpegs/jpegs.ino b/test/jpegs/jpegs.ino index e69de29..f442484 100644 --- a/test/jpegs/jpegs.ino +++ b/test/jpegs/jpegs.ino @@ -0,0 +1,106 @@ +#include "Inkplate.h" +#include "SdFat.h" + +#include "sample1bit.h" +#include "sample3bit.h" + +Inkplate display(INKPLATE_1BIT); + +#define DELAYMS 1000 + +const char *images[] = {"Lenna.jpg", "Lenna.jpg"}; +const char *imageUrls[] = { + "https://raw.githubusercontent.com/nitko12/Inkplate-revision/master/test/jpegs/Lenna.bmp", + "https://raw.githubusercontent.com/nitko12/Inkplate-revision/master/test/jpegs/Lenna.bmp", +}; +const bool depth[] = {INKPLATE_1BIT, INKPLATE_3BIT}; + +void setup() +{ + Serial.begin(115200); + + display.begin(); + + display.joinAP("e-radionica.com", "croduino"); + + Serial.println(); + delay(500); +} + +void loop() +{ + display.clearDisplay(); + display.display(); + + if (!display.sdCardInit()) + { + display.println("Sd card error!"); + delay(1000); + return; + } + + for (int i = 0; i < 4; ++i) + { + bool dither = i & 1; + bool invert = i >> 1; + + for (int j = 0; j < 2; ++j) + { + display.selectDisplayMode(depth[j]); + display.setTextSize(2); + display.setTextColor(1); + display.setCursor(100, 100); + display.print("Displaying "); + display.print(images[j]); + if (!dither) + display.print(" non"); + display.print(" dithered and"); + if (!invert) + display.print(" non"); + display.print(" inverted."); + + display.display(); + display.clearDisplay(); + delay(5000); + + display.drawBitmapFromSd(images[j], 0, 0, dither, invert); + display.display(); + display.clearDisplay(); + delay(5000); + } + } + + for (int i = 0; i < 4; ++i) + { + bool dither = i & 1; + bool invert = i >> 1; + + for (int j = 0; j < 2; ++j) + { + display.selectDisplayMode(depth[j]); + display.setTextSize(2); + display.setTextColor(1); + display.setCursor(100, 100); + display.print("Displaying "); + display.print(images[j]); + display.print(" from web"); + if (!dither) + display.print(" non"); + display.print(" dithered and"); + if (!invert) + display.print(" non"); + display.print(" inverted."); + + display.display(); + display.clearDisplay(); + delay(5000); + + display.drawBitmapFromWeb(imageUrls[j], 0, 0, dither, invert); + display.display(); + display.clearDisplay(); + delay(5000); + } + } + + delay(5000); +} \ No newline at end of file diff --git a/test/test.ino b/test/test.ino index 3077639..988676e 100644 --- a/test/test.ino +++ b/test/test.ino @@ -1,6 +1,7 @@ #include "Inkplate.h" #include "SdFat.h" -Inkplate display(INKPLATE_3BIT); + +Inkplate display(INKPLATE_1BIT); void setup() { @@ -19,6 +20,14 @@ void loop() display.clearDisplay(); display.display(); + if (display.sdCardInit()) + { + Serial.println(display.drawBitmapFromSd("Lenna.bmp", 0, 0, 1, 0)); + } + display.display(); + + delay(5000); + if (display.sdCardInit()) { Serial.println(display.drawJpegFromSd("Lenna.jpg", 0, 0, 1, 0));