赤外線リモコンの受信をパルス幅にて行います。 Displays the pulse width of the IR control.
Dependents: IRLED_SendReceveDemo IRreceiver_PulseWidth
IRRcevPulseWidth.h@0:612202986301, 2016-12-25 (annotated)
- Committer:
- nameless129
- Date:
- Sun Dec 25 08:54:15 2016 +0000
- Revision:
- 0:612202986301
- Child:
- 1:51aa48441784
first commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nameless129 | 0:612202986301 | 1 | #ifndef __IRRCEV_PULSEWIDTH_H__ |
nameless129 | 0:612202986301 | 2 | #define __IRRCEV_PULSEWIDTH_H__ |
nameless129 | 0:612202986301 | 3 | |
nameless129 | 0:612202986301 | 4 | #include "mbed.h" |
nameless129 | 0:612202986301 | 5 | |
nameless129 | 0:612202986301 | 6 | #define IR_RCEV_DEBUGOUT_ENABLE (1) |
nameless129 | 0:612202986301 | 7 | |
nameless129 | 0:612202986301 | 8 | #if IR_RCEV_DEBUGOUT_ENABLE |
nameless129 | 0:612202986301 | 9 | #define DBG(...) printf("" __VA_ARGS__) |
nameless129 | 0:612202986301 | 10 | #else |
nameless129 | 0:612202986301 | 11 | #define DBG(...) |
nameless129 | 0:612202986301 | 12 | #endif |
nameless129 | 0:612202986301 | 13 | |
nameless129 | 0:612202986301 | 14 | class IRRcevPulseWidth { |
nameless129 | 0:612202986301 | 15 | public: |
nameless129 | 0:612202986301 | 16 | IRRcevPulseWidth(PinName InputPin); |
nameless129 | 0:612202986301 | 17 | |
nameless129 | 0:612202986301 | 18 | void init(uint16_t *dataPtr,uint16_t dataLim,uint32_t timeout_us); |
nameless129 | 0:612202986301 | 19 | uint16_t getData_N(void); |
nameless129 | 0:612202986301 | 20 | int8_t status(void); |
nameless129 | 0:612202986301 | 21 | |
nameless129 | 0:612202986301 | 22 | private: |
nameless129 | 0:612202986301 | 23 | Timer _timer; |
nameless129 | 0:612202986301 | 24 | DigitalIn _inputPin; |
nameless129 | 0:612202986301 | 25 | uint32_t IRRcevMicroSec_prev; |
nameless129 | 0:612202986301 | 26 | uint32_t IRRcevMicroSec,IRRcevMicroSec_diff; |
nameless129 | 0:612202986301 | 27 | uint8_t IRRcevState,IRRcevState_prev; |
nameless129 | 0:612202986301 | 28 | uint32_t IRRcevTimeOut; |
nameless129 | 0:612202986301 | 29 | uint16_t cIRRcev,cIRRceved; |
nameless129 | 0:612202986301 | 30 | uint8_t fRcevStart; |
nameless129 | 0:612202986301 | 31 | uint16_t *p_data; |
nameless129 | 0:612202986301 | 32 | uint16_t limitUpper_dataN; |
nameless129 | 0:612202986301 | 33 | uint16_t i; |
nameless129 | 0:612202986301 | 34 | }; |
nameless129 | 0:612202986301 | 35 | |
nameless129 | 0:612202986301 | 36 | #endif |