Functions

Initialization and Configuration functions. More...

Collaboration diagram for Initialization and Configuration functions:

Functions

void I2C_10BitAddressingModeCmd (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables the I2C 10-bit addressing mode for the master. More...
 
void I2C_AcknowledgeConfig (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables the specified I2C acknowledge feature. More...
 
void I2C_AnalogFilterCmd (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables the Analog filter of I2C peripheral. More...
 
void I2C_ARPCmd (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables the specified I2C ARP. More...
 
void I2C_Cmd (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables the specified I2C peripheral. More...
 
void I2C_DeInit (I2C_TypeDef *I2Cx)
 Deinitialize the I2Cx peripheral registers to their default reset values. More...
 
void I2C_DigitalFilterConfig (I2C_TypeDef *I2Cx, uint16_t I2C_DigitalFilter)
 Configures the Digital noise filter of I2C peripheral. More...
 
void I2C_DualAddressCmd (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables the specified I2C dual addressing mode. More...
 
void I2C_FastModeDutyCycleConfig (I2C_TypeDef *I2Cx, uint16_t I2C_DutyCycle)
 Selects the specified I2C fast mode duty cycle. More...
 
void I2C_GeneralCallCmd (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables the specified I2C general call feature. 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...
 
void I2C_Init (I2C_TypeDef *I2Cx, I2C_InitTypeDef *I2C_InitStruct)
 Initializes the I2Cx peripheral according to the specified parameters in the I2C_InitStruct. More...
 
void I2C_ITConfig (I2C_TypeDef *I2Cx, uint32_t I2C_IT, FunctionalState NewState)
 Enables or disables the specified I2C interrupts. More...
 
void I2C_NACKPositionConfig (I2C_TypeDef *I2Cx, uint16_t I2C_NACKPosition)
 Selects the specified I2C NACK position in master receiver mode. More...
 
void I2C_OwnAddress2Config (I2C_TypeDef *I2Cx, uint16_t Address, uint8_t Mask)
 Configures the I2C slave own address 2 and mask. More...
 
void I2C_OwnAddress2Config (I2C_TypeDef *I2Cx, uint8_t Address)
 Configures the specified I2C own address2. More...
 
void I2C_Send7bitAddress (I2C_TypeDef *I2Cx, uint8_t Address, uint8_t I2C_Direction)
 Transmits the address byte to select the slave device. More...
 
void I2C_SlaveAddressConfig (I2C_TypeDef *I2Cx, uint16_t Address)
 Configures the slave address to be transmitted after start generation. More...
 
void I2C_SlaveByteControlCmd (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables the I2C slave byte control. More...
 
void I2C_SMBusAlertConfig (I2C_TypeDef *I2Cx, uint16_t I2C_SMBusAlert)
 Drives the SMBusAlert pin high or low for the specified I2C. More...
 
void I2C_SoftwareResetCmd (I2C_TypeDef *I2Cx)
 Enables or disables the specified I2C software reset. More...
 
void I2C_SoftwareResetCmd (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables the specified I2C software reset. More...
 
void I2C_StopModeCmd (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables I2C wakeup from stop mode. More...
 
void I2C_StretchClockCmd (I2C_TypeDef *I2Cx, FunctionalState NewState)
 Enables or disables the specified I2C Clock stretching. More...
 
void I2C_StructInit (I2C_InitTypeDef *I2C_InitStruct)
 Fills each I2C_InitStruct member with its default value. More...
 

Detailed Description

Initialization and Configuration functions.

 ===============================================================================
            ##### 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
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
NewStatenew 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_AcknowledgeConfig ( I2C_TypeDef I2Cx,
FunctionalState  NewState 
)

Enables or disables the specified I2C acknowledge feature.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
NewStatenew state of the I2C Acknowledgement. This parameter can be: ENABLE or DISABLE.
Return values
None.

Definition at line 472 of file stm32f4xx_i2c.c.

void I2C_AnalogFilterCmd ( I2C_TypeDef I2Cx,
FunctionalState  NewState 
)

Enables or disables the Analog filter of I2C peripheral.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
NewStatenew state of the Analog filter. This parameter can be: ENABLE or DISABLE.
Note
This function should be called before initializing and enabling the I2C Peripheral.
Return values
None

Definition at line 339 of file stm32f4xx_i2c.c.

void I2C_ARPCmd ( I2C_TypeDef I2Cx,
FunctionalState  NewState 
)

Enables or disables the specified I2C ARP.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
NewStatenew state of the I2Cx ARP. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 712 of file stm32f4xx_i2c.c.

void I2C_Cmd ( I2C_TypeDef I2Cx,
FunctionalState  NewState 
)

Enables or disables the specified I2C peripheral.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
NewStatenew state of the I2Cx peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
NewStatenew state of the I2Cx peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 313 of file stm32f4xx_i2c.c.

void I2C_DeInit ( I2C_TypeDef I2Cx)

Deinitialize the I2Cx peripheral registers to their default reset values.

Deinitializes the I2Cx peripheral registers to their default reset values.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
Return values
None
Parameters
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
Return values
None

Definition at line 137 of file stm32f4xx_i2c.c.

void I2C_DigitalFilterConfig ( I2C_TypeDef I2Cx,
uint16_t  I2C_DigitalFilter 
)

Configures the Digital noise filter of I2C peripheral.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
I2C_DigitalFilterCoefficient of digital noise filter. This parameter can be a number between 0x00 and 0x0F.
Note
This function should be called before initializing and enabling the I2C Peripheral.
Return values
None

Definition at line 365 of file stm32f4xx_i2c.c.

void I2C_DualAddressCmd ( I2C_TypeDef I2Cx,
FunctionalState  NewState 
)

Enables or disables the specified I2C dual addressing mode.

Enables or disables the I2C own address 2.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
NewStatenew state of the I2C dual addressing mode. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
NewStatenew state of the I2C own address 2. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 522 of file stm32f4xx_i2c.c.

void I2C_FastModeDutyCycleConfig ( I2C_TypeDef I2Cx,
uint16_t  I2C_DutyCycle 
)

Selects the specified I2C fast mode duty cycle.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
I2C_DutyCyclespecifies the fast mode duty cycle. This parameter can be one of the following values:
  • I2C_DutyCycle_2: I2C fast mode Tlow/Thigh = 2
  • I2C_DutyCycle_16_9: I2C fast mode Tlow/Thigh = 16/9
Return values
None

Definition at line 622 of file stm32f4xx_i2c.c.

void I2C_GeneralCallCmd ( I2C_TypeDef I2Cx,
FunctionalState  NewState 
)

Enables or disables the specified I2C general call feature.

Enables or disables the I2C general call mode.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
NewStatenew state of the I2C General call. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
NewStatenew state of the I2C general call mode. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 546 of file stm32f4xx_i2c.c.

void I2C_GenerateSTART ( I2C_TypeDef I2Cx,
FunctionalState  NewState 
)

Generates I2Cx communication START condition.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
NewStatenew state of the I2C START condition generation. This parameter can be: ENABLE or DISABLE.
Return values
None.

Definition at line 393 of file stm32f4xx_i2c.c.

void I2C_GenerateSTOP ( I2C_TypeDef I2Cx,
FunctionalState  NewState 
)

Generates I2Cx communication STOP condition.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
NewStatenew state of the I2C STOP condition generation. This parameter can be: ENABLE or DISABLE.
Return values
None.

Definition at line 417 of file stm32f4xx_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.

Note
To use the I2C at 400 KHz (in fast mode), the PCLK1 frequency (I2C peripheral input clock) must be a multiple of 10 MHz.
Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
I2C_InitStructpointer to a I2C_InitTypeDef structure that contains the configuration information for the specified I2C peripheral.
Return values
None
Parameters
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
I2C_InitStructpointer to a I2C_InitTypeDef structure that contains the configuration information for the specified I2C peripheral.
Return values
None

Definition at line 180 of file stm32f4xx_i2c.c.

void I2C_ITConfig ( I2C_TypeDef I2Cx,
uint32_t  I2C_IT,
FunctionalState  NewState 
)

Enables or disables the specified I2C interrupts.

Parameters
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
I2C_ITspecifies 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
NewStatenew 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_NACKPositionConfig ( I2C_TypeDef I2Cx,
uint16_t  I2C_NACKPosition 
)

Selects the specified I2C NACK position in master receiver mode.

Note
This function is useful in I2C Master Receiver mode when the number of data to be received is equal to 2. In this case, this function should be called (with parameter I2C_NACKPosition_Next) before data reception starts,as described in the 2-byte reception procedure recommended in Reference Manual in Section: Master receiver.
Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
I2C_NACKPositionspecifies the NACK position. This parameter can be one of the following values:
  • I2C_NACKPosition_Next: indicates that the next byte will be the last received byte.
  • I2C_NACKPosition_Current: indicates that current byte is the last received byte.
Note
This function configures the same bit (POS) as I2C_PECPositionConfig() but is intended to be used in I2C mode while I2C_PECPositionConfig() is intended to used in SMBUS mode.
Return values
None

Definition at line 660 of file stm32f4xx_i2c.c.

void I2C_OwnAddress2Config ( I2C_TypeDef I2Cx,
uint16_t  Address,
uint8_t  Mask 
)

Configures the I2C slave own address 2 and mask.

Parameters
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
Addressspecifies the slave address to be programmed.
Maskspecifies 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_OwnAddress2Config ( I2C_TypeDef I2Cx,
uint8_t  Address 
)

Configures the specified I2C own address2.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
Addressspecifies the 7bit I2C own address2.
Return values
None.

Definition at line 495 of file stm32f4xx_i2c.c.

void I2C_Send7bitAddress ( I2C_TypeDef I2Cx,
uint8_t  Address,
uint8_t  I2C_Direction 
)

Transmits the address byte to select the slave device.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
Addressspecifies the slave address which will be transmitted
I2C_Directionspecifies whether the I2C device will be a Transmitter or a Receiver. This parameter can be one of the following values
  • I2C_Direction_Transmitter: Transmitter mode
  • I2C_Direction_Receiver: Receiver mode
Return values
None.

Definition at line 445 of file stm32f4xx_i2c.c.

void I2C_SlaveAddressConfig ( I2C_TypeDef I2Cx,
uint16_t  Address 
)

Configures the slave address to be transmitted after start generation.

Parameters
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
Addressspecifies 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
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
NewStatenew 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_SMBusAlertConfig ( I2C_TypeDef I2Cx,
uint16_t  I2C_SMBusAlert 
)

Drives the SMBusAlert pin high or low for the specified I2C.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
I2C_SMBusAlertspecifies SMBAlert pin level. This parameter can be one of the following values:
  • I2C_SMBusAlert_Low: SMBAlert pin driven low
  • I2C_SMBusAlert_High: SMBAlert pin driven high
Return values
None

Definition at line 688 of file stm32f4xx_i2c.c.

void I2C_SoftwareResetCmd ( I2C_TypeDef I2Cx)

Enables or disables the specified I2C software reset.

Parameters
I2Cxwhere 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_SoftwareResetCmd ( I2C_TypeDef I2Cx,
FunctionalState  NewState 
)

Enables or disables the specified I2C software reset.

Note
When software reset is enabled, the I2C IOs are released (this can be useful to recover from bus errors).
Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
NewStatenew state of the I2C software reset. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 572 of file stm32f4xx_i2c.c.

void I2C_StopModeCmd ( I2C_TypeDef I2Cx,
FunctionalState  NewState 
)

Enables or disables I2C wakeup from stop mode.

Parameters
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
NewStatenew 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 specified I2C Clock stretching.

Enables or disables the I2C Clock stretching.

Parameters
I2Cxwhere x can be 1, 2 or 3 to select the I2C peripheral.
NewStatenew state of the I2Cx Clock stretching. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
I2Cxwhere x can be 1 or 2 to select the I2C peripheral.
NewStatenew state of the I2Cx Clock stretching. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 596 of file stm32f4xx_i2c.c.

void I2C_StructInit ( I2C_InitTypeDef I2C_InitStruct)

Fills each I2C_InitStruct member with its default value.

Parameters
I2C_InitStructpointer to an I2C_InitTypeDef structure which will be initialized.
Return values
None

Definition at line 289 of file stm32f4xx_i2c.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:55