16FXlib
LCD (lcd.h)

Detailed Description

#include "lcd.h"
Overview
Routines to access an AV12864 pixelmatrix display.

Modules

 Font (font.h)
 
 Internal configurations (lcd.cfg.h)
 

Functions

void lcd_init (void)
 
void lcd_clear (uint8_t color)
 
void lcd_drawPage (uint8_t x, uint8_t page, uint8_t data)
 
int8_t lcd_getPixel (int16_t x, int16_t y)
 
void lcd_drawPixel (int16_t x, int16_t y, uint8_t color)
 
void lcd_drawCircle (int16_t x, int16_t y, uint8_t r, uint8_t color, uint8_t filled)
 
void lcd_drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t color, uint8_t filled)
 
void lcd_drawLine (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
 
uint8_t lcd_drawCharacter (uint8_t x, uint8_t page, char ascii, uint8_t color, uint8_t overlay)
 
uint8_t lcd_drawString (uint8_t x1, uint8_t page1, uint8_t x2, uint8_t page2, uint8_t wrap, uint16_t delay, char *firstChar, uint8_t color, uint8_t overlay)
 
int16_t lcd_drawCharacterPrecise (int16_t x, int16_t y, char ascii, uint8_t color, uint8_t orientation, uint8_t font)
 
int16_t lcd_drawStringPrecise (int16_t x, int16_t y, char *firstChar, uint8_t color, uint8_t settings, uint8_t font)
 
void lcd_flush (void)
 

Macros

#define LCD_COLOR_BLACK   (1)
 
#define LCD_COLOR_WHITE   (0)
 
#define LCD_ALIGNMENT_LEFT   (0)
 
#define LCD_ALIGNMENT_CENTER   (1)
 
#define LCD_ALIGNMENT_RIGHT   (2)
 
#define LCD_ALIGNMENT_TOP   (0)
 
#define LCD_ALIGNMENT_MIDDLE   (4)
 
#define LCD_ALIGNMENT_BOTTOM   (8)
 
#define LCD_ORIENTATION_0   (0)
 
#define LCD_ORIENTATION_90   (16)
 
#define LCD_ORIENTATION_180   (32)
 
#define LCD_ORIENTATION_270   (64)
 

LCD size

Defines LCD horizontal/vertical size

#define LCD_WIDTH   128
 
#define LCD_HEIGHT   64
 

Function Documentation

void lcd_init ( void  )

Initializes I/Os for display usage and display's controllers

Definition at line 109 of file lcd.c.

void lcd_clear ( uint8_t  color)

Clears the display contents

Parameters
colorClear to all black (1) or all white (0)

Definition at line 120 of file lcd.c.

void lcd_drawPage ( uint8_t  x,
uint8_t  page,
uint8_t  data 
)

Draws a single page (1*8 pixel) onto the display.

Parameters
xX coordinate of the page (0 - 127)
pagePage (0 - 7)
dataContents of the page. LSB is the topmost pixel

Definition at line 140 of file lcd.c.

int8_t lcd_getPixel ( int16_t  x,
int16_t  y 
)

Read the state of a single pixel.

Parameters
xX coordinate (0 - 127)
yY coordinate (0 - 63)
Returns
1 = active, 0 = inactive, -1 = x or y outside display area

Definition at line 181 of file lcd.c.

void lcd_drawPixel ( int16_t  x,
int16_t  y,
uint8_t  color 
)

Draws a single pixel onto the display, preserving the state of all other pixels in the same page.

Parameters
xX coordinate (0 - 127)
yY coordinate (0 - 63)
color1 = active, 0 = inactive

Definition at line 154 of file lcd.c.

void lcd_drawCircle ( int16_t  x,
int16_t  y,
uint8_t  r,
uint8_t  color,
uint8_t  filled 
)

Draws a (non-filled) circle onto the display.

Parameters
xX coordinate of the center of the circle (0 - 127)
yY coordinate of the center of the circle (0 - 63)
rRadius of the circle
color1 = pixels of circle will be active, 0 = inactive
filled1 = circle will be completely filled, 0 = only borderline

Definition at line 196 of file lcd.c.

void lcd_drawRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint8_t  color,
uint8_t  filled 
)

