48 #ifndef bsm_motor_driver_drv8706q1_h 49 #define bsm_motor_driver_drv8706q1_h 193 #ifndef DOXYGEN_SHOULD_SKIP_THIS 197 DRV8706Q1_SPI_W0_WRITE = 0,
199 DRV8706Q1_SPI_W0_READ = 1,
200 } DRV8706Q1_SPI_W0_BIT;
310 DRV8706Q1_H_BRIDGE_DRIVES drive);
322 DRV8706Q1_H_BRIDGE_DRIVES drive);
335 DRV8706Q1_PHASE_DRIVES drive);
347 DRV8706Q1_PHASE_DRIVES drive);
359 DRV8706Q1_SOLENOID_DRIVES drive);
372 DRV8706Q1_PWM_CHANNELS drvChan,
373 DRV8706Q1_HALF_BRIDGE_DRIVES drive);
387 DRV8706Q1_HALF_BRIDGE_DRIVES driveChan0,
388 DRV8706Q1_HALF_BRIDGE_DRIVES driveChan1);
401 DRV8706Q1_SOLENOID_DRIVES drive);
403 #ifndef DOXYGEN_SHOULD_SKIP_THIS 406 DRV8706Q1_SPI_W0_BIT wo_bit,
407 DRV8706Q1_SPI_ADDR addr,
432 DRV8706Q1_SPI_ADDR addr,
454 DRV8706Q1_SPI_ADDR addr,
456 return DRV8706Q1_spiCmd(drv.
spiChan,drv.
spiCS, DRV8706Q1_SPI_W0_WRITE,addr,data);
472 DRV8706Q1_SPI_ADDR addr) {
473 return DRV8706Q1_spiCmd(drv.
spiChan,drv.
spiCS, DRV8706Q1_SPI_W0_READ,addr,0x0);
485 #ifndef DOXYGEN_SHOULD_SKIP_THIS 488 DRV8706Q1_PWM_CHANNELS drvChan,
492 DRV8706Q1_PWM_CHANNELS drvChan,
509 DRV8706Q1_PWM_CHANNELS drvPwmChan,
525 DRV8706Q1_PWM_CHANNELS drvPwmChan,
DRV8706Q1_CSA_DIV csaDiv
Definition: drv8706-q1.h:275
__STATIC_INLINE void DRV8706Q1_setDrvOff(DRV8706Q1_INSTANCE drv, bool value)
Help function that controls the MCU pin connected to DrvOff pin on the motor driver.
Definition: drv8706-q1.h:573
_iq20 csaSF
Definition: drv8706-q1.h:215
SPI_CHANNELS spiChan
Definition: drv8706-q1.h:255
Definition: drv8706-q1.h:163
Definition: drv8706-q1.h:159
uint16_t DRV8706Q1_switchToPhaseDrive(DRV8706Q1_INSTANCE *drv, DRV8706Q1_PHASE_DRIVES drive)
Function will program the motor driver to switch to Phase control mode and reconfigure the pin to the...
Definition: drv8706-q1.c:270
Definition: drv8706-q1.h:94
void HAL_setGPIOOutput(GPIO_OUTPUT_PINS pin, PIN_MODE mode)
Set output pin's value.
Definition: hal.c:210
Definition: drv8706-q1.h:64
DRV8706Q1_CSA_GAINS csaGain
Definition: drv8706-q1.h:270
DRV8706Q1_PWM_CHANNELS
Represents the motor driver's input pins that expects a PWM signal.
Definition: drv8706-q1.h:127
__STATIC_INLINE void DRV8706Q1_setNHiZ1(DRV8706Q1_INSTANCE drv, bool value)
Help function that controls the MCU pin connected to nHiZ1 pin on the motor driver.
Definition: drv8706-q1.h:584
__STATIC_INLINE uint16_t DRV8706Q1_spiWriteCmd(DRV8706Q1_INSTANCE drv, DRV8706Q1_SPI_ADDR addr, uint8_t data)
Perform a SPI write operation. This function already converts the address and data to the data format...
Definition: drv8706-q1.h:453
Definition: drv8706-q1.h:151
Brushed Motor Driver Library HAL Module.
Definition: drv8706-q1.h:107
__STATIC_INLINE void DRV8706Q1_setNHiZ2(DRV8706Q1_INSTANCE drv, bool value)
Help function that controls the MCU pin connected to nHiZ2 pin on the motor driver.
Definition: drv8706-q1.h:595
Definition: drv8706-q1.h:131
void DRV8706Q1_changeHBridgeDrive(DRV8706Q1_INSTANCE drv, DRV8706Q1_H_BRIDGE_DRIVES drive)
Function will reconfigure the pins for the specific H-bridge mode configuration. Unlike DRV8706Q1_swi...
Definition: drv8706-q1.c:193
Definition: drv8706-q1.h:173
Definition: drv8706-q1.h:145
ADC_CHANS
Definition: hal.h:161
DRV8706Q1_PHASE_DRIVES
Represents all the different configurations the Phase Enable control mode supports.
Definition: drv8706-q1.h:92
void DRV8706Q1_changeSolenoidDrive(DRV8706Q1_INSTANCE drv, DRV8706Q1_SOLENOID_DRIVES drive)
Function will reconfigure the pins for the specific Solenoid mode configuration. Unlike DRV8706Q1_swi...
Definition: drv8706-q1.c:144
Definition: drv8706-q1.h:129
DRV8706Q1_SOLENOID_DRIVES
Represents all the different configurations the Solenoid control mode supports.
Definition: drv8706-q1.h:105
Definition: drv8706-q1.h:79
void DRV8706Q1_reset(DRV8706Q1_INSTANCE *drv)
This functions resets the SPI registers of the motor driver by putting it to sleep, delaying and waking it up. Note that when this function is called the motor driver sleep pin will be high. This functional internally calls DRV8706Q1_powerOnResetVal.
Definition: drv8706-q1.c:232
Definition: drv8706-q1.h:147
PWM_CHANNELS in2Ph
Definition: drv8706-q1.h:250
GPIO_INPUT_PINS nFault
Definition: drv8706-q1.h:230
_iq20 aRef_V
Definition: drv8706-q1.h:265
DRV8706Q1_CSA_DIV
Represents all the current sense amplifier reference voltage divider settings.
Definition: drv8706-q1.h:186
Definition: drv8706-q1.h:141
uint16_t DRV8706Q1_switchToHBridgeDrive(DRV8706Q1_INSTANCE *drv, DRV8706Q1_H_BRIDGE_DRIVES drive)
Function will program the motor driver to switch to H-bridge control mode and reconfigure the pin to ...
Definition: drv8706-q1.c:251
DRV8706Q1_MODES driveMode
Definition: drv8706-q1.h:285
Internal structure that represents a specific DRV8706-Q1.
Definition: drv8706-q1.h:206
Definition: drv8706-q1.h:81
void HAL_delayMilliSeconds(uint32_t num_ms)
Delay function in milliseconds.
Definition: hal.c:327
Definition: drv8706-q1.h:96
Definition: drv8706-q1.h:157
Definition: drv8706-q1.h:188
Definition: drv8706-q1.h:85
uint16_t DRV8706Q1_setCurrentSenseGain(DRV8706Q1_INSTANCE *drv, DRV8706Q1_CSA_GAINS gcsa)
Configure the CSA to the gain setting specified. This function will update the CSA_CTRL.CSA_GAIN register bitfield with the gain you specified.
Definition: drv8706-q1.c:358
GPIO_INPUT_PINS
Definition: hal.h:153
Definition: drv8706-q1.h:175
DRV8706Q1_HALF_BRIDGE_DRIVES
Represents all the different configurations the Half Bridge control mode supports.
Definition: drv8706-q1.h:116
uint16_t DRV8706Q1_spiUpdateRegister(DRV8706Q1_INSTANCE drv, DRV8706Q1_SPI_ADDR addr, uint8_t mask, uint8_t value)
Function to allow a user to modify a specific bitfield in one of the motor driver's registers...
Definition: drv8706-q1.c:240
DRV8706Q1_H_BRIDGE_DRIVES
Represents all the different configurations the H-Bridge control mode supports.
Definition: drv8706-q1.h:77
GPIO_OUTPUT_PINS nHiz2
Definition: drv8706-q1.h:240
PWM_CHANNELS
Channels described here simply references individual PWM output pins. This means a micro-controller c...
Definition: hal.h:97
void DRV8706Q1_changePhaseDrive(DRV8706Q1_INSTANCE drv, DRV8706Q1_PHASE_DRIVES drive)
Function will reconfigure the pins for the specific Phase enable mode configuration. Unlike DRV8706Q1_switchToPhaseDrive this function does not update the control mode via SPI. So the device must be configured to Phase enable mode already.
Definition: drv8706-q1.c:215
void DRV8706Q1_powerOnResetVal(DRV8706Q1_INSTANCE *drv)
Reset internal DRV structure variables to sync with the motor driver registers power on reset value...
Definition: drv8706-q1.c:60
void DRV8706Q1_changeHalfBridgeDrive(DRV8706Q1_INSTANCE drv, DRV8706Q1_PWM_CHANNELS drvChan, DRV8706Q1_HALF_BRIDGE_DRIVES drive)
Function will reconfigure the pins for the specific Half Bridge mode configuration. Unlike DRV8706Q1_switchToHalfBridgeDrive this function does not update the control mode via SPI. So the device must be configured to Phase enable mode already.
Definition: drv8706-q1.c:163
DRV8706Q1_SPI_ADDR
Represents the addresses for all the SPI registers.
Definition: drv8706-q1.h:137
Definition: drv8706-q1.h:66
__STATIC_INLINE uint16_t DRV8706Q1_spiReadCmd(DRV8706Q1_INSTANCE drv, DRV8706Q1_SPI_ADDR addr)
Perform a SPI read operation. This function converts the address to the data format required by the m...
Definition: drv8706-q1.h:471
Definition: drv8706-q1.h:109
GPIO_OUTPUT_PINS nSleep
Definition: drv8706-q1.h:220
void DRV8706Q1_setAnalogReference(DRV8706Q1_INSTANCE *drv, _iq20 aRef_V)
Set voltage connected to the motor driver's AREF pin. This value is needed to properly calculate the ...
Definition: drv8706-q1.c:354
DRV8706Q1_CSA_GAINS
Represents all the current sense amplifier gain settings.
Definition: drv8706-q1.h:171
uint16_t DRV8706Q1_switchToSolenoidDrive(DRV8706Q1_INSTANCE *drv, DRV8706Q1_SOLENOID_DRIVES drive)
Function will program the motor driver to switch to Solenoid control mode and reconfigure the pin to ...
Definition: drv8706-q1.c:303
__STATIC_INLINE void DRV8706Q1_setNSleep(DRV8706Q1_INSTANCE drv, bool value)
Help function that controls the MCU pin connected to nSleep pin on the motor driver. Note if you manually set nSLEEP low for more than 1 ms then all the register values will be reset to their default values. Therefore, it would be important to immediately call DRV8706Q1_powerOnResetVal whenver you set nSLEEP to high to make sure internal structures are sync.
Definition: drv8706-q1.h:557
Definition: drv8706-q1.h:177
Definition: drv8706-q1.h:190
Definition: drv8706-q1.h:68
Definition: drv8706-q1.h:70
void DRV8706Q1_init(DRV8706Q1_INSTANCE *drv)
Initialized critical structure representing specific instance of the motor driver. Important Not calling this function will result in unexpected results.
Definition: drv8706-q1.c:68
Definition: drv8706-q1.h:165
uint16_t DRV8706Q1_setAnalogReferenceDivider(DRV8706Q1_INSTANCE *drv, DRV8706Q1_CSA_DIV csaDiv)
Set current shunt amplifier reference voltage divider. This function will update the CSA_CTRL...
Definition: drv8706-q1.c:382
SPI_CS spiCS
Definition: drv8706-q1.h:260
void DRV8706Q1_setCurrentShuntResistor(DRV8706Q1_INSTANCE *drv, _iq20 rShunt)
Set the current shunt resistor value used by the current sense amplifier. This value needs to be set ...
Definition: drv8706-q1.c:399
GPIO_OUTPUT_PINS nHiz1
Definition: drv8706-q1.h:235
Definition: drv8706-q1.h:153
_iq20 shuntRes
Definition: drv8706-q1.h:280
DRV8706Q1_MODES
Represents the four different input control modes the DRV8706-Q1 supports.
Definition: drv8706-q1.h:61
void DRV8706Q1_setDriveDutyCycle(DRV8706Q1_INSTANCE drv, DRV8706Q1_PWM_CHANNELS drvPwmChan, uint8_t value)
Sets the duty cycle for the correct channel based on the drive specified.
Definition: drv8706-q1.c:126
uint16_t DRV8706Q1_switchToHalfBridgeDrive(DRV8706Q1_INSTANCE *drv, DRV8706Q1_HALF_BRIDGE_DRIVES driveChan0, DRV8706Q1_HALF_BRIDGE_DRIVES driveChan1)
Function will reconfigure the pins for the specific Half Bridge mode configuration. Also the control mode will be updated via SPI.
Definition: drv8706-q1.c:285
_iq20 DRV8706Q1_getCurrent(DRV8706Q1_INSTANCE drv)
Return the current read from the DRV8706-Q1 motor driver.
Definition: drv8706-q1.c:404
void DRV8706Q1_setDrivePWMFreq(DRV8706Q1_INSTANCE drv, DRV8706Q1_PWM_CHANNELS drvPwmChan, uint32_t value)
Sets the PWM frequency for the correct channel based on the drive specified.
Definition: drv8706-q1.c:107
Definition: drv8706-q1.h:149
PWM_CHANNELS in1En
Definition: drv8706-q1.h:245
Definition: drv8706-q1.h:83
Definition: drv8706-q1.h:161
GPIO_OUTPUT_PINS
Definition: hal.h:137
Definition: drv8706-q1.h:143
Definition: drv8706-q1.h:139
SPI_CS
The chip select number here has no relationship with the physical chip select that the SPI peripheral...
Definition: hal.h:123
GPIO_OUTPUT_PINS drvOff
Definition: drv8706-q1.h:225
Definition: drv8706-q1.h:120
SPI_CHANNELS
Channels described usually references individual SPI peripheral instances ie ( SCLK, PICO and POCI).
Definition: hal.h:110
Definition: drv8706-q1.h:155
Definition: drv8706-q1.h:118
Definition: drv8706-q1.h:98
Definition: drv8706-q1.h:179
ADC_CHANS adcChan
Definition: drv8706-q1.h:210