An I2C text LCD library for Displaytronic ACM1602NI-FLW-FBW-M01 MOD by Zak
Fork of ACM1602NI by
Diff: ACM1602NI.h
- Revision:
- 7:728c03b52b79
- Parent:
- 6:55b648ec5216
- Child:
- 8:661827681a12
diff -r 55b648ec5216 -r 728c03b52b79 ACM1602NI.h --- a/ACM1602NI.h Tue Jan 14 02:18:57 2014 +0000 +++ b/ACM1602NI.h Sat Jan 18 02:27:30 2014 +0000 @@ -1,5 +1,5 @@ /* An I2C text LCD library for Displaytronic ACM1602NI-FLW-FBW-M01 - * Copyright 2013, Takuo WATANABE (wtakuo) + * Copyright 2013, 2014, Takuo WATANABE (wtakuo) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,14 +24,22 @@ * This library adds some extra waits so that the device can answer to the I2C commands. * The interface is basically the same as TextLCD by Simon Ford. * + * Example: * @code * #include "mbed.h" + * + * // I2C Text LCD: http://mbed.org/users/takuo/code/ACM1602NI/ * #include "ACM1602NI.h" * - * // p9: sda, p10: scl + * // I2C pins: p9 = sda, p10 = scl * ACM1602NI lcd(p9, p10); * - * int main() { + * // You can specify an I2C object instead. + * // I2C i2c(p9, p10); + * // ACM1602NI lcd(i2c); + * + * int main() + * { * lcd.printf("Hello, World!\n"); * lcd.printf("ACM1602NI\n"); * } @@ -42,14 +50,14 @@ public: /** Create an ACM1602NI object connected to the specified I2C pins. * - * @param sda The I2C data pin - * @param scl The I2C clock pin + * @param sda I2C data pin + * @param scl I2C clock pin */ ACM1602NI(PinName sda, PinName scl); /** Create an ACM1602NI object connected to the specified I2C port. * - * @param i2c The I2C port to connect to + * @param i2c I2C port */ ACM1602NI(I2C &i2c); @@ -71,15 +79,6 @@ int columns(); protected: - virtual int _putc(int value); - virtual int _getc(); - - int address(int column, int raw); - void character(int column, int row, int c); - int writeBytes(const char *data, int length, bool repeated = false); - void writeCommand(int command); - void writeData(int data); - static const int i2c_addr = 0x50 << 1; static const int i2c_bit_wait_us = 20; static const int i2c_command_wait_ms = 4; @@ -89,6 +88,15 @@ I2C _i2c; int _column, _row; + + virtual int _putc(int value); + virtual int _getc(); + + int address(int column, int raw); + void character(int column, int row, int c); + int writeBytes(const char *data, int length, bool repeated = false); + void writeCommand(int command); + void writeData(int data); }; #endif