Giter VIP home page Giter VIP logo

linksprite_ep2p04's Introduction

Linksprite_EP2P04

An arduino library for the Linksprite 2.04" EPaper Display using the Adafruit GFX library, intended to make this display much easier to work with in the Arduino environment. Printing text and primitive graphics are made with simple function calls, and all display work is done "behind the scenes"

Bugs are likely, please raise an issue if you have any problems or question.

If you're using an Atmel328 or similar (Arduino Uno or similar), you won't have enough memory to buffer the whole display in 4-tone, and will only be able to use monochrome. I have not been able to test full 4-tone yet (I've been able to test run half display on the uno), I will verify it's implemented right once I get ahold of a chip with more memory.

I am currently working on an updated version that uses the onboard display memory, solving this issue and taking full advantage of this chip.

Usage:

Installation:

Both this library and the Adafruit_GFX library must be installed. To install this one, download this repository as a zip and extract it in your Arduino/Libraries folder. You should than be able to find it under the Examples menu.

For the Adafruit_GFX libary, use the Arduino library manager.

Initialization:

First, you must include both Linksprite_EP2P04.h and Adafruit_GFX.h

#include <Adafruit_GFX.h>
#include <Linksprite_EP2P04.h>

The constructor is:
Linksprite_EP2P04(uint8_t DC, uint8_t STAT, uint8_t CS, uint8_t DA, uint8_t RS, uint8_t SCK, uint8_t MODE)

MODE defines whether the display will be monochrome or four tone grayscale. Mono = 0, Four tone = 1. Mono will take up around 1.5k of memory, and four tone 3.

For example, the constructor call to intialize it as epaper display with the default pinouts and monochrome is:
Linksprite_EP2P04 epaper_display(8,9,10,11,12,13,0);

Finally, call begin() on your display object in the setup portion of the sketch.

Functions:

Because this library implements the display as a Adafruit_GFX object, most of the GFX functions should work. Checkout the GFX Documentation for in depth description of the available functions. However, here are few of the most important functions, along with ones that differ from normal GFX usage:

void begin()
This initializes the display.

bool refresh(), refresh(int timeout)
This writes the display buffer (stored on the arduino), to the display. It is called when you want to display any changes made to the buffer. int timeout is an optional parameter that defines how long an attempt to write to the display should be made, as the display has been observed to block as much as 100ms. 200ms is the default value, it is important to change this if your code is time sensitive. Returns True if refresh successful, False if timed out.

void image_display()
Displays the default buffer stored in the library. This does not make any call through the GFX Library, so it is useful for testing the most basic functionality of the display.

void clearDisplay() This fills the entrie buffer with white. Used to clear the canvas.

GFX Functions:

Refer to Adafruit for the full documentation.

Printing Text:

void setCursor(uint16_t x0, uint16_t y0);
void setTextColor(uint16_t color);
void setTextColor(uint16_t color, uint16_t backgroundcolor);
void setTextSize(uint8_t size);
void setTextWrap(boolean w);

These functions set your text color, size, position, etc. Colors in this libray are modulus 4 with four-tone or binary with monochrome.

print("Your Message");
println("Hello World");

The GFX library allows you to print to the display as if it were a serial object. Remember that these functions are all prototypes, and in real usage you are calling them on your initialized display object, i.e. epaper_display.print("Hi!);

linksprite_ep2p04's People

Contributors

mvniemi avatar atzingen avatar

Stargazers

TJ avatar Kirby avatar

Watchers

James Cloos avatar  avatar

Forkers

atzingen

linksprite_ep2p04's Issues

#include <util/delay.h> not found for esp8266 or esp32

The examples don't compile for esp boards.
I have made a fix (basicaly two problens: one is the _delay_ms that the esp compiler does not have and the other is the progmemory use on esp, that needs a esp library for that.
Can I submit a pull request ? Or you Just need to change the main .cpp file from this library with this:

#include "Linksprite_EP2P04.h"
#if defined(ESP32)
#include <pgmspace.h>
#define _delay_ms(ms) delayMicroseconds((ms) * 1000)
#endif
#if defined(ESP8266)
#include <pgmspace.h>
#define _delay_ms(ms) delayMicroseconds((ms) * 1000)
#endif
#ifdef avr
#include <util/delay.h>
#endif

Thanks for the library !

GFX_demo fails to compile - bad constructor call

Hi,

Possibly I'm misunderstanding how this is meant to be installed and used, with the Arduino IDE, but I can't get the GFX_demo example to compile.

I first tried opening the examples as sketches, but that meant the IDE couldn't find the Linksprite_EP2P04.h include file for GFX_demo, so I copied the folder into ..\Arduino\libraries. I now get this error, when I try to compile it:

GFX_demo:8: error: no matching function for call to 'Linksprite_EP2P04::Linksprite_EP2P04(int)'
Linksprite_EP2P04 display(1);

The constructor in the include file appears to require several arguments (not just the one given here), which are not optional, so either I'm looking at the wrong include file (and so is the IDE) or something is wrong with the example code.

I did manage to get the write_buffer_only example compiled and running on a Leonardo, though I had to comment out the Serial.begin(9600); line - which doesn't appear to do anything useful, and for some reason, stopped it running.

Also, I had to isntall the Adafruit graphics library (Adafruit-GFX-Library). That might be obvious to some people, but it should probably get a mention in the readme, to give the rest of us a clue. If it was documented, I didn't see it.

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.