This class implements a motor driver for the ME405 board. More...
Public Member Functions | |
def | __init__ (self, nSLEEP_pin, IN1_pin, IN2_pin, timer, ch1, ch2) |
Creates a motor driver by initializing GPIO pins and turning the motor off for safety. More... | |
def | enable (self) |
method is called when the user desires to enable the motor. More... | |
def | disable (self) |
method is called when the user desires to disable the motor. More... | |
def | set_duty (self, duty) |
This method sets the duty cycle to be sent to the motor to the given level. More... | |
Public Attributes | |
nSLEEP_pin | |
init pin connected to nsleep DRV8847 Pin as output | |
IN1_pin | |
init DRV8847 Pin IN1 which will be used to drive the motor in either a forward or reverse direction | |
IN2_pin | |
init DRV8847 Pin IN1 which will be used to drive the motor in either a forward or reverse direction | |
timer | |
init timer (fill in once you better understand this oned) | |
ch1 | |
specifies which channel to use for timer | |
ch2 | |
specifies which channel to use for timer | |
t3ch1 | |
init timer 3 channel 1 | |
t3ch2 | |
init timer 3 channel 2 | |
nFault | |
flag to indicate nFault | |
FaultInt | |
interrupt that is called when the nfault pin is high | |
duty | |
DRV8847 Pin IN1 goes "high" (with associated duty cycle) More... | |
This class implements a motor driver for the ME405 board.
def MotorDriver.MotorDriver.__init__ | ( | self, | |
nSLEEP_pin, | |||
IN1_pin, | |||
IN2_pin, | |||
timer, | |||
ch1, | |||
ch2 | |||
) |
Creates a motor driver by initializing GPIO pins and turning the motor off for safety.
nSLEEP_pin | A pyb.Pin object to use as the enable pin. |
IN1_pin | A pyb.Pin object to use as the input to half bridge 1. |
IN2_pin | A pyb.Pin object to use as the input to half bridge 2. |
timer | A pyb.Timer object to use for PWM generation on IN1_pin and IN2_pin. |
ch1 | A value to select the channel on the timer |
ch2 | A value to select the channel on the timer |
def MotorDriver.MotorDriver.disable | ( | self | ) |
method is called when the user desires to disable the motor.
This sets the output of nsleep DRV8847 Pin to 0 (low).
def MotorDriver.MotorDriver.enable | ( | self | ) |
method is called when the user desires to enable the motor.
This sets the output of nsleep DRV8847 Pin to 1 (high).
def MotorDriver.MotorDriver.set_duty | ( | self, | |
duty | |||
) |
This method sets the duty cycle to be sent to the motor to the given level.
Positive values cause effort in one direction, negative values in the opposite direction.
duty | A signed integer holding the duty cycle of the PWM signal sent to the motor |
MotorDriver.MotorDriver.duty |
DRV8847 Pin IN1 goes "high" (with associated duty cycle)
DRV8847 Pin IN2 goes low