STM8L15x Standard Peripherals Drivers
|
Initialization and Configuration functions. More...
Functions | |
void | I2C_AcknowledgeConfig (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enable or Disable the I2C acknowledge feature. | |
void | I2C_AckPositionConfig (I2C_TypeDef *I2Cx, I2C_AckPosition_TypeDef I2C_AckPosition) |
Selects the specified I2C Ack position. | |
void | I2C_ARPCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the I2C ARP. | |
void | I2C_Cmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the I2C peripheral. | |
void | I2C_DeInit (I2C_TypeDef *I2Cx) |
Deinitializes the I2C peripheral registers to their default reset values. | |
void | I2C_DualAddressCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the specified I2C dual addressing mode. | |
void | I2C_FastModeDutyCycleConfig (I2C_TypeDef *I2Cx, I2C_DutyCycle_TypeDef I2C_DutyCycle) |
Selects I2C fast mode duty cycle. | |
void | I2C_GeneralCallCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the I2C General Call feature. | |
void | I2C_GenerateSTART (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Generates I2C communication START condition. | |
void | I2C_GenerateSTOP (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Generates I2C communication STOP condition. | |
void | I2C_Init (I2C_TypeDef *I2Cx, uint32_t OutputClockFrequency, uint16_t OwnAddress, I2C_Mode_TypeDef I2C_Mode, I2C_DutyCycle_TypeDef I2C_DutyCycle, I2C_Ack_TypeDef I2C_Ack, I2C_AcknowledgedAddress_TypeDef I2C_AcknowledgedAddress) |
Initializes the I2C according to the specified parameters in standard or fast mode. | |
void | I2C_OwnAddress2Config (I2C_TypeDef *I2Cx, uint8_t Address) |
Configures the specified I2C own address2. | |
void | I2C_Send7bitAddress (I2C_TypeDef *I2Cx, uint8_t Address, I2C_Direction_TypeDef I2C_Direction) |
Transmits the 7-bit address (to select the) slave device. | |
void | I2C_SMBusAlertConfig (I2C_TypeDef *I2Cx, I2C_SMBusAlert_TypeDef I2C_SMBusAlert) |
Drives the SMBusAlert pin high or low. | |
void | I2C_SoftwareResetCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables I2C software reset. | |
void | I2C_StretchClockCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the I2C clock stretching. |
Detailed Description
Initialization and Configuration functions.
=============================================================================== Initialization and Configuration functions ===============================================================================
Function Documentation
void I2C_AcknowledgeConfig | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enable or Disable the I2C acknowledge feature.
Definition at line 465 of file stm8l15x_i2c.c.
References I2C_struct::CR2, DISABLE, I2C_CR2_ACK, and IS_FUNCTIONAL_STATE.
void I2C_AckPositionConfig | ( | I2C_TypeDef * | I2Cx, |
I2C_AckPosition_TypeDef | I2C_AckPosition | ||
) |
Selects the specified I2C Ack position.
- Note:
- This function must be called before data reception starts.
Definition at line 539 of file stm8l15x_i2c.c.
References I2C_struct::CR2, I2C_CR2_POS, and IS_I2C_ACK_POSITION.
void I2C_ARPCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the I2C ARP.
Definition at line 440 of file stm8l15x_i2c.c.
References I2C_struct::CR1, DISABLE, I2C_CR1_ARP, and IS_FUNCTIONAL_STATE.
void I2C_Cmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the I2C peripheral.
Definition at line 289 of file stm8l15x_i2c.c.
References I2C_struct::CR1, DISABLE, I2C_CR1_PE, and IS_FUNCTIONAL_STATE.
void I2C_DeInit | ( | I2C_TypeDef * | I2Cx | ) |
Deinitializes the I2C peripheral registers to their default reset values.
Definition at line 135 of file stm8l15x_i2c.c.
References I2C_struct::CCRH, I2C_struct::CCRL, I2C_struct::CR1, I2C_struct::CR2, I2C_struct::FREQR, I2C_CCRH_RESET_VALUE, I2C_CCRL_RESET_VALUE, I2C_CR1_RESET_VALUE, I2C_CR2_RESET_VALUE, I2C_FREQR_RESET_VALUE, I2C_ITR_RESET_VALUE, I2C_OAR2_RESET_VALUE, I2C_OARH_RESET_VALUE, I2C_OARL_RESET_VALUE, I2C_TRISER_RESET_VALUE, I2C_struct::ITR, I2C_struct::OAR2, I2C_struct::OARH, I2C_struct::OARL, and I2C_struct::TRISER.
void I2C_DualAddressCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the specified I2C dual addressing mode.
Definition at line 512 of file stm8l15x_i2c.c.
References DISABLE, I2C_OAR2_ENDUAL, IS_FUNCTIONAL_STATE, and I2C_struct::OAR2.
void I2C_FastModeDutyCycleConfig | ( | I2C_TypeDef * | I2Cx, |
I2C_DutyCycle_TypeDef | I2C_DutyCycle | ||
) |
Selects I2C fast mode duty cycle.
Definition at line 586 of file stm8l15x_i2c.c.
References I2C_struct::CCRH, I2C_CCRH_DUTY, I2C_DutyCycle_16_9, and IS_I2C_DUTY_CYCLE.
void I2C_GeneralCallCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the I2C General Call feature.
Definition at line 314 of file stm8l15x_i2c.c.
References I2C_struct::CR1, DISABLE, I2C_CR1_ENGC, and IS_FUNCTIONAL_STATE.
void I2C_GenerateSTART | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Generates I2C communication START condition.
- Note:
- CCR must be programmed, i.e. I2C_Init function must have been called with a valid I2C_ClockSpeed
Definition at line 341 of file stm8l15x_i2c.c.
References I2C_struct::CR2, DISABLE, I2C_CR2_START, and IS_FUNCTIONAL_STATE.
void I2C_GenerateSTOP | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Generates I2C communication STOP condition.
Definition at line 366 of file stm8l15x_i2c.c.
References I2C_struct::CR2, DISABLE, I2C_CR2_STOP, and IS_FUNCTIONAL_STATE.
void I2C_Init | ( | I2C_TypeDef * | I2Cx, |
uint32_t | OutputClockFrequency, | ||
uint16_t | OwnAddress, | ||
I2C_Mode_TypeDef | I2C_Mode, | ||
I2C_DutyCycle_TypeDef | I2C_DutyCycle, | ||
I2C_Ack_TypeDef | I2C_Ack, | ||
I2C_AcknowledgedAddress_TypeDef | I2C_AcknowledgedAddress | ||
) |
Initializes the I2C according to the specified parameters in standard or fast mode.
- Note:
- The I2C_DutyCycle parameter doesn't have impact when the OutputClockFrequency is lower than 100KHz.
- Note:
- To use the I2C at 400 KHz (in fast mode), the PCLK frequency (I2C peripheral input clock) must be a multiple of 10 MHz.
Definition at line 178 of file stm8l15x_i2c.c.
References I2C_struct::CCRH, I2C_struct::CCRL, CLK_GetClockFreq(), I2C_struct::CR1, I2C_struct::CR2, I2C_struct::FREQR, I2C_CCRH_CCR, I2C_CCRH_DUTY, I2C_CCRH_FS, I2C_CCRL_CCR, I2C_CR1_PE, I2C_DutyCycle_2, I2C_FREQR_FREQ, I2C_MAX_STANDARD_FREQ, I2C_OARH_ADDCONF, IS_I2C_ACK_STATE, IS_I2C_ACKNOWLEDGE_ADDRESS, IS_I2C_DUTY_CYCLE, IS_I2C_MODE, IS_I2C_OUTPUT_CLOCK_FREQ, IS_I2C_OWN_ADDRESS, I2C_struct::OARH, I2C_struct::OARL, and I2C_struct::TRISER.
void I2C_OwnAddress2Config | ( | I2C_TypeDef * | I2Cx, |
uint8_t | Address | ||
) |
Configures the specified I2C own address2.
Definition at line 488 of file stm8l15x_i2c.c.
References I2C_OAR2_ADD2, and I2C_struct::OAR2.
void I2C_Send7bitAddress | ( | I2C_TypeDef * | I2Cx, |
uint8_t | Address, | ||
I2C_Direction_TypeDef | I2C_Direction | ||
) |
Transmits the 7-bit address (to select the) slave device.
Definition at line 615 of file stm8l15x_i2c.c.
References I2C_struct::DR, I2C_Direction_Transmitter, IS_I2C_ADDRESS, IS_I2C_DIRECTION, OAR1_ADD0_Reset, and OAR1_ADD0_Set.
void I2C_SMBusAlertConfig | ( | I2C_TypeDef * | I2Cx, |
I2C_SMBusAlert_TypeDef | I2C_SMBusAlert | ||
) |
Drives the SMBusAlert pin high or low.
Definition at line 559 of file stm8l15x_i2c.c.
References I2C_struct::CR2, I2C_CR2_ALERT, I2C_SMBusAlert_High, and IS_I2C_SMBUS_ALERT.
void I2C_SoftwareResetCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables I2C software reset.
Definition at line 391 of file stm8l15x_i2c.c.
References I2C_struct::CR2, DISABLE, I2C_CR2_SWRST, and IS_FUNCTIONAL_STATE.
void I2C_StretchClockCmd | ( | I2C_TypeDef * | I2Cx, |
FunctionalState | NewState | ||
) |
Enables or disables the I2C clock stretching.
Definition at line 415 of file stm8l15x_i2c.c.
References I2C_struct::CR1, DISABLE, I2C_CR1_NOSTRETCH, and IS_FUNCTIONAL_STATE.