p kj
/
MKS22-CubeFine
LPC824
Fork of CubeFine by
Microduino_Motor.h
- Committer:
- lixianyu
- Date:
- 2016-06-02
- Revision:
- 0:362c1482232c
- Child:
- 2:7964622fb5a5
File content as of revision 0:362c1482232c:
#ifndef Motor_h #define Motor_h //#include "Arduino.h" #include "mbed.h" #define CHAN_LEFT 0 #define CHAN_RIGHT 1 #if 0 typedef struct { uint8_t nbr_A :6 ; uint8_t nbr_B :6 ; } MotorPin_t; #else typedef struct { PinName nbr_A; PinName nbr_B; } MotorPin_t; #endif typedef struct { MotorPin_t Pin; } motor_t; class Motor { public: Motor(PinName _motor_pinA, PinName _motor_pinB); void Fix(float _fix); void Driver(int16_t _motor_driver); void Free(); void Brake(); int16_t GetData(int16_t _throttle, int16_t _steering, uint8_t _dir); private: uint8_t motorIndex; // index into the channel data for this key float fix; int16_t _motor_vol; protected: pwmout_t _pwmA; pwmout_t _pwmB; int _period_us; }; #endif