EPD Display  1.0.0
Library and application for EPD smart displays
Classes | Macros | Functions
EPD Display - library

Library for EPD displays. More...

Classes

class  DisplayCanvas
 Representation of image canvas. More...
 
class  EPD_2in66b
 E-Paper size 2.66" initialization. More...
 
class  EPD_4in2
 E-Paper size 4.2" initialization. More...
 
class  EPD_7in5
 E-Paper size 7.5" initialization. More...
 
class  EPD_Display
 E-Paper display initialization (same functions for multiple display sizes) More...
 

Macros

#define uS_TO_S   1000000
 
#define TIME_TO_SLEEP   20
 
#define EPD_CS_PIN   15
 
#define EPD_RST_PIN   2
 
#define EPD_DC_PIN   4
 
#define EPD_BUSY_PIN   5
 
#define EPD_MOSI_PIN   23
 
#define EPD_CLK_PIN   18
 
#define GPIO_PIN_SET   1
 
#define GPIO_PIN_RESET   0
 
#define DEV_Digital_Write(_pin, _value)   digitalWrite(_pin, _value == 0? LOW:HIGH)
 
#define DEV_Digital_Read(_pin)   digitalRead(_pin)
 
#define DEV_Delay_ms(__xms)   delay(__xms)
 

Functions

 DisplayCanvas::DisplayCanvas (DisplaySize_t s)
 Allocate the needed memory. More...
 
void DisplayCanvas::NewImage (uint8_t index, uint16_t color)
 Create new image. More...
 
void DisplayCanvas::SelectImage (uint8_t index)
 Select Image. More...
 
void DisplayCanvas::SetRotate (uint16_t rotate)
 Rotate image by 0,90,180,270 degrees. More...
 
void DisplayCanvas::SetMirroring (uint8_t mirror)
 Select Image mirror. More...
 
void DisplayCanvas::SetScale (uint8_t scale)
 Set display scale. More...
 
void DisplayCanvas::SetPixel (uint16_t Xpoint, uint16_t Ypoint, uint16_t Color)
 Draw Pixels. More...
 
void DisplayCanvas::Clear (uint16_t color)
 Clear the color of the picture. More...
 
void DisplayCanvas::ClearWindows (uint16_t Xstart, uint16_t Ystart, uint16_t Xend, uint16_t Yend, uint16_t Color)
 Clear the color of a window. More...
 
