robot

Dependencies:   FastPWM3 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PwmIn.h Source File

PwmIn.h

00001 #ifndef __PWMIN_H
00002 #define __PWMIN_H
00003 
00004 #include "mbed.h"
00005 
00006 class PwmIn {
00007 public:
00008     PwmIn(PinName pin, int usec_min, int usec_max);
00009     bool get_enabled();
00010     float get_throttle();
00011 public:
00012     void block() {blocked = true;}
00013     int state() {return dig_in->read();}
00014     int get_usecs() {return usecs;}
00015 private:
00016     void handle_rise();
00017     void handle_fall();
00018 private:
00019     InterruptIn* int_in;
00020     DigitalIn*   dig_in;
00021     Timer timer;
00022     int usec_min, usec_max;
00023 private:
00024     bool enabled;
00025     bool blocked;
00026     bool risen;
00027     int usecs;
00028 };
00029 #endif