robot

Dependencies:   FastPWM3 mbed

Committer:
bwang
Date:
Fri Feb 24 21:37:14 2017 +0000
Revision:
75:591556ce033d
Parent:
18:3863ca45cf26
Child:
78:b8df106126a7
throttle edges acquired during commutation are invalidated; physically impossible throttle readings are invalidated; removed two-step throttle filtering code in lieu of superior methods

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bwang 18:3863ca45cf26 1 #ifndef __PWMIN_H
bwang 18:3863ca45cf26 2 #define __PWMIN_H
bwang 16:f283d6032fe5 3
dicarloj 13:41d102a53caf 4 #include "mbed.h"
dicarloj 13:41d102a53caf 5
bwang 16:f283d6032fe5 6 class PwmIn {
bwang 16:f283d6032fe5 7 public:
bwang 16:f283d6032fe5 8 PwmIn(PinName pin, int usec_min, int usec_max);
dicarloj 13:41d102a53caf 9 bool get_enabled();
dicarloj 13:41d102a53caf 10 float get_throttle();
bwang 75:591556ce033d 11 public:
bwang 75:591556ce033d 12 void block() {blocked = true;}
bwang 75:591556ce033d 13 int state() {return dig_in->read();}
bwang 75:591556ce033d 14 int get_usecs() {return usecs;}
bwang 75:591556ce033d 15 private:
bwang 75:591556ce033d 16 void handle_rise();
bwang 75:591556ce033d 17 void handle_fall();
bwang 16:f283d6032fe5 18 private:
dicarloj 13:41d102a53caf 19 InterruptIn* int_in;
dicarloj 13:41d102a53caf 20 DigitalIn* dig_in;
dicarloj 13:41d102a53caf 21 Timer timer;
bwang 75:591556ce033d 22 int usec_min, usec_max;
bwang 75:591556ce033d 23 private:
dicarloj 13:41d102a53caf 24 bool enabled;
bwang 75:591556ce033d 25 bool blocked;
dicarloj 13:41d102a53caf 26 int usecs;
dicarloj 13:41d102a53caf 27 };
dicarloj 13:41d102a53caf 28 #endif