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
35 extern "C" {
36 #endif
37 
39 //
40 // Definitions
41 //
43 
45 
53 typedef 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 
94 } lcd_segment;
95 
97 
99 typedef enum {
100  digit = 0x3017,
101  // works only with comma_style digit
102 
103  sign = 0x3001,
104  unsign = 0x301F
105 
107 
109 /*
110  */
111 typedef 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 
156 extern inline void lcd_show(lcd_segment segment)
157 {
158  __asm__ ASMVOLATILE(
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 
171 extern inline void lcd_hide(lcd_segment segment)
172 {
173  __asm__ ASMVOLATILE(
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 
188 extern void lcd_number(int i, lcd_number_style n, lcd_comma_style c);
189 
191 extern inline void lcd_clear(void)
192 {
193  __asm__ ASMVOLATILE(
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__
Definition: lcd.h:61
signed, no leading zeros
Definition: lcd.h:103
Definition: lcd.h:71
seemingly without effect. cycle reset?
Definition: lcd.h:78
unsigned, 0 displayed as 0000
Definition: lcd.h:104
0..4 dots: add a dot. 5 dots: reset
Definition: lcd.h:82
Definition: lcd.h:72
Definition: lcd.h:89
Definition: lcd.h:76
Definition: lcd.h:75
0..3 quarters: add one. 4 quarters: reset
Definition: lcd.h:80
Definition: lcd.h:55
void lcd_number(int i, lcd_number_style n, lcd_comma_style c)
show number on LCD display
Definition: lcd.h:64
Definition: lcd.h:60
#define ASMVOLATILE
Definition: lcd.h:150
Definition: lcd.h:74
the IR display values are mutually exclusive.
Definition: lcd.h:90
void lcd_show(lcd_segment segment)
show LCD segment
Definition: lcd.h:156
void lcd_clear(void)
clear LCD display
Definition: lcd.h:191
10ths
Definition: lcd.h:116
void lcd_hide(lcd_segment segment)
hide LCD segment
Definition: lcd.h:171
Definition: lcd.h:87
Definition: lcd.h:66
1000ths, problematic with negatives
Definition: lcd.h:118
100ths
Definition: lcd.h:117
lcd_segment
LCD segment codes.
Definition: lcd.h:53
lcd_number_style
LCD number display styles.
Definition: lcd.h:99
Definition: lcd.h:57
Definition: lcd.h:54
lcd_comma_style
LCD comma display styles.
Definition: lcd.h:111
single digit on the right
Definition: lcd.h:112
Definition: lcd.h:63
0 dots: show 5. 1..4 dots: subtract one
Definition: lcd.h:84
single digit on the right
Definition: lcd.h:100
Definition: lcd.h:70
Definition: lcd.h:58
Definition: lcd.h:67
the IR display values are mutually exclusive.
Definition: lcd.h:92
whole
Definition: lcd.h:115
Definition: lcd.h:68

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

Generated for brickOS C++ by doxygen 1.8.11