|
MotorWare f2806x Driver API Documentation
|
Data Structures | |
| struct | _DRV_SPI_8301_Stat1_t_ |
| struct | _DRV_SPI_8301_Stat2_t_ |
| struct | _DRV_SPI_8301_CTRL1_t_ |
| struct | _DRV_SPI_8301_CTRL2_t_ |
| struct | _DRV_SPI_8301_Vars_t_ |
| struct | _DRV8301_Obj_ |
| Defines the DRV8301 object. More... | |
Macros | |
| #define | DRV8301_ADDR_MASK (0x7800) |
| Defines the address mask. More... | |
| #define | DRV8301_DATA_MASK (0x07FF) |
| Defines the data mask. More... | |
| #define | DRV8301_RW_MASK (0x8000) |
| Defines the R/W mask. More... | |
| #define | DRV8301_FAULT_TYPE_MASK (0x07FF) |
| Defines the R/W mask. More... | |
| #define | DRV8301_STATUS1_FETLC_OC_BITS (1 << 0) |
| Defines the location of the FETLC_OC (FET Low side, Phase C Over Current) bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS1_FETHC_OC_BITS (1 << 1) |
| Defines the location of the FETLC_OC (FET High side, Phase C Over Current) bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS1_FETLB_OC_BITS (1 << 2) |
| Defines the location of the FETLC_OC (FET Low side, Phase B Over Current) bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS1_FETHB_OC_BITS (1 << 3) |
| Defines the location of the FETLC_OC (FET High side, Phase B Over Current) bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS1_FETLA_OC_BITS (1 << 4) |
| Defines the location of the FETLC_OC (FET Low side, Phase A Over Current) bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS1_FETHA_OC_BITS (1 << 5) |
| Defines the location of the FETLC_OC (FET High side, Phase A Over Current) bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS1_OTW_BITS (1 << 6) |
| Defines the location of the OTW (Over Temperature Warning) bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS1_OTSD_BITS (1 << 7) |
| Defines the location of the OTSD (Over Temperature Shut Down) bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS1_PVDD_UV_BITS (1 << 8) |
| Defines the location of the PVDD_UV (Power supply Vdd, Under Voltage) bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS1_GVDD_UV_BITS (1 << 9) |
| Defines the location of the GVDD_UV (DRV8301 Vdd, Under Voltage) bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS1_FAULT_BITS (1 << 10) |
| Defines the location of the FAULT bits in the Status 1 register. More... | |
| #define | DRV8301_STATUS2_ID_BITS (15 << 0) |
| Defines the location of the Device ID bits in the Status 2 register. More... | |
| #define | DRV8301_STATUS2_GVDD_OV_BITS (1 << 7) |
| Defines the location of the GVDD_OV (DRV8301 Vdd, Over Voltage) bits in the Status 2 register. More... | |
| #define | DRV8301_CTRL1_GATE_CURRENT_BITS (3 << 0) |
| Defines the location of the GATE_CURRENT bits in the Control 1 register. More... | |
| #define | DRV8301_CTRL1_GATE_RESET_BITS (1 << 2) |
| Defines the location of the GATE_RESET bits in the Control 1 register. More... | |
| #define | DRV8301_CTRL1_PWM_MODE_BITS (1 << 3) |
| Defines the location of the PWM_MODE bits in the Control 1 register. More... | |
| #define | DRV8301_CTRL1_OC_MODE_BITS (3 << 4) |
| Defines the location of the OC_MODE bits in the Control 1 register. More... | |
| #define | DRV8301_CTRL1_OC_ADJ_SET_BITS (31 << 6) |
| Defines the location of the OC_ADJ bits in the Control 1 register. More... | |
| #define | DRV8301_CTRL2_OCTW_SET_BITS (3 << 0) |
| Defines the location of the OCTW_SET bits in the Control 2 register. More... | |
| #define | DRV8301_CTRL2_GAIN_BITS (3 << 2) |
| Defines the location of the GAIN bits in the Control 2 register. More... | |
| #define | DRV8301_CTRL2_DC_CAL_1_BITS (1 << 4) |
| Defines the location of the DC_CAL_1 bits in the Control 2 register. More... | |
| #define | DRV8301_CTRL2_DC_CAL_2_BITS (1 << 5) |
| Defines the location of the DC_CAL_2 bits in the Control 2 register. More... | |
| #define | DRV8301_CTRL2_OC_TOFF_BITS (1 << 6) |
| Defines the location of the OC_TOFF bits in the Control 2 register. More... | |
Typedefs | |
| typedef struct _DRV_SPI_8301_Stat1_t_ | DRV_SPI_8301_Stat1_t_ |
| typedef struct _DRV_SPI_8301_Stat2_t_ | DRV_SPI_8301_Stat2_t_ |
| typedef struct _DRV_SPI_8301_CTRL1_t_ | DRV_SPI_8301_CTRL1_t_ |
| typedef struct _DRV_SPI_8301_CTRL2_t_ | DRV_SPI_8301_CTRL2_t_ |
| typedef struct _DRV_SPI_8301_Vars_t_ | DRV_SPI_8301_Vars_t |
| typedef struct _DRV8301_Obj_ | DRV8301_Obj |
| Defines the DRV8301 object. More... | |
| typedef struct _DRV8301_Obj_ * | DRV8301_Handle |
| Defines the DRV8301 handle. More... | |
| typedef uint16_t | DRV8301_Word_t |
| Defines the DRV8301 Word type. More... | |
Functions | |
| static DRV8301_Word_t | DRV8301_buildCtrlWord (const DRV8301_CtrlMode_e ctrlMode, const DRV8301_RegName_e regName, const uint16_t data) |
| Builds the control word. More... | |
| DRV8301_DcCalMode_e | DRV8301_getDcCalMode (DRV8301_Handle handle, const DRV8301_ShuntAmpNumber_e ampNumber) |
| Gets the DC calibration mode. More... | |
| void | DRV8301_enable (DRV8301_Handle handle) |
| Enables the DRV8301. More... | |
| DRV8301_FaultType_e | DRV8301_getFaultType (DRV8301_Handle handle) |
| Gets the fault type. More... | |
| uint16_t | DRV8301_getId (DRV8301_Handle handle) |
| Gets the device ID. More... | |
| DRV8301_VdsLevel_e | DRV8301_getOcLevel (DRV8301_Handle handle) |
| Gets the over current level. More... | |
| DRV8301_OcMode_e | DRV8301_getOcMode (DRV8301_Handle handle) |
| Gets the over current mode. More... | |
| DRV8301_OcOffTimeMode_e | DRV8301_getOcOffTimeMode (DRV8301_Handle handle) |
| Gets the over current off time mode. More... | |
| DRV8301_OcTwMode_e | DRV8301_getOcTwMode (DRV8301_Handle handle) |
| Gets the over current, temperature warning mode. More... | |
| DRV8301_PeakCurrent_e | DRV8301_getPeakCurrent (DRV8301_Handle handle) |
| Gets the peak current value. More... | |
| DRV8301_PwmMode_e | DRV8301_getPwmMode (DRV8301_Handle handle) |
| Gets the PWM mode. More... | |
| DRV8301_ShuntAmpGain_e | DRV8301_getShuntAmpGain (DRV8301_Handle handle) |
| Gets the shunt amplifier gain value. More... | |
| uint16_t | DRV8301_getStatusRegister1 (DRV8301_Handle handle) |
| Gets the status register 1 value. More... | |
| uint16_t | DRV8301_getStatusRegister2 (DRV8301_Handle handle) |
| Gets the status register 2 value. More... | |
| DRV8301_Handle | DRV8301_init (void *pMemory, const size_t numBytes) |
| Initializes the DRV8301 object. More... | |
| bool | DRV8301_isFault (DRV8301_Handle handle) |
| Determines if DRV8301 fault has occurred. More... | |
| bool | DRV8301_isReset (DRV8301_Handle handle) |
| Determines if DRV8301 is in reset. More... | |
| uint16_t | DRV8301_readSpi (DRV8301_Handle handle, const DRV8301_RegName_e regName) |
| Reads data from the DRV8301 register. More... | |
| void | DRV8301_reset (DRV8301_Handle handle) |
| Resets the DRV8301. More... | |
| static void | DRV8301_resetEnableTimeout (DRV8301_Handle handle) |
| Resets the enable timeout flag. More... | |
| static void | DRV8301_resetRxTimeout (DRV8301_Handle handle) |
| Resets the RX fifo timeout flag. More... | |
| void | DRV8301_setDcCalMode (DRV8301_Handle handle, const DRV8301_ShuntAmpNumber_e ampNumber, const DRV8301_DcCalMode_e mode) |
| Sets the DC calibration mode. More... | |
| void | DRV8301_setGpioHandle (DRV8301_Handle handle, GPIO_Handle gpioHandle) |
| Sets the GPIO handle in the DRV8301. More... | |
| void | DRV8301_setGpioNumber (DRV8301_Handle handle, GPIO_Number_e gpioNumber) |
| Sets the GPIO number in the DRV8301. More... | |
| void | DRV8301_setOcLevel (DRV8301_Handle handle, const DRV8301_VdsLevel_e VdsLevel) |
| Sets the over current level in terms of Vds. More... | |
| void | DRV8301_setOcMode (DRV8301_Handle handle, const DRV8301_OcMode_e mode) |
| Sets the over current mode. More... | |
| void | DRV8301_setOcOffTimeMode (DRV8301_Handle handle, const DRV8301_OcOffTimeMode_e mode) |
| Sets the over current off time mode. More... | |
| void | DRV8301_setOcTwMode (DRV8301_Handle handle, const DRV8301_OcTwMode_e mode) |
| Sets the over current, temperature warning mode. More... | |
| void | DRV8301_setPeakCurrent (DRV8301_Handle handle, const DRV8301_PeakCurrent_e peakCurrent) |
| Sets the peak current value. More... | |
| void | DRV8301_setPwmMode (DRV8301_Handle handle, const DRV8301_PwmMode_e mode) |
| Sets the PWM mode. More... | |
| void | DRV8301_setShuntAmpGain (DRV8301_Handle handle, const DRV8301_ShuntAmpGain_e gain) |
| Sets the shunt amplifier gain value. More... | |
| void | DRV8301_setSpiHandle (DRV8301_Handle handle, SPI_Handle spiHandle) |
| Sets the SPI handle in the DRV8301. More... | |
| void | DRV8301_writeSpi (DRV8301_Handle handle, const DRV8301_RegName_e regName, const uint16_t data) |
| Writes data to the DRV8301 register. More... | |
| void | DRV8301_writeData (DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars) |
| Interface to all 8301 SPI variables. More... | |
| void | DRV8301_readData (DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars) |
| void | DRV8301_setupSpi (DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars) |
| Initialize the interface to all 8301 SPI variables. More... | |
| struct _DRV_SPI_8301_Stat1_t_ |
| struct _DRV_SPI_8301_Stat2_t_ |
| struct _DRV_SPI_8301_CTRL1_t_ |
| Data Fields | ||
|---|---|---|
| DRV8301_PeakCurrent_e | DRV8301_CURRENT | |
| DRV8301_Reset_e | DRV8301_RESET | |
| DRV8301_VdsLevel_e | OC_ADJ_SET | |
| DRV8301_OcMode_e | OC_MODE | |
| DRV8301_PwmMode_e | PWM_MODE | |
| struct _DRV_SPI_8301_CTRL2_t_ |
| Data Fields | ||
|---|---|---|
| DRV8301_DcCalMode_e | DC_CAL_CH1p2 | |
| DRV8301_ShuntAmpGain_e | GAIN | |
| DRV8301_OcOffTimeMode_e | OC_TOFF | |
| DRV8301_OcTwMode_e | OCTW_SET | |
| struct _DRV_SPI_8301_Vars_t_ |
| Data Fields | ||
|---|---|---|
| DRV_SPI_8301_CTRL1_t_ | Ctrl_Reg_1 | |
| DRV_SPI_8301_CTRL2_t_ | Ctrl_Reg_2 | |
| bool | RcvCmd | |
| bool | SndCmd | |
| DRV_SPI_8301_Stat1_t_ | Stat_Reg_1 | |
| DRV_SPI_8301_Stat2_t_ | Stat_Reg_2 | |
| struct _DRV8301_Obj_ |
| Data Fields | ||
|---|---|---|
| bool | enableTimeOut | the timeout flag for drv8301 enable |
| GPIO_Handle | gpioHandle | the gpio handle that is connected to the drv8301 enable pin |
| GPIO_Number_e | gpioNumber | the gpio number that is connected to the drv8301 enable pin |
| bool | RxTimeOut | the timeout flag for the RX fifo |
| SPI_Handle | spiHandle | the handle for the serial peripheral interface |
| #define DRV8301_ADDR_MASK (0x7800) |
| #define DRV8301_CTRL1_GATE_CURRENT_BITS (3 << 0) |
Defines the location of the GATE_CURRENT bits in the Control 1 register.
Definition at line 146 of file drv8301.h.
Referenced by DRV8301_getPeakCurrent(), DRV8301_readData(), DRV8301_setPeakCurrent(), and DRV8301_setupSpi().
| #define DRV8301_CTRL1_GATE_RESET_BITS (1 << 2) |
Defines the location of the GATE_RESET bits in the Control 1 register.
Definition at line 150 of file drv8301.h.
Referenced by DRV8301_isReset(), DRV8301_readData(), DRV8301_reset(), and DRV8301_setupSpi().
| #define DRV8301_CTRL1_OC_ADJ_SET_BITS (31 << 6) |
Defines the location of the OC_ADJ bits in the Control 1 register.
Definition at line 162 of file drv8301.h.
Referenced by DRV8301_getOcLevel(), DRV8301_readData(), DRV8301_setOcLevel(), and DRV8301_setupSpi().
| #define DRV8301_CTRL1_OC_MODE_BITS (3 << 4) |
Defines the location of the OC_MODE bits in the Control 1 register.
Definition at line 158 of file drv8301.h.
Referenced by DRV8301_getOcMode(), DRV8301_readData(), DRV8301_setOcMode(), and DRV8301_setupSpi().
| #define DRV8301_CTRL1_PWM_MODE_BITS (1 << 3) |
Defines the location of the PWM_MODE bits in the Control 1 register.
Definition at line 154 of file drv8301.h.
Referenced by DRV8301_getPwmMode(), DRV8301_readData(), DRV8301_setPwmMode(), and DRV8301_setupSpi().
| #define DRV8301_CTRL2_DC_CAL_1_BITS (1 << 4) |
Defines the location of the DC_CAL_1 bits in the Control 2 register.
Definition at line 175 of file drv8301.h.
Referenced by DRV8301_getDcCalMode(), DRV8301_readData(), DRV8301_setDcCalMode(), and DRV8301_setupSpi().
| #define DRV8301_CTRL2_DC_CAL_2_BITS (1 << 5) |
Defines the location of the DC_CAL_2 bits in the Control 2 register.
Definition at line 179 of file drv8301.h.
Referenced by DRV8301_getDcCalMode(), DRV8301_readData(), DRV8301_setDcCalMode(), and DRV8301_setupSpi().
| #define DRV8301_CTRL2_GAIN_BITS (3 << 2) |
Defines the location of the GAIN bits in the Control 2 register.
Definition at line 171 of file drv8301.h.
Referenced by DRV8301_getShuntAmpGain(), DRV8301_readData(), DRV8301_setShuntAmpGain(), and DRV8301_setupSpi().
| #define DRV8301_CTRL2_OC_TOFF_BITS (1 << 6) |
Defines the location of the OC_TOFF bits in the Control 2 register.
Definition at line 183 of file drv8301.h.
Referenced by DRV8301_getOcOffTimeMode(), DRV8301_readData(), DRV8301_setOcOffTimeMode(), and DRV8301_setupSpi().
| #define DRV8301_CTRL2_OCTW_SET_BITS (3 << 0) |
Defines the location of the OCTW_SET bits in the Control 2 register.
Definition at line 167 of file drv8301.h.
Referenced by DRV8301_getOcTwMode(), DRV8301_readData(), DRV8301_setOcTwMode(), and DRV8301_setupSpi().
| #define DRV8301_DATA_MASK (0x07FF) |
Defines the data mask.
Definition at line 77 of file drv8301.h.
Referenced by DRV8301_buildCtrlWord(), and DRV8301_readSpi().
| #define DRV8301_FAULT_TYPE_MASK (0x07FF) |
Defines the R/W mask.
Definition at line 87 of file drv8301.h.
Referenced by DRV8301_getFaultType().
| #define DRV8301_STATUS1_FAULT_BITS (1 << 10) |
Defines the location of the FAULT bits in the Status 1 register.
Definition at line 132 of file drv8301.h.
Referenced by DRV8301_enable(), DRV8301_getFaultType(), DRV8301_isFault(), DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS1_FETHA_OC_BITS (1 << 5) |
Defines the location of the FETLC_OC (FET High side, Phase A Over Current) bits in the Status 1 register.
Definition at line 112 of file drv8301.h.
Referenced by DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS1_FETHB_OC_BITS (1 << 3) |
Defines the location of the FETLC_OC (FET High side, Phase B Over Current) bits in the Status 1 register.
Definition at line 104 of file drv8301.h.
Referenced by DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS1_FETHC_OC_BITS (1 << 1) |
Defines the location of the FETLC_OC (FET High side, Phase C Over Current) bits in the Status 1 register.
Definition at line 96 of file drv8301.h.
Referenced by DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS1_FETLA_OC_BITS (1 << 4) |
Defines the location of the FETLC_OC (FET Low side, Phase A Over Current) bits in the Status 1 register.
Definition at line 108 of file drv8301.h.
Referenced by DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS1_FETLB_OC_BITS (1 << 2) |
Defines the location of the FETLC_OC (FET Low side, Phase B Over Current) bits in the Status 1 register.
Definition at line 100 of file drv8301.h.
Referenced by DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS1_FETLC_OC_BITS (1 << 0) |
Defines the location of the FETLC_OC (FET Low side, Phase C Over Current) bits in the Status 1 register.
Definition at line 92 of file drv8301.h.
Referenced by DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS1_GVDD_UV_BITS (1 << 9) |
Defines the location of the GVDD_UV (DRV8301 Vdd, Under Voltage) bits in the Status 1 register.
Definition at line 128 of file drv8301.h.
Referenced by DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS1_OTSD_BITS (1 << 7) |
Defines the location of the OTSD (Over Temperature Shut Down) bits in the Status 1 register.
Definition at line 120 of file drv8301.h.
Referenced by DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS1_OTW_BITS (1 << 6) |
Defines the location of the OTW (Over Temperature Warning) bits in the Status 1 register.
Definition at line 116 of file drv8301.h.
Referenced by DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS1_PVDD_UV_BITS (1 << 8) |
Defines the location of the PVDD_UV (Power supply Vdd, Under Voltage) bits in the Status 1 register.
Definition at line 124 of file drv8301.h.
Referenced by DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS2_GVDD_OV_BITS (1 << 7) |
Defines the location of the GVDD_OV (DRV8301 Vdd, Over Voltage) bits in the Status 2 register.
Definition at line 141 of file drv8301.h.
Referenced by DRV8301_getFaultType(), DRV8301_readData(), and DRV8301_setupSpi().
| #define DRV8301_STATUS2_ID_BITS (15 << 0) |
Defines the location of the Device ID bits in the Status 2 register.
Definition at line 137 of file drv8301.h.
Referenced by DRV8301_getId(), DRV8301_readData(), and DRV8301_setupSpi().
| typedef struct _DRV8301_Obj_* DRV8301_Handle |
| typedef struct _DRV8301_Obj_ DRV8301_Obj |
Defines the DRV8301 object.
| typedef uint16_t DRV8301_Word_t |
| typedef struct _DRV_SPI_8301_CTRL1_t_ DRV_SPI_8301_CTRL1_t_ |
| typedef struct _DRV_SPI_8301_CTRL2_t_ DRV_SPI_8301_CTRL2_t_ |
| typedef struct _DRV_SPI_8301_Stat1_t_ DRV_SPI_8301_Stat1_t_ |
| typedef struct _DRV_SPI_8301_Stat2_t_ DRV_SPI_8301_Stat2_t_ |
| typedef struct _DRV_SPI_8301_Vars_t_ DRV_SPI_8301_Vars_t |
| enum DRV8301_CtrlMode_e |
| enum DRV8301_DcCalMode_e |
Enumeration for the DC calibration modes.
| enum DRV8301_FaultType_e |
Enumeration for the fault types.
| enum DRV8301_OcMode_e |
| enum DRV8301_OcTwMode_e |
| enum DRV8301_PwmMode_e |
| enum DRV8301_RegName_e |
| enum DRV8301_Reset_e |
| enum DRV8301_VdsLevel_e |
Enumeration for the Vds level for th over current adjustment.
|
inlinestatic |
Builds the control word.
| [in] | ctrlMode | The control mode |
| [in] | regName | The register name |
| [in] | data | The data |
Definition at line 452 of file drv8301.h.
References DRV8301_DATA_MASK.
Referenced by DRV8301_readSpi(), and DRV8301_writeSpi().
| void DRV8301_enable | ( | DRV8301_Handle | handle | ) |
Enables the DRV8301.
| [in] | handle | The DRV8301 handle |
Definition at line 66 of file drv8301.c.
References DRV8301_readSpi(), DRV8301_RegName_Status_1, DRV8301_STATUS1_FAULT_BITS, _DRV8301_Obj_::enableTimeOut, GPIO_setHigh(), _DRV8301_Obj_::gpioHandle, and _DRV8301_Obj_::gpioNumber.
| DRV8301_DcCalMode_e DRV8301_getDcCalMode | ( | DRV8301_Handle | handle, |
| const DRV8301_ShuntAmpNumber_e | ampNumber | ||
| ) |
Gets the DC calibration mode.
| [in] | handle | The DRV8301 handle |
| [in] | ampNumber | The shunt amplifier number |
Definition at line 93 of file drv8301.c.
References DRV8301_CTRL2_DC_CAL_1_BITS, DRV8301_CTRL2_DC_CAL_2_BITS, DRV8301_readSpi(), DRV8301_RegName_Control_2, DRV8301_ShuntAmpNumber_1, and DRV8301_ShuntAmpNumber_2.
| DRV8301_FaultType_e DRV8301_getFaultType | ( | DRV8301_Handle | handle | ) |
Gets the fault type.
| [in] | handle | The DRV8301 handle |
Definition at line 116 of file drv8301.c.
References DRV8301_FAULT_TYPE_MASK, DRV8301_FaultType_GVDD_OV, DRV8301_FaultType_NoFault, DRV8301_readSpi(), DRV8301_RegName_Status_1, DRV8301_RegName_Status_2, DRV8301_STATUS1_FAULT_BITS, and DRV8301_STATUS2_GVDD_OV_BITS.
| uint16_t DRV8301_getId | ( | DRV8301_Handle | handle | ) |
Gets the device ID.
| [in] | handle | The DRV8301 handle |
Definition at line 145 of file drv8301.c.
References DRV8301_readSpi(), DRV8301_RegName_Status_2, and DRV8301_STATUS2_ID_BITS.
| DRV8301_VdsLevel_e DRV8301_getOcLevel | ( | DRV8301_Handle | handle | ) |
Gets the over current level.
| [in] | handle | The DRV8301 handle |
Definition at line 160 of file drv8301.c.
References DRV8301_CTRL1_OC_ADJ_SET_BITS, DRV8301_readSpi(), and DRV8301_RegName_Control_1.
| DRV8301_OcMode_e DRV8301_getOcMode | ( | DRV8301_Handle | handle | ) |
Gets the over current mode.
| [in] | handle | The DRV8301 handle |
Definition at line 174 of file drv8301.c.
References DRV8301_CTRL1_OC_MODE_BITS, DRV8301_readSpi(), and DRV8301_RegName_Control_1.
| DRV8301_OcOffTimeMode_e DRV8301_getOcOffTimeMode | ( | DRV8301_Handle | handle | ) |
Gets the over current off time mode.
| [in] | handle | The DRV8301 handle |
Definition at line 189 of file drv8301.c.
References DRV8301_CTRL2_OC_TOFF_BITS, DRV8301_readSpi(), and DRV8301_RegName_Control_2.
| DRV8301_OcTwMode_e DRV8301_getOcTwMode | ( | DRV8301_Handle | handle | ) |
Gets the over current, temperature warning mode.
| [in] | handle | The DRV8301 handle |
Definition at line 204 of file drv8301.c.
References DRV8301_CTRL2_OCTW_SET_BITS, DRV8301_readSpi(), and DRV8301_RegName_Control_2.
| DRV8301_PeakCurrent_e DRV8301_getPeakCurrent | ( | DRV8301_Handle | handle | ) |
Gets the peak current value.
| [in] | handle | The DRV8301 handle |
Definition at line 219 of file drv8301.c.
References DRV8301_CTRL1_GATE_CURRENT_BITS, DRV8301_readSpi(), and DRV8301_RegName_Control_1.
| DRV8301_PwmMode_e DRV8301_getPwmMode | ( | DRV8301_Handle | handle | ) |
Gets the PWM mode.
| [in] | handle | The DRV8301 handle |
Definition at line 234 of file drv8301.c.
References DRV8301_CTRL1_PWM_MODE_BITS, DRV8301_readSpi(), and DRV8301_RegName_Control_1.
| DRV8301_ShuntAmpGain_e DRV8301_getShuntAmpGain | ( | DRV8301_Handle | handle | ) |
Gets the shunt amplifier gain value.
| [in] | handle | The DRV8301 handle |
Definition at line 249 of file drv8301.c.
References DRV8301_CTRL2_GAIN_BITS, DRV8301_readSpi(), and DRV8301_RegName_Control_2.
| uint16_t DRV8301_getStatusRegister1 | ( | DRV8301_Handle | handle | ) |
Gets the status register 1 value.
| [in] | handle | The DRV8301 handle |
| uint16_t DRV8301_getStatusRegister2 | ( | DRV8301_Handle | handle | ) |
Gets the status register 2 value.
| [in] | handle | The DRV8301 handle |
| DRV8301_Handle DRV8301_init | ( | void * | pMemory, |
| const size_t | numBytes | ||
| ) |
Initializes the DRV8301 object.
| [in] | pMemory | A pointer to the memory for the DRV8301 object |
| [in] | numBytes | The number of bytes allocated for the DRV8301 object, bytes |
Definition at line 264 of file drv8301.c.
References DRV8301_resetEnableTimeout(), and DRV8301_resetRxTimeout().
| bool DRV8301_isFault | ( | DRV8301_Handle | handle | ) |
Determines if DRV8301 fault has occurred.
| [in] | handle | The DRV8301 handle |
Definition at line 317 of file drv8301.c.
References DRV8301_readSpi(), DRV8301_RegName_Status_1, and DRV8301_STATUS1_FAULT_BITS.
| bool DRV8301_isReset | ( | DRV8301_Handle | handle | ) |
Determines if DRV8301 is in reset.
| [in] | handle | The DRV8301 handle |
Definition at line 335 of file drv8301.c.
References DRV8301_CTRL1_GATE_RESET_BITS, DRV8301_readSpi(), and DRV8301_RegName_Control_1.
| void DRV8301_readData | ( | DRV8301_Handle | handle, |
| DRV_SPI_8301_Vars_t * | Spi_8301_Vars | ||
| ) |
| [in] | handle | The DRV8301 handle |
| [in] | Spi_8301_Vars | The (DRV_SPI_8301_Vars_t) structure that contains all DRV8301 Status/Control register options |
Definition at line 642 of file drv8301.c.
References _DRV_SPI_8301_Vars_t_::Ctrl_Reg_1, _DRV_SPI_8301_Vars_t_::Ctrl_Reg_2, _DRV_SPI_8301_CTRL2_t_::DC_CAL_CH1p2, _DRV_SPI_8301_Stat2_t_::DeviceID, DRV8301_CTRL1_GATE_CURRENT_BITS, DRV8301_CTRL1_GATE_RESET_BITS, DRV8301_CTRL1_OC_ADJ_SET_BITS, DRV8301_CTRL1_OC_MODE_BITS, DRV8301_CTRL1_PWM_MODE_BITS, DRV8301_CTRL2_DC_CAL_1_BITS, DRV8301_CTRL2_DC_CAL_2_BITS, DRV8301_CTRL2_GAIN_BITS, DRV8301_CTRL2_OC_TOFF_BITS, DRV8301_CTRL2_OCTW_SET_BITS, _DRV_SPI_8301_CTRL1_t_::DRV8301_CURRENT, DRV8301_readSpi(), DRV8301_RegName_Control_1, DRV8301_RegName_Control_2, DRV8301_RegName_Status_1, DRV8301_RegName_Status_2, _DRV_SPI_8301_CTRL1_t_::DRV8301_RESET, DRV8301_STATUS1_FAULT_BITS, DRV8301_STATUS1_FETHA_OC_BITS, DRV8301_STATUS1_FETHB_OC_BITS, DRV8301_STATUS1_FETHC_OC_BITS, DRV8301_STATUS1_FETLA_OC_BITS, DRV8301_STATUS1_FETLB_OC_BITS, DRV8301_STATUS1_FETLC_OC_BITS, DRV8301_STATUS1_GVDD_UV_BITS, DRV8301_STATUS1_OTSD_BITS, DRV8301_STATUS1_OTW_BITS, DRV8301_STATUS1_PVDD_UV_BITS, DRV8301_STATUS2_GVDD_OV_BITS, DRV8301_STATUS2_ID_BITS, _DRV_SPI_8301_Stat1_t_::FAULT, _DRV_SPI_8301_Stat1_t_::FETHA_OC, _DRV_SPI_8301_Stat1_t_::FETHB_OC, _DRV_SPI_8301_Stat1_t_::FETHC_OC, _DRV_SPI_8301_Stat1_t_::FETLA_OC, _DRV_SPI_8301_Stat1_t_::FETLB_OC, _DRV_SPI_8301_Stat1_t_::FETLC_OC, _DRV_SPI_8301_CTRL2_t_::GAIN, _DRV_SPI_8301_Stat2_t_::GVDD_OV, _DRV_SPI_8301_Stat1_t_::GVDD_UV, _DRV_SPI_8301_CTRL1_t_::OC_ADJ_SET, _DRV_SPI_8301_CTRL1_t_::OC_MODE, _DRV_SPI_8301_CTRL2_t_::OC_TOFF, _DRV_SPI_8301_CTRL2_t_::OCTW_SET, _DRV_SPI_8301_Stat1_t_::OTSD, _DRV_SPI_8301_Stat1_t_::OTW, _DRV_SPI_8301_Stat1_t_::PVDD_UV, _DRV_SPI_8301_CTRL1_t_::PWM_MODE, _DRV_SPI_8301_Vars_t_::RcvCmd, _DRV_SPI_8301_Vars_t_::Stat_Reg_1, and _DRV_SPI_8301_Vars_t_::Stat_Reg_2.
| uint16_t DRV8301_readSpi | ( | DRV8301_Handle | handle, |
| const DRV8301_RegName_e | regName | ||
| ) |
Reads data from the DRV8301 register.
| [in] | handle | The DRV8301 handle |
| [in] | regName | The register name |
Definition at line 353 of file drv8301.c.
References DRV8301_buildCtrlWord(), DRV8301_CtrlMode_Read, DRV8301_DATA_MASK, _DRV8301_Obj_::RxTimeOut, SPI_enableRxFifo(), SPI_FifoStatus_2_Words, SPI_FifoStatus_Empty, SPI_getRxFifoStatus(), SPI_readEmu(), SPI_resetRxFifo(), SPI_write(), and _DRV8301_Obj_::spiHandle.
Referenced by DRV8301_enable(), DRV8301_getDcCalMode(), DRV8301_getFaultType(), DRV8301_getId(), DRV8301_getOcLevel(), DRV8301_getOcMode(), DRV8301_getOcOffTimeMode(), DRV8301_getOcTwMode(), DRV8301_getPeakCurrent(), DRV8301_getPwmMode(), DRV8301_getShuntAmpGain(), DRV8301_isFault(), DRV8301_isReset(), DRV8301_readData(), DRV8301_reset(), DRV8301_setDcCalMode(), DRV8301_setOcLevel(), DRV8301_setOcMode(), DRV8301_setOcOffTimeMode(), DRV8301_setOcTwMode(), DRV8301_setPeakCurrent(), DRV8301_setPwmMode(), DRV8301_setShuntAmpGain(), and DRV8301_setupSpi().
| void DRV8301_reset | ( | DRV8301_Handle | handle | ) |
Resets the DRV8301.
| [in] | handle | The DRV8301 handle |
Definition at line 395 of file drv8301.c.
References DRV8301_CTRL1_GATE_RESET_BITS, DRV8301_readSpi(), DRV8301_RegName_Control_1, and DRV8301_writeSpi().
|
inlinestatic |
Resets the enable timeout flag.
| [in] | handle | The DRV8301 handle |
Definition at line 573 of file drv8301.h.
References _DRV8301_Obj_::enableTimeOut.
Referenced by DRV8301_init().
|
inlinestatic |
Resets the RX fifo timeout flag.
| [in] | handle | The DRV8301 handle |
Definition at line 585 of file drv8301.h.
References _DRV8301_Obj_::RxTimeOut.
Referenced by DRV8301_init().
| void DRV8301_setDcCalMode | ( | DRV8301_Handle | handle, |
| const DRV8301_ShuntAmpNumber_e | ampNumber, | ||
| const DRV8301_DcCalMode_e | mode | ||
| ) |
Sets the DC calibration mode.
| [in] | handle | The DRV8301 handle |
| [in] | ampNumber | The shunt amplifier number |
| [in] | mode | The DC calibration mode |
Definition at line 413 of file drv8301.c.
References DRV8301_CTRL2_DC_CAL_1_BITS, DRV8301_CTRL2_DC_CAL_2_BITS, DRV8301_readSpi(), DRV8301_RegName_Control_2, DRV8301_ShuntAmpNumber_1, DRV8301_ShuntAmpNumber_2, and DRV8301_writeSpi().
| void DRV8301_setGpioHandle | ( | DRV8301_Handle | handle, |
| GPIO_Handle | gpioHandle | ||
| ) |
Sets the GPIO handle in the DRV8301.
| [in] | handle | The DRV8301 handle |
| [in] | gpioHandle | The GPIO handle to use |
Definition at line 284 of file drv8301.c.
References _DRV8301_Obj_::gpioHandle.
| void DRV8301_setGpioNumber | ( | DRV8301_Handle | handle, |
| GPIO_Number_e | gpioNumber | ||
| ) |
Sets the GPIO number in the DRV8301.
| [in] | handle | The DRV8301 handle |
| [in] | gpioHandle | The GPIO number to use |
Definition at line 295 of file drv8301.c.
References _DRV8301_Obj_::gpioNumber.
| void DRV8301_setOcLevel | ( | DRV8301_Handle | handle, |
| const DRV8301_VdsLevel_e | VdsLevel | ||
| ) |
Sets the over current level in terms of Vds.
| [in] | handle | The DRV8301 handle |
| [in] | VdsLevel | The over current level, V |
Definition at line 442 of file drv8301.c.
References DRV8301_CTRL1_OC_ADJ_SET_BITS, DRV8301_readSpi(), DRV8301_RegName_Control_1, and DRV8301_writeSpi().
| void DRV8301_setOcMode | ( | DRV8301_Handle | handle, |
| const DRV8301_OcMode_e | mode | ||
| ) |
Sets the over current mode.
| [in] | handle | The DRV8301 handle |
| [in] | mode | The over current mode |
Definition at line 463 of file drv8301.c.
References DRV8301_CTRL1_OC_MODE_BITS, DRV8301_readSpi(), DRV8301_RegName_Control_1, and DRV8301_writeSpi().
| void DRV8301_setOcOffTimeMode | ( | DRV8301_Handle | handle, |
| const DRV8301_OcOffTimeMode_e | mode | ||
| ) |
Sets the over current off time mode.
| [in] | handle | The DRV8301 handle |
| [in] | mode | The over current off time mode |
Definition at line 484 of file drv8301.c.
References DRV8301_CTRL2_OC_TOFF_BITS, DRV8301_readSpi(), DRV8301_RegName_Control_2, and DRV8301_writeSpi().
| void DRV8301_setOcTwMode | ( | DRV8301_Handle | handle, |
| const DRV8301_OcTwMode_e | mode | ||
| ) |
Sets the over current, temperature warning mode.
| [in] | handle | The DRV8301 handle |
| [in] | mode | The over current, temperature warning mode |
Definition at line 505 of file drv8301.c.
References DRV8301_CTRL2_OCTW_SET_BITS, DRV8301_readSpi(), DRV8301_RegName_Control_2, and DRV8301_writeSpi().
| void DRV8301_setPeakCurrent | ( | DRV8301_Handle | handle, |
| const DRV8301_PeakCurrent_e | peakCurrent | ||
| ) |
Sets the peak current value.
| [in] | handle | The DRV8301 handle |
| [in] | peakCurrent | The peak current value |
Definition at line 526 of file drv8301.c.
References DRV8301_CTRL1_GATE_CURRENT_BITS, DRV8301_readSpi(), DRV8301_RegName_Control_1, and DRV8301_writeSpi().
| void DRV8301_setPwmMode | ( | DRV8301_Handle | handle, |
| const DRV8301_PwmMode_e | mode | ||
| ) |
Sets the PWM mode.
| [in] | handle | The DRV8301 handle |
| [in] | mode | The PWM mode |
Definition at line 547 of file drv8301.c.
References DRV8301_CTRL1_PWM_MODE_BITS, DRV8301_readSpi(), DRV8301_RegName_Control_1, and DRV8301_writeSpi().
| void DRV8301_setShuntAmpGain | ( | DRV8301_Handle | handle, |
| const DRV8301_ShuntAmpGain_e | gain | ||
| ) |
Sets the shunt amplifier gain value.
| [in] | handle | The DRV8301 handle |
| [in] | gain | The shunt amplifier gain value |
Definition at line 568 of file drv8301.c.
References DRV8301_CTRL2_GAIN_BITS, DRV8301_readSpi(), DRV8301_RegName_Control_2, and DRV8301_writeSpi().
| void DRV8301_setSpiHandle | ( | DRV8301_Handle | handle, |
| SPI_Handle | spiHandle | ||
| ) |
Sets the SPI handle in the DRV8301.
| [in] | handle | The DRV8301 handle |
| [in] | spiHandle | The SPI handle to use |
Definition at line 306 of file drv8301.c.
References _DRV8301_Obj_::spiHandle.
| void DRV8301_setupSpi | ( | DRV8301_Handle | handle, |
| DRV_SPI_8301_Vars_t * | Spi_8301_Vars | ||
| ) |
Initialize the interface to all 8301 SPI variables.
| [in] | handle | The DRV8301 handle |
Definition at line 695 of file drv8301.c.
References _DRV_SPI_8301_Vars_t_::Ctrl_Reg_1, _DRV_SPI_8301_Vars_t_::Ctrl_Reg_2, _DRV_SPI_8301_CTRL2_t_::DC_CAL_CH1p2, _DRV_SPI_8301_Stat2_t_::DeviceID, DRV8301_CTRL1_GATE_CURRENT_BITS, DRV8301_CTRL1_GATE_RESET_BITS, DRV8301_CTRL1_OC_ADJ_SET_BITS, DRV8301_CTRL1_OC_MODE_BITS, DRV8301_CTRL1_PWM_MODE_BITS, DRV8301_CTRL2_DC_CAL_1_BITS, DRV8301_CTRL2_DC_CAL_2_BITS, DRV8301_CTRL2_GAIN_BITS, DRV8301_CTRL2_OC_TOFF_BITS, DRV8301_CTRL2_OCTW_SET_BITS, _DRV_SPI_8301_CTRL1_t_::DRV8301_CURRENT, DRV8301_DcCalMode_Ch1_Load, DRV8301_DcCalMode_Ch2_Load, DRV8301_OcMode_CurrentLimit, DRV8301_OcOffTimeMode_Normal, DRV8301_OcTwMode_Both, DRV8301_PeakCurrent_0p25_A, DRV8301_PwmMode_Six_Inputs, DRV8301_readSpi(), DRV8301_RegName_Control_1, DRV8301_RegName_Control_2, DRV8301_RegName_Status_1, DRV8301_RegName_Status_2, _DRV_SPI_8301_CTRL1_t_::DRV8301_RESET, DRV8301_Reset_Normal, DRV8301_ShuntAmpGain_10VpV, DRV8301_STATUS1_FAULT_BITS, DRV8301_STATUS1_FETHA_OC_BITS, DRV8301_STATUS1_FETHB_OC_BITS, DRV8301_STATUS1_FETHC_OC_BITS, DRV8301_STATUS1_FETLA_OC_BITS, DRV8301_STATUS1_FETLB_OC_BITS, DRV8301_STATUS1_FETLC_OC_BITS, DRV8301_STATUS1_GVDD_UV_BITS, DRV8301_STATUS1_OTSD_BITS, DRV8301_STATUS1_OTW_BITS, DRV8301_STATUS1_PVDD_UV_BITS, DRV8301_STATUS2_GVDD_OV_BITS, DRV8301_STATUS2_ID_BITS, DRV8301_VdsLevel_0p730_V, DRV8301_writeSpi(), _DRV_SPI_8301_Stat1_t_::FAULT, _DRV_SPI_8301_Stat1_t_::FETHA_OC, _DRV_SPI_8301_Stat1_t_::FETHB_OC, _DRV_SPI_8301_Stat1_t_::FETHC_OC, _DRV_SPI_8301_Stat1_t_::FETLA_OC, _DRV_SPI_8301_Stat1_t_::FETLB_OC, _DRV_SPI_8301_Stat1_t_::FETLC_OC, _DRV_SPI_8301_CTRL2_t_::GAIN, _DRV_SPI_8301_Stat2_t_::GVDD_OV, _DRV_SPI_8301_Stat1_t_::GVDD_UV, _DRV_SPI_8301_CTRL1_t_::OC_ADJ_SET, _DRV_SPI_8301_CTRL1_t_::OC_MODE, _DRV_SPI_8301_CTRL2_t_::OC_TOFF, _DRV_SPI_8301_CTRL2_t_::OCTW_SET, _DRV_SPI_8301_Stat1_t_::OTSD, _DRV_SPI_8301_Stat1_t_::OTW, _DRV_SPI_8301_Stat1_t_::PVDD_UV, _DRV_SPI_8301_CTRL1_t_::PWM_MODE, _DRV_SPI_8301_Vars_t_::RcvCmd, _DRV_SPI_8301_Vars_t_::SndCmd, _DRV_SPI_8301_Vars_t_::Stat_Reg_1, and _DRV_SPI_8301_Vars_t_::Stat_Reg_2.
| void DRV8301_writeData | ( | DRV8301_Handle | handle, |
| DRV_SPI_8301_Vars_t * | Spi_8301_Vars | ||
| ) |
Interface to all 8301 SPI variables.
Call this function periodically to be able to read the DRV8301 Status1, Status2, Control1, and Control2 registers and write the Control1 and Control2 registers. This function updates the members of the structure DRV_SPI_8301_Vars_t. How to use in Setup Code Add the structure declaration DRV_SPI_8301_Vars_t to your code Make sure the SPI and 8301 EN_Gate GPIO are setup for the 8301 by using HAL_init and HAL_setParams During code setup, call HAL_enableDrv and HAL_setupDrvSpi In background loop, call DRV8301_writeData and DRV8301_readData How to use in Runtime Watch window Add the structure, declared by DRV_SPI_8301_Vars_t above, to the watch window Runtime Pull down the menus from the DRV_SPI_8301_Vars_t strcuture to the desired setting Set SndCmd to send the settings to the DRV8301 If a read of the DRV8301 registers is required, se RcvCmd
| [in] | handle | The DRV8301 handle |
| [in] | Spi_8301_Vars | The (DRV_SPI_8301_Vars_t) structure that contains all DRV8301 Status/Control register options |
Definition at line 610 of file drv8301.c.
References _DRV_SPI_8301_Vars_t_::Ctrl_Reg_1, _DRV_SPI_8301_Vars_t_::Ctrl_Reg_2, _DRV_SPI_8301_CTRL1_t_::DRV8301_CURRENT, DRV8301_RegName_Control_1, DRV8301_RegName_Control_2, DRV8301_writeSpi(), _DRV_SPI_8301_CTRL2_t_::OCTW_SET, and _DRV_SPI_8301_Vars_t_::SndCmd.
| void DRV8301_writeSpi | ( | DRV8301_Handle | handle, |
| const DRV8301_RegName_e | regName, | ||
| const uint16_t | data | ||
| ) |
Writes data to the DRV8301 register.
| [in] | handle | The DRV8301 handle |
| [in] | regName | The register name |
| [in] | data | The data value |
Definition at line 589 of file drv8301.c.
References DRV8301_buildCtrlWord(), DRV8301_CtrlMode_Write, SPI_enableRxFifo(), SPI_resetRxFifo(), SPI_write(), and _DRV8301_Obj_::spiHandle.
Referenced by DRV8301_reset(), DRV8301_setDcCalMode(), DRV8301_setOcLevel(), DRV8301_setOcMode(), DRV8301_setOcOffTimeMode(), DRV8301_setOcTwMode(), DRV8301_setPeakCurrent(), DRV8301_setPwmMode(), DRV8301_setShuntAmpGain(), DRV8301_setupSpi(), and DRV8301_writeData().
1.8.9.1