ePaper (IL3820) module library  v0.5
Library for the 2.9-inch WaveShare ePaper display module
il3820.h
Go to the documentation of this file.
1 /*
2  * @file il3820.h
3  *
4  * @author Matthew Matz & Roy Eltham
5  *
6  * @version 0.5
7  *
8  * @copyright Copyright (C) Parallax, Inc. 2018. See end of file for
9  * terms of use (MIT License).
10  *
11  * @brief This is a driver that allows the Propeller Multicore Microcontroller to
12  * draw text, shapes, and bitmap files on the Waveshare ePaper display.
13  *
14  * @detail This driver must be used with simplegfx.h. When used with the simplegfx
15  * library, it allows the Propeller Multicore Microcontroller tondraw pixels,
16  * lines, circles, recatngles, rounded rectagles, triangles, formatted text in
17  * multiple fonts, and bitmap images stored on an SD card on a WaveShare ePaper
18  * screen. Please submit bug reports, suggestions, and improvements to this code
19  * to editor@parallax.com.
20  */
21 
22 #ifndef IL3820_H // Prevents duplicate
23 #define IL3820_H // declarations
24 
25 #if defined(__cplusplus) // If compiling for C++
26 extern "C" { // Compile for C
27 #endif
28 
29 
30 #include "simpletools.h"
31 #include "simplegfx.h"
32 
33 
34 // il3820 ePaper colors
35 #ifndef BLACK
36  #define BLACK 0
37 #endif
38 
39 #ifndef WHITE
40  #define WHITE 1
41 #endif
42 
43 #ifndef INVERSE
44  #define INVERSE 2
45 #endif
46 
47 
48 // il3820 commands
49 #ifndef IL3820_DRIVER_OUTPUT
50  #define IL3820_DRIVER_OUTPUT 0x01
51 #endif
52 
53 #ifndef IL3820_BOOSTER_SOFT_START
54  #define IL3820_BOOSTER_SOFT_START 0x0C
55 #endif
56 
57 #ifndef IL3820_GATE_SCAN_START
58  #define IL3820_GATE_SCAN_START 0x0F
59 #endif
60 
61 #ifndef IL3820_DEEP_SLEEP_MODE
62  #define IL3820_DEEP_SLEEP_MODE 0x10
63 #endif
64 
65 #ifndef IL3820_DATA_ENTRY_MODE
66  #define IL3820_DATA_ENTRY_MODE 0x11
67 #endif
68 
69 #ifndef IL3820_SW_RESET
70  #define IL3820_SW_RESET 0x12
71 #endif
72 
73 #ifndef IL3820_TEMPERATURE_SENSOR
74  #define IL3820_TEMPERATURE_SENSOR 0x1A
75 #endif
76 
77 #ifndef IL3820_MASTER_ACTIVATION
78  #define IL3820_MASTER_ACTIVATION 0x20
79 #endif
80 
81 #ifndef IL3820_DISPLAY_UPDATE_1
82  #define IL3820_DISPLAY_UPDATE_1 0x21
83 #endif
84 
85 #ifndef IL3820_DISPLAY_UPDATE_2
86  #define IL3820_DISPLAY_UPDATE_2 0x22
87 #endif
88 
89 #ifndef IL3820_WRITE_RAM
90  #define IL3820_WRITE_RAM 0x24
91 #endif
92 
93 #ifndef IL3820_WRITE_VCOM_REGISTER
94  #define IL3820_WRITE_VCOM_REGISTER 0x2C
95 #endif
96 
97 #ifndef IL3820_WRITE_LUT_REGISTER
98  #define IL3820_WRITE_LUT_REGISTER 0x32
99 #endif
100 
101 #ifndef IL3820_SET_DUMMY_LINE_PERIOD
102  #define IL3820_SET_DUMMY_LINE_PERIOD 0x3A
103 #endif
104 
105 #ifndef IL3820_SET_GATE_TIME
106  #define IL3820_SET_GATE_TIME 0x3B
107 #endif
108 
109 #ifndef IL3820_BORDER_WAVEFORM_CONTROL
110  #define IL3820_BORDER_WAVEFORM_CONTROL 0x3C
111 #endif
112 
113 #ifndef IL3820_SET_RAM_X_ADDRESS_POSITION
114  #define IL3820_SET_RAM_X_ADDRESS_POSITION 0x44
115 #endif
116 
117 #ifndef IL3820_SET_RAM_Y_ADDRESS_POSITION
118  #define IL3820_SET_RAM_Y_ADDRESS_POSITION 0x45
119 #endif
120 
121 #ifndef IL3820_SET_RAM_X_ADDRESS_COUNTER
122  #define IL3820_SET_RAM_X_ADDRESS_COUNTER 0x4E
123 #endif
124 
125 #ifndef IL3820_SET_RAM_Y_ADDRESS_COUNTER
126  #define IL3820_SET_RAM_Y_ADDRESS_COUNTER 0x4F
127 #endif
128 
129 #ifndef IL3820_TERMINATE_FRAME_READ_WRITE
130  #define IL3820_TERMINATE_FRAME_READ_WRITE 0xFF
131 #endif
132 
133 
134 
154 screen_t *il3820_init(char sid, char sclk, char cs, char rs, char rst, char busy, int width, int height);
155 
161 void il3820_sleepDisplay(screen_t *dev);
162 
168 void il3820_wakeDisplay(screen_t *dev);
169 
170 
171 
187 void il3820_spiWrite(int mask_cs, int mask_sdi, int mask_clk, int mask_dc, char c, char dc);
188 
204 void il3820_spiWriteBytes(int mask_cs, int mask_sdi, int mask_clk, const unsigned char* data, int numBytes);
205 
206 
210 char il3820_writeLock();
211 
217 void il3820_writeLockSet(char devId);
218 
224 void il3820_writeLockClear(char devId);
225 
226 
238 void il3820_drawPixel(screen_t *dev, int x, int y, int color);
239 
253 void il3820_drawFastHLine(screen_t *dev, int x0, int x1, int y, int color);
254 
268 void il3820_drawFastVLine(screen_t *dev, int y0, int y1, int x, int color);
269 
270 
276 void il3820_clearDisplay(screen_t *dev);
277 
278 
285 void il3820_updateDisplay(screen_t *dev);
286 
292 void il3820_resetDisplay(screen_t *dev);
293 
294 
295 
296 #if defined(__cplusplus)
297 } // End compile for C block
298 #endif
299 /* __cplusplus */
300 
301 #endif // End prevent duplicate forward
302 /* IL3820_H */ // declarations block
303 
304 
305 
void il3820_wakeDisplay(screen_t *dev)
Turn the display on from a sleep mode.
Definition: il3820_sleepWake.c:35
void il3820_resetDisplay(screen_t *dev)
Resets the display.
Definition: il3820_reset.c:38
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 funct...
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.
Definition: il3820_spiWrite.c:24
void il3820_writeLockSet(char devId)
Sets the SPI communication lockout.
Definition: il3820_spiWrite.c:66
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.
Definition: il3820_init.c:25
char il3820_writeLock()
Returns the status of the SPI communication lockout so multiple cogs don't try to write to it at the ...
Definition: il3820_spiWrite.c:62
void il3820_writeLockClear(char devId)
Clears the SPI communication lockout.
Definition: il3820_spiWrite.c:71
void il3820_clearDisplay(screen_t *dev)
Clears the screen by setting the full area of the display to white.
Definition: il3820_clear.c:20
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.
void il3820_updateDisplay(screen_t *dev)
Update the display with whatever is in the frame memory. You need to have updated the frame memory wi...
Definition: il3820_update.c:21
void il3820_sleepDisplay(screen_t *dev)
Turn the display off without changing it's contents (make it sleep).
Definition: il3820_sleepWake.c:22
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 functio...
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.