LPCOpen Platform for LPC112X microcontrollers  112X
LPCOpen Platform for the NXP LPC112X family of Microcontrollers
Macros | Functions | Variables
lcd_st7565s.c File Reference
#include <stdlib.h>
#include "board.h"
#include "lcd_st7565s.h"

Go to the source code of this file.

Macros

#define LCD_FLIP_Y   1 /* If 0 Mirrors Y direction */
 

Functions

static void LCD_WriteCmd (const uint8_t *cmd, uint16_t size)
 
static void LCD_SetRAMAddr (uint8_t pgAddr, uint8_t colAddr)
 
static int LCD_GetCharWidth (int index)
 
void LCD_Init (void)
 Initialize the LCD turns it ON. More...
 
void LCD_Refresh (int left, int top, int right, int bottom)
 Update content of Display RAM to Display device. More...
 
void LCD_SetPixel (int x, int y, int col)
 Turns On/Off a pixel at (x,y) in Display RAM. More...
 
void LCD_PutPixel (int x, int y, int col)
 Turns On/Off a pixel at (x,y) in Display device. More...
 
void LCD_DrawRect (int left, int top, int right, int bottom, int col)
 Draws a rectangle from (top,right) to (bottom,left) More...
 
void LCD_FillRect (int left, int top, int right, int bottom, int col)
 Fills a rectangle from (top,right) to (bottom,left) More...
 
void LCD_DrawLine (int x0, int y0, int x1, int y1, int col)
 Draws a line from x0,y0 to x1,y1. More...
 
void LCD_SetFontColor (int color)
 Sets the foreground color of font. More...
 
void LCD_SetFontBgColor (int color)
 Sets the background color of font. More...
 
void LCD_SetFontWidth (int width)
 Sets width for fixed width fonts. More...
 
void LCD_SetFont (const FONT_T *font)
 Sets the current font. More...
 
void LCD_SetFontCharSpace (int space)
 Sets the space between two chars. More...
 
uint32_t LCD_PutCharXY (int xPos, int yPos, int ch)
 Prints ASCII character at given position. More...
 
void LCD_PutStrXY (int xPos, int yPos, const char *str)
 Prints ASCII string at given position. More...
 

Variables

struct {
   int   fcolor
 
   int   bgcolor
 
   int   spacing
 
   int   fwidth
 
   const FONT_T *   font
 
cfont
 
struct {
   int   fcolor
 
   int   bgcolor
 
   int   spacing
 
   int   fwidth
 
