Sitronix ST7032 controlled AQM1602A character LCD module to I2C adapter http://mbed.org/users/okini3939/notebook/i2c-lcd-library/
I2CLCD.h
00001 /* 00002 * mbed library for I2C LCD 00003 * Copyright (c) 2011 Hiroshi Suga 00004 * Released under the MIT License: http://mbed.org/license/mit 00005 * 00006 * This product includes: 00007 * mbed TextLCD Library, for a 4-bit LCD based on HD44780 00008 * Copyright (c) 2007-2010, sford 00009 */ 00010 00011 /** @file I2CLCD.h 00012 * @brief I2C LCD library (mbed Phone Platform) 00013 */ 00014 00015 #ifndef I2CLCD_H 00016 #define I2CLCD_H 00017 00018 #include "mbed.h" 00019 00020 /** 00021 * @brief default I2C address 00022 */ 00023 #define I2CLCD_ADDR 0x7c 00024 00025 /** 00026 * @brief LCD type 00027 */ 00028 enum I2CLCDType { 00029 LCD8x2, 00030 LCD16x1, 00031 LCD16x2, 00032 LCD16x2B, 00033 LCD16x4, 00034 LCD20x2, 00035 LCD20x4 00036 }; 00037 00038 /** 00039 * @brief LCD config 00040 */ 00041 enum I2CLCDConfig { 00042 LCDCFG_ENABLE = 0x20, 00043 LCDCFG_PWMCOUNT = 0x10, 00044 LCDCFG_LED = 0x08, 00045 LCDCFG_3V = 0x04, 00046 LCDCFG_ADDR = 0x02, 00047 LCDCFG_INIT = 0x01 00048 }; 00049 00050 /** 00051 * @brief I2CLCD class 00052 */ 00053 class I2CLCD : public Stream { 00054 public: 00055 I2CLCD (PinName p_sda, PinName p_scl, int p_i2caddr = I2CLCD_ADDR, I2CLCDType p_type = LCD16x2, I2CLCDConfig p_config = LCDCFG_3V); 00056 I2CLCD (I2C& p_i2c, int p_i2caddr = I2CLCD_ADDR, I2CLCDType p_type = LCD16x2, I2CLCDConfig p_config = LCDCFG_3V); 00057 00058 void locate (int, int); 00059 void cls (); 00060 void lcd_cfg (I2CLCDConfig); 00061 00062 protected: 00063 virtual int _putc (int); 00064 virtual int _getc (); 00065 00066 int address (int, int); 00067 int rows (); 00068 int cols (); 00069 void init (int, I2CLCDType, I2CLCDConfig); 00070 void lcd_out (char, char); 00071 char lcd_in (char); 00072 00073 I2C i2c; 00074 int i2caddr; 00075 I2CLCDType type; 00076 int x, y; 00077 }; 00078 00079 #endif
Generated on Tue Jul 12 2022 11:49:48 by
1.7.2