STM8L15x Standard Peripherals Drivers
|
This file provides firmware functions to manage the following functionalities of the Inter-integrated circuit (I2C)
- Initialization and Configuration
- Data transfers
- PEC management
- DMA transfers management
- Interrupts, events and flags management.
#include "stm8l15x_i2c.h"
#include "stm8l15x_clk.h"
Go to the source code of this file.
Defines | |
#define | FLAG_Mask ((uint16_t)0x00FF) |
#define | ITEN_Mask ((uint16_t)0x0700) |
#define | OAR1_ADD0_Reset ((uint8_t)0xFE) |
#define | OAR1_ADD0_Set ((uint8_t)0x01) |
#define | REGISTER_Mask ((uint16_t)0x3000) |
#define | REGISTER_SR1_Index ((uint16_t)0x0100) |
#define | REGISTER_SR2_Index ((uint16_t)0x0200) |
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_CalculatePEC (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables PEC calculation. | |
ErrorStatus | I2C_CheckEvent (I2C_TypeDef *I2Cx, I2C_Event_TypeDef I2C_Event) |
=============================================================================== 1. | |
void | I2C_ClearFlag (I2C_TypeDef *I2Cx, I2C_FLAG_TypeDef I2C_FLAG) |
Clear flags. | |
void | I2C_ClearITPendingBit (I2C_TypeDef *I2Cx, I2C_IT_TypeDef I2C_IT) |
Clear IT pending bit. | |
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_DMACmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables the I2C DMA requests . | |
void | I2C_DMALastTransferCmd (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Specifies that the next DMA transfer is the last one . | |
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. | |
FlagStatus | I2C_GetFlagStatus (I2C_TypeDef *I2Cx, I2C_FLAG_TypeDef I2C_FLAG) |
=============================================================================== 3. | |
ITStatus | I2C_GetITStatus (I2C_TypeDef *I2Cx, I2C_IT_TypeDef I2C_IT) |
Checks whether the specified I2C interrupt has occurred or not. | |
I2C_Event_TypeDef | I2C_GetLastEvent (I2C_TypeDef *I2Cx) |
=============================================================================== 2. | |
uint8_t | I2C_GetPEC (I2C_TypeDef *I2Cx) |
Returns PEC value. | |
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_ITConfig (I2C_TypeDef *I2Cx, I2C_IT_TypeDef I2C_IT, FunctionalState NewState) |
Enables or disables the specified I2C interrupt. | |
void | I2C_OwnAddress2Config (I2C_TypeDef *I2Cx, uint8_t Address) |
Configures the specified I2C own address2. | |
void | I2C_PECPositionConfig (I2C_TypeDef *I2Cx, I2C_PECPosition_TypeDef I2C_PECPosition) |
Selects I2C PEC position. | |
uint8_t | I2C_ReadRegister (I2C_TypeDef *I2Cx, I2C_Register_TypeDef I2C_Register) |
Reads the specified I2C register and returns its value. | |
uint8_t | I2C_ReceiveData (I2C_TypeDef *I2Cx) |
Returns the most recent received data. | |
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_SendData (I2C_TypeDef *I2Cx, uint8_t Data) |
Send a byte by writing in the DR register. | |
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. | |
void | I2C_TransmitPEC (I2C_TypeDef *I2Cx, FunctionalState NewState) |
Enables or disables PEC transfer. |
Detailed Description
This file provides firmware functions to manage the following functionalities of the Inter-integrated circuit (I2C)
- Initialization and Configuration
- Data transfers
- PEC management
- DMA transfers management
- Interrupts, events and flags management.
- Attention:
THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
© COPYRIGHT 2011 STMicroelectronics
Definition in file stm8l15x_i2c.c.