6 x 7 segment display library for PCA9637 driven breakout board

Dependents:   FTSE100 InternetDispBoB digitalThermometer Counter ... more

Committer:
d_worrall
Date:
Wed Jun 29 11:26:13 2011 +0000
Revision:
1:d3d2fb119fa3
Parent:
0:843654413849
Child:
2:b20aa44dec87
version1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
d_worrall 0:843654413849 1 //NXP PCA9635 library
d_worrall 0:843654413849 2 //mbed Team - 28th June 2011
d_worrall 0:843654413849 3 //Daniel Worrall
d_worrall 0:843654413849 4
d_worrall 0:843654413849 5 #ifndef MBED_DISPBOB_H
d_worrall 0:843654413849 6 #define MBED_DISPBOB_H
d_worrall 0:843654413849 7
d_worrall 0:843654413849 8 #include "mbed.h"
d_worrall 0:843654413849 9 #include "string"
d_worrall 0:843654413849 10 #include "PCA9635.h"
d_worrall 0:843654413849 11 #include "ctype.h"
d_worrall 0:843654413849 12
d_worrall 0:843654413849 13 class dispBoB {
d_worrall 0:843654413849 14 public:
d_worrall 0:843654413849 15 //constructor
d_worrall 1:d3d2fb119fa3 16 /** Create a dispBoB object defined on the I2C bus
d_worrall 1:d3d2fb119fa3 17 *
d_worrall 1:d3d2fb119fa3 18 */
d_worrall 0:843654413849 19 dispBoB(PinName sda, PinName scl, PinName en);
d_worrall 0:843654413849 20
d_worrall 0:843654413849 21 //output control
d_worrall 0:843654413849 22 /** Clear screen
d_worrall 0:843654413849 23 *
d_worrall 0:843654413849 24 */
d_worrall 0:843654413849 25 void cls(void);
d_worrall 0:843654413849 26 /** Set cursor position
d_worrall 0:843654413849 27 *
d_worrall 0:843654413849 28 * @param pos display location left to right (0-5)
d_worrall 0:843654413849 29 */
d_worrall 0:843654413849 30 void locate(char pos);
d_worrall 0:843654413849 31 /** Put an ASCII encoded character onto display at current location
d_worrall 0:843654413849 32 *
d_worrall 0:843654413849 33 * @param c ASCII encoded character or number (no punctuation)
d_worrall 0:843654413849 34 */
d_worrall 0:843654413849 35 void putc(char c);
d_worrall 0:843654413849 36 /** Put an ASCII encoded character onto display at specified location
d_worrall 0:843654413849 37 *
d_worrall 0:843654413849 38 * @param c ASCII encoded character or number
d_worrall 0:843654413849 39 * @param pos display location lef to right (0-5)
d_worrall 0:843654413849 40 */
d_worrall 0:843654413849 41 void putc(char c, char pos);
d_worrall 0:843654413849 42 /** Write a string to the display
d_worrall 0:843654413849 43 *
d_worrall 0:843654413849 44 * @param str String to be displayed
d_worrall 0:843654413849 45 */
d_worrall 0:843654413849 46 void write(string str);
d_worrall 0:843654413849 47 /** Write a scrolling string (right to left) to display (no punctuation)
d_worrall 0:843654413849 48 *
d_worrall 0:843654413849 49 * @param str String to be displayed
d_worrall 0:843654413849 50 * @param speed duration of each frame (seconds)
d_worrall 0:843654413849 51 */
d_worrall 0:843654413849 52 void scroll(string str, float speed);
d_worrall 0:843654413849 53
d_worrall 0:843654413849 54 private:
d_worrall 0:843654413849 55
d_worrall 0:843654413849 56 PCA9635 _pca;
d_worrall 0:843654413849 57 DigitalOut _en;
d_worrall 0:843654413849 58 char _cursor;
d_worrall 0:843654413849 59 };
d_worrall 0:843654413849 60
d_worrall 0:843654413849 61 #endif
d_worrall 0:843654413849 62