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@5:090ef6275773, 2014-01-28 (annotated)
- Committer:
- sandwich
- Date:
- Tue Jan 28 23:59:21 2014 +0000
- Revision:
- 5:090ef6275773
- Child:
- 6:a4d6f3e4bf28
added interrupts
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(); |
sandwich | 5:090ef6275773 | 8 | PwmReader(PinName pwmInPort); |
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 | 5:090ef6275773 | 14 | void pwmRise(); //0 to 1 |
sandwich | 5:090ef6275773 | 15 | void pwmFall(); //-1 to 1 |
sandwich | 5:090ef6275773 | 16 | |
sandwich | 5:090ef6275773 | 17 | InterruptIn* di; |
sandwich | 5:090ef6275773 | 18 | int lastRise; |
sandwich | 5:090ef6275773 | 19 | int period; |
sandwich | 5:090ef6275773 | 20 | float duty; |
sandwich | 5:090ef6275773 | 21 | Timer t; |
sandwich | 5:090ef6275773 | 22 | |
sandwich | 5:090ef6275773 | 23 | }; |