Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

lcd.c File Reference

LCD routines. More...

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <inttypes.h>
#include "main/lcd.h"
#include "main/rom.h"
#include "delay.h"
#include "utils.h"

Go to the source code of this file.

Defines

#define WBF_MASTER   0x04
#define WBF_SLAVE   0x02
#define WBF_MODE_DATA   0x01
#define WBF_MODE_CMD   0x00
#define CMD_DISPLAY_ON   0x3f
#define CMD_DISPLAY_OFF   0x3e
#define CMD_SET_START   0xC0
#define CMD_SET_PAGE   0xB8
#define CMD_SET_COLUMN   0x40
#define send_cmd(a, b)   write_byte(a, b | WBF_MODE_CMD)
#define send_all_cmd(a)   send_cmd(a, WBF_MASTER | WBF_SLAVE)
#define RES_PORT   PORTC
#define RES_BIT   PC5
#define RS_PORT   PORTE
#define RS_BIT   PE3
#define RW_PORT   PORTE
#define RW_BIT   PE4
#define E_PORT   PORTE
#define E_BIT   PE5
#define CS1_PORT   PORTC
#define CS1_BIT   PC7
#define CS2_PORT   PORTC
#define CS2_BIT   PC6
#define LED_PORT   PORTD
#define LED_BIT   PD7

Functions

uint8_t lcd_str_width (uint8_t *text)
 Calculate string width in pixels.

void lcd_print (uint8_t x, uint8_t y, uint8_t inverted, char *text)
 Print string on display.

void lcd_v_line (uint8_t x, uint8_t y1, uint8_t y2)
 Draw a vertical line.

void lcd_h_line (uint8_t x1, uint8_t x2, uint8_t y)
 Draw a horizontal line.

void lcd_put_image (uint8_t x, uint8_t y, PGM_P image)
 Put an image on the display.

void lcd_clear_line (uint8_t x1, uint8_t x2, uint8_t y)
void lcd_clear (void)
void lcd_init (void)
void lcd_activate (void)
void lcd_deactivate (void)
void lcd_enable_backlight (void)
void lcd_disable_backlight (void)


Detailed Description

LCD routines.

This file contains basic low level routines to drive a lcd using the ks0108b segemtn driver.

Definition in file lcd.c.


Function Documentation

void lcd_activate void   ) 
 

Activate display.

Definition at line 351 of file lcd.c.

Referenced by main().

void lcd_clear void   ) 
 

Clear diplay.

Definition at line 320 of file lcd.c.

Referenced by lcd_init().

void lcd_clear_line uint8_t  x1,
uint8_t  x2,
uint8_t  y
 

Clear a part of a page.

Definition at line 296 of file lcd.c.

void lcd_deactivate void   ) 
 

Enter power save mode.

Definition at line 360 of file lcd.c.

void lcd_disable_backlight void   ) 
 

Switch backlight off.

Definition at line 377 of file lcd.c.

Referenced by INTERRUPT(), and main().

void lcd_enable_backlight void   ) 
 

Switch backlight on.

Definition at line 369 of file lcd.c.

Referenced by INTERRUPT().

void lcd_init void   ) 
 

Initialize lcd-display.

Definition at line 335 of file lcd.c.

References lcd_clear().

Referenced by main().

void lcd_print uint8_t  x,
uint8_t  y,
uint8_t  inverted,
char *  text
 

Print string on display.

Note:
The y coordinate is rounded to the next display page. ( y = {0,8,16,24,..} )

Definition at line 154 of file lcd.c.

void lcd_put_image uint8_t  x,
uint8_t  y,
PGM_P  image
 

Put an image on the display.

Note:
The y coordinate of the image must be a multiple of eight.

Definition at line 262 of file lcd.c.


Generated on Thu Oct 16 13:13:41 2003 for OpenHomeMainPanel by doxygen 1.3.3