A lib to handle a E-Paper display from Pervasive Displays. There is a interface board from Embedded Artists. The lib can handle graphic and text drawing and is using external fonts.

Dependents:   epaper_mbed_130411_KL25Z epaper_mbed_test epaper_KL25Z_2 test_he10 ... more

Embed: (wiki syntax)

« Back to documentation index

EaEpaper Class Reference

EaEpaper Class Reference

Display control class, based on GraphicsDisplay and TextDisplay. More...

#include <EaEpaper.h>

Inherits GraphicsDisplay.

Public Member Functions

 EaEpaper (PinName p_on, PinName border, PinName discharge, PinName reset, PinName busy, PinName cs, PinName pwm, PinName mosi, PinName miso, PinName sck, PinName sda, PinName scl, const char *name="E_Paper")
 Constructor.
virtual int width ()
 Get the width of the screen in pixel.
virtual int height ()
 Get the height of the screen in pixel.
void clear ()
 Clear the display.
void write_disp (void)
 Write image buffer to display.
virtual void pixel (int x, int y, int color)
 set or reset a single pixel
virtual void cls (void)
 Fill the screen with white.
void line (int x0, int y0, int x1, int y1, int color)
 draw a 1 pixel line
void rect (int x0, int y0, int x1, int y1, int color)
 draw a rect
void fillrect (int x0, int y0, int x1, int y1, int color)
 draw a filled rect
void circle (int x0, int y0, int r, int color)
 draw a circle
void fillcircle (int x0, int y0, int r, int color)
 draw a filled circle
void setmode (int mode)
 set drawing mode
virtual void locate (int x, int y)
 setup cursor position
virtual int columns ()
 calculate the max number of char in a line
virtual int rows ()
 calculate the max number of columns
virtual int _putc (int value)
 put a char on the screen
virtual void character (int x, int y, int c)
 paint a character on given position out of the active font to the screen buffer
void set_font (unsigned char *f)
 select the font to use
void print_bm (Bitmap bm, int x, int y)
 print bitmap to buffer
virtual bool claim (FILE *stream)
 redirect output from a stream (stoud, sterr) to display

Detailed Description

Display control class, based on GraphicsDisplay and TextDisplay.

