lcd.h
Go to the documentation of this file.
1
11/*
12 * The contents of this file are subject to the Mozilla Public License
13 * Version 1.0 (the "License"); you may not use this file except in
14 * compliance with the License. You may obtain a copy of the License
15 * at http://www.mozilla.org/MPL/
16 *
17 * Software distributed under the License is distributed on an "AS IS"
18 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19 * the License for the specific language governing rights and
20 * limitations under the License.
21 *
22 * The Original Code is legOS code, released October 17, 1999.
23 *
24 * The Initial Developer of the Original Code is Markus L. Noga.
25 * Portions created by Markus L. Noga are Copyright (C) 1999
26 * Markus L. Noga. All Rights Reserved.
27 *
28 * Contributor(s): Markus L. Noga <markus@noga.de>
29 */
30
31#ifndef __rom_lcd_h__
32#define __rom_lcd_h__
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
39//
40// Definitions
41//
43
45
53typedef enum {
54 man_stand = 0x3006,
55 man_run = 0x3007,
56
57 s1_select = 0x3008,
58 s1_active = 0x3009,
59
60 s2_select = 0x300A,
61 s2_active = 0x300B,
62
63 s3_select = 0x300C,
64 s3_active = 0x300D,
65
66 a_select = 0x300E,
67 a_left = 0x300F,
68 a_right = 0x3010,
69
70 b_select = 0x3011,
71 b_left = 0x3012,
72 b_right = 0x3013,
73
74 c_select = 0x3014,
75 c_left = 0x3015,
76 c_right = 0x3016,
77
78 unknown_1 = 0x3017,
79
80 circle = 0x3018,
81
82 dot = 0x3019,
83 // dots are added on the right.
84 dot_inv = 0x301A,
85 // dots are removed on the left
86
87 battery_x = 0x301B,
88
89 ir_half = 0x301C,
90 ir_full = 0x301D,
91
92 everything= 0x3020
93
95
97
99typedef enum {
100 digit = 0x3017,
101 // works only with comma_style digit
102
103 sign = 0x3001,
104 unsign = 0x301F
105
107
109/*
110 */
111typedef enum {
112 digit_comma = 0x0000,
113 // works only with number_style digit
114
115 e0 = 0x3002,
116 e_1 = 0x3003,
117 e_2 = 0x3004,
118 e_3 = 0x3005,
119
120} lcd_comma_style; // lcd display comma style
121
123#define lcd_int(i) lcd_number(i,sign,e0)
124
126#define lcd_unsigned(u) lcd_number(u,unsign,e0)
127
129
131#define lcd_clock(t) lcd_number(t,unsign,e_2)
132
134#define lcd_digit(d) lcd_number(d,digit,digit_comma)
135
137//
138// Functions
139//
141
147#ifdef CXX
148#define ASMVOLATILE
149#else
150#define ASMVOLATILE __volatile__
151#endif
152
154
156extern inline void lcd_show(lcd_segment segment)
157{
159 "push r6\n"
160 "mov.w %0,r6\n"
161 "jsr @lcd_show\n"
162 "pop r6\n"
163 : // outputs
164 :"r"(segment) // inputs
165 );
166}
167
169
171extern inline void lcd_hide(lcd_segment segment)
172{
174 "push r6\n"
175 "mov.w %0,r6\n"
176 "jsr @lcd_hide\n"
177 "pop r6\n"
178 : // outputs
179 :"r"(segment) // inputs
180 );
181}
182
184
189
191extern inline void lcd_clear(void)
192{
194 "push r6\n"
195 "jsr @lcd_clear\n"
196 "pop r6\n"
197 );
198}
199
200#ifdef __cplusplus
201}
202#endif
203
204#endif // __rom_lcd_h__
__asm__("\n\ .text\n\ .globl _atomic_inc\n\ _atomic_inc:\n\ stc ccr, r1h ; save flags\n\ orc #0x80, ccr ; disable all but NMI\n\ mov.b @r0, r1l\n\ inc r1l\n\ mov.b r1l, @r0\n\ ldc r1h, ccr ; restore flags\n\ rts\n\ ")
void lcd_hide(lcd_segment segment)
hide LCD segment
Definition: lcd.h:171
lcd_number_style
LCD number display styles.
Definition: lcd.h:99
@ sign
signed, no leading zeros
Definition: lcd.h:103
@ unsign
unsigned, 0 displayed as 0000
Definition: lcd.h:104
@ digit
single digit on the right
Definition: lcd.h:100
lcd_segment
LCD segment codes.
Definition: lcd.h:53
@ s2_active
Definition: lcd.h:61
@ battery_x
Definition: lcd.h:87
@ circle
0..3 quarters: add one. 4 quarters: reset
Definition: lcd.h:80
@ a_select
Definition: lcd.h:66
@ b_select
Definition: lcd.h:70
@ s3_select
Definition: lcd.h:63
@ b_left
Definition: lcd.h:71
@ ir_half
Definition: lcd.h:89
@ man_stand
Definition: lcd.h:54
@ s2_select
Definition: lcd.h:60
@ b_right
Definition: lcd.h:72
@ dot
0..4 dots: add a dot. 5 dots: reset
Definition: lcd.h:82
@ c_right
Definition: lcd.h:76
@ c_select
Definition: lcd.h:74
@ a_left
Definition: lcd.h:67
@ unknown_1
seemingly without effect. cycle reset?
Definition: lcd.h:78
@ s1_select
Definition: lcd.h:57
@ man_run
Definition: lcd.h:55
@ s3_active
Definition: lcd.h:64
@ c_left
Definition: lcd.h:75
@ ir_full
the IR display values are mutually exclusive.
Definition: lcd.h:90
@ s1_active
Definition: lcd.h:58
@ everything
the IR display values are mutually exclusive.
Definition: lcd.h:92
@ a_right
Definition: lcd.h:68
@ dot_inv
0 dots: show 5. 1..4 dots: subtract one
Definition: lcd.h:84
#define ASMVOLATILE
Definition: lcd.h:150
void lcd_number(int i, lcd_number_style n, lcd_comma_style c)
show number on LCD display
lcd_comma_style
LCD comma display styles.
Definition: lcd.h:111
@ digit_comma
single digit on the right
Definition: lcd.h:112
@ e_2
100ths
Definition: lcd.h:117
@ e0
whole
Definition: lcd.h:115
@ e_1
10ths
Definition: lcd.h:116
@ e_3
1000ths, problematic with negatives
Definition: lcd.h:118
void lcd_clear(void)
clear LCD display
Definition: lcd.h:191
void lcd_show(lcd_segment segment)
show LCD segment
Definition: lcd.h:156

brickOS is released under the Mozilla Public License.
Original code copyright 1998-2005 by the authors.

Generated for brickOS Kernel Developer by doxygen 1.9.4