動作確認済み
GMD.hpp@1:b85088467ae0, 2016-07-02 (annotated)
- Committer:
- inst
- Date:
- Sat Jul 02 06:16:41 2016 +0000
- Revision:
- 1:b85088467ae0
- Parent:
- 0:010c6f6ac7c0
- Child:
- 2:3d70888e91c6
template????????duty???????????????;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
inst | 0:010c6f6ac7c0 | 1 | #ifndef INCLUDED_GMD_H |
inst | 0:010c6f6ac7c0 | 2 | #define INCLUDED_GMD_H |
inst | 0:010c6f6ac7c0 | 3 | |
inst | 0:010c6f6ac7c0 | 4 | #include "mbed.h" |
inst | 0:010c6f6ac7c0 | 5 | #include "FastPWM.h" |
inst | 0:010c6f6ac7c0 | 6 | |
inst | 1:b85088467ae0 | 7 | template <size_t MIN, size_t MAX> |
inst | 0:010c6f6ac7c0 | 8 | class GMD { |
inst | 0:010c6f6ac7c0 | 9 | public: |
inst | 0:010c6f6ac7c0 | 10 | GMD(PinName p0, PinName p1, PinName shut_down); |
inst | 0:010c6f6ac7c0 | 11 | void set_frequency_kHz(float f_kHz); |
inst | 0:010c6f6ac7c0 | 12 | |
inst | 0:010c6f6ac7c0 | 13 | float operator=(float p); |
inst | 0:010c6f6ac7c0 | 14 | float set(float p); |
inst | 0:010c6f6ac7c0 | 15 | void release(); |
inst | 0:010c6f6ac7c0 | 16 | |
inst | 0:010c6f6ac7c0 | 17 | private: |
inst | 0:010c6f6ac7c0 | 18 | static const float _frequency_to_tick_coeff; |
inst | 0:010c6f6ac7c0 | 19 | static const uint32_t _default_frequency_kHz; |
inst | 0:010c6f6ac7c0 | 20 | |
inst | 0:010c6f6ac7c0 | 21 | FastPWM* _pwm[2]; |
inst | 0:010c6f6ac7c0 | 22 | DigitalOut _shut_down; |
inst | 0:010c6f6ac7c0 | 23 | }; |
inst | 0:010c6f6ac7c0 | 24 | |
inst | 1:b85088467ae0 | 25 | #include "GMD_impl.hpp" |
inst | 1:b85088467ae0 | 26 | |
inst | 1:b85088467ae0 | 27 | typedef GMD<0, 100> basic_motor_driver; |
inst | 1:b85088467ae0 | 28 | |
inst | 0:010c6f6ac7c0 | 29 | #endif |