#include <motor/TB9051FTGMotorCarrier.h>
Implements support for the Pololu TB9051FTG MotorCarrier (https://www.pololu.com/product/2997)
◆ TB9051FTGMotorCarrier()
Constructor.
Construct a new instance of TB9051FTGMotorCarrier.
- Parameters
-
pwm1 | The pin number connected to the PWM1 input on the motor driver carrier |
pwm2 | The pin number connected to the PWM2 input on the motor driver carrier |
en | (Optional) The pin number connected to the EN input on the motor driver carrier. Defaults to kPinNotUsed |
enb | (Optional) The pin number connected to the ENB input on the motor driver carrier. Defaults to kPinNotUsed |
ocm | (Optional) The pin number connected to the OCM output on the motor driver carrier. Defaults to kPinNotUsed |
diag | (Optional) The pin number connected to the DIAG output on the motor driver carrier. Defaults to kPinNotUsed |
occ | (Optional) The pin number connected to the OCC input on the motor driver carrier. Defaults to kPinNotUsed |
◆ disable()
void TB9051FTGMotorCarrier::disable |
( |
void |
| ) |
|
|
inline |
Disable the motor driver carrier's outputs.
◆ enable()
void TB9051FTGMotorCarrier::enable |
( |
void |
| ) |
|
|
inline |
Enable the motor driver carrier's outputs.
The motor driver carrier Initially is disabled, so it needs to be manually enabled using this function
◆ getCurrent()
float TB9051FTGMotorCarrier::getCurrent |
( |
void |
| ) |
const |
|
inline |
Reads an estimate of the motor current from the motor driver carrier.
Output is in milliamps (mA). Note: This measurement is a coarse approximation only. Consider using an external sensor for fine current measurements.
- Returns
- Current measurement in mA
◆ getDiagnostic()
uint8_t TB9051FTGMotorCarrier::getDiagnostic |
( |
void |
| ) |
const |
|
inline |
Reads the DIAG pin on the motor driver carrier.
If there is a fault, or if the motor driver carrier is disabled by the EN or ENB pins, it returns logical low (0). Otherwise, it returns logical high (1)
- Returns
- 0 if fault or disabled. 1 otherwise.
◆ setBrakeMode()
void TB9051FTGMotorCarrier::setBrakeMode |
( |
bool |
mode | ) |
|
|
inline |
Sets the brake mode for the motor driver carrier.
If the carrier is set to brake mode (mode 1), the carrier outputs will be shorted to ground when the motor stops. This acts as a brake. If the carrier is not set to brake mode (0), the carrier outputs will be left floating, so the motor will coast to a stop.
- Parameters
-
mode | Brake mode (true) or non brake mode (false). |
◆ setDeadband()
void TB9051FTGMotorCarrier::setDeadband |
( |
float |
lower, |
|
|
float |
upper |
|
) |
| |
|
inline |
Sets the dead band range.
When the throttle output value is within this range, the motor driver carrier stops the motor according to the current brake mode configuration
- Parameters
-
lower | Lower dead band value (exclusively) |
upper | Upper dead band value (exclusively) |
◆ setOccResponse()
void TB9051FTGMotorCarrier::setOccResponse |
( |
bool |
automatic | ) |
const |
|
inline |
Sets the over-current response.
If false, the motor driver carrier is disabled when an over-current event happens. The motor driver carrier can be reset by toggling either the EN pin or the ENB pin. If true, the motor driver carrier will re-enable after a short period following an over-current event.
- Parameters
-
automatic | over-current response |
◆ setOutput()
void TB9051FTGMotorCarrier::setOutput |
( |
float |
percent | ) |
const |
|
inline |
Sets the throttle output percentage [-1, 1], which is the percentage of the driver carrier's input voltage.
When the output percentage is negative, the motor will turn in reverse
- Parameters
-
percent | output throttle percentage (-1.0 - 1.0) |
◆ kPinNotUsed
constexpr uint8_t TB9051FTGMotorCarrier::kPinNotUsed {255} |
|
staticconstexpr |
The documentation for this class was generated from the following file: