|
TM STM32Fxxx HAL Libraries
v1.0.0
Libraries for STM32Fxxx (F0, F4 and F7 series) devices based on HAL drivers from ST from Tilen Majerle
|
Library Functions. More...
Functions | |
| void | TM_SPI_Init (SPI_TypeDef *SPIx, TM_SPI_PinsPack_t pinspack) |
| Initializes SPIx peripheral with custom pinspack and default other settings. More... | |
| void | TM_SPI_InitWithMode (SPI_TypeDef *SPIx, TM_SPI_PinsPack_t pinspack, TM_SPI_Mode_t SPI_Mode) |
| Initializes SPIx peripheral with custom pinspack and SPI mode and default other settings. More... | |
| void | TM_SPI_InitFull (SPI_TypeDef *SPIx, TM_SPI_PinsPack_t pinspack, uint16_t SPI_BaudRatePrescaler, TM_SPI_Mode_t SPI_Mode_t, uint16_t SPI_Mode, uint16_t SPI_FirstBit) |
| Initializes SPIx peripheral with custom settings. More... | |
| uint16_t | TM_SPI_GetPrescalerFromMaxFrequency (SPI_TypeDef *SPIx, uint32_t MAX_SPI_Frequency) |
| Calculates bits for SPI prescaler register to get minimal prescaler value for SPI peripheral. More... | |
| TM_SPI_DataSize_t | TM_SPI_SetDataSize (SPI_TypeDef *SPIx, TM_SPI_DataSize_t DataSize) |
| Sets data size for SPI at runtime. More... | |
| static __INLINE uint8_t | TM_SPI_Send (SPI_TypeDef *SPIx, uint8_t data) |
| Sends single byte over SPI. More... | |
| void | TM_SPI_SendMulti (SPI_TypeDef *SPIx, uint8_t *dataOut, uint8_t *dataIn, uint32_t count) |
| Sends and receives multiple bytes over SPIx. More... | |
| void | TM_SPI_WriteMulti (SPI_TypeDef *SPIx, uint8_t *dataOut, uint32_t count) |
| Writes multiple bytes over SPI. More... | |
| void | TM_SPI_ReadMulti (SPI_TypeDef *SPIx, uint8_t *dataIn, uint8_t dummy, uint32_t count) |
| Receives multiple data bytes over SPI. More... | |
| static __INLINE uint16_t | TM_SPI_Send16 (SPI_TypeDef *SPIx, uint8_t data) |
| Sends single byte over SPI. More... | |
| void | TM_SPI_SendMulti16 (SPI_TypeDef *SPIx, uint16_t *dataOut, uint16_t *dataIn, uint32_t count) |
| Sends and receives multiple bytes over SPIx in 16-bit SPI mode. More... | |
| void | TM_SPI_WriteMulti16 (SPI_TypeDef *SPIx, uint16_t *dataOut, uint32_t count) |
| Writes multiple data via SPI in 16-bit SPI mode. More... | |
| void | TM_SPI_ReadMulti16 (SPI_TypeDef *SPIx, uint16_t *dataIn, uint16_t dummy, uint32_t count) |
| Receives multiple data bytes over SPI in 16-bit SPI mode. More... | |
| void | TM_SPI_InitCustomPinsCallback (SPI_TypeDef *SPIx, uint16_t AlternateFunction) |
| Init custom SPI pins for your SPIx. This is callback function and will be called from my library if needed. More... | |
Library Functions.
| uint16_t TM_SPI_GetPrescalerFromMaxFrequency | ( | SPI_TypeDef * | SPIx, |
| uint32_t | MAX_SPI_Frequency | ||
| ) |
Calculates bits for SPI prescaler register to get minimal prescaler value for SPI peripheral.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6. Different SPIx works on different clock and is important to know for which SPI you need prescaler. |
| MAX_SPI_Frequency | Max SPI frequency you can use. Function will calculate the minimum prescaler you need for that. |
| Bits | combination for SPI_CR1 register, with aligned location already, prepared to set parameter for TM_SPI_InitFull() function. |
| void TM_SPI_Init | ( | SPI_TypeDef * | SPIx, |
| TM_SPI_PinsPack_t | pinspack | ||
| ) |
Initializes SPIx peripheral with custom pinspack and default other settings.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| pinspack | Pinspack you will use from default SPI table. This parameter can be a value of TM_SPI_PinsPack_t enumeration |
| None |
| void TM_SPI_InitCustomPinsCallback | ( | SPI_TypeDef * | SPIx, |
| uint16_t | AlternateFunction | ||
| ) |
Init custom SPI pins for your SPIx. This is callback function and will be called from my library if needed.
| *SPIx | Pointer to SPIx peripheral for which you have to set your custom pin settings |
| AlternateFunction | Alternate function number which should be used for GPIO pins |
| None |
| void TM_SPI_InitFull | ( | SPI_TypeDef * | SPIx, |
| TM_SPI_PinsPack_t | pinspack, | ||
| uint16_t | SPI_BaudRatePrescaler, | ||
| TM_SPI_Mode_t | SPI_Mode_t, | ||
| uint16_t | SPI_Mode, | ||
| uint16_t | SPI_FirstBit | ||
| ) |
Initializes SPIx peripheral with custom settings.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| pinspack | Pinspack you will use from default SPI table. This parameter can be a value of TM_SPI_PinsPack_t enumeration |
| SPI_BaudRatePrescaler | SPI baudrate prescaler. This parameter can be a value of SPI_BaudRatePrescaler |
| SPI_Mode_t | SPI mode you will use. This parameter can be a value of TM_SPI_Mode_t enumeration |
| SPI_Mode | SPI mode you will use:
|
| SPI_FirstBit | select first bit for SPI
|
| None |
| void TM_SPI_InitWithMode | ( | SPI_TypeDef * | SPIx, |
| TM_SPI_PinsPack_t | pinspack, | ||
| TM_SPI_Mode_t | SPI_Mode | ||
| ) |
Initializes SPIx peripheral with custom pinspack and SPI mode and default other settings.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| pinspack | Pinspack you will use from default SPI table. This parameter can be a value of TM_SPI_PinsPack_t enumeration |
| SPI_Mode | SPI mode you will use. This parameter can be a value of TM_SPI_Mode_t enumeration |
| None |
| void TM_SPI_ReadMulti | ( | SPI_TypeDef * | SPIx, |
| uint8_t * | dataIn, | ||
| uint8_t | dummy, | ||
| uint32_t | count | ||
| ) |
Receives multiple data bytes over SPI.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| *dataIn | Pointer to 8-bit array to save data into |
| dummy | Dummy byte to be sent over SPI, to receive data back. In most cases 0x00 or 0xFF |
| count | Number of bytes you want read from device |
| None |
| void TM_SPI_ReadMulti16 | ( | SPI_TypeDef * | SPIx, |
| uint16_t * | dataIn, | ||
| uint16_t | dummy, | ||
| uint32_t | count | ||
| ) |
Receives multiple data bytes over SPI in 16-bit SPI mode.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| *dataIn | Pointer to 16-bit array to save data into |
| dummy | Dummy 16-bit value to be sent over SPI, to receive data back. In most cases 0x00 or 0xFF |
| count | Number of 16-bit values you want read from device |
| None |
|
static |
Sends single byte over SPI.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| data | 8-bit data size to send over SPI |
| Received | byte from slave device |
|
static |
Sends single byte over SPI.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| data | 16-bit data size to send over SPI |
| Received | 16-bit value from slave device |
| void TM_SPI_SendMulti | ( | SPI_TypeDef * | SPIx, |
| uint8_t * | dataOut, | ||
| uint8_t * | dataIn, | ||
| uint32_t | count | ||
| ) |
Sends and receives multiple bytes over SPIx.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| *dataOut | Pointer to array with data to send over SPI |
| *dataIn | Pointer to array to to save incoming data |
| count | Number of bytes to send/receive over SPI |
| None |
| void TM_SPI_SendMulti16 | ( | SPI_TypeDef * | SPIx, |
| uint16_t * | dataOut, | ||
| uint16_t * | dataIn, | ||
| uint32_t | count | ||
| ) |
Sends and receives multiple bytes over SPIx in 16-bit SPI mode.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| *dataOut | Pointer to array with data to send over SPI |
| *dataIn | Pointer to array to to save incoming data |
| count | Number of 16-bit values to send/receive over SPI |
| None |
| TM_SPI_DataSize_t TM_SPI_SetDataSize | ( | SPI_TypeDef * | SPIx, |
| TM_SPI_DataSize_t | DataSize | ||
| ) |
Sets data size for SPI at runtime.
| *SPIx | Pointer to SPIx peripheral where data size will be set |
| DataSize | Datasize which will be used. This parameter can be a value of TM_SPI_DataSize_t enumeration |
| Status | of data size before changes happen |
| void TM_SPI_WriteMulti | ( | SPI_TypeDef * | SPIx, |
| uint8_t * | dataOut, | ||
| uint32_t | count | ||
| ) |
Writes multiple bytes over SPI.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| *dataOut | Pointer to array with data to send over SPI |
| count | Number of elements to send over SPI |
| None |
| void TM_SPI_WriteMulti16 | ( | SPI_TypeDef * | SPIx, |
| uint16_t * | dataOut, | ||
| uint32_t | count | ||
| ) |
Writes multiple data via SPI in 16-bit SPI mode.
| *SPIx | Pointer to SPIx peripheral you will use, where x is between 1 to 6 |
| *dataOut | Pointer to 16-bit array with data to send over SPI |
| count | Number of elements to send over SPI |
| None |