![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Microduino的cube小车。
Diff: Microduino_Motor.h
- Revision:
- 3:e4ac7c1a14de
- Parent:
- 2:70ca3e685cca
- Child:
- 4:0670023d3f36
--- a/Microduino_Motor.h Wed May 25 13:25:09 2016 +0000 +++ b/Microduino_Motor.h Fri May 27 01:44:31 2016 +0000 @@ -7,10 +7,18 @@ #define CHAN_LEFT 0 #define CHAN_RIGHT 1 +#if 0 typedef struct { uint8_t nbr_A :6 ; uint8_t nbr_B :6 ; -} MotorPin_t ; +} MotorPin_t; +#else +typedef struct { + PinName nbr_A; + PinName nbr_B; +} MotorPin_t; + +#endif typedef struct { MotorPin_t Pin; @@ -30,8 +38,9 @@ float fix; int16_t _motor_vol; protected: - gpio_t gpioA; - gpio_t gpioB; + pwmout_t _pwmA; + pwmout_t _pwmB; + uint16_t _period_us; }; #endif \ No newline at end of file