Test mbed1.
SLCD/SLCD.h@2:9f7506fa29d4, 2014-03-13 (annotated)
- Committer:
- mja054
- Date:
- Thu Mar 13 16:35:52 2014 +0000
- Revision:
- 2:9f7506fa29d4
- Parent:
- 1:1019095e41c4
Tested for 1ms to 10s;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mja054 | 1:1019095e41c4 | 1 | #include "mbed.h" |
mja054 | 1:1019095e41c4 | 2 | |
mja054 | 1:1019095e41c4 | 3 | |
mja054 | 1:1019095e41c4 | 4 | /* ------ sample usage------ |
mja054 | 1:1019095e41c4 | 5 | |
mja054 | 1:1019095e41c4 | 6 | #include "mbed.h" |
mja054 | 1:1019095e41c4 | 7 | #include "SLCD.h" |
mja054 | 1:1019095e41c4 | 8 | |
mja054 | 1:1019095e41c4 | 9 | SLCD slcd; |
mja054 | 1:1019095e41c4 | 10 | |
mja054 | 1:1019095e41c4 | 11 | main() |
mja054 | 1:1019095e41c4 | 12 | { |
mja054 | 1:1019095e41c4 | 13 | slcd.printf("1234"); // standard printf function, only charaters in ASCII_TO_WF_CODIFICATION_TABLE will display |
mja054 | 1:1019095e41c4 | 14 | slcd.putc("A"); // prints a single character |
mja054 | 1:1019095e41c4 | 15 | slcd.Write_Char('A'); // prints a single character |
mja054 | 1:1019095e41c4 | 16 | slcd.All_Segments(y); // y=1 for ALL segments on, 0 for ALL segments off |
mja054 | 1:1019095e41c4 | 17 | slcd.DPx(y); // x=DP1 to DP3, y=1 for on 0 for off |
mja054 | 1:1019095e41c4 | 18 | slcd.Colon(y); // y=1 for on, 0 for off |
mja054 | 1:1019095e41c4 | 19 | slcd.CharPosition=x; // x=0 to 3, 0 is start position |
mja054 | 1:1019095e41c4 | 20 | slcd.Home(); // sets next charater to posistion 0 (start) |
mja054 | 1:1019095e41c4 | 21 | slcd.Contrast (x); // set contrast x=0 - 15, 0 lightest, 15 darkest |
mja054 | 1:1019095e41c4 | 22 | } |
mja054 | 1:1019095e41c4 | 23 | */ |
mja054 | 1:1019095e41c4 | 24 | |
mja054 | 1:1019095e41c4 | 25 | class SLCD : public Stream { |
mja054 | 1:1019095e41c4 | 26 | public: |
mja054 | 1:1019095e41c4 | 27 | SLCD(); |
mja054 | 1:1019095e41c4 | 28 | |
mja054 | 1:1019095e41c4 | 29 | void init(); |
mja054 | 1:1019095e41c4 | 30 | void Write_Char(char lbValue); |
mja054 | 1:1019095e41c4 | 31 | void Home (void); |
mja054 | 1:1019095e41c4 | 32 | void Contrast (uint8_t lbContrast); |
mja054 | 1:1019095e41c4 | 33 | void All_Segments (int); |
mja054 | 1:1019095e41c4 | 34 | void DP1 (int); |
mja054 | 1:1019095e41c4 | 35 | void DP2 (int); |
mja054 | 1:1019095e41c4 | 36 | void DP3 (int); |
mja054 | 1:1019095e41c4 | 37 | void Colon (int); |
mja054 | 1:1019095e41c4 | 38 | uint8_t CharPosition; |
mja054 | 1:1019095e41c4 | 39 | |
mja054 | 1:1019095e41c4 | 40 | virtual int _putc(int c); |
mja054 | 1:1019095e41c4 | 41 | virtual int _getc() { |
mja054 | 1:1019095e41c4 | 42 | return 0; |
mja054 | 1:1019095e41c4 | 43 | } |
mja054 | 1:1019095e41c4 | 44 | }; |