Stefan Staub / EADOG

Dependencies:   Fonts

Embed: (wiki syntax)

« Back to documentation index

EADOG Class Reference

Library for the EADOG LCD displays from electronic assembly. More...

#include <EADOG.h>

Public Member Functions

 EADOG (PinName mosi, PinName sck, PinName reset, PinName a0, PinName cs, uint8_t type)
 create a EADOG object connected to SPI
void pixel (int x, int y, uint8_t colour)
 draw a pixel in buffer at x, y black or white
void point (int x, int y, uint8_t colour)
 draw a single point
void line (int x0, int y0, int x1, int y1, uint8_t colour)
 draw a 1 pixel line
void rectangle (int x0, int y0, int x1, int y1, uint8_t colour)
 draw a rect
void fillrect (int x0, int y0, int x1, int y1, uint8_t colour)
 draw a filled rect
void roundrect (int x0, int y0, int x1, int y1, int rnd, uint8_t colour)
 draw a rounded rect
void fillrrect (int x0, int y0, int x1, int y1, int rnd, uint8_t colour)
 draw a filled rounded rect
void circle (int x, int y, int r, uint8_t colour)
 draw a circle
void fillcircle (int x, int y, int r, uint8_t colour)
 draw a filled circle
void update ()
 update copy display buffer to lcd
void display (uint8_t display)
 display functions
void display (uint8_t display, uint8_t value)
 display functions
void cls ()
 clear the screen
void character (uint8_t x, uint8_t y, uint8_t c)
 draw a character on given position out of the active font to the LCD
void locate (uint8_t x, uint8_t y)
 set top left position of char/printf
void font (uint8_t *f)
 select the font to use
void bitmap (Bitmap bm, int x, int y)
 print bitmap to buffer

Protected Member Functions

virtual int _putc (int value)
 stream class, put a char on the screen
virtual int _getc ()
 stream class, dummy
void init ()
 init the DOGM132 LCD controller
void write_data (uint8_t data)
 write data to the LCD controller
void write_command (uint8_t command)
 Write a command the LCD controller.

Detailed Description

Library for the EADOG LCD displays from electronic assembly.

Example for EA DOGM132x-5 with STM32F401RE Nucleo

 // display test for EA DOGM132x-5 with STM32F401RE Nucleo
 // sstaub(c)2016

 #include "mbed.h"
 #include "EADOG.h"
 #include "Small_7.h"
 #include "Fonts/ArialR12x14.h"

 // DOGM132x-5 Wide Range
 // Pins for STM32F401RE Nucleo

 // DOG Pin   Purpose   ST Pin
 // 40        CS        PB_6(D10)
 // 39        Reset     PC_7(D9)
 // 38        A0        PA_9(D8)
 // 37        SCK       PA_5(D13, SCK)
 // 36        MOSI      PA_7(D11, MOSI)
 // 35        VDD       3.3V
 // 34        VDD2      3.3V
 // 33        VSS       GND
 // 32        VOUT      1uF -> GND
 // 31        CAP3P     1uF -> CAP1N
 // 30        CAP1N     1uF -> CAP1P
 // 29        CAP1P
 // 28        CAP2P     1uF -> CAP2N
 // 27        CAP2N
 // 26        VSS       GND
 // 25        V4        1uF -> GND
 // 24        V3        1uF -> GND
 // 23        V2        1uF -> GND
 // 22        V1        1uF -> GND
 // 21        V0        1uF -> GND
 

 EADOG lcd(PA_7, PA_5, PC_7, PA_9, PB_6, DOGM132); // MOSI, SCK, Reset, A0, CS
 
 int main() {
   // create logo
   lcd.update(MANUAL);
   lcd.rectangle(0, 0, 131, 31, 1);
   lcd.fillrect(2, 2, 4, 4, 1);
   lcd.fillrect(2, 27, 4, 29, 1);
   lcd.fillrect(61, 2, 63, 4, 1);
   lcd.fillrect(61, 27, 63, 29, 1);
   lcd.line(65, 0, 65, 31, 1);
   lcd.circle(33, 15, 10, 1);
   lcd.circle(33, 15, 6, 1);
   lcd.fillcircle(33, 15, 3, 1);
   lcd.update();
   lcd.update(AUTO);
   // create description text
   lcd.locate(70, 1);
   lcd.font((unsigned char*)ArialR12x14);
   lcd.printf("mbed");
   lcd.locate(70, 13);
   lcd.font((unsigned char*)Small_7);
   lcd.printf("EA");
   lcd.locate(70, 22);
   lcd.printf("DOGM132x-5");

   wait(1);
   lcd.display(CONTRAST, 16); // contrast low
   wait(1);
   lcd.display(CONTRAST, 40); // contrast high
   wait(1);
   lcd.display(CONTRAST);     // contrast default
   wait(1);
   lcd.display(OFF);          // display off
   wait(1);
   lcd.display(ON);           // display on
   wait(1);
   lcd.display(SLEEP);        // display sleep
   wait(1);
   lcd.display(ON);           // display wake up

   while(1) {                 // main loop
     lcd.display(INVERT);     // display inverted
     lcd.display(BOTTOM);     // display normal orientation
     wait(2);
     lcd.display(DEFAULT);    // display 
     lcd.display(TOPVIEW);    // display rotated
     wait(2);    
     }
   }

Definition at line 150 of file EADOG.h.


