Simple libary for AQM1602XA I2C Character LCD.

Committer:
takashiyamanoue
Date:
Tue Jun 02 01:39:26 2020 +0000
Revision:
1:4fca021edef0
Parent:
0:933748ca1307
20200602 aqm1602xa

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kazz12211 0:933748ca1307 1 /**
kazz12211 0:933748ca1307 2 * Simple class to handle I2C 16 chars x 2 rows Character LCD
kazz12211 0:933748ca1307 3 * By K. Tsubaki
kazz12211 0:933748ca1307 4 * Date: 2016/04/24
kazz12211 0:933748ca1307 5 * Tested with: mbed LPC1114
kazz12211 0:933748ca1307 6 * Usage:
kazz12211 0:933748ca1307 7 * mbed <---> LCD
kazz12211 0:933748ca1307 8 * dp5 <---> SDA
kazz12211 0:933748ca1307 9 * dp27 <---> SCL
kazz12211 0:933748ca1307 10 * VIN <---> +V
kazz12211 0:933748ca1307 11 * GND <---> GND
kazz12211 0:933748ca1307 12 **/
kazz12211 0:933748ca1307 13 #ifndef __AQM1602XA__
kazz12211 0:933748ca1307 14
kazz12211 0:933748ca1307 15 #include "mbed.h"
kazz12211 0:933748ca1307 16
kazz12211 0:933748ca1307 17 #define AQM1602XA_ADDR (0x3E << 1)
kazz12211 0:933748ca1307 18
kazz12211 0:933748ca1307 19 class AQM1602XA {
kazz12211 0:933748ca1307 20 private:
kazz12211 0:933748ca1307 21 I2C wire;
kazz12211 0:933748ca1307 22 char address;
kazz12211 0:933748ca1307 23
kazz12211 0:933748ca1307 24 void initialize(void);
takashiyamanoue 1:4fca021edef0 25 // void writeCommand(char cmd);
takashiyamanoue 1:4fca021edef0 26 // void writeData(char data);
kazz12211 0:933748ca1307 27 public:
kazz12211 0:933748ca1307 28 /**
kazz12211 0:933748ca1307 29 * Constructor - default device address is 0x3E
kazz12211 0:933748ca1307 30 **/
kazz12211 0:933748ca1307 31 AQM1602XA(PinName sda, PinName scl, char slave_adr = AQM1602XA_ADDR);
kazz12211 0:933748ca1307 32 /**
kazz12211 0:933748ca1307 33 * print characters on the LCD
kazz12211 0:933748ca1307 34 * params: row (0 or 1)
kazz12211 0:933748ca1307 35 * str - string to show on the LCD. The length is up to 16 characters
kazz12211 0:933748ca1307 36 **/
kazz12211 0:933748ca1307 37 void printString(int row, char *str);
takashiyamanoue 1:4fca021edef0 38
takashiyamanoue 1:4fca021edef0 39 //
takashiyamanoue 1:4fca021edef0 40 void writeCommand(char cmd);
takashiyamanoue 1:4fca021edef0 41 void writeData(char data);
kazz12211 0:933748ca1307 42 };
kazz12211 0:933748ca1307 43
kazz12211 0:933748ca1307 44 #endif