Bayley Wang
/
foc-ed_in_the_bot_compact
robot
PwmIn/PwmIn.h@18:3863ca45cf26, 2016-10-31 (annotated)
- Committer:
- bwang
- Date:
- Mon Oct 31 06:53:28 2016 +0000
- Revision:
- 18:3863ca45cf26
- Parent:
- pwm_in.h@16:f283d6032fe5
- Child:
- 75:591556ce033d
added functionality for torque->dq, throttle->torque commands
Who changed what in which revision?
User | Revision | Line number | New 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 | 16:f283d6032fe5 | 11 | private: |
dicarloj | 13:41d102a53caf | 12 | InterruptIn* int_in; |
dicarloj | 13:41d102a53caf | 13 | DigitalIn* dig_in; |
dicarloj | 13:41d102a53caf | 14 | Timer timer; |
dicarloj | 13:41d102a53caf | 15 | bool was_on; |
dicarloj | 13:41d102a53caf | 16 | bool enabled; |
dicarloj | 13:41d102a53caf | 17 | void handle_rise(); |
dicarloj | 13:41d102a53caf | 18 | void handle_fall(); |
dicarloj | 13:41d102a53caf | 19 | int usecs; |
dicarloj | 13:41d102a53caf | 20 | int usec_min, usec_max; |
dicarloj | 13:41d102a53caf | 21 | |
dicarloj | 13:41d102a53caf | 22 | }; |
dicarloj | 13:41d102a53caf | 23 | #endif |