robot

Dependencies:   FastPWM3 mbed

PwmIn/PwmIn.h

Committer:
bwang
Date:
2016-10-31
Revision:
18:3863ca45cf26
Parent:
pwm_in.h@ 16:f283d6032fe5
Child:
75:591556ce033d

File content as of revision 18:3863ca45cf26:

#ifndef __PWMIN_H
#define __PWMIN_H

#include "mbed.h"

class PwmIn {
public:
    PwmIn(PinName pin, int usec_min, int usec_max);
    bool get_enabled();
    float get_throttle();
private:
    InterruptIn* int_in;
    DigitalIn*   dig_in;
    Timer timer;
    bool was_on;
    bool enabled;
    void handle_rise();
    void handle_fall();
    int usecs;
    int usec_min, usec_max;
    
};
#endif