lcd_32122a_avr.c File Reference

Displaytech 32122A LCD driver. More...

#include "lcd_32122a_avr.h"
#include <gfx/gfx.h>
#include <drv/timer.h>
#include <cpu/irq.h>
#include <cpu/types.h>
#include <hw.h>
#include <cfg/macros.h>
#include <cfg/debug.h>
#include <avr/io.h>
#include <stdbool.h>
#include <inttypes.h>

Go to the source code of this file.


Defines

#define LCD_PAGES   4
 Number of LCD pages.
#define LCD_PAGESIZE   (LCD_WIDTH / 2)
 Width of an LCD page.
#define LCD_READ
 Read from the LCD data bus (DB[0-7]).
#define LCD_WRITE(d)
 Write to the LCD data bus (DB[0-7]).
#define LCD_DB_OUT
 Set data bus direction to output (write to display).
#define LCD_DB_IN
 Set data bus direction to input (read from display).
#define LCD_DELAY_WRITE
 Delay for tEW (160ns).
#define LCD_DELAY_READ
 Delay for tACC6 (180ns).
LCD I/O pins/ports
#define LCD_PF_DB0   PF4
#define LCD_PF_DB1   PF5
#define LCD_PF_DB2   PF6
#define LCD_PF_DB3   PF7
#define LCD_PD_DB4   PD4
#define LCD_PD_DB5   PD5
#define LCD_PD_DB6   PD6
#define LCD_PD_DB7   PD7
#define LCD_PB_A0   PB0
#define LCD_PE_RW   PE7
#define LCD_PE_E1   PE2
#define LCD_PE_E2   PE6
DB high nibble (DB[4-7])
#define LCD_DATA_HI_PORT   PORTD
#define LCD_DATA_HI_PIN   PIND
#define LCD_DATA_HI_DDR   DDRD
#define LCD_DATA_HI_SHIFT   0
#define LCD_DATA_HI_MASK   0xF0
DB low nibble (DB[0-3])
#define LCD_DATA_LO_PORT   PORTF
#define LCD_DATA_LO_PIN   PINF
#define LCD_DATA_LO_DDR   DDRF
#define LCD_DATA_LO_SHIFT   4
#define LCD_DATA_LO_MASK   0xF0
LCD bus control macros
#define LCD_CLR_A0   (PORTB &= ~BV(LCD_PB_A0))
#define LCD_SET_A0   (PORTB |= BV(LCD_PB_A0))
#define LCD_CLR_RD   (PORTE &= ~BV(LCD_PE_RW))
#define LCD_SET_RD   (PORTE |= BV(LCD_PE_RW))
#define LCD_CLR_E1   (PORTE &= ~BV(LCD_PE_E1))
#define LCD_SET_E1   (PORTE |= BV(LCD_PE_E1))
#define LCD_CLR_E2   (PORTE &= ~BV(LCD_PE_E2))
#define LCD_SET_E2   (PORTE |= BV(LCD_PE_E2))
#define LCD_SET_E(x)   (PORTE |= (x))
#define LCD_CLR_E(x)   (PORTE &= ~(x))
Chip select bits for LCD_SET_E()
#define LCDF_E1   (BV(LCD_PE_E1))
#define LCDF_E2   (BV(LCD_PE_E2))
32122A Commands
#define LCD_CMD_DISPLAY_ON   0xAF
#define LCD_CMD_DISPLAY_OFF   0xAE
#define LCD_CMD_STARTLINE   0xC0
#define LCD_CMD_PAGEADDR   0xB8
#define LCD_CMD_COLADDR   0x00
#define LCD_CMD_ADC_LEFT   0xA1
#define LCD_CMD_ADC_RIGHT   0xA0
#define LCD_CMD_STATIC_OFF   0xA4
#define LCD_CMD_STATIC_ON   0xA5
#define LCD_CMD_DUTY_32   0xA9
#define LCD_CMD_DUTY_16   0xA8
#define LCD_CMD_RMW_ON   0xE0
#define LCD_CMD_RMW_OFF   0xEE
#define LCD_CMD_RESET   0xE2

Functions

static uint8_t lcd_read (uint8_t chip)
static void lcd_write (uint8_t c, uint8_t chip)
void lcd_setPwm (int duty)
 Set LCD contrast PWM.
void lcd_blitBitmap (Bitmap *bm)
 Update the LCD display with data from the provided bitmap.
void lcd_init (void)
 Initialize LCD subsystem.

Variables

static uint8_t lcd_raster [RAST_SIZE(LCD_WIDTH, LCD_HEIGHT)]
 Raster buffer to draw into.
struct Bitmap lcd_bitmap
 Default LCD bitmap.

Detailed Description

Displaytech 32122A LCD driver.

Version:
Id
lcd_32122a_avr.c 1126 2008-02-18 15:29:39Z bernie

Author:
Bernardo Innocenti <bernie@develer.com>

Stefano Fedrigo <aleph@develer.com>

Definition in file lcd_32122a_avr.c.


Function Documentation

void lcd_init ( void   ) 

Initialize LCD subsystem.

Note:
The PWM used for LCD contrast is initialized in drv/pwm.c because it is the same PWM used for output attenuation.

Definition at line 459 of file lcd_32122a_avr.c.

static uint8_t lcd_read ( uint8_t  chip  )  [inline, static]

      __________________
 A0   __/            \__
         ____________
 R/W  __/            \__
            _______
 E1   _____/       \____

 DATA -------<=====>----

Definition at line 318 of file lcd_32122a_avr.c.

static void lcd_write ( uint8_t  c,
uint8_t  chip 
) [inline, static]

      __________________
 A0   ___/          \___

 R/W  __________________
            ______
 E1   _____/      \_____

 DATA -<==============>-

Definition at line 352 of file lcd_32122a_avr.c.


Variable Documentation

uint8_t lcd_raster[RAST_SIZE(LCD_WIDTH, LCD_HEIGHT)] [static]

Raster buffer to draw into.

Bits in the bitmap bytes have vertical orientation, as required by the LCD driver.

Definition at line 256 of file lcd_32122a_avr.c.