EPD Display
1.0.0
Library and application for EPD smart displays
|
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... | |
Library for EPD displays.
#define DEV_Delay_ms | ( | __xms | ) | delay(__xms) |
delay x ms
#define DEV_Digital_Read | ( | _pin | ) | digitalRead(_pin) |
#define DEV_Digital_Write | ( | _pin, | |
_value | |||
) | digitalWrite(_pin, _value == 0? LOW:HIGH) |
GPIO read and write
#define EPD_BUSY_PIN 5 |
#define EPD_CLK_PIN 18 |
#define EPD_CS_PIN 15 |
GPIO config
#define EPD_DC_PIN 4 |
#define EPD_MOSI_PIN 23 |
#define EPD_RST_PIN 2 |
#define GPIO_PIN_RESET 0 |
#define GPIO_PIN_SET 1 |
#define TIME_TO_SLEEP 20 |
Time ESP32 will go to sleep (in seconds)
#define uS_TO_S 1000000 |
Conversion factor for micro seconds to seconds
|
virtual |
Clear screen.
Implements EPD_Display.
|
virtual |
Clear screen.
Implements EPD_Display.
|
virtual |
Clear screen.
Implements EPD_Display.
void DisplayCanvas::Clear | ( | uint16_t | color | ) |
Clear the color of the picture.
color | Painted colors |
|
virtual |
Clear black layer.
void DisplayCanvas::ClearWindows | ( | uint16_t | Xstart, |
uint16_t | Ystart, | ||
uint16_t | Xend, | ||
uint16_t | Yend, | ||
uint16_t | Color | ||
) |
Clear the color of a window.
Xstart | x starting point |
Ystart | y starting point |
Xend | x end point |
Yend | y end point |
Color | Painted colors |
|
private |
SPI read and write.
DisplayCanvas::DisplayCanvas | ( | DisplaySize_t | s | ) |
Allocate the needed memory.
s | display size |
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.
image_buffer | A picture data converted to a bitmap |
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.
Xpoint | X coordinate |
Ypoint | Y coordinate |
Acsii_Char | To display the English characters |
Font | A structure pointer that displays a character size |
Color_Background | Select the background color |
Color_Foreground | Select the foreground color |
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.
X_Center | Center X coordinate |
Radius | circle Radius |
Color | The color of the :circle segment |
Line_width | Line width |
Draw_Fill | Whether to fill the inside of the Circle |
void DisplayCanvas::DrawImage | ( | const unsigned char * | image_buffer, |
uint16_t | xStart, | ||
uint16_t | yStart, | ||
uint16_t | W_Image, | ||
uint16_t | H_Image | ||
) |
Display image.
image | Image start address |
xStart | X starting coordinates |
yStart | Y starting coordinates |
xEnd | Image width |
yEnd | Image height |
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.
Xstart | Starting Xpoint point coordinates |
Ystart | Starting Xpoint point coordinates |
Xend | End point Xpoint coordinate |
Yend | End point Ypoint coordinate |
Color | The color of the line segment |
Line_width | Line width |
Line_Style | Solid and dotted lines |
void DisplayCanvas::DrawNum | ( | uint16_t | Xpoint, |
uint16_t | Ypoint, | ||
int32_t | Nummber, | ||
sFONT * | Font, | ||
uint16_t | Color_Foreground, | ||
uint16_t | Color_Background | ||
) |
Display nummber.
Xstart | X coordinate |
Ystart | Y coordinate |
Nummber | The number displayed |
Font | A structure pointer that displays a character size |
Color_Background | Select the background color |
Color_Foreground | Select the foreground color |
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.
Xpoint | The Xpoint coordinate of the point |
Ypoint | The Ypoint coordinate of the point |
Dot_Style | point Style |
Dot_Pixel | point size |
Color | Painted colors |
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.
Xstart | Starting Xpoint point coordinates |
Ystart | Starting Xpoint point coordinates |
Xend | End point Xpoint coordinate |
Yend | End point Ypoint coordinate |
Color | The color of the line segment |
Line_width | Line width |
Draw_Fill | Whether to fill the inside of the rectangle |
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.
Xstart | X coordinate |
Ystart | Y coordinate |
pString | The first address of the English string to be displayed |
Font | A structure pointer that displays a character size |
Color_Background | Select the background color |
Color_Foreground | Select the foreground color |
void DisplayCanvas::DrawTime | ( | uint16_t | Xstart, |
uint16_t | Ystart, | ||
PAINT_TIME * | pTime, | ||
sFONT * | Font, | ||
uint16_t | Color_Foreground, | ||
uint16_t | Color_Background | ||
) |
Display time.
Xstart | X coordinate |
Ystart | Y coordinate |
pTime | Time-related structures |
Font | A structure pointer that displays a character size |
Color_Background | Select the background color |
Color_Foreground | Select the foreground color |
EPD_2in66b::EPD_2in66b | ( | ) |
Construct a new specific 2.66 inch display object.
EPD_4in2::EPD_4in2 | ( | ) |
Construct a new specific 4.2 inch display object.
EPD_7in5::EPD_7in5 | ( | ) |
Construct a new specific 7.5 inch display object.
EPD_Display::EPD_Display | ( | uint16_t | w, |
uint16_t | h, | ||
uint16_t | r, | ||
uint8_t | c | ||
) |
Construct a new epd display::epd display object.
w | display width |
h | display height |
r | display rorate |
c | display canvas |
int16_t EPD_Display::getHeight | ( | ) |
Return display height.
DisplaySize_t EPD_Display::getSize | ( | ) |
Return display size.
int16_t EPD_Display::getWidth | ( | ) |
Return display width.
|
private |
GPIO Pin configuration.
|
virtual |
Initialize the e-Paper register.
Implements EPD_Display.
|
virtual |
Initialize the e-Paper register.
Implements EPD_Display.
|
virtual |
Initialize the e-Paper register.
Implements EPD_Display.
|
private |
Module Initialize, the BCM2835 library and initialize the pins, SPI protocol.
void DisplayCanvas::NewImage | ( | uint8_t | index, |
uint16_t | color | ||
) |
Create new image.
index | index of image layer. Note, that image can contain multiple layers |
color | Base color for new image |
|
privatevirtual |
Busy Wait until the busy_pin goes LOW.
|
privatevirtual |
Wait until the busy_pin goes LOW.
|
privatevirtual |
Software reset.
Implements EPD_Display.
|
privatevirtual |
Software reset.
Implements EPD_Display.
|
privatevirtual |
Software reset.
Implements EPD_Display.
void DisplayCanvas::SelectImage | ( | uint8_t | index | ) |
Select Image.
index | index of image layer. Note, that image can contain multiple layers |
image | Pointer to the image cache |
|
protected |
Send Command.
Reg | Command register |
|
protected |
Send Data.
Data | Write data |
|
virtual |
Sends half image buffer in RAM to e-Paper and displays.
TopOrBottom | 0 is top half, 1 is bottom half |
*Image |
|
private |
Set cursor starting position.
Xstart | x starting point |
Ystart | y starting point |
void DisplayCanvas::SetMirroring | ( | uint8_t | mirror | ) |
Select Image mirror.
mirror | None mirror,Horizontal mirror,Vertical mirror,Origin mirror |
void DisplayCanvas::SetPixel | ( | uint16_t | Xpoint, |
uint16_t | Ypoint, | ||
uint16_t | Color | ||
) |
Draw Pixels.
Xpoint | At point X |
Ypoint | At point Y |
Color | Painted colors |
void DisplayCanvas::SetRotate | ( | uint16_t | rotate | ) |
Rotate image by 0,90,180,270 degrees.
rotate | allowed values: ROTATE_0 (0), ROTATE_90 (90), ROTATE_180 (180), ROTATE_270 (270) |
void DisplayCanvas::SetScale | ( | uint8_t | scale | ) |
Set display scale.
scale | supported values 2/4/7 |
|
private |
Setting the display window.
Xstart | x starting point |
Xend | x end point |
Ystart | y starting point |
Yend | y end point |
|
virtual |
Shows the content - Sends the image buffer in RAM to e-Paper and displays.
*canvas | |
canvas_layer |
Implements EPD_Display.
|
virtual |
Show content- Sends the image buffer in RAM to e-Paper and displays.
*canvas | |
canvas_layer |
Implements EPD_Display.
|
virtual |
Show content- Sends the image buffer in RAM to e-Paper and displays.
*canvas | |
canvas_layer |
Implements EPD_Display.
|
virtual |
Enter sleep mode.
Implements EPD_Display.
|
virtual |
Enter sleep mode.
Implements EPD_Display.
|
virtual |
Enter sleep mode.
Implements EPD_Display.
|
protectedvirtual |
Turn On Display.
|
protectedvirtual |
Turn On Display.
!!The delay here is necessary, 200uS at least!!!
|
protectedvirtual |
Turn On Display.
|
virtual |
Wait until the busy_pin goes LOW.