![]() |
![]() |
|
MSPM0C1106BrushedMotorControlLibrary
1.0
|
Macros | |
| #define | HIGH (PIN_MODE_OUTPUT_HIGH) |
| Set GPIO output to high. | |
| #define | LOW (PIN_MODE_OUTPUT_LOW) |
| Set GPIO output to low. | |
Enumerations | |
| enum | PIN_MODE { PIN_MODE_OUTPUT_LOW = 0, PIN_MODE_OUTPUT_HIGH, PIN_MODE_INPUT_PU, PIN_MODE_INPUT_PD, PIN_MODE_INPUT_HZ, PIN_MODE_PERIPHERAL, PIN_MODE_MAX } |
| enum | PWM_CHANNELS { PWM_CHANNEL_0 = 0, PWM_CHANNEL_1, PWM_CHANNELS_MAX } |
| Channels described here simply references individual PWM output pins. This means a micro-controller can have a single peripheral such as a timer that can be used to generate 1 or more different PWM signals. Each of those PWM signals are considered seperate PWM channels. More... | |
| enum | SPI_CHANNELS { SPI_CHANNEL_0 = 0, SPI_CHANNELS_MAX } |
| Channels described usually references individual SPI peripheral instances ie ( SCLK, PICO and POCI). More... | |
| enum | SPI_CS { SPI_CS_0 = 0, SPI_CS_1, SPI_CS_2, SPI_CS_3, SPI_CS_MAX } |
| The chip select number here has no relationship with the physical chip select that the SPI peripheral instance has. For example, SPI_CS_0 can be mapped to the peripheral's CS2 or even a GPIO pin that is being used as a chip select. More... | |
| enum | GPIO_OUTPUT_PINS { GPIO_OUTPUT_PIN_0 = 0, GPIO_OUTPUT_PIN_1, GPIO_OUTPUT_PIN_2, GPIO_OUTPUT_PIN_3, GPIO_OUTPUT_PIN_4, GPIO_OUTPUT_PINS_MAX } |
| enum | GPIO_INPUT_PINS { GPIO_INPUT_PIN_0 = 0, GPIO_INPUT_PINS_MAX } |
| enum | ADC_CHANS { ADC_CHAN_0 = 0, ADC_CHAN_1, ADC_CHANS_MAX } |
Functions | |
| void | HAL_setDutyCycle (PWM_CHANNELS pwmChan, uint8_t targetDutyCycle) |
| Sets the PWM duty cycle for a specific channel. More... | |
| void | HAL_setPWMFreq (PWM_CHANNELS pwmChan, uint32_t targetFreq) |
| Sets the PWM frequency for a specific channel. More... | |
| void | HAL_configurePWMPin (PWM_CHANNELS pwmChan, PIN_MODE mode) |
| Sets the PWM pin to specified pin mode. More... | |
| void | HAL_writeSPI8withTimeout (SPI_CHANNELS spi_chan, SPI_CS cs_chan, uint8_t data, uint32_t timeout) |
| Performs a 8-bit SPI write with timeout. More... | |
| uint8_t | HAL_readSPI8withTimeout (SPI_CHANNELS spi_chan, SPI_CS cs_chan, uint32_t timeout) |
| Performs a 8-bit SPI read with timeout. More... | |
| void | HAL_writeSPI16withTimeout (SPI_CHANNELS spi_chan, SPI_CS cs_chan, uint16_t data, int32_t timeout) |
| Performs a 16-bit SPI write with timeout. More... | |
| uint16_t | HAL_readSPI16withTimeout (SPI_CHANNELS spi_chan, SPI_CS cs_chan, int32_t timeout) |
| Performs a 16-bit SPI write with timeout. More... | |
| void | HAL_delayMicroSeconds (uint32_t num_us) |
| Delay function in microseconds. More... | |
| void | HAL_delayMilliSeconds (uint32_t num_us) |
| Delay function in milliseconds. More... | |
| bool | HAL_readGPIOInput (GPIO_INPUT_PINS pin) |
| Read GPIO input pin value. More... | |
| void | HAL_setGPIOOutput (GPIO_OUTPUT_PINS pin, PIN_MODE mode) |
| Set output pin's value. More... | |
| void | HAL_Init () |
| Function called to run initialization code needed by the HAL. | |
| void | HAL_setADCRefVoltage (ADC_CHANS adcChan, uint16_t voltage_mV) |
| Set the reference voltage that specified ADC channel is using. The software doesn't know what reference voltage is associated with the ADC channel so this needs to be manually configured. More... | |
| uint16_t | HAL_getRawADCValue (ADC_CHANS adcChan) |
| Return the latest raw ADC value from the specified ADC channel. More... | |
| uint32_t | HAL_getmVfromADC (ADC_CHANS adcChan) |
| Returns the voltage in mV read from the specified ADC channel. Important This function depends on the correct ADC reference voltage being set HAL_setADCRefVoltage. More... | |
| _iq20 | HAL_getIQ20VoltageFromADC (ADC_CHANS adcChan) |
| Returns the voltage in mV in IQ20 format read from the specified ADC channel Important This function depends on the correct ADC reference voltage being set HAL_setADCRefVoltage. More... | |
| DL_ADC12_IIDX | HAL_processADCIRQ (ADC12_Regs *adcInst) |
| Function to process ADC interrupts and read converted ADC values. Should only be used in ADC irqs. More... | |
The HAL module provides micro-controller agnostic set of application programming interfaces (APIs) to be used by other module's in the library as well as in the user's application code.
| enum PIN_MODE |
| enum PWM_CHANNELS |
Channels described here simply references individual PWM output pins. This means a micro-controller can have a single peripheral such as a timer that can be used to generate 1 or more different PWM signals. Each of those PWM signals are considered seperate PWM channels.
| Enumerator | |
|---|---|
| PWM_CHANNEL_0 | Reference the 1st generic PWM output |
| PWM_CHANNEL_1 | Reference the 2nd generic PWM output |
| PWM_CHANNELS_MAX | Indicates the max amount of PWM outputs |
| enum SPI_CHANNELS |
| enum SPI_CS |
The chip select number here has no relationship with the physical chip select that the SPI peripheral instance has. For example, SPI_CS_0 can be mapped to the peripheral's CS2 or even a GPIO pin that is being used as a chip select.
| enum GPIO_OUTPUT_PINS |
| enum GPIO_INPUT_PINS |
| enum ADC_CHANS |
| void HAL_setDutyCycle | ( | PWM_CHANNELS | pwmChan, |
| uint8_t | targetDutyCycle | ||
| ) |
Sets the PWM duty cycle for a specific channel.
| [in] | pwmChan | The targetted PWM channel |
| [in] | targetDutyCycle | The duty cycle you want the PWM channel to be set to. |
Referenced by DRV8706Q1_init(), and HAL_setPWMFreq().
| void HAL_setPWMFreq | ( | PWM_CHANNELS | pwmChan, |
| uint32_t | targetFreq | ||
| ) |
Sets the PWM frequency for a specific channel.
| [in] | pwmChan | The targetted PWM channel |
| [in] | targetFreq | Frequency you want to set PWM channel to. |
References HAL_setDutyCycle(), PWM_CHANNEL_0, and PWM_CHANNEL_1.
Referenced by DRV8706Q1_init().
| void HAL_configurePWMPin | ( | PWM_CHANNELS | pwmChan, |
| PIN_MODE | mode | ||
| ) |
Sets the PWM pin to specified pin mode.
| [in] | pwmChan | The targetted PWM channel |
| [in] | mode | Pin mode you want to configure pin to. Should only use the output or peripheral modes. Other modes may result in unexpected behavior. |
References PIN_MODE_PERIPHERAL.
Referenced by DRV8706Q1_changeHalfBridgeDrive(), DRV8706Q1_changeHBridgeDrive(), DRV8706Q1_changePhaseDrive(), and DRV8706Q1_changeSolenoidDrive().
| void HAL_writeSPI8withTimeout | ( | SPI_CHANNELS | spi_chan, |
| SPI_CS | cs_chan, | ||
| uint8_t | data, | ||
| uint32_t | timeout | ||
| ) |
Performs a 8-bit SPI write with timeout.
| [in] | spi_chan | The targetted SPI channel |
| [in] | cs_chan | The targetted SPI chip select |
| [in] | data | Data to send |
| [in] | timeout | (Not currently used) |
| uint8_t HAL_readSPI8withTimeout | ( | SPI_CHANNELS | spi_chan, |
| SPI_CS | cs_chan, | ||
| uint32_t | timeout | ||
| ) |
Performs a 8-bit SPI read with timeout.
| [in] | spi_chan | The targetted SPI channel |
| [in] | cs_chan | The targetted SPI chip select |
| [in] | timeout | (Not currently used) |
| void HAL_writeSPI16withTimeout | ( | SPI_CHANNELS | spi_chan, |
| SPI_CS | cs_chan, | ||
| uint16_t | data, | ||
| int32_t | timeout | ||
| ) |
Performs a 16-bit SPI write with timeout.
| [in] | spi_chan | The targetted SPI channel |
| [in] | cs_chan | The targetted SPI chip select |
| [in] | data | Data to send |
| [in] | timeout | (Not currently used) |
Referenced by DRV8706Q1_switchToSolenoidDrive().
| uint16_t HAL_readSPI16withTimeout | ( | SPI_CHANNELS | spi_chan, |
| SPI_CS | cs_chan, | ||
| int32_t | timeout | ||
| ) |
Performs a 16-bit SPI write with timeout.
| [in] | spi_chan | The targetted SPI channel |
| [in] | cs_chan | The targetted SPI chip select |
| [in] | timeout | (Not currently used) |
Referenced by DRV8706Q1_switchToSolenoidDrive().
| void HAL_delayMicroSeconds | ( | uint32_t | num_us | ) |
Delay function in microseconds.
| [in] | num_us | The number of microseconds you want to delay for |
| void HAL_delayMilliSeconds | ( | uint32_t | num_us | ) |
Delay function in milliseconds.
| [in] | num_us | The number of milliseconds you want to delay for |
Referenced by DRV8706Q1_reset(), and DRV8706Q1_setNSleep().
| bool HAL_readGPIOInput | ( | GPIO_INPUT_PINS | pin | ) |
Read GPIO input pin value.
| [in] | pin | The targetted pin you want to read |
References PIN_MODE_INPUT_HZ, PIN_MODE_INPUT_PD, PIN_MODE_INPUT_PU, PIN_MODE_OUTPUT_HIGH, and PIN_MODE_OUTPUT_LOW.
| void HAL_setGPIOOutput | ( | GPIO_OUTPUT_PINS | pin, |
| PIN_MODE | mode | ||
| ) |
Set output pin's value.
| [in] | pin | The targetted pin whose output value you want to set |
| [in] | mode | Pin mode you want to configure the pin to. Should only use one of the output modes |
References PIN_MODE_OUTPUT_HIGH, and PIN_MODE_OUTPUT_LOW.
Referenced by DRV8706Q1_changeHalfBridgeDrive(), DRV8706Q1_changeSolenoidDrive(), DRV8706Q1_setDrvOff(), DRV8706Q1_setNHiZ1(), DRV8706Q1_setNHiZ2(), and DRV8706Q1_setNSleep().
| void HAL_setADCRefVoltage | ( | ADC_CHANS | adcChan, |
| uint16_t | voltage_mV | ||
| ) |
Set the reference voltage that specified ADC channel is using. The software doesn't know what reference voltage is associated with the ADC channel so this needs to be manually configured.
| adcChan | The targetted adc channel |
| voltage_mV | The reference voltage in mV ie 1.32V = 1320mV |
| uint16_t HAL_getRawADCValue | ( | ADC_CHANS | adcChan | ) |
Return the latest raw ADC value from the specified ADC channel.
| adcChan | The targetted adc channel |
| uint32_t HAL_getmVfromADC | ( | ADC_CHANS | adcChan | ) |
Returns the voltage in mV read from the specified ADC channel. Important This function depends on the correct ADC reference voltage being set HAL_setADCRefVoltage.
| adcChan | The targetted adc channel |
Referenced by HAL_getIQ20VoltageFromADC().
| _iq20 HAL_getIQ20VoltageFromADC | ( | ADC_CHANS | adcChan | ) |
Returns the voltage in mV in IQ20 format read from the specified ADC channel Important This function depends on the correct ADC reference voltage being set HAL_setADCRefVoltage.
| adcChan | The ADC channel to get the voltage from. |
References HAL_getmVfromADC().
Referenced by DRV8706Q1_getCurrent().
| DL_ADC12_IIDX HAL_processADCIRQ | ( | ADC12_Regs * | adcInst | ) |
Function to process ADC interrupts and read converted ADC values. Should only be used in ADC irqs.
| adcInst | MSPM0 ADC Driverlib instance that the IRQ was for |
References ADC_CHANS_MAX.