Generic communication interface between the wireless board (mote) and the sensor board. Any kind of sensor board can be connected to the mote using this specification given it provides a SPI peripheral, one input pin with interrupt capability and one digital output. The sensor board must implement a special register set from which all required information can be retrieved. Protocol: http://is.gd/wuQorh Github: http://is.gd/ySj1L9
SLCD/SLCD.h@1:acdf490d94a7, 2014-04-08 (annotated)
- Committer:
- marcelobarrosalmeida
- Date:
- Tue Apr 08 16:34:20 2014 +0000
- Revision:
- 1:acdf490d94a7
Adding accel to sensor list
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marcelobarrosalmeida | 1:acdf490d94a7 | 1 | #include "mbed.h" |
marcelobarrosalmeida | 1:acdf490d94a7 | 2 | |
marcelobarrosalmeida | 1:acdf490d94a7 | 3 | |
marcelobarrosalmeida | 1:acdf490d94a7 | 4 | /* ------ sample usage------ |
marcelobarrosalmeida | 1:acdf490d94a7 | 5 | |
marcelobarrosalmeida | 1:acdf490d94a7 | 6 | #include "mbed.h" |
marcelobarrosalmeida | 1:acdf490d94a7 | 7 | #include "SLCD.h" |
marcelobarrosalmeida | 1:acdf490d94a7 | 8 | |
marcelobarrosalmeida | 1:acdf490d94a7 | 9 | SLCD slcd; |
marcelobarrosalmeida | 1:acdf490d94a7 | 10 | |
marcelobarrosalmeida | 1:acdf490d94a7 | 11 | main() |
marcelobarrosalmeida | 1:acdf490d94a7 | 12 | { |
marcelobarrosalmeida | 1:acdf490d94a7 | 13 | slcd.printf("1234"); // standard printf function, only charaters in ASCII_TO_WF_CODIFICATION_TABLE will display |
marcelobarrosalmeida | 1:acdf490d94a7 | 14 | slcd.putc("A"); // prints a single character |
marcelobarrosalmeida | 1:acdf490d94a7 | 15 | slcd.Write_Char('A'); // prints a single character |
marcelobarrosalmeida | 1:acdf490d94a7 | 16 | slcd.All_Segments(y); // y=1 for ALL segments on, 0 for ALL segments off |
marcelobarrosalmeida | 1:acdf490d94a7 | 17 | slcd.DPx(y); // x=DP1 to DP3, y=1 for on 0 for off |
marcelobarrosalmeida | 1:acdf490d94a7 | 18 | slcd.Colon(y); // y=1 for on, 0 for off |
marcelobarrosalmeida | 1:acdf490d94a7 | 19 | slcd.CharPosition=x; // x=0 to 3, 0 is start position |
marcelobarrosalmeida | 1:acdf490d94a7 | 20 | slcd.Home(); // sets next charater to posistion 0 (start) |
marcelobarrosalmeida | 1:acdf490d94a7 | 21 | slcd.Contrast (x); // set contrast x=0 - 15, 0 lightest, 15 darkest |
marcelobarrosalmeida | 1:acdf490d94a7 | 22 | } |
marcelobarrosalmeida | 1:acdf490d94a7 | 23 | */ |
marcelobarrosalmeida | 1:acdf490d94a7 | 24 | |
marcelobarrosalmeida | 1:acdf490d94a7 | 25 | class SLCD : public Stream { |
marcelobarrosalmeida | 1:acdf490d94a7 | 26 | public: |
marcelobarrosalmeida | 1:acdf490d94a7 | 27 | SLCD(); |
marcelobarrosalmeida | 1:acdf490d94a7 | 28 | |
marcelobarrosalmeida | 1:acdf490d94a7 | 29 | void init(); |
marcelobarrosalmeida | 1:acdf490d94a7 | 30 | void Write_Char(char lbValue); |
marcelobarrosalmeida | 1:acdf490d94a7 | 31 | void Home (void); |
marcelobarrosalmeida | 1:acdf490d94a7 | 32 | void Contrast (uint8_t lbContrast); |
marcelobarrosalmeida | 1:acdf490d94a7 | 33 | void All_Segments (int); |
marcelobarrosalmeida | 1:acdf490d94a7 | 34 | void DP1 (int); |
marcelobarrosalmeida | 1:acdf490d94a7 | 35 | void DP2 (int); |
marcelobarrosalmeida | 1:acdf490d94a7 | 36 | void DP3 (int); |
marcelobarrosalmeida | 1:acdf490d94a7 | 37 | void Colon (int); |
marcelobarrosalmeida | 1:acdf490d94a7 | 38 | uint8_t CharPosition; |
marcelobarrosalmeida | 1:acdf490d94a7 | 39 | |
marcelobarrosalmeida | 1:acdf490d94a7 | 40 | virtual int _putc(int c); |
marcelobarrosalmeida | 1:acdf490d94a7 | 41 | virtual int _getc() { |
marcelobarrosalmeida | 1:acdf490d94a7 | 42 | return 0; |
marcelobarrosalmeida | 1:acdf490d94a7 | 43 | } |
marcelobarrosalmeida | 1:acdf490d94a7 | 44 | }; |