Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
Public Member Functions | Public Attributes | List of all members
Lab0x03_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
 
 nSLEEP
 
 nFAULT
 
 faultInt
 
 faultStatus
 

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 Lab0x03_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 Lab0x03_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 Lab0x03_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 Lab0x03_DRV8847.DRV8847.fault_cb (   self,
  IRQ_src 
)

Callback function to run on fault condition.

Parameters
IRQ_srcThe source of the interrupt request.
nFAULTFault indication pin. This pin is pulled logic low by a fault condition interrupt request. This open-drain output requires an external pullup resistor. The associated pin is also used as an input pin for the DRV8847S device for releasing the I2C bus.

◆ motor()

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

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