A library for AQM0802A I2C connecting LCD module.

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers KuAQM0802A.h Source File

KuAQM0802A.h

00001 #ifndef AQM0802A_H
00002 #define AQM0802A_H
00003  
00004 #include "mbed.h"
00005 
00006 /**
00007  * A library for AQM0802A I2C connecting LCD.
00008  */
00009 class KuAQM0802A : public Stream {
00010 private:
00011     I2C &i2c;
00012 
00013 public:
00014  
00015     /**
00016      * Constractor of AQM0802A driver. 
00017      * @param i2c I2C object
00018      */
00019     explicit KuAQM0802A(I2C &i2c);
00020  
00021     /**
00022      * Destractor
00023      */
00024     ~KuAQM0802A();
00025  
00026     /**
00027      * Reset target device
00028      */
00029     void reset();
00030 
00031     /**
00032      * Locate cursor
00033      * @param x Position X
00034      * @param y Position Y
00035      */
00036     void locate(unsigned int x, unsigned int y);
00037 
00038     /**
00039      * Print a character
00040      * @param character A character to print
00041      */
00042     void print_char(const int character);
00043 
00044     /**
00045      * Change LCD contrast
00046      * @param contrast LCD contrast (0-63)
00047      */
00048     void set_contrast(unsigned int contrast);
00049 
00050     // for Stream implementation
00051     virtual int _putc(int value) { print_char(value); return 1; };
00052     virtual int _getc() { return -1; };
00053     
00054 private:
00055     void send_cmd(char cmd);
00056 
00057     void send(bool CO, bool RS, char code);
00058 };
00059  
00060 #endif