ePaper (IL3820) module library  v0.5
Library for the 2.9-inch WaveShare ePaper display module
Macros | Functions
il3820.h File Reference
#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
 

Function Documentation

◆ il3820_clearDisplay()

void il3820_clearDisplay ( screen_t *  dev)

Clears the screen by setting the full area of the display to white.

Parameters
devPointer to the display's device structure returned by the initialization function.

◆ il3820_drawFastHLine()

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)

Parameters
devPointer to the display's device structure returned by the initialization function.
x0Starting horizontal coordinate of the line, counted from the left side of the screen.
x1Ending horizontal coordinate of the line.
yVertical coordinate of the line.
colorColor of the pixel.

◆ il3820_drawFastVLine()

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)

Parameters
devPointer to the display's device structure returned by the initialization function.
y0Starting vertical coordinate of the line, counted down from the top of the screen.
y1Ending vertical coordinate of the line.
xHorizontal coordinate of the line.
colorColor of the pixel.

◆ il3820_drawPixel()

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.

Parameters
devPointer to the display's device structure returned by the initialization function.
xHorizontal coordinate of the pixel, counted from the left side of the screen.
yVertical coordinate of the pixel, counted down from the top of the screen.
colorColor of the pixel.

◆ il3820_init()

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.

Parameters
sidwhich pin is connected to the Serial Data In pin, marked "DIN".
sclkwhich pin is connected to the Serial Clock pin, marked "CLK".
cswhich pin is connected to the Chip Select pin, marked "CS".
rswhich pin is connected to the Read Status pin, marked "D/C".
rstwhich pin is connected to the Reset pin, marked "RST".
busywhich pin is connected to the Busy pin, marked "BUSY".
widthWidth of the display in pixels.
heightHeight of the displayin pixels.

◆ il3820_resetDisplay()

void il3820_resetDisplay ( screen_t *  dev)

Resets the display.

Parameters
devPointer to the display's device structure returned by the initialization function.

◆ il3820_sleepDisplay()

void il3820_sleepDisplay ( screen_t *  dev)

Turn the display off without changing it's contents (make it sleep).

Parameters
devPointer to the display's device structure returned by the initialization function.

◆ il3820_spiWrite()

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.

Parameters
mask_csPin mask for the display's chip select pin.
mask_sdiPin mask for the display's serial data in pin.
mask_clkPin mask for the display's clock pin.
mask_dcPin mask for the display's data/command pin.
cByte to be transferred.
dcToggle whether the byte is a command or data.

◆ il3820_spiWriteBytes()

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.

Parameters
mask_csPin mask for the display's chip select pin.
mask_sdiPin mask for the display's serial data in pin.
mask_clkPin mask for the display's clock pin.
mask_dcPin mask for the display's data/command pin.
dataPointer to buffer of bytes to send
numBytesThe number of bytes in the buffer to send.

◆ il3820_updateDisplay()

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.

Parameters
devPointer to the display's device structure returned by the initialization function.

◆ il3820_wakeDisplay()

void il3820_wakeDisplay ( screen_t *  dev)

Turn the display on from a sleep mode.

Parameters
devPointer to the display's device structure returned by the initialization function.

◆ il3820_writeLock()

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.

◆ il3820_writeLockClear()

void il3820_writeLockClear ( char  devId)

Clears the SPI communication lockout.

Parameters
devIdThe ID of the device (usually the chip select pin).

◆ il3820_writeLockSet()

void il3820_writeLockSet ( char  devId)

Sets the SPI communication lockout.

Parameters
devIdThe ID of the device (usually the chip select pin).