Library Functions.
More...
|
| #define | TM_I2C_DMA_Send(I2Cx, TX_Buffer, count) (TM_I2C_DMA_Transmit(I2Cx, TX_Buffer, NULL, count)) |
| | Sends data over I2C without receiving data back using DMA. More...
|
| |
| #define | TM_I2C_DMA_Receive(I2Cx, RX_Buffer, count) (TM_I2C_DMA_Transmit(I2Cx, NULL, RX_Buffer, count)) |
| | Sends dummy byte (0x00) over I2C to receive data back from slave over DMA. More...
|
| |
|
| void | TM_I2C_DMA_Init (I2C_TypeDef *I2Cx) |
| | Initializes I2C peripheral DMA. More...
|
| |
| void | TM_I2C_DMA_InitWithStreamAndChannel (I2C_TypeDef *I2Cx, DMA_Stream_TypeDef *TX_Stream, uint32_t TX_Channel, DMA_Stream_TypeDef *RX_Stream, uint32_t RX_Channel) |
| | Initializes I2C DMA functionality with custom DMA stream and channel options. More...
|
| |
| void | TM_I2C_DMA_Deinit (I2C_TypeDef *I2Cx) |
| | Deinitializes I2C DMA functionality. More...
|
| |
| uint8_t | TM_I2C_DMA_Transmit (I2C_TypeDef *I2Cx, uint8_t *TX_Buffer, uint8_t *RX_Buffer, uint16_t count) |
| | Transmits (exchanges) data over I2C with DMA. More...
|
| |
| uint8_t | TM_I2C_DMA_SendByte (I2C_TypeDef *I2Cx, uint8_t value, uint16_t count) |
| | Sends one byte value multiple times over I2C with DMA. More...
|
| |
| uint8_t | TM_I2C_DMA_SendHalfWord (I2C_TypeDef *I2Cx, uint16_t value, uint16_t count) |
| | Sends one half word value multiple times over I2C with DMA. More...
|
| |
| uint8_t | TM_I2C_DMA_Transmitting (I2C_TypeDef *I2Cx) |
| | Checks if I2C DMA is still sending/receiving data. More...
|
| |
| DMA_Stream_TypeDef * | TM_I2C_DMA_GetStreamTX (I2C_TypeDef *I2Cx) |
| | Gets TX DMA stream for specific I2C. More...
|
| |
| DMA_Stream_TypeDef * | TM_I2C_DMA_GetStreamRX (I2C_TypeDef *I2Cx) |
| | Gets RX DMA stream for specific I2C. More...
|
| |
| void | TM_I2C_DMA_EnableInterrupts (I2C_TypeDef *I2Cx) |
| | Enables DMA stream interrupts for specific I2C. More...
|
| |
| void | TM_I2C_DMA_DisableInterrupts (I2C_TypeDef *I2Cx) |
| | Disables DMA stream interrupts for specific I2C. More...
|
| |
Library Functions.
| #define TM_I2C_DMA_Receive |
( |
|
I2Cx, |
|
|
|
RX_Buffer, |
|
|
|
count |
|
) |
| (TM_I2C_DMA_Transmit(I2Cx, NULL, RX_Buffer, count)) |
Sends dummy byte (0x00) over I2C 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
-
| I2Cx | Pointer to I2Cx where DMA transmission will happen |
| RX_Buffer | Pointer to RX_Buffer where DMA will save data from I2C |
| count | Number of bytes to be received over I2C 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_I2C_DMA_Send |
( |
|
I2Cx, |
|
|
|
TX_Buffer, |
|
|
|
count |
|
) |
| (TM_I2C_DMA_Transmit(I2Cx, TX_Buffer, NULL, count)) |
Sends data over I2C without receiving data back using DMA.
- Note
- Try not to use local variables pointers for DMA memory as TX and RX Buffers
- Parameters
-
| *I2Cx | Pointer to I2Cx where DMA transmission will happen |
| *TX_Buffer | Pointer to TX_Buffer where DMA will take data to sent over I2C |
| count | Number of bytes to be send/received over I2C 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_I2C_DMA_Deinit |
( |
I2C_TypeDef * |
I2Cx | ) |
|
Deinitializes I2C DMA functionality.
- Parameters
-
| *I2Cx | Pointer to I2Cx where you want to disable DMA mode |
- Return values
-
| void TM_I2C_DMA_DisableInterrupts |
( |
I2C_TypeDef * |
I2Cx | ) |
|
Disables DMA stream interrupts for specific I2C.
- Parameters
-
| *I2Cx | Pointer to I2Cx peripheral where you want to disable DMA stream interrupts |
- Return values
-
| void TM_I2C_DMA_EnableInterrupts |
( |
I2C_TypeDef * |
I2Cx | ) |
|
Enables DMA stream interrupts for specific I2C.
- Parameters
-
| *I2Cx | Pointer to I2Cx peripheral where you want to enable DMA stream interrupts |
- Return values
-
| DMA_Stream_TypeDef* TM_I2C_DMA_GetStreamRX |
( |
I2C_TypeDef * |
I2Cx | ) |
|
Gets RX DMA stream for specific I2C.
- Parameters
-
| *I2Cx | Pointer to I2Cx peripheral where you want to get RX stream |
- Return values
-
| Pointer | to I2C DMA RX stream |
| DMA_Stream_TypeDef* TM_I2C_DMA_GetStreamTX |
( |
I2C_TypeDef * |
I2Cx | ) |
|
Gets TX DMA stream for specific I2C.
- Parameters
-
| *I2Cx | Pointer to I2Cx peripheral where you want to get TX stream |
- Return values
-
| Pointer | to I2C DMA TX stream |
| void TM_I2C_DMA_Init |
( |
I2C_TypeDef * |
I2Cx | ) |
|
Initializes I2C peripheral DMA.
- Note
- This function initializes TX and RX DMA streams for I2C
-
I2C HAVE TO be previously initialized using TM_I2C library
- Parameters
-
| *I2Cx | Pointer to I2C peripheral where you want to enable DMA None |
| void TM_I2C_DMA_InitWithStreamAndChannel |
( |
I2C_TypeDef * |
I2Cx, |
|
|
DMA_Stream_TypeDef * |
TX_Stream, |
|
|
uint32_t |
TX_Channel, |
|
|
DMA_Stream_TypeDef * |
RX_Stream, |
|
|
uint32_t |
RX_Channel |
|
) |
| |
Initializes I2C DMA functionality with custom DMA stream and channel options.
- Note
- I2C 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
-
| *I2Cx | Pointer to I2Cx 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 I2C 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 I2C in specific DMA Stream |
- Return values
-
| uint8_t TM_I2C_DMA_SendByte |
( |
I2C_TypeDef * |
I2Cx, |
|
|
uint8_t |
value, |
|
|
uint16_t |
count |
|
) |
| |
Sends one byte value multiple times over I2C with DMA.
- Parameters
-
| I2Cx | Pointer to I2Cx 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_I2C_DMA_SendHalfWord |
( |
I2C_TypeDef * |
I2Cx, |
|
|
uint16_t |
value, |
|
|
uint16_t |
count |
|
) |
| |
Sends one half word value multiple times over I2C with DMA.
- Parameters
-
| I2Cx | Pointer to I2Cx 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_I2C_DMA_Transmit |
( |
I2C_TypeDef * |
I2Cx, |
|
|
uint8_t * |
TX_Buffer, |
|
|
uint8_t * |
RX_Buffer, |
|
|
uint16_t |
count |
|
) |
| |
Transmits (exchanges) data over I2C with DMA.
- Note
- Try not to use local variables pointers for DMA memory as TX and RX Buffers
- Parameters
-
| *I2Cx | Pointer to I2Cx where DMA transmission will happen |
| *TX_Buffer | Pointer to TX_Buffer where DMA will take data to sent over I2C. 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 I2C. 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 I2C 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_I2C_DMA_Transmitting |
( |
I2C_TypeDef * |
I2Cx | ) |
|
Checks if I2C DMA is still sending/receiving data.
- Parameters
-
| *I2Cx | Pointer to I2Cx where you want to enable DMA TX mode |
- Return values
-
| Sending | status:
- 0: I2C DMA does not sending any more
- > 0: I2C DMA is still sending data
|