Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

include/rom/lcd.h

Go to the documentation of this file.
00001 
00011 /*
00012  *  The contents of this file are subject to the Mozilla Public License
00013  *  Version 1.0 (the "License"); you may not use this file except in
00014  *  compliance with the License. You may obtain a copy of the License
00015  *  at http://www.mozilla.org/MPL/
00016  *
00017  *  Software distributed under the License is distributed on an "AS IS"
00018  *  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00019  *  the License for the specific language governing rights and
00020  *  limitations under the License.
00021  *
00022  *  The Original Code is legOS code, released October 17, 1999.
00023  *
00024  *  The Initial Developer of the Original Code is Markus L. Noga.
00025  *  Portions created by Markus L. Noga are Copyright (C) 1999
00026  *  Markus L. Noga. All Rights Reserved.
00027  *
00028  *  Contributor(s): Markus L. Noga <markus@noga.de>
00029  */
00030 
00031 #ifndef __rom_lcd_h__
00032 #define __rom_lcd_h__
00033 
00034 #ifdef  __cplusplus
00035 extern "C" {
00036 #endif
00037 
00039 //
00040 // Definitions
00041 //
00043 
00045 /*! these are not to be confused with the codes defined in direct-lcd.h
00046 
00047    circle and dot codes cycle. cycle state is preserved on powerdown.
00048 
00049    each dot code should be invoked six times before using the other.
00050    mixing them will result in strange behaviour.
00051 
00052  */
00053 typedef enum {
00054   man_stand = 0x3006,
00055   man_run   = 0x3007,
00056 
00057   s1_select = 0x3008,
00058   s1_active = 0x3009,
00059 
00060   s2_select = 0x300A,
00061   s2_active = 0x300B,
00062 
00063   s3_select = 0x300C,
00064   s3_active = 0x300D,
00065 
00066   a_select  = 0x300E,
00067   a_left    = 0x300F,
00068   a_right   = 0x3010,
00069 
00070   b_select  = 0x3011,
00071   b_left    = 0x3012,
00072   b_right   = 0x3013,
00073 
00074   c_select  = 0x3014,
00075   c_left    = 0x3015,
00076   c_right   = 0x3016,
00077 
00078   unknown_1 = 0x3017,           
00079 
00080   circle    = 0x3018,           
00081 
00082   dot       = 0x3019,           
00083                                 // dots are added on the right.
00084   dot_inv   = 0x301A,           
00085                                 // dots are removed on the left
00086 
00087   battery_x = 0x301B,
00088 
00089   ir_half   = 0x301C,           
00090   ir_full   = 0x301D,           
00091 
00092   everything= 0x3020
00093 
00094 } lcd_segment;
00095 
00097 
00099 typedef enum {
00100   digit  = 0x3017,              
00101                                 // works only with comma_style digit
00102 
00103   sign   = 0x3001,              
00104   unsign = 0x301F               
00105 
00106 } lcd_number_style;
00107 
00109 /*
00110  */
00111 typedef enum {
00112   digit_comma = 0x0000,         
00113                                 // works only with number_style digit
00114 
00115   e0  = 0x3002,                 
00116   e_1 = 0x3003,                 
00117   e_2 = 0x3004,                 
00118   e_3 = 0x3005,                 
00119 
00120 } lcd_comma_style;              // lcd display comma style
00121 
00123 #define lcd_int(i)      lcd_number(i,sign,e0)
00124 
00126 #define lcd_unsigned(u) lcd_number(u,unsign,e0)
00127 
00129 
00131 #define lcd_clock(t)    lcd_number(t,unsign,e_2)
00132 
00134 #define lcd_digit(d)    lcd_number(d,digit,digit_comma)
00135 
00137 //
00138 // Functions
00139 //
00141 
00147 #ifdef CXX
00148 #define ASMVOLATILE
00149 #else
00150 #define ASMVOLATILE __volatile__
00151 #endif
00152 
00154 
00156 extern inline void lcd_show(lcd_segment segment)
00157 {
00158   __asm__ ASMVOLATILE(
00159                        "push r6\n"
00160                        "mov.w %0,r6\n"
00161                        "jsr @lcd_show\n"
00162                        "pop r6\n"
00163                        :        // outputs
00164                        :"r"(segment)    // inputs
00165   );
00166 }
00167 
00169 
00171 extern inline void lcd_hide(lcd_segment segment)
00172 {
00173   __asm__ ASMVOLATILE(
00174                        "push r6\n"
00175                        "mov.w %0,r6\n"
00176                        "jsr @lcd_hide\n"
00177                        "pop r6\n"
00178                        :        // outputs
00179                        :"r"(segment)    // inputs
00180   );
00181 }
00182 
00184 
00188 extern void lcd_number(int i, lcd_number_style n, lcd_comma_style c);
00189 
00191 extern inline void lcd_clear(void)
00192 {
00193   __asm__ ASMVOLATILE(
00194                        "push r6\n"
00195                        "jsr @lcd_clear\n"
00196                        "pop r6\n"
00197   );
00198 }
00199 
00200 #ifdef  __cplusplus
00201 }
00202 #endif
00203 
00204 #endif // __rom_lcd_h__

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

Generated on Tue Dec 10 00:09:05 2002 for brickOS C++ by doxygen 1.2.15