void DisplayCanvas::DrawPoint (uint16_t Xpoint, uint16_t Ypoint, uint16_t Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
 Draw Point(Xpoint, Ypoint) Fill the color. More...
 
void DisplayCanvas::DrawLine (uint16_t Xstart, uint16_t Ystart, uint16_t Xend, uint16_t Yend, uint16_t Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style)
 Draw a line of arbitrary slope. More...
 
void DisplayCanvas::DrawRectangle (uint16_t Xstart, uint16_t Ystart, uint16_t Xend, uint16_t Yend, uint16_t Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
 Draw a rectangle. More...
 
void DisplayCanvas::DrawCircle (uint16_t X_Center, uint16_t Y_Center, uint16_t Radius, uint16_t Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
 Use the 8-point method to draw a circle of the specified size at the specified position. More...
 
void DisplayCanvas::DrawChar (uint16_t Xpoint, uint16_t Ypoint, const char Acsii_Char, sFONT *Font, uint16_t Color_Foreground, uint16_t Color_Background)
 Show English characters. More...
 
void DisplayCanvas::DrawString_EN (uint16_t Xstart, uint16_t Ystart, const char *pString, sFONT *Font, uint16_t Color_Foreground, uint16_t Color_Background)
 Show English characters. More...
 
void DisplayCanvas::DrawNum (uint16_t Xpoint, uint16_t Ypoint, int32_t Nummber, sFONT *Font, uint16_t Color_Foreground, uint16_t Color_Background)
 Display nummber. More...
 
void DisplayCanvas::DrawTime (uint16_t Xstart, uint16_t Ystart, PAINT_TIME *pTime, sFONT *Font, uint16_t Color_Foreground, uint16_t Color_Background)
 Display time. More...
 
void DisplayCanvas::DrawBitMap (const unsigned char *image_buffer)
 Display monochrome bitmap - Use a computer to convert the image into a corresponding array, and then embed the array directly into Imagedata.cpp as a .c file. More...
 
void DisplayCanvas::DrawImage (const unsigned char *image_buffer, uint16_t xStart, uint16_t yStart, uint16_t W_Image, uint16_t H_Image)
 Display image. More...
 
 EPD_2in66b::EPD_2in66b ()
 Construct a new specific 2.66 inch display object. More...
 
virtual void EPD_2in66b::reset ()
 Software reset. More...
 
virtual void EPD_2in66b::ReadBusy ()
 Busy Wait until the busy_pin goes LOW. More...
 
virtual void EPD_2in66b::init ()
 Initialize the e-Paper register. More...
 
virtual void EPD_2in66b::show (DisplayCanvas *canvas, uint8_t canvas_layer)
 Shows the content - Sends the image buffer in RAM to e-Paper and displays. More...
 
virtual void EPD_2in66b::TurnOnDisplay (void)
 Turn On Display. More...
 
virtual void EPD_2in66b::Clear ()
 Clear screen. More...
 
void EPD_2in66b::SetWindows (uint16_t Xstart, uint16_t Ystart, uint16_t Xend, uint16_t Yend)
 Setting the display window. More...
 
void EPD_2in66b::SetCursor (uint16_t Xstart, uint16_t Ystart)
 Set cursor starting position. More...
 
virtual void EPD_2in66b::Sleep ()
 Enter sleep mode. More...
 
 EPD_4in2::EPD_4in2 ()
 Construct a new specific 4.2 inch display object. More...
 
virtual void EPD_4in2::reset ()
 Software reset. More...
 
virtual void EPD_4in2::ReadBusy ()
 Wait until the busy_pin goes LOW. More...
 
virtual void EPD_4in2::init ()
 Initialize the e-Paper register. More...
 
virtual void EPD_4in2::TurnOnDisplay (void)
 Turn On Display. More...
 
virtual void EPD_4in2::Clear ()
 Clear screen. More...
 
virtual void EPD_4in2::show (DisplayCanvas *canvas, uint8_t canvas_layer)
 Show content- Sends the image buffer in RAM to e-Paper and displays. More...
 
virtual void EPD_4in2::Sleep ()
 Enter sleep mode. More...
 
 EPD_7in5::EPD_7in5 ()
 Construct a new specific 7.5 inch display object. More...
 
virtual void EPD_7in5::reset ()
 Software reset. More...
 
virtual void EPD_7in5::WaitUntilIdle ()
 Wait until the busy_pin goes LOW. More...
 
virtual void EPD_7in5::TurnOnDisplay (void)
 Turn On Display. More...
 
virtual void EPD_7in5::init ()
 Initialize the e-Paper register. More...
 
virtual void EPD_7in5::Clear ()
 Clear screen. More...
 
virtual void EPD_7in5::ClearBlack ()
 Clear black layer. More...
 
virtual void EPD_7in5::show (DisplayCanvas *canvas, uint8_t canvas_layer)
 Show content- Sends the image buffer in RAM to e-Paper and displays. More...
 
virtual void EPD_7in5::SendHalfImage (char TopOrBottom, const uint16_t *Image)
 Sends half image buffer in RAM to e-Paper and displays. More...
 
virtual void EPD_7in5::Sleep ()
 Enter sleep mode. More...
 
 EPD_Display::EPD_Display (uint16_t w, uint16_t h, uint16_t r, uint8_t c)
 Construct a new epd display::epd display object. More...
 
DisplaySize_t EPD_Display::getSize ()
 Return display size. More...
 
int16_t EPD_Display::getWidth ()
 Return display width. More...
 
int16_t EPD_Display::getHeight ()
 Return display height. More...
 
void EPD_Display::GPIO_Config ()
 GPIO Pin configuration. More...
 
int EPD_Display::module_init ()
 Module Initialize, the BCM2835 library and initialize the pins, SPI protocol. More...
 
void EPD_Display::DEV_SPI_WriteByte (uint8_t data)
 SPI read and write. More...
 
void EPD_Display::SendCommand (uint8_t Reg)
 Send Command. More...
 
void EPD_Display::SendData (uint8_t Data)
 Send Data. More...
 

Detailed Description

Library for EPD displays.

Author
Dávid Jánosfalvi, Juraj Ďuďák

Macro Definition Documentation

◆ DEV_Delay_ms

#define DEV_Delay_ms (   __xms)    delay(__xms)

delay x ms

◆ DEV_Digital_Read

#define DEV_Digital_Read (   _pin)    digitalRead(_pin)

◆ DEV_Digital_Write

#define DEV_Digital_Write (   _pin,
  _value 
)    digitalWrite(_pin, _value == 0? LOW:HIGH)

GPIO read and write

◆ EPD_BUSY_PIN

#define EPD_BUSY_PIN   5

◆ EPD_CLK_PIN

#define EPD_CLK_PIN   18

◆ EPD_CS_PIN

#define EPD_CS_PIN   15

GPIO config

◆ EPD_DC_PIN

#define EPD_DC_PIN   4

◆ EPD_MOSI_PIN

#define EPD_MOSI_PIN   23

◆ EPD_RST_PIN

#define EPD_RST_PIN   2

◆ GPIO_PIN_RESET

#define GPIO_PIN_RESET   0

◆ GPIO_PIN_SET

#define GPIO_PIN_SET   1

◆ TIME_TO_SLEEP

#define TIME_TO_SLEEP   20

Time ESP32 will go to sleep (in seconds)

◆ uS_TO_S

#define uS_TO_S   1000000

Conversion factor for micro seconds to seconds

Function Documentation

◆ Clear() [1/4]

void EPD_2in66b::Clear ( )
virtual

Clear screen.

Implements EPD_Display.

◆ Clear() [2/4]

void EPD_7in5::Clear ( )
virtual

Clear screen.

Implements EPD_Display.

◆ Clear() [3/4]

void EPD_4in2::Clear ( )
virtual

Clear screen.

Implements EPD_Display.

◆ Clear() [4/4]

void DisplayCanvas::Clear ( uint16_t  color)

Clear the color of the picture.

Parameters
colorPainted colors

◆ ClearBlack()

void EPD_7in5::ClearBlack ( )
virtual

Clear black layer.

◆ ClearWindows()

void DisplayCanvas::ClearWindows ( uint16_t  Xstart,
uint16_t  Ystart,
uint16_t  Xend,
uint16_t  Yend,
uint16_t  Color 
)

Clear the color of a window.

Parameters
Xstartx starting point
Ystarty starting point
Xendx end point
Yendy end point
ColorPainted colors

◆ DEV_SPI_WriteByte()

void EPD_Display::DEV_SPI_WriteByte ( uint8_t  data)
private

SPI read and write.

◆ DisplayCanvas()

DisplayCanvas::DisplayCanvas ( DisplaySize_t  s)

Allocate the needed memory.

Parameters
sdisplay size

◆ DrawBitMap()

void DisplayCanvas::DrawBitMap ( const unsigned char *  image_buffer)

Display monochrome bitmap - Use a computer to convert the image into a corresponding array, and then embed the array directly into Imagedata.cpp as a .c file.

Parameters
image_bufferA picture data converted to a bitmap

◆ DrawChar()

void DisplayCanvas::DrawChar ( uint16_t  Xpoint,
uint16_t  Ypoint,
const char  Acsii_Char,
sFONT Font,
uint16_t  Color_Foreground,
uint16_t  Color_Background 
)

Show English characters.

Parameters
XpointX coordinate
YpointY coordinate
Acsii_CharTo display the English characters
FontA structure pointer that displays a character size
Color_BackgroundSelect the background color
Color_ForegroundSelect the foreground color

◆ DrawCircle()

void DisplayCanvas::DrawCircle ( uint16_t  X_Center,
uint16_t  Y_Center,
uint16_t  Radius,
uint16_t  Color,
DOT_PIXEL  Line_width,
DRAW_FILL  Draw_Fill 
)

Use the 8-point method to draw a circle of the specified size at the specified position.

Parameters
X_CenterCenter X coordinate
Radiuscircle Radius
ColorThe color of the :circle segment
Line_widthLine width
Draw_FillWhether to fill the inside of the Circle

◆ DrawImage()

void DisplayCanvas::DrawImage ( const unsigned char *  image_buffer,
uint16_t  xStart,
uint16_t  yStart,
uint16_t  W_Image,
uint16_t  H_Image 
)

Display image.

Parameters
imageImage start address
xStartX starting coordinates
yStartY starting coordinates
xEndImage width
yEndImage height

◆ DrawLine()

void DisplayCanvas::DrawLine ( uint16_t  Xstart,
uint16_t  Ystart,
uint16_t  Xend,
uint16_t  Yend,
uint16_t  Color,
DOT_PIXEL  Line_width,
LINE_STYLE  Line_Style 
)

Draw a line of arbitrary slope.

Parameters
XstartStarting Xpoint point coordinates
YstartStarting Xpoint point coordinates
XendEnd point Xpoint coordinate
YendEnd point Ypoint coordinate
ColorThe color of the line segment
Line_widthLine width
Line_StyleSolid and dotted lines

◆ DrawNum()

void DisplayCanvas::DrawNum ( uint16_t  Xpoint,
uint16_t  Ypoint,
int32_t  Nummber,
sFONT Font,
uint16_t  Color_Foreground,
uint16_t  Color_Background 
)

Display nummber.

Parameters
XstartX coordinate
YstartY coordinate
NummberThe number displayed
FontA structure pointer that displays a character size
Color_BackgroundSelect the background color
Color_ForegroundSelect the foreground color

◆ DrawPoint()

void DisplayCanvas::DrawPoint ( uint16_t  Xpoint,
uint16_t  Ypoint,
uint16_t  Color,
DOT_PIXEL  Dot_Pixel,
DOT_STYLE  Dot_Style 
)

Draw Point(Xpoint, Ypoint) Fill the color.

Parameters
XpointThe Xpoint coordinate of the point
YpointThe Ypoint coordinate of the point
Dot_Stylepoint Style
Dot_Pixelpoint size
ColorPainted colors

◆ DrawRectangle()

void DisplayCanvas::DrawRectangle ( uint16_t  Xstart,
uint16_t  Ystart,
uint16_t  Xend,
uint16_t  Yend,
uint16_t  Color,
DOT_PIXEL  Line_width,
DRAW_FILL  Draw_Fill 
)

Draw a rectangle.

Parameters
XstartStarting Xpoint point coordinates
YstartStarting Xpoint point coordinates
XendEnd point Xpoint coordinate
YendEnd point Ypoint coordinate
ColorThe color of the line segment
Line_widthLine width
Draw_FillWhether to fill the inside of the rectangle

◆ DrawString_EN()

void DisplayCanvas::DrawString_EN ( uint16_t  Xstart,
uint16_t  Ystart,
const char *  pString,
sFONT Font,
uint16_t  Color_Foreground,
uint16_t  Color_Background 
)

Show English characters.

Parameters
XstartX coordinate
YstartY coordinate
pStringThe first address of the English string to be displayed
FontA structure pointer that displays a character size
Color_BackgroundSelect the background color
Color_ForegroundSelect the foreground color

◆ DrawTime()

void DisplayCanvas::DrawTime ( uint16_t  Xstart,
uint16_t  Ystart,
PAINT_TIME pTime,
sFONT Font,
uint16_t  Color_Foreground,
uint16_t  Color_Background 
)

Display time.

Parameters
XstartX coordinate
YstartY coordinate
pTimeTime-related structures
FontA structure pointer that displays a character size
Color_BackgroundSelect the background color
Color_ForegroundSelect the foreground color

◆ EPD_2in66b()

EPD_2in66b::EPD_2in66b ( )

Construct a new specific 2.66 inch display object.

◆ EPD_4in2()

EPD_4in2::EPD_4in2 ( )

Construct a new specific 4.2 inch display object.

◆ EPD_7in5()

EPD_7in5::EPD_7in5 ( )

Construct a new specific 7.5 inch display object.

◆ EPD_Display()

EPD_Display::EPD_Display ( uint16_t  w,
uint16_t  h,
uint16_t  r,
uint8_t  c 
)

Construct a new epd display::epd display object.

Parameters
wdisplay width
hdisplay height
rdisplay rorate
cdisplay canvas

◆ getHeight()

int16_t EPD_Display::getHeight ( )

Return display height.

◆ getSize()

DisplaySize_t EPD_Display::getSize ( )

Return display size.

Returns
DisplaySize_t

◆ getWidth()

int16_t EPD_Display::getWidth ( )

Return display width.

◆ GPIO_Config()

void EPD_Display::GPIO_Config ( )
private

GPIO Pin configuration.

◆ init() [1/3]

void EPD_2in66b::init ( )
virtual

Initialize the e-Paper register.

Implements EPD_Display.

◆ init() [2/3]

void EPD_7in5::init ( )
virtual

Initialize the e-Paper register.

Implements EPD_Display.

◆ init() [3/3]

void EPD_4in2::init ( )
virtual

Initialize the e-Paper register.

Implements EPD_Display.

◆ module_init()

int EPD_Display::module_init ( )
private

Module Initialize, the BCM2835 library and initialize the pins, SPI protocol.

◆ NewImage()

void DisplayCanvas::NewImage ( uint8_t  index,
uint16_t  color 
)

Create new image.

Parameters
indexindex of image layer. Note, that image can contain multiple layers
colorBase color for new image

◆ ReadBusy() [1/2]

void EPD_2in66b::ReadBusy ( )
privatevirtual

Busy Wait until the busy_pin goes LOW.

◆ ReadBusy() [2/2]

void EPD_4in2::ReadBusy ( )
privatevirtual

Wait until the busy_pin goes LOW.

◆ reset() [1/3]

void EPD_2in66b::reset ( )
privatevirtual

Software reset.

Implements EPD_Display.

◆ reset() [2/3]

void EPD_7in5::reset ( )
privatevirtual

Software reset.

Implements EPD_Display.

◆ reset() [3/3]

void EPD_4in2::reset ( )
privatevirtual

Software reset.

Implements EPD_Display.

◆ SelectImage()

void DisplayCanvas::SelectImage ( uint8_t  index)

Select Image.

Parameters
indexindex of image layer. Note, that image can contain multiple layers
imagePointer to the image cache

◆ SendCommand()

void EPD_Display::SendCommand ( uint8_t  Reg)
protected

Send Command.

Parameters
RegCommand register

◆ SendData()

void EPD_Display::SendData ( uint8_t  Data)
protected

Send Data.

Parameters
DataWrite data

◆ SendHalfImage()

void EPD_7in5::SendHalfImage ( char  TopOrBottom,
const uint16_t *  Image 
)
virtual

Sends half image buffer in RAM to e-Paper and displays.

Parameters
TopOrBottom0 is top half, 1 is bottom half
*Image

◆ SetCursor()

void EPD_2in66b::SetCursor ( uint16_t  Xstart,
uint16_t  Ystart 
)
private

Set cursor starting position.

Parameters
Xstartx starting point
Ystarty starting point

◆ SetMirroring()

void DisplayCanvas::SetMirroring ( uint8_t  mirror)

Select Image mirror.

Parameters
mirrorNone mirror,Horizontal mirror,Vertical mirror,Origin mirror

◆ SetPixel()

void DisplayCanvas::SetPixel ( uint16_t  Xpoint,
uint16_t  Ypoint,
uint16_t  Color 
)

Draw Pixels.

Parameters
XpointAt point X
YpointAt point Y
ColorPainted colors

◆ SetRotate()

void DisplayCanvas::SetRotate ( uint16_t  rotate)

Rotate image by 0,90,180,270 degrees.

Parameters
rotateallowed values: ROTATE_0 (0), ROTATE_90 (90), ROTATE_180 (180), ROTATE_270 (270)

◆ SetScale()

void DisplayCanvas::SetScale ( uint8_t  scale)

Set display scale.

Parameters
scalesupported values 2/4/7

◆ SetWindows()

void EPD_2in66b::SetWindows ( uint16_t  Xstart,
uint16_t  Ystart,
uint16_t  Xend,
uint16_t  Yend 
)
private

Setting the display window.

Parameters
Xstartx starting point
Xendx end point
Ystarty starting point
Yendy end point

◆ show() [1/3]

void EPD_2in66b::show ( DisplayCanvas canvas,
uint8_t  canvas_layer 
)
virtual

Shows the content - Sends the image buffer in RAM to e-Paper and displays.

Parameters
*canvas
canvas_layer

Implements EPD_Display.

◆ show() [2/3]

void EPD_7in5::show ( DisplayCanvas canvas,
uint8_t  canvas_layer 
)
virtual

Show content- Sends the image buffer in RAM to e-Paper and displays.

Parameters
*canvas
canvas_layer

Implements EPD_Display.

◆ show() [3/3]

void EPD_4in2::show ( DisplayCanvas canvas,
uint8_t  canvas_layer 
)
virtual

Show content- Sends the image buffer in RAM to e-Paper and displays.

Parameters
*canvas
canvas_layer

Implements EPD_Display.

◆ Sleep() [1/3]

void EPD_2in66b::Sleep ( )
virtual

Enter sleep mode.

Implements EPD_Display.

◆ Sleep() [2/3]

void EPD_7in5::Sleep ( )
virtual

Enter sleep mode.

Implements EPD_Display.

◆ Sleep() [3/3]

void EPD_4in2::Sleep ( )
virtual

Enter sleep mode.

Implements EPD_Display.

◆ TurnOnDisplay() [1/3]

void EPD_2in66b::TurnOnDisplay ( void  )
protectedvirtual

Turn On Display.

◆ TurnOnDisplay() [2/3]

void EPD_7in5::TurnOnDisplay ( void  )
protectedvirtual

Turn On Display.

!!The delay here is necessary, 200uS at least!!!

◆ TurnOnDisplay() [3/3]

void EPD_4in2::TurnOnDisplay ( void  )
protectedvirtual

Turn On Display.

◆ WaitUntilIdle()

void EPD_7in5::WaitUntilIdle ( )
virtual

Wait until the busy_pin goes LOW.