Infrared Rays library
See http://developer.mbed.org/users/yasuyuki/notebook/IRmbed/
IR.h@1:71ca050c4d05, 2015-09-25 (annotated)
- Committer:
- yasuyuki
- Date:
- Fri Sep 25 17:11:16 2015 +0000
- Revision:
- 1:71ca050c4d05
- Parent:
- 0:c74b212c3cbf
revision 1
;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yasuyuki | 0:c74b212c3cbf | 1 | //********************** |
yasuyuki | 0:c74b212c3cbf | 2 | // IR.h for mbed |
yasuyuki | 0:c74b212c3cbf | 3 | // |
yasuyuki | 1:71ca050c4d05 | 4 | // (C)Copyright 2014-2015 All rights reserved by Y.Onodera |
yasuyuki | 0:c74b212c3cbf | 5 | // http://einstlab.web.fc2.com |
yasuyuki | 0:c74b212c3cbf | 6 | //********************** |
yasuyuki | 0:c74b212c3cbf | 7 | |
yasuyuki | 0:c74b212c3cbf | 8 | #ifndef IR_H_ |
yasuyuki | 0:c74b212c3cbf | 9 | #define IR_H_ |
yasuyuki | 0:c74b212c3cbf | 10 | |
yasuyuki | 0:c74b212c3cbf | 11 | #include "mbed.h" |
yasuyuki | 1:71ca050c4d05 | 12 | #define IR_LIMITS 64 // bytes buffer = IR_LIMITS x8 bits |
yasuyuki | 1:71ca050c4d05 | 13 | #define AEHA 19 |
yasuyuki | 1:71ca050c4d05 | 14 | #define NEC 22 |
yasuyuki | 1:71ca050c4d05 | 15 | #define SONY 23 |
yasuyuki | 0:c74b212c3cbf | 16 | |
yasuyuki | 0:c74b212c3cbf | 17 | class IR{ |
yasuyuki | 0:c74b212c3cbf | 18 | public: |
yasuyuki | 1:71ca050c4d05 | 19 | IR (PinName irin, PinName irin); |
yasuyuki | 0:c74b212c3cbf | 20 | void init(); |
yasuyuki | 0:c74b212c3cbf | 21 | |
yasuyuki | 1:71ca050c4d05 | 22 | unsigned char countHigh(); |
yasuyuki | 1:71ca050c4d05 | 23 | unsigned char countLow(); |
yasuyuki | 1:71ca050c4d05 | 24 | void getIR2(); |
yasuyuki | 1:71ca050c4d05 | 25 | void getIR(); |
yasuyuki | 1:71ca050c4d05 | 26 | void outON(char n, char t); |
yasuyuki | 1:71ca050c4d05 | 27 | void outOFF(char n, char t); |
yasuyuki | 1:71ca050c4d05 | 28 | void setIR(); |
yasuyuki | 1:71ca050c4d05 | 29 | |
yasuyuki | 1:71ca050c4d05 | 30 | unsigned char buf[IR_LIMITS]; // bytes buffer |
yasuyuki | 1:71ca050c4d05 | 31 | unsigned char mode; // 1:NEC, 2:AEHA, 3:SONY |
yasuyuki | 1:71ca050c4d05 | 32 | unsigned short bits; // 32768 bits capable |
yasuyuki | 0:c74b212c3cbf | 33 | |
yasuyuki | 0:c74b212c3cbf | 34 | protected: |
yasuyuki | 0:c74b212c3cbf | 35 | |
yasuyuki | 0:c74b212c3cbf | 36 | DigitalIn _irin; |
yasuyuki | 1:71ca050c4d05 | 37 | DigitalOut _irout; |
yasuyuki | 1:71ca050c4d05 | 38 | |
yasuyuki | 0:c74b212c3cbf | 39 | |
yasuyuki | 0:c74b212c3cbf | 40 | }; |
yasuyuki | 0:c74b212c3cbf | 41 | |
yasuyuki | 0:c74b212c3cbf | 42 | |
yasuyuki | 0:c74b212c3cbf | 43 | #endif /* IR_H_ */ |