Draws a (filled) rectangle on the display.

Parameters
xX coordinate of the upper left corner of the rectangle (0 - 127)
yY coordinate of the upper left corner of the rectangle (0 - 63)
wWidth of the rectangle (0 - 128)
hHeight of the rectangle (0 - 64)
color1 = contents will be active, 0 = inactive
filled1 = rectangle will be completely filled, 0 = only borderline

Definition at line 244 of file lcd.c.

void lcd_drawLine ( int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
uint8_t  color 
)

Draws a line on the display.

Parameters
x1X coordinate of the start of the line (0 - 127)
y1Y coordinate of the start of the line (0 - 63)
x2X coordinate of the end of the line (0 - 127)
y2Y coordinate of the end of the line (0 - 63)
color1 = line will be painted with active pixels, 0 = inactive pixels

Definition at line 310 of file lcd.c.

uint8_t lcd_drawCharacter ( uint8_t  x,
uint8_t  page,
char  ascii,
uint8_t  color,
uint8_t  overlay 
)

Draws a single character on screen

Parameters
xX position to write to (0 - 127)
pagePage to write to (0 - 7)
asciiASCII value of character to write (0 - 127)
color1 = Character's pixels will be black, 0 = white
overlay1 = pixels not on character's position will not be changed, 0 = the whole 5 pages for each character will be overwritten
Returns
X coordinate for next character

Definition at line 380 of file lcd.c.

uint8_t lcd_drawString ( uint8_t  x1,
uint8_t  page1,
uint8_t  x2,
uint8_t  page2,
uint8_t  wrap,
uint16_t  delay,
char *  firstChar,
uint8_t  color,
uint8_t  overlay 
)

Draws a string on screen, including line wrapping (if enabled) and delay between characters

Parameters
x1X coordinate of area start (0 - 127)
page1Page of area start (0 - 7)
x2X coordinate of area end, set 0 to ignore (0 - 127)
page2Page of area end (only used if wrap=1) (0 - 7)
wrapString will be wrapped to next line if set to 1
delayWait for specified amount of time between each character (in ms)
firstCharPointer to first character of null-terminated string
color1 = Character's pixels will be black, 0 = white
overlay1 = pixels not on character's position will not be changed, 0 = the whole 5 pages for each character will be overwritten
Returns
X coordinate for next character

Definition at line 422 of file lcd.c.

int16_t lcd_drawCharacterPrecise ( int16_t  x,
int16_t  y,
char  ascii,
uint8_t  color,
uint8_t  orientation,
uint8_t  font 
)

Draws a single character on screen (pixel precise but slower)

Parameters
xX position to write to (0 - 127)
yY position to write to (0 - 63)
asciiASCII value of character to write (0 - 127)
color1 = Character's pixels will be black, 0 = white
orientation1 = vertical, 0 = horizontal
fontselects the font to use (0=default)
Returns
X or Y coordinate for next character (depending on orientation

Definition at line 462 of file lcd.c.

int16_t lcd_drawStringPrecise ( int16_t  x,
int16_t  y,
char *  firstChar,
uint8_t  color,
uint8_t  settings,
uint8_t  font 
)

Draws a string on screen using pixel-precise methods

Parameters
xX coordinate to write to (0 - 127)
yY coordinate to write to (0 - 63)
firstCharPointer to first character of null-terminated string
color1 = Character's pixels will be black, 0 = white
settingsbitmasked settings
fontselects the font to use (0=default)
Returns
X coordinate for next character

Definition at line 522 of file lcd.c.

void lcd_flush ( void  )

Copies the local buffer to the LCD RAM. (Only needed if LCD_FRAMEBUFFER_MODE is set to 1)

Definition at line 603 of file lcd.c.

Macro Definition Documentation

#define LCD_WIDTH   128

Horizontal size of display in pixel

Definition at line 184 of file lcd.h.

#define LCD_HEIGHT   64

Vertical size of display in pixel

Definition at line 188 of file lcd.h.