Bayley Wang
/
foc-ed_in_the_bot_compact
robot
PwmIn/PwmIn.h
- Committer:
- bwang
- Date:
- 2017-02-24
- Revision:
- 75:591556ce033d
- Parent:
- 18:3863ca45cf26
- Child:
- 78:b8df106126a7
File content as of revision 75:591556ce033d:
#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(); public: void block() {blocked = true;} int state() {return dig_in->read();} int get_usecs() {return usecs;} private: void handle_rise(); void handle_fall(); private: InterruptIn* int_in; DigitalIn* dig_in; Timer timer; int usec_min, usec_max; private: bool enabled; bool blocked; int usecs; }; #endif