ePaper (IL3820) module library
v0.5
Library for the 2.9-inch WaveShare ePaper display module
|
#include "simpletools.h"
#include "simplegfx.h"
Go to the source code of this file.
Drawing, Text, and Bitmap Functions | |
simplegfx Library | |
This display driver calls and uses functions from the simplegfx library. | |
Functions | |
screen_t * | il3820_init (char sid, char sclk, char cs, char rs, char rst, char busy, int width, int height) |
Initializes the ePaper screen by setting up it's SPI and control pins. More... | |
void | il3820_sleepDisplay (screen_t *dev) |
Turn the display off without changing it's contents (make it sleep). More... | |
void | il3820_wakeDisplay (screen_t *dev) |
Turn the display on from a sleep mode. More... | |
void | il3820_spiWrite (int mask_cs, int mask_sdi, int mask_clk, int mask_dc, char c, char dc) |
Low-level driver for sending a byte to the ePaper screen. More... | |
void | il3820_spiWriteBytes (int mask_cs, int mask_sdi, int mask_clk, const unsigned char *data, int numBytes) |
Low-level driver for sending multiple bytes to the ePaper screen. More... | |
char | il3820_writeLock () |
Returns the status of the SPI communication lockout so multiple cogs don't try to write to it at the same time. More... | |
void | il3820_writeLockSet (char devId) |
Sets the SPI communication lockout. More... | |
void | il3820_writeLockClear (char devId) |
Clears the SPI communication lockout. More... | |
void | il3820_drawPixel (screen_t *dev, int x, int y, int color) |
Draws a single pixel on the screen in the specified color. No checking. More... | |
void | il3820_drawFastHLine (screen_t *dev, int x0, int x1, int y, int color) |
Draws a horizontal line on the screen in the specified color. No bounds checking (used by other functions that do the bounds checking first) More... | |
void | il3820_drawFastVLine (screen_t *dev, int y0, int y1, int x, int color) |
Draws a vertical line on the screen in the specified color. No bounds checking (used by other functions that do the bounds checking first) More... | |
void | il3820_clearDisplay (screen_t *dev) |
Clears the screen by setting the full area of the display to white. More... | |
void | il3820_updateDisplay (screen_t *dev) |
Update the display with whatever is in the frame memory. You need to have updated the frame memory with _image first. More... | |
void | il3820_resetDisplay (screen_t *dev) |
Resets the display. More... | |
Macros | |
#define | IL3820_H |
#define | BLACK 0 |
#define | WHITE 1 |
#define | INVERSE 2 |
#define | IL3820_DRIVER_OUTPUT 0x01 |
#define | IL3820_BOOSTER_SOFT_START 0x0C |
#define | IL3820_GATE_SCAN_START 0x0F |
#define | IL3820_DEEP_SLEEP_MODE 0x10 |
#define | IL3820_DATA_ENTRY_MODE 0x11 |
#define | IL3820_SW_RESET 0x12 |
#define | IL3820_TEMPERATURE_SENSOR 0x1A |
#define | IL3820_MASTER_ACTIVATION 0x20 |
#define | IL3820_DISPLAY_UPDATE_1 0x21 |
#define | IL3820_DISPLAY_UPDATE_2 0x22 |
#define | IL3820_WRITE_RAM 0x24 |
#define | IL3820_WRITE_VCOM_REGISTER 0x2C |
#define | IL3820_WRITE_LUT_REGISTER 0x32 |
#define | IL3820_SET_DUMMY_LINE_PERIOD 0x3A |
#define | IL3820_SET_GATE_TIME 0x3B |
#define | IL3820_BORDER_WAVEFORM_CONTROL 0x3C |
#define | IL3820_SET_RAM_X_ADDRESS_POSITION 0x44 |
#define | IL3820_SET_RAM_Y_ADDRESS_POSITION 0x45 |
#define | IL3820_SET_RAM_X_ADDRESS_COUNTER 0x4E |
#define | IL3820_SET_RAM_Y_ADDRESS_COUNTER 0x4F |
#define | IL3820_TERMINATE_FRAME_READ_WRITE 0xFF |
void il3820_clearDisplay | ( | screen_t * | dev | ) |
Clears the screen by setting the full area of the display to white.
dev | Pointer to the display's device structure returned by the initialization function. |
void il3820_drawFastHLine | ( | screen_t * | dev, |
int | x0, | ||
int | x1, | ||
int | y, | ||
int | color | ||
) |
Draws a horizontal line on the screen in the specified color. No bounds checking (used by other functions that do the bounds checking first)
dev | Pointer to the display's device structure returned by the initialization function. |
x0 | Starting horizontal coordinate of the line, counted from the left side of the screen. |
x1 | Ending horizontal coordinate of the line. |
y | Vertical coordinate of the line. |
color | Color of the pixel. |
void il3820_drawFastVLine | ( | screen_t * | dev, |
int | y0, | ||
int | y1, | ||
int | x, | ||
int | color | ||
) |
Draws a vertical line on the screen in the specified color. No bounds checking (used by other functions that do the bounds checking first)
dev | Pointer to the display's device structure returned by the initialization function. |
y0 | Starting vertical coordinate of the line, counted down from the top of the screen. |
y1 | Ending vertical coordinate of the line. |
x | Horizontal coordinate of the line. |
color | Color of the pixel. |
void il3820_drawPixel | ( | screen_t * | dev, |
int | x, | ||
int | y, | ||
int | color | ||
) |
Draws a single pixel on the screen in the specified color. No checking.
dev | Pointer to the display's device structure returned by the initialization function. |
x | Horizontal coordinate of the pixel, counted from the left side of the screen. |
y | Vertical coordinate of the pixel, counted down from the top of the screen. |
color | Color of the pixel. |
screen_t* il3820_init | ( | char | sid, |
char | sclk, | ||
char | cs, | ||
char | rs, | ||
char | rst, | ||
char | busy, | ||
int | width, | ||
int | height | ||
) |
Initializes the ePaper screen by setting up it's SPI and control pins.
sid | which pin is connected to the Serial Data In pin, marked "DIN". |
sclk | which pin is connected to the Serial Clock pin, marked "CLK". |
cs | which pin is connected to the Chip Select pin, marked "CS". |
rs | which pin is connected to the Read Status pin, marked "D/C". |
rst | which pin is connected to the Reset pin, marked "RST". |
busy | which pin is connected to the Busy pin, marked "BUSY". |
width | Width of the display in pixels. |
height | Height of the displayin pixels. |
void il3820_resetDisplay | ( | screen_t * | dev | ) |
Resets the display.
dev | Pointer to the display's device structure returned by the initialization function. |
void il3820_sleepDisplay | ( | screen_t * | dev | ) |
Turn the display off without changing it's contents (make it sleep).
dev | Pointer to the display's device structure returned by the initialization function. |
void il3820_spiWrite | ( | int | mask_cs, |
int | mask_sdi, | ||
int | mask_clk, | ||
int | mask_dc, | ||
char | c, | ||
char | dc | ||
) |
Low-level driver for sending a byte to the ePaper screen.
mask_cs | Pin mask for the display's chip select pin. |
mask_sdi | Pin mask for the display's serial data in pin. |
mask_clk | Pin mask for the display's clock pin. |
mask_dc | Pin mask for the display's data/command pin. |
c | Byte to be transferred. |
dc | Toggle whether the byte is a command or data. |
void il3820_spiWriteBytes | ( | int | mask_cs, |
int | mask_sdi, | ||
int | mask_clk, | ||
const unsigned char * | data, | ||
int | numBytes | ||
) |
Low-level driver for sending multiple bytes to the ePaper screen.
mask_cs | Pin mask for the display's chip select pin. |
mask_sdi | Pin mask for the display's serial data in pin. |
mask_clk | Pin mask for the display's clock pin. |
mask_dc | Pin mask for the display's data/command pin. |
data | Pointer to buffer of bytes to send |
numBytes | The number of bytes in the buffer to send. |
void il3820_updateDisplay | ( | screen_t * | dev | ) |
Update the display with whatever is in the frame memory. You need to have updated the frame memory with _image first.
dev | Pointer to the display's device structure returned by the initialization function. |
void il3820_wakeDisplay | ( | screen_t * | dev | ) |
Turn the display on from a sleep mode.
dev | Pointer to the display's device structure returned by the initialization function. |
char il3820_writeLock | ( | ) |
Returns the status of the SPI communication lockout so multiple cogs don't try to write to it at the same time.
void il3820_writeLockClear | ( | char | devId | ) |
Clears the SPI communication lockout.
devId | The ID of the device (usually the chip select pin). |
void il3820_writeLockSet | ( | char | devId | ) |
Sets the SPI communication lockout.
devId | The ID of the device (usually the chip select pin). |