test

Dependencies:   mbed

Fork of CubeFine by Li Weiyi

Committer:
beian10
Date:
Mon Jul 04 07:17:39 2016 +0000
Revision:
2:7964622fb5a5
Parent:
0:362c1482232c
V2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lixianyu 0:362c1482232c 1 #ifndef Motor_h
lixianyu 0:362c1482232c 2 #define Motor_h
lixianyu 0:362c1482232c 3
lixianyu 0:362c1482232c 4 #include "mbed.h"
lixianyu 0:362c1482232c 5
lixianyu 0:362c1482232c 6 #define CHAN_LEFT 0
lixianyu 0:362c1482232c 7 #define CHAN_RIGHT 1
lixianyu 0:362c1482232c 8
lixianyu 0:362c1482232c 9 typedef struct {
lixianyu 0:362c1482232c 10 PinName nbr_A;
lixianyu 0:362c1482232c 11 PinName nbr_B;
lixianyu 0:362c1482232c 12 } MotorPin_t;
lixianyu 0:362c1482232c 13
lixianyu 0:362c1482232c 14
lixianyu 0:362c1482232c 15 typedef struct {
lixianyu 0:362c1482232c 16 MotorPin_t Pin;
lixianyu 0:362c1482232c 17 } motor_t;
lixianyu 0:362c1482232c 18
lixianyu 0:362c1482232c 19 class Motor
lixianyu 0:362c1482232c 20 {
lixianyu 0:362c1482232c 21 public:
lixianyu 0:362c1482232c 22 Motor(PinName _motor_pinA, PinName _motor_pinB);
lixianyu 0:362c1482232c 23 void Fix(float _fix);
lixianyu 0:362c1482232c 24 void Driver(int16_t _motor_driver);
lixianyu 0:362c1482232c 25 void Free();
lixianyu 0:362c1482232c 26 void Brake();
lixianyu 0:362c1482232c 27 int16_t GetData(int16_t _throttle, int16_t _steering, uint8_t _dir);
lixianyu 0:362c1482232c 28 private:
beian10 2:7964622fb5a5 29 // uint8_t motorIndex; // index into the channel data for this key
lixianyu 0:362c1482232c 30 float fix;
lixianyu 0:362c1482232c 31 int16_t _motor_vol;
lixianyu 0:362c1482232c 32 protected:
lixianyu 0:362c1482232c 33 pwmout_t _pwmA;
beian10 2:7964622fb5a5 34 gpio_t gpioB;
lixianyu 0:362c1482232c 35 int _period_us;
lixianyu 0:362c1482232c 36 };
lixianyu 0:362c1482232c 37
lixianyu 0:362c1482232c 38 #endif