AP1017 library for the Rev.E hardware with expanded capabilities.
Fork of AP1017 by
Diff: AP1017.h
- Revision:
- 11:ac867fa4aa10
- Parent:
- 10:16d45e3f4be3
- Child:
- 13:1bea9a9412cb
diff -r 16d45e3f4be3 -r ac867fa4aa10 AP1017.h --- a/AP1017.h Wed Nov 08 21:37:24 2017 +0000 +++ b/AP1017.h Tue May 01 21:28:57 2018 +0000 @@ -3,8 +3,6 @@ #include "mbed.h" #include "akdp_debug.h" -#include "tca9554a.h" -#include "I2C.h" /** * This is a device driver for the AP1017 with pulse width modulation. @@ -15,9 +13,9 @@ /** * Default constructor creates motors with PWM initial duty cycle of 0%. - * Motor EN pin connected to D2, INA connected to D0, INB connected to D1. + * Motor EN pin connected to D9, INA connected to D0, INB connected to D1. */ - AP1017(DigitalOut* A, DigitalOut* B, I2C* M); + AP1017(DigitalOut* InputA, DigitalOut* InputB, DigitalOut* Enable); /** * Disables PWM for the motors. @@ -72,12 +70,12 @@ * @param dc Duty cycle as a proportion (0.0 to 1.0). * @return Returns successful termination or dutyc cyle error. */ - Status setSpeed(float dc); + Status setSpeed(double dc); /** * Returns the currently set speed as a percentage. */ - float getSpeed(void); + double getSpeed(void); /** * Engages the motor. @@ -117,14 +115,12 @@ private: bool motorOn; // Status flag for the motor - float dutyCycle; // Given as proportion: 0.00 to 1.00 + double dutyCycle; // Given as proportion: 0.00 to 1.00 Rotation direction; - TCA9554A *motor; // Motor object - I2C* i2cMotor; - DigitalOut* inA; DigitalOut* inB; + DigitalOut* en; /* inA=L, inB=L -> Standby (Coast) * inA=H, inB=L -> Forward (CW) * inA=L, inB=H -> Reverse (CCW)