Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SB1602E by
Diff: SB1602E.h
- Revision:
- 2:baf578069dfc
- Parent:
- 1:fce3e353410c
- Child:
- 3:27245e83c96c
--- a/SB1602E.h Mon Jan 05 05:19:43 2015 +0000
+++ b/SB1602E.h Tue Apr 07 05:03:44 2015 +0000
@@ -1,8 +1,8 @@
/** Text LCD module "SB1602E" class library
*
- * @author Tedd OKANO & Masato YAMANISHI
- * @version 2.01
- * @date 05-Jan-2015
+ * @author Tedd OKANO, Masato YAMANISHI & Toyomasa Watarai
+ * @version 2.1
+ * @date 07-April-2015
*
* SB1602E is an I2C based low voltage text LCD panel (based Sitronix ST7032 chip)
* The module by StrawberryLinux
@@ -21,6 +21,8 @@
* revision 1.3 02-May-2014 a. puticon() added (for SB1602B) by Masato YAMANISHI san
* revision 2.0 20-Oct-2014 a. class name is changed and published as "SB1602E"
* b. re-written for better usability
+ * revision 2.1 07-Apl-2015 a. add printf() with X and Y position
+ * b. add setter for number of chars in a line (e.g. 8x2 LCD support)
*/
#ifndef MBED_SB1602E
@@ -31,12 +33,10 @@
#include "SB1602E.h"
-/** PCA9629A class
+/** SB1602E class
*
- * This is a driver code for the PCA9629A stepper motor controller.
- * This class provides interface for PCA9629A operation and accessing its registers.
- * Detail information is available on next URL.
- * http://www.nxp.com/products/interface_and_connectivity/i2c/i2c_bus_controller_and_bridge_ics/PCA9629APW.html
+ * This is a driver code for the SB1602E LCD module.
+ * This class provides interface for ST7032 operation and accessing its registers.
*
* Example:
* @code
@@ -76,7 +76,7 @@
/** Printf
*
- * pirntf function with line number.
+ * printf function with line number.
* it can be used like
*
* lcd.printf( 0, "Hello world!" );
@@ -87,6 +87,20 @@
*/
void printf( char line, char *format, ... );
+ /** Printf
+ *
+ * printf function with X and Y character position on the LCD.
+ * it can be used like
+ *
+ * lcd.printf( 0, 0, "Hello world!" );
+ * lcd.printf( 4, 1, "pi = %.6f", 3.14159265 );
+ *
+ * @param x X horizontal character position on the LCD
+ * @param y Y vertical character position on the LCD
+ * @param format following parameters are compatible to stdout's printf
+ */
+ void printf( char x, char y, char *format, ... );
+
/** Put character : "putc()"
*
* @param line line# (0 for upper, 1 for lower)
@@ -148,6 +162,12 @@
*/
void puticon( unsigned short flg );
+ /** Set number of charactors in a line
+ *
+ * @param ch number of charactors in a line
+ */
+ void setCharsInLine( char ch ) { charsInLine = ch; };
+
private:
char curs[2];
void init( char *init_massage );
@@ -158,6 +178,7 @@
I2C *i2c_p;
I2C &i2c;
char i2c_addr;
+ char charsInLine;
private:
typedef enum {
