STM32F10x library
Macros | Functions | Variables
lcd.c File Reference

HD44780 LCD routines (high level) More...

#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include "itoa.h"

Macros

#define LCD_WIDTH   20
 LCD width.
 
#define LCD_HEIGHT   2
 LCD height (number of lines)
 
#define LCD_USE_FB
 Define to use framebuffer. Skips unnecessary LCD writes. Recommended.
 

Functions

void lcd_clear (void)
 Clear LCD.
 
void lcd_init (void)
 Init LCD.
 
void lcd_goto (uint8_t x, uint8_t y)
 Position LCD cursor. More...
 
void lcd_line (const uint8_t y)
 Position LCD cursor to the beginning of line y. More...
 
void lcd_putc (const char c)
 Write a char. More...
 
void lcd_endl (void)
 Emulate endl by printing spaces until LCD width is reached.
 
uint8_t lcd_puts (const char *s)
 Write a string. More...
 
void lcd_putsn (const char *s, uint8_t n)
 Write n chars of string. More...
 
void lcd_puti_lc (const uint32_t a, uint8_t r, uint8_t l, char c)
 Write int in the specified radix r of minlen w prepended by char c. More...
 
void lcd_putf (float f, uint8_t prec)
 Write float with specified precision. More...
 

Variables

uint8_t lcd_busw
 

Detailed Description

HD44780 LCD routines (high level)

This is the high level part of HD44780 control. Low level driver is implemented elsewhere.

Author
Matej Kogovsek (matej.nosp@m.@ham.nosp@m.radio.nosp@m..si)
Note
This file is part of mat-stm32f1-lib

Function Documentation

void lcd_goto ( uint8_t  x,
uint8_t  y 
)

Position LCD cursor.

Parameters
[in]xcharacter (0 based)
[in]yline (0 based)
void lcd_line ( const uint8_t  y)

Position LCD cursor to the beginning of line y.

Parameters
[in]yline (1 based)
void lcd_putc ( const char  c)

Write a char.

Parameters
[in]ccharacter to write
void lcd_putf ( float  f,
uint8_t  prec 
)

Write float with specified precision.

Parameters
[in]ffloat
[in]precNumber of decimals
void lcd_puti_lc ( const uint32_t  a,
uint8_t  r,
uint8_t  l,
char  c 
)

Write int in the specified radix r of minlen w prepended by char c.

Parameters
[in]aint
[in]rRadix
[in]lMin length
[in]cPrepending char
uint8_t lcd_puts ( const char *  s)

Write a string.

Parameters
[in]sZero terminated string
Returns
Number of chars written.
void lcd_putsn ( const char *  s,
uint8_t  n 
)

Write n chars of string.

Parameters
[in]sString (zeros are printed as spaces)
[in]nNumber of characters to write

Variable Documentation

uint8_t lcd_busw

Extern variable defined by "driver" specifying used LCD bus width (0 = 4 bit, 0x10 = 8 bit)

Actual LCD bus width = 4 bit