   const FONT_T *   font
 
cf = &cfont
 
static const uint8_t lcd_init_cmd []
 
static uint8_t fbuffer [LCD_Y_RES >> 3][LCD_X_RES]
 

Macro Definition Documentation

#define LCD_FLIP_Y   1 /* If 0 Mirrors Y direction */

Definition at line 41 of file lcd_st7565s.c.

Function Documentation

void LCD_DrawLine ( int  x0,
int  y0,
int  x1,
int  y1,
int  col 
)

Draws a line from x0,y0 to x1,y1.

Parameters
x0: X0
y0: Y0
x1: X1
y1: Y1
col: Color of the pixel (0 - OFF[WHITE]; 1 - ON[BLACK])
Returns
Nothing

Definition at line 215 of file lcd_st7565s.c.

void LCD_DrawRect ( int  left,
int  top,
int  right,
int  bottom,
int  col 
)

Draws a rectangle from (top,right) to (bottom,left)

Parameters
left: Left coordinate [X coordinate]
top: Top coordinate [Y coordinate]
right: Right coordinate [X coordinate]
bottom: Bottom coorinate [Y coordinate]
col: Color of the pixel (0 - OFF[WHITE]; 1 - ON[BLACK])
Returns
Nothing

Definition at line 186 of file lcd_st7565s.c.

void LCD_FillRect ( int  left,
int  top,
int  right,
int  bottom,
int  col 
)

Fills a rectangle from (top,right) to (bottom,left)

Parameters
left: Left coordinate [X coordinate]
top: Top coordinate [Y coordinate]
right: Right coordinate [X coordinate]
bottom: Bottom coorinate [Y coordinate]
col: Color of the pixel (0 - OFF[WHITE]; 1 - ON[BLACK])
Returns
Nothing

Definition at line 202 of file lcd_st7565s.c.

static int LCD_GetCharWidth ( int  index)
static

Definition at line 103 of file lcd_st7565s.c.

void LCD_Init ( void  )

Initialize the LCD turns it ON.

Returns
Nothing

Definition at line 118 of file lcd_st7565s.c.

uint32_t LCD_PutCharXY ( int  xPos,
int  yPos,
int  ch 
)

Prints ASCII character at given position.

Parameters
xPos: x Position in pixels
yPos: y Position in pixels
ch: ASCII character (int casted)
Returns
Next char's x Position in lower half word and next char's y position in upper half word

Definition at line 262 of file lcd_st7565s.c.

void LCD_PutPixel ( int  x,
int  y,
int  col 
)

Turns On/Off a pixel at (x,y) in Display device.

Parameters
x: X coordinate of the pixel
y: Y coordinate of the pixel
col: Color of the pixel (0 - OFF[WHITE]; 1 - ON[BLACK])
Returns
Nothing

Definition at line 179 of file lcd_st7565s.c.

void LCD_PutStrXY ( int  xPos,
int  yPos,
const char *  str 
)

Prints ASCII string at given position.

Parameters
xPos: x Position in pixels
yPos: y Position in pixels
str: Pointer to NUL terminated ASCII string
Returns
nothing

Definition at line 288 of file lcd_st7565s.c.

void LCD_Refresh ( int  left,
int  top,
int  right,
int  bottom 
)

Update content of Display RAM to Display device.

Parameters
left: Left coordinate [X coordinate]
top: Top coordinate [Y coordinate]
right: Right coordinate [X coordinate]
bottom: Bottom coorinate [Y coordinate]
Returns
Nothing
Note
left should not be greater than right and top should not be greater than bottom, if not the behavior is undefined.

Definition at line 134 of file lcd_st7565s.c.

void LCD_SetFont ( const FONT_T font)

Sets the current font.

Parameters
font: Pointer to a font structure (swim font)
Returns
Nothing

Definition at line 250 of file lcd_st7565s.c.

void LCD_SetFontBgColor ( int  color)

Sets the background color of font.

Parameters
color: Color 1 - ON[Black], 0 - OFF[WHITE]
Returns
Nothing

Definition at line 238 of file lcd_st7565s.c.

void LCD_SetFontCharSpace ( int  space)

Sets the space between two chars.

Parameters
space: Space in pixels
Returns
Nothing
Note
This functions sets the space that will be left between chars in addition to the default space provided by the font itself

Definition at line 256 of file lcd_st7565s.c.

void LCD_SetFontColor ( int  color)

Sets the foreground color of font.

Parameters
color: Color 1 - ON[Black], 0 - OFF[WHITE]
Returns
Nothing

Definition at line 232 of file lcd_st7565s.c.

void LCD_SetFontWidth ( int  width)

Sets width for fixed width fonts.

Parameters
width: Width of a single char in pixels
Returns
Nothing
Note
This width is effective only for fonts that has fixed with and having the width table initialized to null

Definition at line 244 of file lcd_st7565s.c.

void LCD_SetPixel ( int  x,
int  y,
int  col 
)

Turns On/Off a pixel at (x,y) in Display RAM.

Parameters
x: X coordinate of the pixel
y: Y coordinate of the pixel
col: Color of the pixel (0 - OFF[WHITE]; 1 - ON[BLACK])
Returns
Nothing
Note
Set pixel will not display the pixel until LCD_Refresh is called for the region containing this pixel.

Definition at line 161 of file lcd_st7565s.c.

static void LCD_SetRAMAddr ( uint8_t  pgAddr,
uint8_t  colAddr 
)
static

Definition at line 93 of file lcd_st7565s.c.

static void LCD_WriteCmd ( const uint8_t *  cmd,
uint16_t  size 
)
static

Definition at line 85 of file lcd_st7565s.c.

Variable Documentation

int bgcolor

Definition at line 47 of file lcd_st7565s.c.

struct { ... } * cf
struct { ... } cfont
uint8_t fbuffer[LCD_Y_RES >> 3][LCD_X_RES]
static

Definition at line 73 of file lcd_st7565s.c.

int fcolor

Definition at line 46 of file lcd_st7565s.c.

const FONT_T* font

Definition at line 50 of file lcd_st7565s.c.

int fwidth

Definition at line 49 of file lcd_st7565s.c.

const uint8_t lcd_init_cmd[]
static
Initial value:
= {
0xA2,
0xA0,
0xC0 | (LCD_FLIP_Y << 3),
0x40,
0x2C,
0x2E,
0x2F,
0x25,
0x81,
0x20,
0xAF,
0xB0,
0x10,
0x04,
}

Definition at line 53 of file lcd_st7565s.c.

int spacing

Definition at line 48 of file lcd_st7565s.c.