summaryrefslogtreecommitdiff
path: root/firmware/lcd.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-03-28 15:09:10 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-03-28 15:09:10 +0000
commitd9eb5c76032867f2f1f03d591c61c59be799fa7a (patch)
treef0adb17755cc95ddc908842b7d5ff63f5cd4db4e /firmware/lcd.c
parentcd0f122071947ea08edea827efe176413de07151 (diff)
downloadrockbox-d9eb5c76032867f2f1f03d591c61c59be799fa7a.tar.gz
rockbox-d9eb5c76032867f2f1f03d591c61c59be799fa7a.zip
First version
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@60 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/lcd.c')
-rw-r--r--firmware/lcd.c135
1 files changed, 135 insertions, 0 deletions
diff --git a/firmware/lcd.c b/firmware/lcd.c
new file mode 100644
index 0000000000..5563bbe881
--- /dev/null
+++ b/firmware/lcd.c
@@ -0,0 +1,135 @@
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#include "lcd.h"
21
22void lcd_data (int data)
23 { lcd_byte (data,1); }
24
25void lcd_instruction (int instruction)
26 { lcd_byte (instruction,0); }
27
28void lcd_zero (int length)
29 { length *= 8; while (--length >= 0) lcd_data (0); }
30
31void lcd_fill (int data,int length)
32 { length *= 8; while (--length >= 0) lcd_data (data); }
33
34void lcd_copy (void *data,int count)
35 { while (--count >= 0) lcd_data (*((char *)data)++); }
36
37
38#ifdef JBP
39# ifndef JBP_OLD
40
41static char const lcd_ascii[] =
42 {
43/*****************************************************************************************/
44/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
45/* ************************************************************************************/
46/* 0x */ 0x00,0x01,0x02,0x03,0x00,0x00,0x00,0x00,0x04,0x05,0x00,0x00,0x00,0x00,0x00,0x00,
47/* 1x */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
48/* 2x */ 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
49/* 3x */ 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
50/* 4x */ 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
51/* 5x */ 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
52/* 6x */ 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
53/* 7x */ 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x20,0x20,0x20,0x20,0x20,
54/* 8x */ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
55/* 9x */ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
56/* Ax */ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
57/* Bx */ 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
58/* Cx */ 0x41,0x41,0x41,0x41,0x41,0x41,0x20,0x43,0x45,0x45,0x45,0x45,0x49,0x49,0x49,0x49,
59/* Dx */ 0x44,0x4E,0x4F,0x4F,0x4F,0x4F,0x4F,0x20,0x20,0x55,0x55,0x55,0x55,0x59,0x20,0x20,
60/* Ex */ 0x61,0x61,0x61,0x61,0x61,0x61,0x20,0x63,0x65,0x65,0x65,0x65,0x69,0x69,0x69,0x69,
61/* Fx */ 0x64,0x6E,0x6F,0x6F,0x6F,0x6F,0x6F,0x20,0x20,0x75,0x75,0x75,0x75,0x79,0x79,0x79
62/******/
63 };
64
65# else
66
67static char const lcd_ascii[] =
68 {
69/*****************************************************************************************/
70/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
71/* ************************************************************************************/
72/* 0x */ 0x00,0x01,0x02,0x03,0x00,0x00,0x00,0x00,0x85,0x89,0x00,0x00,0x00,0x00,0x00,0x00,
73/* 1x */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
74/* 2x */ 0x24,0x25,0x26,0x37,0x06,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,
75/* 3x */ 0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,0x40,0x41,0x42,0x43,
76/* 4x */ 0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,
77/* 5x */ 0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0xA9,0x33,0xCE,0x00,0x15,
78/* 6x */ 0x00,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,
79/* 7x */ 0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x24,0x24,0x24,0x24,0x24,
80/* 8x */ 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
81/* 9x */ 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
82/* Ax */ 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
83/* Bx */ 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,
84/* Cx */ 0x45,0x45,0x45,0x45,0x45,0x45,0x24,0x47,0x49,0x49,0x49,0x49,0x4D,0x4D,0x4D,0x4D,
85/* Dx */ 0x48,0x52,0x53,0x53,0x53,0x53,0x53,0x24,0x24,0x59,0x59,0x59,0x59,0x5D,0x24,0x24,
86/* Ex */ 0x65,0x65,0x65,0x65,0x65,0x65,0x24,0x67,0x69,0x69,0x69,0x69,0x6D,0x6D,0x6D,0x6D,
87/* Fx */ 0x73,0x72,0x73,0x73,0x73,0x73,0x73,0x24,0x24,0x79,0x79,0x79,0x79,0x7D,0x24,0x7D
88/******/
89 };
90
91# endif
92
93void lcd_puts (char const *string)
94 {
95 while (*string)
96 lcd_data (LCD_ASCII(*string++));
97 }
98
99void lcd_putns (char const *string,int n)
100 {
101 while (n--)
102 lcd_data (LCD_ASCII(*string++));
103 }
104
105void lcd_putc (int character)
106 {
107 lcd_data (LCD_ASCII(character));
108 }
109
110void lcd_pattern (int which,char const *pattern,int count)
111 {
112 lcd_instruction (LCD_PRAM|which);
113 lcd_copy ((void *)pattern,count);
114 }
115
116#else
117# error "JBR : FIX ME"
118#endif
119
120void lcd_puthex (unsigned int value,int digits)
121 {
122 switch (digits)
123 {
124 case 8:
125 lcd_puthex (value >> 16,4);
126 case 4:
127 lcd_puthex (value >> 8,2);
128 case 2:
129 lcd_puthex (value >> 4,1);
130 case 1:
131 value &= 15;
132 lcd_putc (value+((value < 10) ? '0' : ('A'-10)));
133 }
134 }
135