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

Fork of SLCD by Erik -

Committer:
Sissors
Date:
Thu Feb 27 21:57:22 2014 +0000
Revision:
4:ec7b3c9b2aeb
Parent:
3:f70873bc6121
Child:
5:6e3c11967108
Switched clock source to 4MHz oscillator.
; Added option to enable/disable it in deepsleep mode

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"
star297 3:f70873bc6121 8
star297 3:f70873bc6121 9 SLCD slcd;
star297 3:f70873bc6121 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
star297 3:f70873bc6121 14 slcd.putc("A"); // prints a single character
star297 3:f70873bc6121 15 slcd.Write_Char('A'); // prints a single character
star297 3:f70873bc6121 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
star297 3:f70873bc6121 24 }
star297 3:f70873bc6121 25 */
star297 3:f70873bc6121 26
Sissors 0:d04758e76d5b 27 class SLCD : public Stream {
Sissors 0:d04758e76d5b 28 public:
Sissors 0:d04758e76d5b 29 SLCD();
Sissors 0:d04758e76d5b 30
Sissors 4:ec7b3c9b2aeb 31
star297 3:f70873bc6121 32 void Write_Char(char lbValue);
star297 3:f70873bc6121 33 void Home (void);
star297 3:f70873bc6121 34 void Contrast (uint8_t lbContrast);
star297 3:f70873bc6121 35 void All_Segments (int);
star297 3:f70873bc6121 36 void DP1 (int);
star297 3:f70873bc6121 37 void DP2 (int);
star297 3:f70873bc6121 38 void DP3 (int);
star297 3:f70873bc6121 39 void Colon (int);
star297 3:f70873bc6121 40 uint8_t CharPosition;
Sissors 4:ec7b3c9b2aeb 41 void blink(int blink = 3);
Sissors 4:ec7b3c9b2aeb 42 void deepsleepEnable(bool enable);
Sissors 4:ec7b3c9b2aeb 43
Sissors 4:ec7b3c9b2aeb 44 private:
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;
star297 1:1579bcd31410 49 }
Sissors 0:d04758e76d5b 50 };