Sitronix ST7032 controlled AQM1602A character LCD module to I2C adapter http://mbed.org/users/okini3939/notebook/i2c-lcd-library/

Committer:
okini3939
Date:
Thu Oct 14 14:45:30 2010 +0000
Revision:
0:b069b7027af2
Child:
1:bf21aa3f7cdc

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 0:b069b7027af2 1 /*
okini3939 0:b069b7027af2 2 * mbed library to use a I2C LCD
okini3939 0:b069b7027af2 3 * Copyright (c) 2010 Hiroshi Suga
okini3939 0:b069b7027af2 4 * Released under the MIT License: http://mbed.org/license/mit
okini3939 0:b069b7027af2 5 */
okini3939 0:b069b7027af2 6
okini3939 0:b069b7027af2 7 #ifndef I2CLCD_H
okini3939 0:b069b7027af2 8 #define I2CLCD_H
okini3939 0:b069b7027af2 9
okini3939 0:b069b7027af2 10 #include "mbed.h"
okini3939 0:b069b7027af2 11
okini3939 0:b069b7027af2 12 enum I2CLCDType {
okini3939 0:b069b7027af2 13 LCD8x2,
okini3939 0:b069b7027af2 14 LCD16x1,
okini3939 0:b069b7027af2 15 LCD16x2,
okini3939 0:b069b7027af2 16 LCD16x2B,
okini3939 0:b069b7027af2 17 LCD16x4,
okini3939 0:b069b7027af2 18 LCD20x2,
okini3939 0:b069b7027af2 19 LCD20x4
okini3939 0:b069b7027af2 20 };
okini3939 0:b069b7027af2 21
okini3939 0:b069b7027af2 22 enum I2CLCDConfig {
okini3939 0:b069b7027af2 23 LCDCFG_ENABLE = 0x20,
okini3939 0:b069b7027af2 24 LCDCFG_PWMCOUNT = 0x10,
okini3939 0:b069b7027af2 25 LCDCFG_LED = 0x08,
okini3939 0:b069b7027af2 26 LCDCFG_3V = 0x04,
okini3939 0:b069b7027af2 27 LCDCFG_ADDR = 0x02,
okini3939 0:b069b7027af2 28 LCDCFG_INIT = 0x01
okini3939 0:b069b7027af2 29 };
okini3939 0:b069b7027af2 30
okini3939 0:b069b7027af2 31 class I2CLCD : public Stream {
okini3939 0:b069b7027af2 32 public:
okini3939 0:b069b7027af2 33 I2CLCD (PinName p_sda, PinName p_scl, I2CLCDType p_type = LCD16x2, I2CLCDConfig p_config = LCDCFG_3V);
okini3939 0:b069b7027af2 34 I2CLCD (I2C& p_i2c, I2CLCDType p_type = LCD16x2, I2CLCDConfig p_config = LCDCFG_3V);
okini3939 0:b069b7027af2 35
okini3939 0:b069b7027af2 36 void locate (int, int);
okini3939 0:b069b7027af2 37 void cls ();
okini3939 0:b069b7027af2 38 void lcd_cfg (I2CLCDConfig);
okini3939 0:b069b7027af2 39
okini3939 0:b069b7027af2 40 protected:
okini3939 0:b069b7027af2 41 virtual int _putc (int);
okini3939 0:b069b7027af2 42 virtual int _getc ();
okini3939 0:b069b7027af2 43
okini3939 0:b069b7027af2 44 int address (int, int);
okini3939 0:b069b7027af2 45 int rows ();
okini3939 0:b069b7027af2 46 int cols ();
okini3939 0:b069b7027af2 47 void init (I2CLCDType, I2CLCDConfig);
okini3939 0:b069b7027af2 48 void lcd_out (int, int);
okini3939 0:b069b7027af2 49 int lcd_in (int);
okini3939 0:b069b7027af2 50
okini3939 0:b069b7027af2 51 I2C i2c;
okini3939 0:b069b7027af2 52 I2CLCDType type;
okini3939 0:b069b7027af2 53 int x, y;
okini3939 0:b069b7027af2 54 };
okini3939 0:b069b7027af2 55
okini3939 0:b069b7027af2 56 #endif