Giter VIP home page Giter VIP logo

epd75bhd's Introduction

EPD75BHD

An ESP32 Arduino library for Waveshare 7.5 inch 3-color E-Paper Display (880x528)

Demo:

demo

Features

  • Developed in C++
  • Work out of the box
  • Initialize display in one line
  • Support Adafruit GFX fonts
  • Powerful formatted print function (GFX::GFXPrintf)
  • Display PPM image from SD card

Installation

Important Notes

  • This library is built for the Espressif ESP32 using the Arduino Framework, it has not been tested on other platforms
  • This library uses at least over 100KB RAM, therefore it CANNOT be used for standard AVR based Arduino boards (which have only 2KB RAM)
  • This library works perfectly on PlatformIO IDE (which is much more developer-friendly than the Arduino IDE)
  • The methods whose name start with GFX only update the RAM, to reflect the change to the display, call the EPD class's Display() method
  • About PPM functions:
    • PPM2IMG function requires a huge amount of RAM (> 2 bits per pixel) because it creates a new Image class, use it with caution, or your program may crash
    • DrawPPM function uses very little extra RAM because it skips the step of creating a Image class and directly make the changes on the EPD class's image buffers
    • The PPM format is not fully implemented, please adhere to the following rules:
      • First line: P3
      • Second line: <width> <height> (e.g. 880 528)
      • Third line: 1 (the maximum color value, since the display does not support grayscale)
      • Each pixel must be on its own line, with the format of <R> <G> <B>, each color takes the value of either 0 or 1
      • A valid pixel line should be one of the following:
        • 1 1 1 (black)
        • 0 0 0 (white)
        • 1 0 0 (red)
    • Currently the PPM functions are relatively slow. E.g. when using DrawPPM with a picture of the same size as the display, it takes approximately 80 seconds to complete
    • To convert your image to supported PPM format, use this Python3 script
  • This library supports Adafruid GFX fonts. Create your own font headers at https://rop.nl/truetype2gfx/

Get Started

Refer to the examples in this repository.

Basic Usage

Include the EPD class library:

#include <EPD75BHD.hpp>

Create a new EPD class and initialize the display:

EPD75BHD epd(<sck_pin>, <mosi_pin>, <cs_pin>, <rst_pin>, <dc_pin>, <busy_pin>);
epd.Init();

Clear the display (make the whole screen white):

epd.Clear();

Print Hello, world! in red:

epd.GFXSetCursor(20, 400); // The cursor is at the bottom left corner of the first character you print
epd.GFXSetColor(GFXColor::RED);
epd.GFXPrintf("Hello, world!");

Advanced usage of GFX::GFXPrintf:

epd.GFXPrintf("%%c:(%c), %%d:(%d), %%s:(%s), %%x:(%x), %%%%:(%%)\nHahaha~~~\n", 'C', 5201314, "I <3 U", 85988116);
/*
Result:
%c:(C), %d:(5201314), %s:(5201314), %x:(5201314), %%:(%)
Hahaha~~~
*/

Make the central pixel black:

epd.GFXSetPixel(epd.WIDTH/2, epd.HEIGHT/2, GFXColor::BLACK);

Draw a red rectangle at the center:

epd.GFXClearRect(100, 100, epd.WIDTH-100, epd.HEIGHT-100, GFXColor::RED);

Draw a 4x4 black point at the center:

epd.GFXDrawPoint(epd.WIDTH/2, epd.HEIGHT/2, GFXColor::BLACK, 4);

Load and draw a PPM image from SD card:

SDC* sd = new SDC(); //SD card wrapper class
if (!DrawPPM(*(sd->fs), "/test.ppm", epd, 0, 0)) { // read /test.ppm from SD card
    std::printf("Done drawing image!\n");
} else {
    std::printf("Read file failed...\n");
}

Commit the changes to the display:

epd.Display();

Put the display at deep-sleep mode:

epd.DeepSleep()

Future Plan

  • Screen rotation
  • No-buffer solution
  • Reduce time complexity
  • Dithering for color images
  • GUI framework

epd75bhd's People

Contributors

lirc572 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.