From a1a2d9ebcc1a37ae30fc16e00f5df027b40b9b7d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 11 Apr 2002 12:35:54 +0000 Subject: [PATCH] Updated a lot. Uses the new config #defines for hardware features Allows SIMULATOR Now contains defines for the bitmap LCD display Most of this came from Alan and Gary, kudos! git-svn-id: svn://svn.rockbox.org/rockbox/trunk@74 a1c6a512-1295-4272-9138-f99709370657 --- firmware/lcd.h | 74 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 10 deletions(-) diff --git a/firmware/lcd.h b/firmware/lcd.h index 03c459c303..449adba57d 100644 --- a/firmware/lcd.h +++ b/firmware/lcd.h @@ -20,15 +20,17 @@ #ifndef __LCD_H__ #define __LCD_H__ -#include -#include +#include "sh7034.h" +#include "system.h" +#include "types.h" #define LCDR (PBDR+1) /* PA14 : /LCD-BL --- backlight */ #define LCD_BL (14-8) -#ifdef JBP /* JukeBox MP3 Player - AJB6K, AJBS20 */ +#ifdef HAVE_LCD_CHARCELLS + /* JukeBox MP3 Player - AJB6K, AJBS20 */ # define LCD_DS +1 // PB0 = 1 --- 0001 --- LCD-DS # define LCD_CS +2 // PB1 = 1 --- 0010 --- /LCD-CS # define LCD_SD +4 // PB2 = 1 --- 0100 --- LCD-SD @@ -78,11 +80,63 @@ # define LCD_PARAM_SYMBOL 0xF0 #endif -#ifdef JBR /* JukeBox MP3 Recorder - AJBR --- FIXME */ -# error "JBR : FIX ME" +#ifdef HAVE_LCD_BITMAP +/* JukeBox MP3 Recorder - AJBR --- FIXME */ + +/* Defines from Alan on IRC, April 11th 2002 */ +#define LCD_SD +1 // PB0 = 1 --- 0001 +#define LCD_SC +2 // PB1 = 1 --- 0010 +#define LCD_RS +4 // PB2 = 1 --- 0100 +#define LCD_CS +8 // PB3 = 1 --- 1000 + +#define LCD_DS LCD_RS + +#define LCD_SET_LOWER_COLUMN_ADDRESS ((char)0x00) +#define LCD_SET_HIGHER_COLUMN_ADDRESS ((char)0x10) +#define LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO ((char)0x20) +#define LCD_SET_POWER_CONTROL_REGISTER ((char)0x28) +#define LCD_SET_DISPLAY_START_LINE ((char)0x40) +#define LCD_SET_CONTRAST_CONTROL_REGISTER ((char)0x81) +#define LCD_SET_SEGMENT_REMAP ((char)0xA0) +#define LCD_SET_LCD_BIAS ((char)0xA2) +#define LCD_SET_ENTIRE_DISPLAY_OFF ((char)0xA4) +#define LCD_SET_ENTIRE_DISPLAY_ON ((char)0xA5) +#define LCD_SET_NORMAL_DISPLAY ((char)0xA6) +#define LCD_SET_REVERSE_DISPLAY ((char)0xA7) +#define LCD_SET_INDICATOR_OFF ((char)0xAC) +#define LCD_SET_INDICATOR_ON ((char)0xAD) +#define LCD_SET_DISPLAY_OFF ((char)0xAE) +#define LCD_SET_DISPLAY_ON ((char)0xAF) +#define LCD_SET_PAGE_ADDRESS ((char)0xB0) +#define LCD_SET_COM_OUTPUT_SCAN_DIRECTION ((char)0xC0) +#define LCD_SET_DISPLAY_OFFSET ((char)0xD3) +#define LCD_SET_READ_MODIFY_WRITE_MODE ((char)0xE0) +#define LCD_SOFTWARE_RESET ((char)0xE2) +#define LCD_NOP ((char)0xE3) +#define LCD_SET_END_OF_READ_MODIFY_WRITE_MODE ((char)0xEE) + + +#define DISP_X 112 +#define DISP_Y 64 + +#define LCD_WIDTH DISP_X /* Display width in pixels */ +#define LCD_HEIGHT DISP_Y /* Display height in pixels */ + +void lcd_init (void); +void lcd_update (void); +void lcd_clear_display (void); +void lcd_position (int x, int y, int size); +void lcd_string (const char *str); +void lcd_bitmap (const unsigned char *src, int x, int y, int nx, int ny, + bool clear); +void lcd_clearrect (int x, int y, int nx, int ny); +void lcd_fillrect (int x, int y, int nx, int ny); +void lcd_invertrect (int x, int y, int nx, int ny); + #endif +#ifndef SIMULATOR /* * About /CS,DS,SC,SD * ------------------ @@ -222,6 +276,10 @@ static inline void lcd_byte (int byte,int rs) /* %4 */ "I"(LCD_SC), /* %5 */ "z"(LCDR)); } +#else +/* make a faked lcd_byte() function when simulating */ +#define lcd_byte(x,y) +#endif /* SIMULATOR */ extern void lcd_data (int data); extern void lcd_instruction (int instruction); @@ -229,7 +287,7 @@ extern void lcd_zero (int length); extern void lcd_fill (int data,int length); extern void lcd_copy (void *data,int count); -#ifdef JBP +#ifdef HAVE_LCD_CHARCELLS extern void lcd_puts (char const *string); extern void lcd_putns (char const *string,int n); @@ -243,10 +301,6 @@ static inline void lcd_goto (int x,int y) #endif -#ifdef JBR -# error "JBR : FIX ME" -#endif - /*** BACKLIGHT ***/ static inline void lcd_toggle_backlight (void)