IRM2121のfork
Fork of IRM2121 by
Diff: IRM2121.h
- Revision:
- 0:fd5c1ea78a7c
- Child:
- 1:1f7a3a98a5f5
diff -r 000000000000 -r fd5c1ea78a7c IRM2121.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IRM2121.h Sun Nov 09 11:11:37 2014 +0000 @@ -0,0 +1,66 @@ + + + #ifndef MBED_IRM_H + #define MBED_IRM_H + +#include "mbed.h" +/** IRM2121 class, based on an InterruptIn pin, and a timer + * use RoboCup Junior Soccer to find PULSE BALL. + + + * Example: + * @code + * // Set interrupt and read sensor. + * #include "mbed.h" + * #include "IRM2121.h" + * + * IRM2121 IR(p21); + * + * int main() { + * int range; + + * while(1) { + * + * IR.Send(); + * wait_ms(10); + * range = IR.Read(); + * } + * } + * @endcode + */ +class IRM2121 { + public: + /** Create a IRM2121 object connected to the specified InterruptIn pin + * + * @param IRM_PIN InterruptIn pin to connect to + */ + IRM2121(PinName IRM_PIN); + + /** Set a IRM2121 Interrupt Pin + * + * @param none + */ + void Set(void); + /** Read the result + * + * @param none + */ + + int Read(void); + + protected: + + InterruptIn _event; + Timer _timer; + + bool _Flag; + bool _Valid; + bool _Busy; + int _Time; + + void _Start(void); + void _Stop (void); + + }; + + #endif \ No newline at end of file