Bayley Wang
/
foc-ed_in_the_bot_compact
robot
PwmIn/PwmIn.h
- Committer:
- bwang
- Date:
- 2017-02-28
- Revision:
- 79:d0b1bb3dcf68
- Parent:
- 78:b8df106126a7
- Child:
- 92:a9dac72d8cac
File content as of revision 79:d0b1bb3dcf68:
#ifndef __PWMIN_H #define __PWMIN_H #include "mbed.h" class PwmIn { public: PwmIn(PinName pin, int usec_min, int usec_max, int usec_crazy); 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, usec_crazy; private: bool enabled; bool blocked; int usecs; }; #endif