dsaf
Fork of a4998 by
a4988.h@1:ab0f997c2d9c, 2018-05-08 (annotated)
- Committer:
- brainliang
- Date:
- Tue May 08 01:19:00 2018 +0000
- Revision:
- 1:ab0f997c2d9c
- Parent:
- 0:173936452e07
fds
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
glintligo | 0:173936452e07 | 1 | #ifndef __A4988_H |
glintligo | 0:173936452e07 | 2 | #define __A4988_H |
glintligo | 0:173936452e07 | 3 | #endif |
glintligo | 0:173936452e07 | 4 | |
glintligo | 0:173936452e07 | 5 | #include "mbed.h" |
glintligo | 0:173936452e07 | 6 | //class Stepper; |
glintligo | 0:173936452e07 | 7 | //typedef void (Stepper::*pClassFun)(); |
glintligo | 0:173936452e07 | 8 | class Stepper |
glintligo | 0:173936452e07 | 9 | { |
glintligo | 0:173936452e07 | 10 | public: |
glintligo | 0:173936452e07 | 11 | Stepper(PinName _en,PinName _stepPin, PinName _direction); |
brainliang | 1:ab0f997c2d9c | 12 | void step(int dir, int frequency ,volatile int _remain); //方向,频率,步数3个参数 |
glintligo | 0:173936452e07 | 13 | void enable(); |
glintligo | 0:173936452e07 | 14 | void disable(); |
glintligo | 0:173936452e07 | 15 | private: |
glintligo | 0:173936452e07 | 16 | DigitalOut en; |
glintligo | 0:173936452e07 | 17 | DigitalOut stepPin; |
glintligo | 0:173936452e07 | 18 | DigitalOut direction; |
glintligo | 0:173936452e07 | 19 | volatile int remain; |
glintligo | 0:173936452e07 | 20 | Ticker step_ticker; |
glintligo | 0:173936452e07 | 21 | void step_control(); |
glintligo | 0:173936452e07 | 22 | // pClassFun fun; |
glintligo | 0:173936452e07 | 23 | }; |