Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
|
A motor driver class for the DRV8847 from TI. More...
Public Member Functions | |
def | __init__ (self, timerPin, sleepPin, faultPin) |
Initializes and returns a DRV8847 object. More... | |
def | enable (self) |
Brings the DRV8847 out of sleep mode. More... | |
def | disable (self) |
Puts the DRV8847 in sleep mode. More... | |
def | fault_cb (self, IRQ_src) |
Callback function to run on fault condition. More... | |
def | motor (self, PWM_tim, IN1_pin, IN2_pin, chA, chB) |
Creates a DC motor object connected to the DRV8847. More... | |
Public Attributes | |
tim | |
tim creates new timer object for tracking time data and correlating it with encoder position. More... | |
nSLEEP | |
nSLEEP creates new pin object for enabling and disabling of the DRV8847 driver. More... | |
nFAULT | |
nFAULT creates new pin object associated with the driver fault pin. More... | |
faultInt | |
faultInt creates an external interrupt request object. More... | |
faultStatus | |
faultStatus is used to indicate the current status of the driver. More... | |
A motor driver class for the DRV8847 from TI.
Objects of this class can be used to configure the DRV8847 motor driver and to create one or more objects of the Motor class which can be used to perform motor control. Refer to the DRV8847 datasheet here: https://www.ti.com/lit/ds/symlink/drv8847.pdf
def Lab0x04_DRV8847.DRV8847.__init__ | ( | self, | |
timerPin, | |||
sleepPin, | |||
faultPin | |||
) |
def Lab0x04_DRV8847.DRV8847.disable | ( | self | ) |
Puts the DRV8847 in sleep mode.
The disable method will disable all motors controlled by the motor driver class by setting the nSLEEP pin to low.
def Lab0x04_DRV8847.DRV8847.enable | ( | self | ) |
Brings the DRV8847 out of sleep mode.
The enable method disables the faultInt external interrupt and resets the nSLEEP pin specified upon driver instatiation to 'high' before waiting 50 microseconds to re-enable faultInt in preparation for another potential fault condition occurring. This will allow the user to once again operate the motor driver.
def Lab0x04_DRV8847.DRV8847.fault_cb | ( | self, | |
IRQ_src | |||
) |
Callback function to run on fault condition.
IRQ_src | The source of the interrupt request. |
def Lab0x04_DRV8847.DRV8847.motor | ( | self, | |
PWM_tim, | |||
IN1_pin, | |||
IN2_pin, | |||
chA, | |||
chB | |||
) |
Creates a DC motor object connected to the DRV8847.
PWM_tim | The pulse-width modulation timer for control of the motor object duty cycle. |
IN1_pin | The first of two pins required to supply power to a motor. |
IN2_pin | The second of two pins required to supply power to a motor. |
chA | One of two channels which control the direction of rotation of a motor |
chB | One of two channels which control the direction of rotation of a motor. |
Lab0x04_DRV8847.DRV8847.faultInt |
faultInt creates an external interrupt request object.
Initiaties an object that represents the external interrupt request which is sent to in the event that a fault condition is encountered. This will control the faultPin.
Lab0x04_DRV8847.DRV8847.faultStatus |
faultStatus is used to indicate the current status of the driver.
faultStatus True indicates that a fault has occurred and must be cleared for continued operation of the driver. faultStatus False indicates that the driver is still operational.
Lab0x04_DRV8847.DRV8847.nFAULT |
nFAULT creates new pin object associated with the driver fault pin.
Initiates a pin corresponding to the passed in variable faultPin. This pin will be pulled logic low in the event that a fault condition is detected in either motor controlled by the DRV8847 driver.
Lab0x04_DRV8847.DRV8847.nSLEEP |
nSLEEP creates new pin object for enabling and disabling of the DRV8847 driver.
Initiates a pin corresponding to the passed in variable sleepPin. This pin corresponds to the enable/disable pin for the motor driver.
Lab0x04_DRV8847.DRV8847.tim |
tim creates new timer object for tracking time data and correlating it with encoder position.
Initiates a timer corresponding to the passed in variable timerPin.