Forked to make it possible to include this lib in a multi target setting

Fork of SLCD by Erik -

Committer:
Tomo2k
Date:
Fri Mar 14 15:13:15 2014 +0000
Revision:
6:f4773221794b
Parent:
5:6e3c11967108
Child:
7:0e084b33d730
Magic Wand formatted (MBED standard style)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sissors 0:d04758e76d5b 1 #include "mbed.h"
Sissors 0:d04758e76d5b 2
star297 1:1579bcd31410 3
star297 3:f70873bc6121 4 /* ------ sample usage------
star297 3:f70873bc6121 5
star297 3:f70873bc6121 6 #include "mbed.h"
star297 3:f70873bc6121 7 #include "SLCD.h"
Tomo2k 6:f4773221794b 8
star297 3:f70873bc6121 9 SLCD slcd;
Tomo2k 6:f4773221794b 10
star297 3:f70873bc6121 11 main()
star297 3:f70873bc6121 12 {
star297 3:f70873bc6121 13 slcd.printf("1234"); // standard printf function, only charaters in ASCII_TO_WF_CODIFICATION_TABLE will display
Tomo2k 6:f4773221794b 14 slcd.putc("A"); // prints a single character
star297 3:f70873bc6121 15 slcd.Write_Char('A'); // prints a single character
Tomo2k 6:f4773221794b 16 slcd.All_Segments(y); // y=1 for ALL segments on, 0 for ALL segments off
star297 3:f70873bc6121 17 slcd.DPx(y); // x=DP1 to DP3, y=1 for on 0 for off
star297 3:f70873bc6121 18 slcd.Colon(y); // y=1 for on, 0 for off
star297 3:f70873bc6121 19 slcd.CharPosition=x; // x=0 to 3, 0 is start position
star297 3:f70873bc6121 20 slcd.Home(); // sets next charater to posistion 0 (start)
Sissors 4:ec7b3c9b2aeb 21 slcd.Contrast (x); // set contrast x=0 - 15, 0 lightest, 15 darkest
Sissors 4:ec7b3c9b2aeb 22 slcd.blink(x); // set display to blink, 0-7 is blink rate (default = 3), -1 disables blink
Sissors 4:ec7b3c9b2aeb 23 slcd.deepsleepEnable(x);// true (default) keeps the lcd enabled in deepsleep, false disables its 4MHz internal oscillator clock. Total power consumption ~= 40uA
Tomo2k 6:f4773221794b 24 }
star297 3:f70873bc6121 25 */
star297 3:f70873bc6121 26
Tomo2k 6:f4773221794b 27 class SLCD : public Stream
Tomo2k 6:f4773221794b 28 {
Tomo2k 6:f4773221794b 29 public:
Sissors 0:d04758e76d5b 30 SLCD();
Tomo2k 6:f4773221794b 31
star297 3:f70873bc6121 32 void Home (void);
star297 3:f70873bc6121 33 void Contrast (uint8_t lbContrast);
Tomo2k 6:f4773221794b 34 void All_Segments (int);
star297 3:f70873bc6121 35 void DP1 (int);
star297 3:f70873bc6121 36 void DP2 (int);
star297 3:f70873bc6121 37 void DP3 (int);
Tomo2k 6:f4773221794b 38 void Colon (int);
star297 3:f70873bc6121 39 uint8_t CharPosition;
Sissors 4:ec7b3c9b2aeb 40 void blink(int blink = 3);
Sissors 4:ec7b3c9b2aeb 41 void deepsleepEnable(bool enable);
Tomo2k 6:f4773221794b 42
Tomo2k 6:f4773221794b 43 private:
Sissors 5:6e3c11967108 44 void Write_Char(char lbValue);
Sissors 4:ec7b3c9b2aeb 45 void init();
Sissors 0:d04758e76d5b 46 virtual int _putc(int c);
Sissors 0:d04758e76d5b 47 virtual int _getc() {
Sissors 0:d04758e76d5b 48 return 0;
Tomo2k 6:f4773221794b 49 }
Sissors 0:d04758e76d5b 50 };