Example with pinning for KL25Z:

 #include "mbed.h"
 #include "EaEpaper.h"
 #include "Arial28x28.h" 
 #include "Arial12x12.h"
 #include "font_big.h"
 #include "graphics.h"

 // the E-Paper board from embedded artists has a LM75 temp sensor to compensate the temperature effect. If it is cold the display reacts slower.
 // The LM75 need a I2C -> 2 pins : sda and scl 
 // The display data is written via SPI -> 3 pins : mosi,miso,sck
 // There are also some control signals 
 // The pwm pin has to be connected to a PWM enabled pin : pwm
 // The other signals are connected to normal IO`s
 //              
 EaEpaper epaper(PTD7,            // PWR_CTRL
                 PTD6,            // BORDER
                 PTE31,           // DISCHARGE
                 PTA17,           // RESET_DISP
                 PTA16,           // BUSY
                 PTC17,           // SSEL
                 PTD4,            // PWM
                 PTD2,PTD3,PTD1,  // MOSI,MISO,SCLK
                 PTE0,PTE1);      // SDA,SCL 

 int main() {

   epaper.cls();                                  // clear screen                        
   epaper.set_font((unsigned char*) Arial28x28);  // select the font
   epaper.locate(5,20);                           // set cursor
   epaper.printf("Hello Mbed");                   // print text
   epaper.rect(3,15,150,50,1);                    // draw frame
   epaper.write_disp();                           // update screen

Definition at line 89 of file EaEpaper.h.


Constructor & Destructor Documentation

EaEpaper ( PinName  p_on,
PinName  border,
PinName  discharge,
PinName  reset,
PinName  busy,
PinName  cs,
PinName  pwm,
PinName  mosi,
PinName  miso,
PinName  sck,
PinName  sda,
PinName  scl,
const char *  name = "E_Paper" 
)

Constructor.

Definition at line 12 of file EaEpaper.cpp.


Member Function Documentation

int _putc ( int  value ) [virtual]

put a char on the screen

Parameters:
valuechar to print
Returns:
printed char

Definition at line 270 of file EaEpaper.cpp.

void character ( int  x,
int  y,
int  c 
) [virtual]

paint a character on given position out of the active font to the screen buffer

Parameters:
xx-position (top left)
yy-position
cchar code

Definition at line 285 of file EaEpaper.cpp.

void circle ( int  x0,
int  y0,
int  r,
int  color 
)

draw a circle

Parameters:
x0,y0center
rradius
color: 0 white, 1 black *

Definition at line 210 of file EaEpaper.cpp.

bool claim ( FILE *  stream ) [virtual, inherited]

redirect output from a stream (stoud, sterr) to display

Parameters:
streamstream that shall be redirected to the TextDisplay

Definition at line 65 of file TextDisplay.cpp.

void clear (  )

Clear the display.

Definition at line 49 of file EaEpaper.cpp.

void cls ( void   ) [virtual]

Fill the screen with white.

Definition at line 105 of file EaEpaper.cpp.

int columns (  ) [virtual]

calculate the max number of char in a line

Returns:
max columns depends on actual font size

Definition at line 258 of file EaEpaper.cpp.

void fillcircle ( int  x0,
int  y0,
int  r,
int  color 
)

draw a filled circle

Parameters:
x0,y0center
rradius
color: 0 white, 1 black *

Definition at line 229 of file EaEpaper.cpp.

void fillrect ( int  x0,
int  y0,
int  x1,
int  y1,
int  color 
)

draw a filled rect

Parameters:
x0,y0top left corner
x1,y1down right corner
color: 0 white, 1 black

Definition at line 187 of file EaEpaper.cpp.

int height (  ) [virtual]

Get the height of the screen in pixel.

Returns:
height of screen in pixel

Definition at line 42 of file EaEpaper.cpp.

void line ( int  x0,
int  y0,
int  x1,
int  y1,
int  color 
)

draw a 1 pixel line

Parameters:
x0,y0start point
x1,y1stop point
color: 0 white, 1 black

Definition at line 111 of file EaEpaper.cpp.

void locate ( int  x,
int  y 
) [virtual]

setup cursor position

Parameters:
xx-position (top left)
yy-position

Definition at line 251 of file EaEpaper.cpp.

void pixel ( int  x,
int  y,
int  color 
) [virtual]

set or reset a single pixel

Parameters:
xhorizontal position
yvertical position
color: 0 white, 1 black

Definition at line 88 of file EaEpaper.cpp.

void print_bm ( Bitmap  bm,
int  x,
int  y 
)

print bitmap to buffer

Parameters:
bmstruct Bitmap in flash
xx start
yy start

Definition at line 332 of file EaEpaper.cpp.

void rect ( int  x0,
int  y0,
int  x1,
int  y1,
int  color 
)

draw a rect

Parameters:
x0,y0top left corner
x1,y1down right corner
color: 0 white, 1 black

Definition at line 170 of file EaEpaper.cpp.

int rows (  ) [virtual]

calculate the max number of columns

Returns:
max column depends on actual font size

Definition at line 264 of file EaEpaper.cpp.

void set_font ( unsigned char *  f )

select the font to use

Parameters:
fpointer to font array

font array can created with GLCD Font Creator from http://www.mikroe.com you have to add 4 parameter at the beginning of the font array to use:

  • the number of byte / char
  • the vertial size in pixel
  • the horizontal size in pixel
  • the number of byte per vertical line you also have to change the array to char[]

Definition at line 327 of file EaEpaper.cpp.

void setmode ( int  mode )

set drawing mode

Parameters:
NORMAL: paint normal color, XOR : paint XOR of current pixels

Definition at line 245 of file EaEpaper.cpp.

int width (  ) [virtual]

Get the width of the screen in pixel.

Parameters:
@returnswidth of screen in pixel

Definition at line 37 of file EaEpaper.cpp.

void write_disp ( void   )

Write image buffer to display.

Definition at line 61 of file EaEpaper.cpp.