KBrat-SSD541-Final-16-1
Fork of SLCD by
SLCD.h@7:0e084b33d730, 2014-03-14 (annotated)
- Committer:
- Tomo2k
- Date:
- Fri Mar 14 15:22:09 2014 +0000
- Revision:
- 7:0e084b33d730
- Parent:
- 6:f4773221794b
- Child:
- 8:99e4215cfc11
Added "." as a valid character printed using the decimal point LCD cell.; Added SLCD::clear() method to clear the LCD.; Note that ".." will only print one dot, dots must be manually cleared, eg using clear()
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" |
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); |
Tomo2k | 7:0e084b33d730 | 35 | void clear(); |
Tomo2k | 7:0e084b33d730 | 36 | void DP(int pos, bool on); |
star297 | 3:f70873bc6121 | 37 | void DP1 (int); |
star297 | 3:f70873bc6121 | 38 | void DP2 (int); |
star297 | 3:f70873bc6121 | 39 | void DP3 (int); |
Tomo2k | 6:f4773221794b | 40 | void Colon (int); |
star297 | 3:f70873bc6121 | 41 | uint8_t CharPosition; |
Sissors | 4:ec7b3c9b2aeb | 42 | void blink(int blink = 3); |
Sissors | 4:ec7b3c9b2aeb | 43 | void deepsleepEnable(bool enable); |
Tomo2k | 6:f4773221794b | 44 | |
Tomo2k | 6:f4773221794b | 45 | private: |
Sissors | 5:6e3c11967108 | 46 | void Write_Char(char lbValue); |
Sissors | 4:ec7b3c9b2aeb | 47 | void init(); |
Sissors | 0:d04758e76d5b | 48 | virtual int _putc(int c); |
Sissors | 0:d04758e76d5b | 49 | virtual int _getc() { |
Sissors | 0:d04758e76d5b | 50 | return 0; |
Tomo2k | 6:f4773221794b | 51 | } |
Sissors | 0:d04758e76d5b | 52 | }; |