Data transfers functions.
More...
|
void | I2C_10BitAddressHeaderCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
| Enables or disables the I2C 10-bit header only mode with read direction. More...
|
|
void | I2C_AcknowledgeConfig (I2C_TypeDef *I2Cx, FunctionalState NewState) |
| Generates I2C communication Acknowledge. More...
|
|
void | I2C_AutoEndCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
| Enables or disables the I2C automatic end mode (stop condition is automatically sent when nbytes data are transferred). More...
|
|
void | I2C_GenerateSTART (I2C_TypeDef *I2Cx, FunctionalState NewState) |
| Generates I2Cx communication START condition. More...
|
|
void | I2C_GenerateSTOP (I2C_TypeDef *I2Cx, FunctionalState NewState) |
| Generates I2Cx communication STOP condition. More...
|
|
uint8_t | I2C_GetAddressMatched (I2C_TypeDef *I2Cx) |
| Returns the I2C slave matched address . More...
|
|
uint16_t | I2C_GetTransferDirection (I2C_TypeDef *I2Cx) |
| Returns the I2C slave received request. More...
|
|
void | I2C_MasterRequestConfig (I2C_TypeDef *I2Cx, uint16_t I2C_Direction) |
| Configures the type of transfer request for the master. More...
|
|
void | I2C_NumberOfBytesConfig (I2C_TypeDef *I2Cx, uint8_t Number_Bytes) |
| Configures the number of bytes to be transmitted/received. More...
|
|
uint8_t | I2C_ReceiveData (I2C_TypeDef *I2Cx) |
| Returns the most recent received data by the I2Cx peripheral. More...
|
|
void | I2C_ReloadCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
| Enables or disables the I2C nbytes reload mode. More...
|
|
void | I2C_SendData (I2C_TypeDef *I2Cx, uint8_t Data) |
| Sends a data byte through the I2Cx peripheral. More...
|
|
void | I2C_TransferHandling (I2C_TypeDef *I2Cx, uint16_t Address, uint8_t Number_Bytes, uint32_t ReloadEndMode, uint32_t StartStopMode) |
| Handles I2Cx communication when starting transfer or during transfer (TC or TCR flag are set). More...
|
|
Data transfers functions.
Communications handling functions.
===============================================================================
##### Data transfers functions #####
===============================================================================
===============================================================================
##### Communications handling functions #####
===============================================================================
[..] This section provides a set of functions that handles I2C communication.
[..] Automatic End mode is enabled using I2C_AutoEndCmd() function. When Reload
mode is enabled via I2C_ReloadCmd() AutoEnd bit has no effect.
[..] I2C_NumberOfBytesConfig() function set the number of bytes to be transferred,
this configuration should be done before generating start condition in master
mode.
[..] When switching from master write operation to read operation in 10Bit addressing
mode, master can only sends the 1st 7 bits of the 10 bit address, followed by
Read direction by enabling HEADR bit using I2C_10BitAddressHeader() function.
[..] In master mode, when transferring more than 255 bytes Reload mode should be used
to handle communication. In the first phase of transfer, Nbytes should be set to
255. After transferring these bytes TCR flag is set and I2C_TransferHandling()
function should be called to handle remaining communication.
[..] In master mode, when software end mode is selected when all data is transferred
TC flag is set I2C_TransferHandling() function should be called to generate STOP
or generate ReStart.
Enables or disables the I2C 10-bit header only mode with read direction.
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
NewState | new state of the I2C 10-bit header only mode. This parameter can be: ENABLE or DISABLE. |
- Note
- This mode can be used only when switching from master transmitter mode to master receiver mode.
- Return values
-
Definition at line 774 of file stm32f30x_i2c.c.
Generates I2C communication Acknowledge.
Enables or disables the specified I2C acknowledge feature.
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
NewState | new state of the Acknowledge. This parameter can be: ENABLE or DISABLE. |
- Return values
-
Definition at line 799 of file stm32f30x_i2c.c.
Enables or disables the I2C automatic end mode (stop condition is automatically sent when nbytes data are transferred).
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
NewState | new state of the I2C automatic end mode. This parameter can be: ENABLE or DISABLE. |
- Note
- This function has effect if Reload mode is disabled.
- Return values
-
Definition at line 618 of file stm32f30x_i2c.c.
Generates I2Cx communication START condition.
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
NewState | new state of the I2C START condition generation. This parameter can be: ENABLE or DISABLE. |
- Return values
-
Definition at line 722 of file stm32f30x_i2c.c.
Generates I2Cx communication STOP condition.
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
NewState | new state of the I2C STOP condition generation. This parameter can be: ENABLE or DISABLE. |
- Return values
-
Definition at line 747 of file stm32f30x_i2c.c.
Returns the I2C slave matched address .
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
- Return values
-
The | value of the slave matched address . |
Definition at line 822 of file stm32f30x_i2c.c.
uint16_t I2C_GetTransferDirection |
( |
I2C_TypeDef * |
I2Cx | ) |
|
Returns the I2C slave received request.
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
- Return values
-
The | value of the received request. |
Definition at line 836 of file stm32f30x_i2c.c.
void I2C_MasterRequestConfig |
( |
I2C_TypeDef * |
I2Cx, |
|
|
uint16_t |
I2C_Direction |
|
) |
| |
Configures the type of transfer request for the master.
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
I2C_Direction | specifies the transfer request direction to be programmed. This parameter can be one of the following values:
- I2C_Direction_Transmitter: Master request a write transfer
- I2C_Direction_Receiver: Master request a read transfer
|
- Return values
-
Definition at line 696 of file stm32f30x_i2c.c.
void I2C_NumberOfBytesConfig |
( |
I2C_TypeDef * |
I2Cx, |
|
|
uint8_t |
Number_Bytes |
|
) |
| |
Configures the number of bytes to be transmitted/received.
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
Number_Bytes | specifies the number of bytes to be programmed. |
- Return values
-
Definition at line 667 of file stm32f30x_i2c.c.
Returns the most recent received data by the I2Cx peripheral.
- Parameters
-
I2Cx | where x can be 1, 2 or 3 to select the I2C peripheral. |
- Return values
-
The | value of the received data. |
Definition at line 763 of file stm32f4xx_i2c.c.
Enables or disables the I2C nbytes reload mode.
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
NewState | new state of the nbytes reload mode. This parameter can be: ENABLE or DISABLE. |
- Return values
-
Definition at line 643 of file stm32f30x_i2c.c.
Sends a data byte through the I2Cx peripheral.
- Parameters
-
I2Cx | where x can be 1, 2 or 3 to select the I2C peripheral. |
Data | Byte to be transmitted.. |
- Return values
-
Definition at line 750 of file stm32f4xx_i2c.c.
void I2C_TransferHandling |
( |
I2C_TypeDef * |
I2Cx, |
|
|
uint16_t |
Address, |
|
|
uint8_t |
Number_Bytes, |
|
|
uint32_t |
ReloadEndMode, |
|
|
uint32_t |
StartStopMode |
|
) |
| |
Handles I2Cx communication when starting transfer or during transfer (TC or TCR flag are set).
- Parameters
-
I2Cx | where x can be 1 or 2 to select the I2C peripheral. |
Address | specifies the slave address to be programmed. |
Number_Bytes | specifies the number of bytes to be programmed. This parameter must be a value between 0 and 255. |
ReloadEndMode | new state of the I2C START condition generation. This parameter can be one of the following values:
- I2C_Reload_Mode: Enable Reload mode .
- I2C_AutoEnd_Mode: Enable Automatic end mode.
- I2C_SoftEnd_Mode: Enable Software end mode.
|
StartStopMode | new state of the I2C START condition generation. This parameter can be one of the following values:
- I2C_No_StartStop: Don't Generate stop and start condition.
- I2C_Generate_Stop: Generate stop condition (Number_Bytes should be set to 0).
- I2C_Generate_Start_Read: Generate Restart for read request.
- I2C_Generate_Start_Write: Generate Restart for write request.
|
- Return values
-
Definition at line 880 of file stm32f30x_i2c.c.