赤外線リモコンの受信をパルス幅にて行います。 Displays the pulse width of the IR control.
Dependents: IRLED_SendReceveDemo IRreceiver_PulseWidth
Diff: IRRcevPulseWidth.h
- Revision:
- 0:612202986301
- Child:
- 1:51aa48441784
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IRRcevPulseWidth.h Sun Dec 25 08:54:15 2016 +0000 @@ -0,0 +1,36 @@ +#ifndef __IRRCEV_PULSEWIDTH_H__ +#define __IRRCEV_PULSEWIDTH_H__ + +#include "mbed.h" + +#define IR_RCEV_DEBUGOUT_ENABLE (1) + +#if IR_RCEV_DEBUGOUT_ENABLE +#define DBG(...) printf("" __VA_ARGS__) +#else +#define DBG(...) +#endif + +class IRRcevPulseWidth { +public: + IRRcevPulseWidth(PinName InputPin); + + void init(uint16_t *dataPtr,uint16_t dataLim,uint32_t timeout_us); + uint16_t getData_N(void); + int8_t status(void); + +private: + Timer _timer; + DigitalIn _inputPin; + uint32_t IRRcevMicroSec_prev; + uint32_t IRRcevMicroSec,IRRcevMicroSec_diff; + uint8_t IRRcevState,IRRcevState_prev; + uint32_t IRRcevTimeOut; + uint16_t cIRRcev,cIRRceved; + uint8_t fRcevStart; + uint16_t *p_data; + uint16_t limitUpper_dataN; + uint16_t i; +}; + +#endif \ No newline at end of file