KBrat-SSD541-HW-15-1
Fork of SLCD_minus_mod by
SLCD.h@5:6e3c11967108, 2014-02-27 (annotated)
- Committer:
- Sissors
- Date:
- Thu Feb 27 22:02:34 2014 +0000
- Revision:
- 5:6e3c11967108
- Parent:
- 4:ec7b3c9b2aeb
- Child:
- 6:f4773221794b
Write_Char function -> private (use putc)
Who changed what in which revision?
User | Revision | Line number | New 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 | |
star297 | 3:f70873bc6121 | 31 | void Home (void); |
star297 | 3:f70873bc6121 | 32 | void Contrast (uint8_t lbContrast); |
star297 | 3:f70873bc6121 | 33 | void All_Segments (int); |
star297 | 3:f70873bc6121 | 34 | void DP1 (int); |
star297 | 3:f70873bc6121 | 35 | void DP2 (int); |
star297 | 3:f70873bc6121 | 36 | void DP3 (int); |
star297 | 3:f70873bc6121 | 37 | void Colon (int); |
star297 | 3:f70873bc6121 | 38 | uint8_t CharPosition; |
Sissors | 4:ec7b3c9b2aeb | 39 | void blink(int blink = 3); |
Sissors | 4:ec7b3c9b2aeb | 40 | void deepsleepEnable(bool enable); |
Sissors | 4:ec7b3c9b2aeb | 41 | |
Sissors | 4:ec7b3c9b2aeb | 42 | private: |
Sissors | 5:6e3c11967108 | 43 | void Write_Char(char lbValue); |
Sissors | 4:ec7b3c9b2aeb | 44 | void init(); |
Sissors | 0:d04758e76d5b | 45 | virtual int _putc(int c); |
Sissors | 0:d04758e76d5b | 46 | virtual int _getc() { |
Sissors | 0:d04758e76d5b | 47 | return 0; |
star297 | 1:1579bcd31410 | 48 | } |
Sissors | 0:d04758e76d5b | 49 | }; |