6 x 7 segment display library for PCA9637 driven breakout board

Dependents:   FTSE100 InternetDispBoB digitalThermometer Counter ... more

dispBoB.h

Committer:
d_worrall
Date:
2011-06-29
Revision:
2:b20aa44dec87
Parent:
1:d3d2fb119fa3
Child:
3:e767f379b823

File content as of revision 2:b20aa44dec87:

//NXP PCA9635 library
//mbed Team     -   28th June 2011
//Daniel Worrall

#ifndef MBED_DISPBOB_H
#define MBED_DISPBOB_H

#include "mbed.h"
#include "string"
#include "PCA9635.h"
#include "ctype.h"

/** dispBoB class, defined on the I2C master bus
* 
* Example:
* @code
* #include "mbed.h"
* #include "dispBoB.h"
*
* dispBoB db(p28, p27, p26);
* string str = "This is London calling";
*
* int main() {
*     db.cls();
*     while(1){
*         db.scroll(str, 0.25);
*     }
* }
* @endcode
*/
class dispBoB {
public:
    //constructor
    /** Create a dispBoB object defined on the I2C master bus
    *
    */
    dispBoB(PinName sda, PinName scl, PinName en);
    
    //output control
    /** Clear screen
    *
    */
    void cls(void);
    /** Set cursor position
    *
    * @param pos display location left to right (0-5)
    */
    void locate(char pos);
    /** Put an ASCII encoded character onto display at current location
    *
    * @param c ASCII encoded character or number (no punctuation)
    */
    void putc(char c);
    /** Put an ASCII encoded character onto display at specified location
    *
    * @param c ASCII encoded character or number
    * @param pos display location lef to right (0-5)  
    */
    void putc(char c, char pos);
    /** Write a string to the display
    *
    * @param str String to be displayed
    */
    void write(string str);
    /** Write a scrolling string (right to left) to display (no punctuation)
    *
    * @param str String to be displayed
    * @param speed duration of each frame (seconds)
    */
    void scroll(string str, float speed);
    
private:

    PCA9635 _pca;
    DigitalOut _en;
    char _cursor; 
};

#endif