Changed @ to degree sign and < to -
Fork of SLCD by
SLCD.h@9:dae947a658f0, 2014-03-23 (annotated)
- Committer:
- Tomo2k
- Date:
- Sun Mar 23 19:10:10 2014 +0000
- Revision:
- 9:dae947a658f0
- Parent:
- 8:99e4215cfc11
- Child:
- 10:ef2b3b7f1b01
Added #pragma once guards
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Tomo2k | 9:dae947a658f0 | 1 | #pragma once |
Sissors | 0:d04758e76d5b | 2 | #include "mbed.h" |
Sissors | 0:d04758e76d5b | 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 | { |
Tomo2k | 8:99e4215cfc11 | 13 | slcd.printf("1.2.3.4"); // standard printf function, only charaters in ASCII_TO_WF_CODIFICATION_TABLE will display |
Tomo2k | 8:99e4215cfc11 | 14 | // Dots printed using decimal points |
Tomo2k | 8:99e4215cfc11 | 15 | slcd.putc('A'); // prints a single character |
Tomo2k | 8:99e4215cfc11 | 16 | slcd.clear(); // All segments off |
Tomo2k | 6:f4773221794b | 17 | slcd.All_Segments(y); // y=1 for ALL segments on, 0 for ALL segments off |
Tomo2k | 8:99e4215cfc11 | 18 | slcd.DP(x, true/false); // Set/Clear decimal point. x=0, 1 or 2. |
Tomo2k | 8:99e4215cfc11 | 19 | // Does nothing if invalid decimal point |
Tomo2k | 8:99e4215cfc11 | 20 | slcd.DPx(y); // x=DP1 to DP3, y=1 for on 0 for off (legacy) |
star297 | 3:f70873bc6121 | 21 | slcd.Colon(y); // y=1 for on, 0 for off |
star297 | 3:f70873bc6121 | 22 | slcd.CharPosition=x; // x=0 to 3, 0 is start position |
star297 | 3:f70873bc6121 | 23 | slcd.Home(); // sets next charater to posistion 0 (start) |
Sissors | 4:ec7b3c9b2aeb | 24 | slcd.Contrast (x); // set contrast x=0 - 15, 0 lightest, 15 darkest |
Sissors | 4:ec7b3c9b2aeb | 25 | slcd.blink(x); // set display to blink, 0-7 is blink rate (default = 3), -1 disables blink |
Sissors | 4:ec7b3c9b2aeb | 26 | 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 | 27 | } |
star297 | 3:f70873bc6121 | 28 | */ |
star297 | 3:f70873bc6121 | 29 | |
Tomo2k | 6:f4773221794b | 30 | class SLCD : public Stream |
Tomo2k | 6:f4773221794b | 31 | { |
Tomo2k | 6:f4773221794b | 32 | public: |
Sissors | 0:d04758e76d5b | 33 | SLCD(); |
Tomo2k | 6:f4773221794b | 34 | |
star297 | 3:f70873bc6121 | 35 | void Home (void); |
star297 | 3:f70873bc6121 | 36 | void Contrast (uint8_t lbContrast); |
Tomo2k | 6:f4773221794b | 37 | void All_Segments (int); |
Tomo2k | 7:0e084b33d730 | 38 | void clear(); |
Tomo2k | 7:0e084b33d730 | 39 | void DP(int pos, bool on); |
star297 | 3:f70873bc6121 | 40 | void DP1 (int); |
star297 | 3:f70873bc6121 | 41 | void DP2 (int); |
star297 | 3:f70873bc6121 | 42 | void DP3 (int); |
Tomo2k | 6:f4773221794b | 43 | void Colon (int); |
star297 | 3:f70873bc6121 | 44 | uint8_t CharPosition; |
Sissors | 4:ec7b3c9b2aeb | 45 | void blink(int blink = 3); |
Sissors | 4:ec7b3c9b2aeb | 46 | void deepsleepEnable(bool enable); |
Tomo2k | 6:f4773221794b | 47 | |
Tomo2k | 6:f4773221794b | 48 | private: |
Sissors | 5:6e3c11967108 | 49 | void Write_Char(char lbValue); |
Sissors | 4:ec7b3c9b2aeb | 50 | void init(); |
Sissors | 0:d04758e76d5b | 51 | virtual int _putc(int c); |
Sissors | 0:d04758e76d5b | 52 | virtual int _getc() { |
Sissors | 0:d04758e76d5b | 53 | return 0; |
Tomo2k | 6:f4773221794b | 54 | } |
Sissors | 0:d04758e76d5b | 55 | }; |