Constructor & Destructor Documentation

EADOG ( PinName  mosi,
PinName  sck,
PinName  reset,
PinName  a0,
PinName  cs,
uint8_t  type 
)

create a EADOG object connected to SPI

Parameters:
mosipinname
sckpinname
resetpinname
a0pinname
cspinname

Definition at line 20 of file EADOG.cpp.


Member Function Documentation

int _getc (  ) [protected, virtual]

stream class, dummy

Definition at line 406 of file EADOG.cpp.

int _putc ( int  value ) [protected, virtual]

stream class, put a char on the screen

Parameters:
valuechar to print
Returns:
printed char

Definition at line 391 of file EADOG.cpp.

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

print bitmap to buffer

Parameters:
bmBitmap in flash
xx start
yy start

Definition at line 454 of file EADOG.cpp.

void character ( uint8_t  x,
uint8_t  y,
uint8_t  c 
)

draw a character on given position out of the active font to the LCD

Parameters:
xx-position of char (top left)
yy-position
cchar to print

Definition at line 410 of file EADOG.cpp.

void circle ( int  x,
int  y,
int  r,
uint8_t  colour 
)

draw a circle

Parameters:
x0,y0center
rradius
colour1 set pixel, 0 erase pixel

Definition at line 356 of file EADOG.cpp.

void cls (  )

clear the screen

Definition at line 254 of file EADOG.cpp.

void display ( uint8_t  display,
uint8_t  value 
)

display functions

Parameters:
displayCONTRAST set display contrast with value,
valuesets display contrast 0 - 63, default 31

Definition at line 88 of file EADOG.cpp.

void display ( uint8_t  display )

display functions

Parameters:
displayON switch display on, or wake up from sleep
displayOFF set display off
displaySLEEP set display off and to sleep mode
displayBOTTOM (default) set display orientation 0°
displayTOPVIEW draw display oriention to 180°
displayINVERT invert the pixels
displayDEFAULT normal pixel display
displayCONTRAST set display contrast to default

Definition at line 43 of file EADOG.cpp.

void fillcircle ( int  x,
int  y,
int  r,
uint8_t  colour 
)

draw a filled circle

Parameters:
x0,y0center
rradius
color1 set pixel, 0 erase pixel

use circle with different radius, can miss some pixel

Definition at line 370 of file EADOG.cpp.

void fillrect ( int  x0,
int  y0,
int  x1,
int  y1,
uint8_t  colour 
)

draw a filled rect

Parameters:
x0,y0top left corner
x1,y1down right corner
color1 set pixel, 0 erase pixel

Definition at line 298 of file EADOG.cpp.

void fillrrect ( int  x0,
int  y0,
int  x1,
int  y1,
int  rnd,
uint8_t  colour 
)

draw a filled rounded rect

Parameters:
x0,y0top left corner
x1,y1down right corner
rndradius of the rounding
color1 set pixel, 0 erase pixel

Definition at line 333 of file EADOG.cpp.

void font ( uint8_t *  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[]
     lcd.font((unsigned char*)Small_7);
    

Definition at line 450 of file EADOG.cpp.

void init (  ) [protected]

init the DOGM132 LCD controller

Definition at line 114 of file EADOG.cpp.

void line ( int  x0,
int  y0,
int  x1,
int  y1,
uint8_t  colour 
)

draw a 1 pixel line

Parameters:
x0,y0start point
x1,y1end point
color1 set pixel, 0 erase pixel

Definition at line 272 of file EADOG.cpp.

void locate ( uint8_t  x,
uint8_t  y 
)

set top left position of char/printf

Parameters:
xx-position
yy-position

Definition at line 386 of file EADOG.cpp.

void pixel ( int  x,
int  y,
uint8_t  colour 
)

draw a pixel in buffer at x, y black or white

Parameters:
xhorizontal position
yvertical position
colour1 set pixel, 0 erase pixel there is no update, it writes the pixel only in the buffer

Definition at line 260 of file EADOG.cpp.

void point ( int  x,
int  y,
uint8_t  colour 
)

draw a single point

Parameters:
xhorizontal position
yvertical position
colour1 set pixel, 0 erase pixel

Definition at line 266 of file EADOG.cpp.

void rectangle ( int  x0,
int  y0,
int  x1,
int  y1,
uint8_t  colour 
)

draw a rect

Parameters:
x0,y0top left corner
x1,y1down right corner
color1 set pixel, 0 erase pixel

Definition at line 287 of file EADOG.cpp.

void roundrect ( int  x0,
int  y0,
int  x1,
int  y1,
int  rnd,
uint8_t  colour 
)

draw a rounded rect

Parameters:
x0,y0top left corner
x1,y1down right corner
rndradius of the rounding
color1 set pixel, 0 erase pixel

Definition at line 309 of file EADOG.cpp.

void update (  )

update copy display buffer to lcd

Parameters:
AUTOset update mode to auto, default
MANUELLthe update function must manually set update() copy display buffer to lcd

Definition at line 162 of file EADOG.cpp.

void write_command ( uint8_t  command ) [protected]

Write a command the LCD controller.

Parameters:
cmdcommand to be written

Definition at line 98 of file EADOG.cpp.

void write_data ( uint8_t  data ) [protected]

write data to the LCD controller

Parameters:
datdata written to LCD controller

Definition at line 106 of file EADOG.cpp.