John Donnal / IrReceiver
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Ir.h Source File

Ir.h

00001 
00002 /* Parallax High Speed Continuous Servo
00003    John Donnal 2018
00004 */
00005 
00006 #ifndef _IR_H
00007 #define _IR_H
00008 
00009 /**
00010  * Includes
00011  */
00012 #include "mbed.h"
00013 
00014 /**
00015  * 38KHz IR Receiver (for Sony RM-EZ4 Remote) 
00016  */
00017 class IrIn {
00018 
00019 public:
00020 
00021     /**
00022      * Constructor.
00023      *
00024      * @param output mbed pin for input channel.
00025      */
00026     IrIn(PinName input);
00027 
00028     /**
00029      * Decode IR data, blocks until data is received
00030      */
00031     int read();
00032 private:
00033 
00034     void falling_edge_();
00035     void rising_edge_();
00036     InterruptIn ir_;
00037     Timer t_;
00038     int rx_in_progress_;
00039     int rx_complete_;
00040     int rx_bits_;
00041     int msg_;
00042 };
00043 
00044 #endif /* CONTINUOUS_SERVO_H */