Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more
Initialization and Configuration functions
[I2C_Private_Functions]
Initialization and Configuration functions. More...
Functions | |
void | I2C_DeInit (I2C_TypeDef *I2Cx) |
Deinitializes the I2Cx peripheral registers to their default reset values. | |
void | I2C_Init (I2C_TypeDef *I2Cx, I2C_InitTypeDef *I2C_InitStruct) |
Initializes the I2Cx peripheral according to the specified parameters in the I2C_InitStruct. | |
void | I2C_StructInit (I2C_InitTypeDef *I2C_InitStruct) |
Fills each I2C_InitStruct member with its default value. | |
void | I2C_Cmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the specified I2C peripheral. | |
void | I2C_SoftwareResetCmd (I2C_TypeDef *I2Cx) |
Enables or disables the specified I2C software reset. | |
void | I2C_ITConfig (I2C_TypeDef *I2Cx, uint32_t I2C_IT, FunctionalState NewState) |
Enables or disables the specified I2C interrupts. | |
void | I2C_StretchClockCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the I2C Clock stretching. | |
void | I2C_StopModeCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables I2C wakeup from stop mode. | |
void | I2C_DualAddressCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the I2C own address 2. | |
void | I2C_OwnAddress2Config (I2C_TypeDef *I2Cx, uint16_t Address, uint8_t Mask) |
Configures the I2C slave own address 2 and mask. | |
void | I2C_GeneralCallCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the I2C general call mode. | |
void | I2C_SlaveByteControlCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the I2C slave byte control. | |
void | I2C_SlaveAddressConfig (I2C_TypeDef *I2Cx, uint16_t Address) |
Configures the slave address to be transmitted after start generation. | |
void | I2C_10BitAddressingModeCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the I2C 10-bit addressing mode for the master. |
Detailed Description
Initialization and Configuration functions.
=============================================================================== ##### Initialization and Configuration functions ##### =============================================================================== [..] This section provides a set of functions allowing to initialize the I2C Mode, I2C Timing, I2C filters, I2C Addressing mode, I2C OwnAddress1. [..] The I2C_Init() function follows the I2C configuration procedures (these procedures are available in reference manual). [..] When the Software Reset is performed using I2C_SoftwareResetCmd() function, the internal states machines are reset and communication control bits, as well as status bits come back to their reset value. [..] Before enabling Stop mode using I2C_StopModeCmd() I2C Clock source must be set to HSI and Digital filters must be disabled. [..] Before enabling Own Address 2 via I2C_DualAddressCmd() function, OA2 and mask should be configured using I2C_OwnAddress2Config() function. [..] I2C_SlaveByteControlCmd() enable Slave byte control that allow user to get control of each byte in slave mode when NBYTES is set to 0x01.
Function Documentation
void I2C_10BitAddressingModeCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the I2C 10-bit addressing mode for the master.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. NewState,: new state of the I2C 10-bit addressing mode. This parameter can be: ENABLE or DISABLE.
- Note:
- This function should be called before generating start condition.
- Return values:
-
None
Definition at line 553 of file stm32f30x_i2c.c.
void I2C_Cmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the specified I2C peripheral.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. NewState,: new state of the I2Cx peripheral. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 279 of file stm32f30x_i2c.c.
void I2C_DeInit | ( | I2C_TypeDef * | I2Cx ) |
Deinitializes the I2Cx peripheral registers to their default reset values.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral.
- Return values:
-
None
Definition at line 145 of file stm32f30x_i2c.c.
void I2C_DualAddressCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the I2C own address 2.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. NewState,: new state of the I2C own address 2. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 410 of file stm32f30x_i2c.c.
void I2C_GeneralCallCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the I2C general call mode.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. NewState,: new state of the I2C general call mode. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 474 of file stm32f30x_i2c.c.
void I2C_Init | ( | I2C_TypeDef * | I2Cx, |
I2C_InitTypeDef * | I2C_InitStruct | ||
) |
Initializes the I2Cx peripheral according to the specified parameters in the I2C_InitStruct.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. I2C_InitStruct,: pointer to a I2C_InitTypeDef structure that contains the configuration information for the specified I2C peripheral.
- Return values:
-
None
Definition at line 174 of file stm32f30x_i2c.c.
void I2C_ITConfig | ( | I2C_TypeDef * | I2Cx, |
uint32_t | I2C_IT, | ||
FunctionalState | NewState | ||
) |
Enables or disables the specified I2C interrupts.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. I2C_IT,: specifies the I2C interrupts sources to be enabled or disabled. This parameter can be any combination of the following values: - I2C_IT_ERRI: Error interrupt mask
- I2C_IT_TCI: Transfer Complete interrupt mask
- I2C_IT_STOPI: Stop Detection interrupt mask
- I2C_IT_NACKI: Not Acknowledge received interrupt mask
- I2C_IT_ADDRI: Address Match interrupt mask
- I2C_IT_RXI: RX interrupt mask
- I2C_IT_TXI: TX interrupt mask
NewState,: new state of the specified I2C interrupts. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 334 of file stm32f30x_i2c.c.
void I2C_OwnAddress2Config | ( | I2C_TypeDef * | I2Cx, |
uint16_t | Address, | ||
uint8_t | Mask | ||
) |
Configures the I2C slave own address 2 and mask.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. Address,: specifies the slave address to be programmed. Mask,: specifies own address 2 mask to be programmed. This parameter can be one of the following values: - I2C_OA2_NoMask: no mask.
- I2C_OA2_Mask01: OA2[1] is masked and don't care.
- I2C_OA2_Mask02: OA2[2:1] are masked and don't care.
- I2C_OA2_Mask03: OA2[3:1] are masked and don't care.
- I2C_OA2_Mask04: OA2[4:1] are masked and don't care.
- I2C_OA2_Mask05: OA2[5:1] are masked and don't care.
- I2C_OA2_Mask06: OA2[6:1] are masked and don't care.
- I2C_OA2_Mask07: OA2[7:1] are masked and don't care.
- Return values:
-
None
Definition at line 444 of file stm32f30x_i2c.c.
void I2C_SlaveAddressConfig | ( | I2C_TypeDef * | I2Cx, |
uint16_t | Address | ||
) |
Configures the slave address to be transmitted after start generation.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. Address,: specifies the slave address to be programmed.
- Note:
- This function should be called before generating start condition.
- Return values:
-
None
Definition at line 524 of file stm32f30x_i2c.c.
void I2C_SlaveByteControlCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the I2C slave byte control.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. NewState,: new state of the I2C slave byte control. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 499 of file stm32f30x_i2c.c.
void I2C_SoftwareResetCmd | ( | I2C_TypeDef * | I2Cx ) |
Enables or disables the specified I2C software reset.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral.
- Return values:
-
None
Definition at line 302 of file stm32f30x_i2c.c.
void I2C_StopModeCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables I2C wakeup from stop mode.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. NewState,: new state of the I2Cx stop mode. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 385 of file stm32f30x_i2c.c.
void I2C_StretchClockCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the I2C Clock stretching.
- Parameters:
-
I2Cx,: where x can be 1 or 2 to select the I2C peripheral. NewState,: new state of the I2Cx Clock stretching. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 360 of file stm32f30x_i2c.c.
void I2C_StructInit | ( | I2C_InitTypeDef * | I2C_InitStruct ) |
Fills each I2C_InitStruct member with its default value.
- Parameters:
-
I2C_InitStruct,: pointer to an I2C_InitTypeDef structure which will be initialized.
- Return values:
-
None
Definition at line 253 of file stm32f30x_i2c.c.
Generated on Tue Jul 12 2022 17:34:45 by
