00001 /* 00002 * File: lcd.h 00003 * Purpose: LCD handling functions header 00004 * Author: Peter Ivanov 00005 * Modified by: 00006 * Created: 2007-05-19 11:29:32 00007 * Last modify: 2007-10-14 18:19:01 ivanovp {Time-stamp} 00008 * Copyright: (C) Peter Ivanov, 2007 00009 * Licence: GPL 00010 */ 00011 /** 00012 * \file lcd.h 00013 * \brief LCD handling functions header 00014 * \author Peter Ivanov 00015 */ 00016 #ifndef __INCLUDE_LCD_H 00017 #define __INCLUDE_LCD_H 00018 00019 #include <msp430x44x.h> 00020 #include <msp430/basic_clock.h> 00021 #include <msp430/system_clock.h> 00022 #include <sys/types.h> 00023 #include "common.h" 00024 00025 #define LCD_PRINTF_BUF_SIZE (8) 00026 #define LCD_ARROW_UP (0x20) 00027 #define LCD_ARROW_DOWN (0x80) 00028 #define LCD_ARROW_RIGHT (0x40) 00029 #define LCD_ARROW_LEFT (0x10) 00030 #define LCD_ARROW_ALL (LCD_ARROW_UP + LCD_ARROW_DOWN + LCD_ARROW_LEFT + LCD_ARROW_RIGHT) 00031 00032 /// Pointer to access LCD memory 00033 extern char *LCD; 00034 00035 /** 00036 * Initializes LCD driver. 00037 * 00038 * @author Peter Ivanov, Muneem Shahriar 00039 */ 00040 void LCD_init (); 00041 00042 /** 00043 * Clear all segment of LCD. 00044 * 00045 * @author Peter Ivanov, Muneem Shahriar 00046 */ 00047 void LCD_clear (); 00048 00049 /** 00050 * Clear segments of clock on LCD (four digit at top-right). 00051 * 00052 * @author Peter Ivanov 00053 */ 00054 void LCD_clearClock (); 00055 00056 /** 00057 * Shows all segment of LCD. Useful for testing the LCD. 00058 * 00059 * @author Peter Ivanov, Muneem Shahriar 00060 */ 00061 void LCD_all (); 00062 00063 /** 00064 * Write an integer variable to clock part of LCD (four digit at top-right). 00065 * 00066 * @author Peter Ivanov 00067 * 00068 * Input: 00069 * @param value Integer value to display: 0..9999. 00070 * @param paddingZeroes Display zeroes if number of digits are less than 00071 * four. 00072 */ 00073 void LCD_writeClockInt (uint16_t value, bool_t paddingZeroes); 00074 00075 /** 00076 * Write a digit to clock part of LCD (four digit at top-right). 00077 * 00078 * @author Peter Ivanov 00079 * 00080 * Input: 00081 * @param position 0..3: 0 is the most right digit. 00082 * @param digit 0..9: digit to display. -1: clear digit. 00083 */ 00084 void LCD_writeClockDigit (uint8_t position, uint8_t digit); 00085 00086 /** 00087 * Shows or hides colon on clock part of LCD (four digit at top-right). 00088 * 00089 * @author Peter Ivanov 00090 * 00091 * Input: 00092 * @param on TRUE: switch on colon, FALSE: switch off colon. 00093 */ 00094 void LCD_setClockColon (bool_t on); 00095 00096 /** 00097 * Shows or hides dots on clock part of LCD (four digit at top-right). 00098 * 00099 * @author Peter Ivanov 00100 * 00101 * Input: 00102 * @param position 0..2: 0 is the dot at most right digit. 00103 * @param on TRUE: switch on dot, FALSE: switch off dot. 00104 */ 00105 void LCD_setClockDot (uint8_t position, bool_t on); 00106 00107 /** 00108 * Shows arrows. 00109 * 00110 * @author Peter Ivanov 00111 * 00112 * Input: 00113 * @param arrows Which arrow has to display: LCD_ARROW_UP | 00114 * LCD_ARROW_DOWN | LCD_ARROW_RIGHT | 00115 * LCD_ARROW_LEFT | LCD_ARROW_ALL. 00116 */ 00117 void LCD_showArrows (uint8_t arrows); 00118 00119 /** 00120 * Clear arrows. 00121 * 00122 * @author Peter Ivanov 00123 * 00124 * Input: 00125 * @param arrows Which arrow has to clear: LCD_ARROW_UP | 00126 * LCD_ARROW_DOWN | LCD_ARROW_RIGHT | 00127 * LCD_ARROW_LEFT | LCD_ARROW_ALL. 00128 */ 00129 void LCD_clearArrows (uint8_t arrows); 00130 00131 /** 00132 * Shows battery level. 00133 * 00134 * @author Peter Ivanov 00135 * 00136 * Input: 00137 * @param level Valid values are 0..3: 00138 * 0: Zero battery, 00139 * 1: Low battery, 00140 * 2: Medium battery, 00141 * 3: Full battery. 00142 */ 00143 void LCD_showBatteryLevel (uint8_t level); 00144 00145 /** 00146 * Shows or hides colon. 00147 * 00148 * @author Peter Ivanov 00149 * 00150 * Input: 00151 * @param position 0..5: 0 is the dot at most right digit. 00152 * @param on TRUE: switch on colon, FALSE: switch off colon. 00153 */ 00154 void LCD_setColon (uint8_t position, bool_t on); 00155 00156 /** 00157 * Write an integer variable to LCD. 00158 * 00159 * @author Peter Ivanov, Muneem Shahriar 00160 * 00161 * Input: 00162 * @param number Integer value to display: 0..9999999. 00163 */ 00164 void LCD_writeInt (int number); 00165 00166 /** 00167 * Write an alphanumeric character to LCD. 00168 * 00169 * @author Peter Ivanov, Muneem Shahriar 00170 * 00171 * Input: 00172 * @param position 0..5: 0 the most right digit. 00173 * @param letter Implemented characters: A-Z 0-9 . : , / \ 00174 */ 00175 void LCD_writeLetter (uint8_t position, char letter); 00176 00177 /** 00178 * Write a character buffer to LCD. 00179 * 00180 * @author Peter Ivanov 00181 * 00182 * Input: 00183 * @param buf Pointer to buffer. 00184 * @param length Length of buffer. 00185 */ 00186 void LCD_write (const char *buf, uint8_t length); 00187 00188 /** 00189 * Write a formatted string to LCD. 00190 * Example: 00191 <pre> 00192 LCD_printf ("I %02i", i); 00193 </pre> 00194 * 00195 * @author Peter Ivanov 00196 * 00197 * Input: 00198 * @param fmt Printf format string. e.g.: "I %02i" 00199 */ 00200 void LCD_printf (const char *fmt, ...); 00201 00202 #endif // __INCLUDE_LCD_H
1.5.1