Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
Public Member Functions | Public Attributes | List of all members
Lab0x04_DRV8847.DRV8847 Class Reference

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...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __init__()

def Lab0x04_DRV8847.DRV8847.__init__ (   self,
  timerPin,
  sleepPin,
  faultPin 
)

Initializes and returns a DRV8847 object.

Upon calling the DRV8847 class, the init method will instantiate a motor driver object with the timerPin, sleepPin, and faultPin pins passed in by the user.

Member Function Documentation

◆ disable()

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.

◆ enable()

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.

◆ fault_cb()

def Lab0x04_DRV8847.DRV8847.fault_cb (   self,
  IRQ_src 
)

Callback function to run on fault condition.

Parameters
IRQ_srcThe source of the interrupt request.

◆ motor()

def Lab0x04_DRV8847.DRV8847.motor (   self,
  PWM_tim,
  IN1_pin,
  IN2_pin,
  chA,
  chB 
)

Creates a DC motor object connected to the DRV8847.

Returns
An object of class Motor with the specified: pulse-width modulation timer channel, input 1 and input 2 pins, and channels 1 and 2.
Parameters
PWM_timThe pulse-width modulation timer for control of the motor object duty cycle.
IN1_pinThe first of two pins required to supply power to a motor.
IN2_pinThe second of two pins required to supply power to a motor.
chAOne of two channels which control the direction of rotation of a motor
chBOne of two channels which control the direction of rotation of a motor.

Member Data Documentation

◆ faultInt

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.

◆ faultStatus

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.

◆ nFAULT

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.

◆ nSLEEP

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.

◆ tim

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.


The documentation for this class was generated from the following file: