Li Weiyi
/
Cube
Microduino的cube小车。
Diff: Microduino_Motor.cpp
- Revision:
- 2:70ca3e685cca
- Parent:
- 1:758ccab13947
- Child:
- 3:e4ac7c1a14de
--- a/Microduino_Motor.cpp Wed May 25 11:52:03 2016 +0000 +++ b/Microduino_Motor.cpp Wed May 25 13:25:09 2016 +0000 @@ -4,15 +4,18 @@ uint8_t MotorCount = 0; // the total number of attached keys -Motor::Motor(uint8_t _motor_pinA, uint8_t _motor_pinB) +Motor::Motor(PinName _motor_pinA, PinName _motor_pinB) { if ( MotorCount < 10) { this->motorIndex = MotorCount++; // assign a key index to this instance - if (_motor_pinA < NUM_DIGITAL_PINS && _motor_pinB < NUM_DIGITAL_PINS) { - pinMode( _motor_pinA, OUTPUT) ; + //if (_motor_pinA < NUM_DIGITAL_PINS && _motor_pinB < NUM_DIGITAL_PINS) { + if (true) { + //pinMode( _motor_pinA, OUTPUT) ; + gpio_init_out(&gpioA, _motor_pinA); motors[this->motorIndex].Pin.nbr_A = _motor_pinA; - pinMode( _motor_pinB, OUTPUT) ; + //pinMode( _motor_pinB, OUTPUT) ; + gpio_init_out(&gpioB, _motor_pinB); motors[this->motorIndex].Pin.nbr_B = _motor_pinB; this->fix=1;