summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd.h')
-rw-r--r--firmware/drivers/lcd.h162
1 files changed, 162 insertions, 0 deletions
diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h
new file mode 100644
index 0000000000..dcfa1d587e
--- /dev/null
+++ b/firmware/drivers/lcd.h
@@ -0,0 +1,162 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Alan Korr
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef __LCD_H__
21#define __LCD_H__
22
23#include "sh7034.h"
24#include "types.h"
25#include "config.h"
26
27#define LCDR (PBDR+1)
28
29/* PA14 : /LCD-BL --- backlight */
30#define LCD_BL (14-8)
31
32#ifdef HAVE_LCD_CHARCELLS
33 /* JukeBox MP3 Player - AJB6K, AJBS20 */
34# define LCD_DS +1 // PB0 = 1 --- 0001 --- LCD-DS
35# define LCD_CS +2 // PB1 = 1 --- 0010 --- /LCD-CS
36# define LCD_SD +4 // PB2 = 1 --- 0100 --- LCD-SD
37# define LCD_SC +8 // PB3 = 1 --- 1000 --- LCD-SC
38# ifndef JBP_OLD
39# define LCD_CONTRAST_SET ((char)0x50)
40# define LCD_CRAM ((char)0x80) /* Characters */
41# define LCD_PRAM ((char)0xC0) /* Patterns */
42# define LCD_IRAM ((char)0x40) /* Icons */
43# else
44# define LCD_CONTRAST_SET ((char)0xA8)
45# define LCD_CRAM ((char)0xB0) /* Characters */
46# define LCD_PRAM ((char)0x80) /* Patterns */
47# define LCD_IRAM ((char)0xE0) /* Icons */
48# endif
49# define LCD_ASCII(c) (lcd_ascii[(c)&255])
50# define LCD_CURSOR(x,y) ((char)(LCD_CRAM+((y)*16+(x))))
51# define LCD_ICON(i) ((char)(LCD_IRAM+i))
52# define LCD_ICON_BATTERY 0
53# define LCD_BATTERY_FRAME 0x02
54# define LCD_BATTERY_BAR1 0x08
55# define LCD_BATTERY_BAR2 0x04
56# define LCD_BATTERY_BAR3 0x10
57# define LCD_ICON_USB 2
58# define LCD_USB_LOGO 0xFF
59# define LCD_ICON_PLAY 3
60# define LCD_PLAY_ICON 0xFF
61# define LCD_ICON_RECORD 4
62# define LCD_RECORD_ICON 0x10
63# define LCD_ICON_STOP 5
64# define LCD_STOP_ICON 0x0F
65# define LCD_ICON_AUDIO 5
66# define LCD_AUDIO_ICON 0xF0
67# define LCD_ICON_REVERSE 6
68# define LCD_REVERSE_ICON 0xFF
69# define LCD_ICON_SINGLE 7
70# define LCD_SINGLE_ICON 0xFF
71# define LCD_ICON_VOLUME0 9
72# define LCD_VOLUME_ICON 0x04
73# define LCD_VOLUME_BAR1 0x02
74# define LCD_VOLUME_BAR2 0x01
75# define LCD_ICON_VOLUME1 10
76# define LCD_VOLUME_BAR3 0x08
77# define LCD_VOLUME_BAR4 0x04
78# define LCD_VOLUME_BAR5 0x01
79# define LCD_ICON_PARAM 10
80# define LCD_PARAM_SYMBOL 0xF0
81#endif
82
83#ifdef HAVE_LCD_BITMAP
84/* JukeBox MP3 Recorder - AJBR --- FIXME */
85
86/* Defines from Alan on IRC, April 11th 2002 */
87#define LCD_SD +1 // PB0 = 1 --- 0001
88#define LCD_SC +2 // PB1 = 1 --- 0010
89#define LCD_RS +4 // PB2 = 1 --- 0100
90#define LCD_CS +8 // PB3 = 1 --- 1000
91
92#define LCD_DS LCD_RS
93
94#define LCD_SET_LOWER_COLUMN_ADDRESS ((char)0x00)
95#define LCD_SET_HIGHER_COLUMN_ADDRESS ((char)0x10)
96#define LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO ((char)0x20)
97#define LCD_SET_POWER_CONTROL_REGISTER ((char)0x28)
98#define LCD_SET_DISPLAY_START_LINE ((char)0x40)
99#define LCD_SET_CONTRAST_CONTROL_REGISTER ((char)0x81)
100#define LCD_SET_SEGMENT_REMAP ((char)0xA0)
101#define LCD_SET_LCD_BIAS ((char)0xA2)
102#define LCD_SET_ENTIRE_DISPLAY_OFF ((char)0xA4)
103#define LCD_SET_ENTIRE_DISPLAY_ON ((char)0xA5)
104#define LCD_SET_NORMAL_DISPLAY ((char)0xA6)
105#define LCD_SET_REVERSE_DISPLAY ((char)0xA7)
106#define LCD_SET_INDICATOR_OFF ((char)0xAC)
107#define LCD_SET_INDICATOR_ON ((char)0xAD)
108#define LCD_SET_DISPLAY_OFF ((char)0xAE)
109#define LCD_SET_DISPLAY_ON ((char)0xAF)
110#define LCD_SET_PAGE_ADDRESS ((char)0xB0)
111#define LCD_SET_COM_OUTPUT_SCAN_DIRECTION ((char)0xC0)
112#define LCD_SET_DISPLAY_OFFSET ((char)0xD3)
113#define LCD_SET_READ_MODIFY_WRITE_MODE ((char)0xE0)
114#define LCD_SOFTWARE_RESET ((char)0xE2)
115#define LCD_NOP ((char)0xE3)
116#define LCD_SET_END_OF_READ_MODIFY_WRITE_MODE ((char)0xEE)
117
118
119#define DISP_X 112
120#define DISP_Y 64
121
122#define LCD_WIDTH DISP_X /* Display width in pixels */
123#define LCD_HEIGHT DISP_Y /* Display height in pixels */
124
125void lcd_init (void);
126void lcd_update (void);
127void lcd_clear_display (void);
128void lcd_position (int x, int y, int size);
129void lcd_string (const char *str);
130void lcd_bitmap (const unsigned char *src, int x, int y, int nx, int ny,
131 bool clear);
132void lcd_clearrect (int x, int y, int nx, int ny);
133void lcd_fillrect (int x, int y, int nx, int ny);
134void lcd_invertrect (int x, int y, int nx, int ny);
135void lcd_drawline( int x1, int y1, int x2, int y2 );
136void lcd_drawpixel(int x, int y);
137void lcd_clearpixel(int x, int y);
138#endif
139
140
141#ifndef SIMULATOR
142
143extern void lcd_data (int data);
144extern void lcd_instruction (int instruction);
145extern void lcd_zero (int length);
146extern void lcd_fill (int data,int length);
147extern void lcd_copy (void *data,int count);
148
149#ifdef HAVE_LCD_CHARCELLS
150
151extern void lcd_puts (char const *string);
152extern void lcd_putns (char const *string,int n);
153extern void lcd_putc (int character);
154extern void lcd_puthex (unsigned int value,int digits);
155
156extern void lcd_pattern (int which,char const *pattern,int count);
157
158#endif /* HAVE_LCD_CHARCELLS */
159
160#endif /* SIMULATOR */
161
162#endif /* __LCD_H__ */