Library Functions.
More...
|
| #define | TM_SPI_DMA_Send(SPIx, TX_Buffer, count) (TM_SPI_DMA_Transmit(SPIx, TX_Buffer, NULL, count)) |
| | Sends data over SPI without receiving data back using DMA. More...
|
| |
| #define | TM_SPI_DMA_Receive(SPIx, RX_Buffer, count) (TM_SPI_DMA_Transmit(SPIx, NULL, RX_Buffer, count)) |
| | Sends dummy byte (0x00) over SPI to receive data back from slave over DMA. More...
|
| |
|
| void | TM_SPI_DMA_Init (SPI_TypeDef *SPIx) |
| | Initializes SPI peripheral DMA. More...
|
| |
| void | TM_SPI_DMA_InitWithStreamAndChannel (SPI_TypeDef *SPIx, DMA_Stream_TypeDef *TX_Stream, uint32_t TX_Channel, DMA_Stream_TypeDef *RX_Stream, uint32_t RX_Channel) |
| | Initializes SPI DMA functionality with custom DMA stream and channel options. More...
|
| |
| void | TM_SPI_DMA_Deinit (SPI_TypeDef *SPIx) |
| | Deinitializes SPI DMA functionality. More...
|
| |
| uint8_t | TM_SPI_DMA_Transmit (SPI_TypeDef *SPIx, uint8_t *TX_Buffer, uint8_t *RX_Buffer, uint16_t count) |
| | Transmits (exchanges) data over SPI with DMA. More...
|
| |
| uint8_t | TM_SPI_DMA_SendByte (SPI_TypeDef *SPIx, uint8_t value, uint16_t count) |
| | Sends one byte value multiple times over SPI with DMA. More...
|
| |
| uint8_t | TM_SPI_DMA_SendHalfWord (SPI_TypeDef *SPIx, uint16_t value, uint16_t count) |
| | Sends one half word value multiple times over SPI with DMA. More...
|
| |
| uint8_t | TM_SPI_DMA_Transmitting (SPI_TypeDef *SPIx) |
| | Checks if SPI DMA is still sending/receiving data. More...
|
| |
| DMA_Stream_TypeDef * | TM_SPI_DMA_GetStreamTX (SPI_TypeDef *SPIx) |
| | Gets TX DMA stream for specific SPI. More...
|
| |
| DMA_Stream_TypeDef * | TM_SPI_DMA_GetStreamRX (SPI_TypeDef *SPIx) |
| | Gets RX DMA stream for specific SPI. More...
|
| |
| void | TM_SPI_DMA_EnableInterrupts (SPI_TypeDef *SPIx) |
| | Enables DMA stream interrupts for specific SPI. More...
|
| |
| void | TM_SPI_DMA_DisableInterrupts (SPI_TypeDef *SPIx) |
| | Disables DMA stream interrupts for specific SPI. More...
|
| |
Library Functions.
| #define TM_SPI_DMA_Receive |
( |
|
SPIx, |
|
|
|
RX_Buffer, |
|
|
|
count |
|
) |
| (TM_SPI_DMA_Transmit(SPIx, NULL, RX_Buffer, count)) |
Sends dummy byte (0x00) over SPI to receive data back from slave over DMA.
- Note
- Try not to use local variables pointers for DMA memory as TX and RX Buffers
- Parameters
-
| SPIx | Pointer to SPIx where DMA transmission will happen |
| RX_Buffer | Pointer to RX_Buffer where DMA will save data from SPI |
| count | Number of bytes to be received over SPI with DMA |
- Return values
-
| Receiving | started status:
- 0: DMA has not started with sending data
- > 0: DMA has started with sending data
|
- Note
- Defined as macro for faster execution
| #define TM_SPI_DMA_Send |
( |
|
SPIx, |
|
|
|
TX_Buffer, |
|
|
|
count |
|
) |
| (TM_SPI_DMA_Transmit(SPIx, TX_Buffer, NULL, count)) |
Sends data over SPI without receiving data back using DMA.
- Note
- Try not to use local variables pointers for DMA memory as TX and RX Buffers
- Parameters
-
| *SPIx | Pointer to SPIx where DMA transmission will happen |
| *TX_Buffer | Pointer to TX_Buffer where DMA will take data to sent over SPI |
| count | Number of bytes to be send/received over SPI with DMA |
- Return values
-
| Sending | started status:
- 0: DMA has not started with sending data
- > 0: DMA has started with sending data
|
- Note
- Defined as macro for faster execution
| void TM_SPI_DMA_Deinit |
( |
SPI_TypeDef * |
SPIx | ) |
|
Deinitializes SPI DMA functionality.
- Parameters
-
| *SPIx | Pointer to SPIx where you want to disable DMA mode |
- Return values
-
| void TM_SPI_DMA_DisableInterrupts |
( |
SPI_TypeDef * |
SPIx | ) |
|
Disables DMA stream interrupts for specific SPI.
- Parameters
-
| *SPIx | Pointer to SPIx peripheral where you want to disable DMA stream interrupts |
- Return values
-
| void TM_SPI_DMA_EnableInterrupts |
( |
SPI_TypeDef * |
SPIx | ) |
|
Enables DMA stream interrupts for specific SPI.
- Parameters
-
| *SPIx | Pointer to SPIx peripheral where you want to enable DMA stream interrupts |
- Return values
-
| DMA_Stream_TypeDef* TM_SPI_DMA_GetStreamRX |
( |
SPI_TypeDef * |
SPIx | ) |
|
Gets RX DMA stream for specific SPI.
- Parameters
-
| *SPIx | Pointer to SPIx peripheral where you want to get RX stream |
- Return values
-
| Pointer | to SPI DMA RX stream |
| DMA_Stream_TypeDef* TM_SPI_DMA_GetStreamTX |
( |
SPI_TypeDef * |
SPIx | ) |
|
Gets TX DMA stream for specific SPI.
- Parameters
-
| *SPIx | Pointer to SPIx peripheral where you want to get TX stream |
- Return values
-
| Pointer | to SPI DMA TX stream |
| void TM_SPI_DMA_Init |
( |
SPI_TypeDef * |
SPIx | ) |
|
Initializes SPI peripheral DMA.
- Note
- This function initializes TX and RX DMA streams for SPI
-
SPI HAVE TO be previously initialized using TM_SPI library
- Parameters
-
| *SPIx | Pointer to SPI peripheral where you want to enable DMA None |
| void TM_SPI_DMA_InitWithStreamAndChannel |
( |
SPI_TypeDef * |
SPIx, |
|
|
DMA_Stream_TypeDef * |
TX_Stream, |
|
|
uint32_t |
TX_Channel, |
|
|
DMA_Stream_TypeDef * |
RX_Stream, |
|
|
uint32_t |
RX_Channel |
|
) |
| |
Initializes SPI DMA functionality with custom DMA stream and channel options.
- Note
- SPI HAVE TO be previously initialized using TM_USART library
-
Use this function only in case default Stream and Channel settings are not good for you
- Parameters
-
| *SPIx | Pointer to SPIx where you want to set custom DMA streams and channels |
| *TX_Stream | Pointer to DMAy_Streamx, where y is DMA (1 or 2) and x is Stream (0 to 7) |
| TX_Channel | Select DMA TX channel for your SPI in specific DMA Stream |
| *RX_Stream | Pointer to DMAy_Streamx, where y is DMA (1 or 2) and x is Stream (0 to 7) |
| RX_Channel | Select DMA RX channel for your SPI in specific DMA Stream |
- Return values
-
| uint8_t TM_SPI_DMA_SendByte |
( |
SPI_TypeDef * |
SPIx, |
|
|
uint8_t |
value, |
|
|
uint16_t |
count |
|
) |
| |
Sends one byte value multiple times over SPI with DMA.
- Parameters
-
| SPIx | Pointer to SPIx where DMA transmission will happen |
| value | Byte value to be sent |
| count | Number of bytes with value of
|
- Return values
-
| Transmission | started status:
- 0: DMA has not started with sending data
- > 0: DMA has started with sending data
|
| uint8_t TM_SPI_DMA_SendHalfWord |
( |
SPI_TypeDef * |
SPIx, |
|
|
uint16_t |
value, |
|
|
uint16_t |
count |
|
) |
| |
Sends one half word value multiple times over SPI with DMA.
- Parameters
-
| SPIx | Pointer to SPIx where DMA transmission will happen |
| value | Byte value to be sent |
| count | Number of half words with value of
|
- Return values
-
| Transmission | started status:
- 0: DMA has not started with sending data
- > 0: DMA has started with sending data
|
| uint8_t TM_SPI_DMA_Transmit |
( |
SPI_TypeDef * |
SPIx, |
|
|
uint8_t * |
TX_Buffer, |
|
|
uint8_t * |
RX_Buffer, |
|
|
uint16_t |
count |
|
) |
| |
Transmits (exchanges) data over SPI with DMA.
- Note
- Try not to use local variables pointers for DMA memory as TX and RX Buffers
- Parameters
-
| *SPIx | Pointer to SPIx where DMA transmission will happen |
| *TX_Buffer | Pointer to TX_Buffer where DMA will take data to sent over SPI. Set this parameter to NULL, if you want to sent "0x00" and only receive data into *RX_Buffer pointer |
| *RX_Buffer | Pointer to RX_Buffer where DMA will save data from SPI. Set this parameter to NULL, if you don't want to receive any data, only sent from TX_Buffer |
| count | Number of bytes to be send/received over SPI with DMA |
- Return values
-
| Transmission | started status:
- 0: DMA has not started with sending data
- > 0: DMA has started with sending data
|
| uint8_t TM_SPI_DMA_Transmitting |
( |
SPI_TypeDef * |
SPIx | ) |
|
Checks if SPI DMA is still sending/receiving data.
- Parameters
-
| *SPIx | Pointer to SPIx where you want to enable DMA TX mode |
- Return values
-
| Sending | status:
- 0: SPI DMA does not sending any more
- > 0: SPI DMA is still sending data
|