![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
My modifications/additions to the code
Dependencies: ADXL345 ADXL345_I2C IMUfilter ITG3200 Servo fishgait mbed-rtos mbed pixy_cam
Fork of robotic_fish_ver_4_8 by
PwmReader.h@25:4f2f441eceec, 2014-07-11 (annotated)
- Committer:
- sandwich
- Date:
- Fri Jul 11 14:30:36 2014 +0000
- Revision:
- 25:4f2f441eceec
- Parent:
- 8:0574a5db1fc4
latest revision
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sandwich | 5:090ef6275773 | 1 | #pragma once |
sandwich | 5:090ef6275773 | 2 | #include "mbed.h" |
sandwich | 5:090ef6275773 | 3 | |
sandwich | 5:090ef6275773 | 4 | class PwmReader |
sandwich | 5:090ef6275773 | 5 | { |
sandwich | 5:090ef6275773 | 6 | public: |
sandwich | 5:090ef6275773 | 7 | PwmReader(); |
rkk | 6:a4d6f3e4bf28 | 8 | PwmReader(PinName pwmInPort, float min = 0.0, float max = 1.0); |
sandwich | 5:090ef6275773 | 9 | ~PwmReader(); |
sandwich | 5:090ef6275773 | 10 | |
sandwich | 5:090ef6275773 | 11 | float getDuty(); //0 to 1 |
sandwich | 5:090ef6275773 | 12 | |
sandwich | 5:090ef6275773 | 13 | protected: |
sandwich | 7:e005cfaff8d1 | 14 | void pwmRise(); |
sandwich | 7:e005cfaff8d1 | 15 | void pwmFall(); |
rkk | 8:0574a5db1fc4 | 16 | void pwmRise2(); |
rkk | 8:0574a5db1fc4 | 17 | void pwmFall2(); |
sandwich | 5:090ef6275773 | 18 | |
rkk | 6:a4d6f3e4bf28 | 19 | private: |
sandwich | 5:090ef6275773 | 20 | InterruptIn* di; |
sandwich | 5:090ef6275773 | 21 | int lastRise; |
sandwich | 5:090ef6275773 | 22 | int period; |
sandwich | 5:090ef6275773 | 23 | float duty; |
rkk | 6:a4d6f3e4bf28 | 24 | Timer t; |
rkk | 6:a4d6f3e4bf28 | 25 | float pwmMin; |
rkk | 6:a4d6f3e4bf28 | 26 | float pwmMax; |
sandwich | 5:090ef6275773 | 27 | |
sandwich | 5:090ef6275773 | 28 | }; |