SO1602A_i2c_oled
Fork of I2CLCD by
Embed:
(wiki syntax)
Show/hide line numbers
I2CLCD.h
Go to the documentation of this file.
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 #define I2CLCD_ADDR 0x78 //SO1602AWWB 00026 00027 /** 00028 * @brief LCD type 00029 */ 00030 enum I2CLCDType { 00031 LCD8x2, 00032 LCD16x1, 00033 LCD16x2, 00034 LCD16x2B, 00035 LCD16x4, 00036 LCD20x2, 00037 LCD20x4 00038 }; 00039 00040 /** 00041 * @brief LCD config 00042 */ 00043 enum I2CLCDConfig { 00044 LCDCFG_ENABLE = 0x20, 00045 LCDCFG_PWMCOUNT = 0x10, 00046 LCDCFG_LED = 0x08, 00047 LCDCFG_3V = 0x04, 00048 LCDCFG_ADDR = 0x02, 00049 LCDCFG_INIT = 0x01 00050 }; 00051 00052 /** 00053 * @brief I2CLCD class 00054 */ 00055 class I2CLCD : public Stream { 00056 public: 00057 I2CLCD (PinName p_sda, PinName p_scl, int p_i2caddr = I2CLCD_ADDR, I2CLCDType p_type = LCD16x2, I2CLCDConfig p_config = LCDCFG_3V); 00058 I2CLCD (I2C& p_i2c, int p_i2caddr = I2CLCD_ADDR, I2CLCDType p_type = LCD16x2, I2CLCDConfig p_config = LCDCFG_3V); 00059 00060 void locate (int, int); 00061 void cls (); 00062 void lcd_cfg (I2CLCDConfig); 00063 00064 protected: 00065 virtual int _putc (int); 00066 virtual int _getc (); 00067 00068 int address (int, int); 00069 int rows (); 00070 int cols (); 00071 void init (int, I2CLCDType, I2CLCDConfig); 00072 void lcd_out (char, char); 00073 char lcd_in (char); 00074 00075 I2C i2c; 00076 int i2caddr; 00077 I2CLCDType type; 00078 int x, y; 00079 }; 00080 00081 #endif
Generated on Tue Jul 19 2022 15:04:36 by 1.7.2