SO1602A_i2c_oled
Fork of I2CLCD by
Diff: I2CLCD.h
- Revision:
- 2:bc4583ce560e
- Parent:
- 1:bf21aa3f7cdc
- Child:
- 3:61518c45ea07
diff -r bf21aa3f7cdc -r bc4583ce560e I2CLCD.h --- a/I2CLCD.h Tue Oct 19 07:08:54 2010 +0000 +++ b/I2CLCD.h Sun Feb 27 14:28:40 2011 +0000 @@ -1,18 +1,30 @@ /* * mbed library for I2C LCD - * Copyright (c) 2010 Hiroshi Suga + * Copyright (c) 2011 Hiroshi Suga * Released under the MIT License: http://mbed.org/license/mit * - * Using some of the source code: + * This product includes: * mbed TextLCD Library, for a 4-bit LCD based on HD44780 * Copyright (c) 2007-2010, sford */ + +/** @file I2CLCD.h + * @brief I2C LCD library (mbed Phone Platform) + */ #ifndef I2CLCD_H #define I2CLCD_H #include "mbed.h" +/** + * @brief default I2C address + */ +#define I2CLCD_ADDR 0x7c + +/** + * @brief LCD type + */ enum I2CLCDType { LCD8x2, LCD16x1, @@ -23,6 +35,9 @@ LCD20x4 }; +/** + * @brief LCD config + */ enum I2CLCDConfig { LCDCFG_ENABLE = 0x20, LCDCFG_PWMCOUNT = 0x10, @@ -32,10 +47,13 @@ LCDCFG_INIT = 0x01 }; +/** + * @brief I2CLCD class + */ class I2CLCD : public Stream { public: - I2CLCD (PinName p_sda, PinName p_scl, I2CLCDType p_type = LCD16x2, I2CLCDConfig p_config = LCDCFG_3V); - I2CLCD (I2C& p_i2c, I2CLCDType p_type = LCD16x2, I2CLCDConfig p_config = LCDCFG_3V); + I2CLCD (PinName p_sda, PinName p_scl, int p_i2caddr = I2CLCD_ADDR, I2CLCDType p_type = LCD16x2, I2CLCDConfig p_config = LCDCFG_3V); + I2CLCD (I2C& p_i2c, int p_i2caddr = I2CLCD_ADDR, I2CLCDType p_type = LCD16x2, I2CLCDConfig p_config = LCDCFG_3V); void locate (int, int); void cls (); @@ -48,11 +66,12 @@ int address (int, int); int rows (); int cols (); - void init (I2CLCDType, I2CLCDConfig); - void lcd_out (int, int); - int lcd_in (int); + void init (int, I2CLCDType, I2CLCDConfig); + void lcd_out (char, char); + char lcd_in (char); I2C i2c; + int i2caddr; I2CLCDType type; int x, y; };