TUKS MCU Introductory course / TUKS-COURSE-THERMOMETER

Fork of TUKS-COURSE-TIMER by TUKS MCU Introductory course

Embed: (wiki syntax)

« Back to documentation index

Data_Management

Data_Management
[I2C Exported Functions]

Functions

__STATIC_INLINE void LL_I2C_EnableAutoEndMode (I2C_TypeDef *I2Cx)
 Enable automatic STOP condition generation (master mode).
__STATIC_INLINE void LL_I2C_DisableAutoEndMode (I2C_TypeDef *I2Cx)
 Disable automatic STOP condition generation (master mode).
__STATIC_INLINE uint32_t LL_I2C_IsEnabledAutoEndMode (I2C_TypeDef *I2Cx)
 Check if automatic STOP condition is enabled or disabled.
__STATIC_INLINE void LL_I2C_EnableReloadMode (I2C_TypeDef *I2Cx)
 Enable reload mode (master mode).
__STATIC_INLINE void LL_I2C_DisableReloadMode (I2C_TypeDef *I2Cx)
 Disable reload mode (master mode).
__STATIC_INLINE uint32_t LL_I2C_IsEnabledReloadMode (I2C_TypeDef *I2Cx)
 Check if reload mode is enabled or disabled.
__STATIC_INLINE void LL_I2C_SetTransferSize (I2C_TypeDef *I2Cx, uint32_t TransferSize)
 Configure the number of bytes for transfer.
__STATIC_INLINE uint32_t LL_I2C_GetTransferSize (I2C_TypeDef *I2Cx)
 Get the number of bytes configured for transfer.
__STATIC_INLINE void LL_I2C_AcknowledgeNextData (I2C_TypeDef *I2Cx, uint32_t TypeAcknowledge)
 Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code or next received byte.
__STATIC_INLINE void LL_I2C_GenerateStopCondition (I2C_TypeDef *I2Cx)
 Generate a STOP condition after the current byte transfer (master mode).
__STATIC_INLINE void LL_I2C_GenerateStartCondition (I2C_TypeDef *I2Cx)
 Generate a START or RESTART condition.
__STATIC_INLINE void LL_I2C_EnableAuto10BitRead (I2C_TypeDef *I2Cx)
 Enable automatic RESTART Read request condition for 10bit address header (master mode).
__STATIC_INLINE void LL_I2C_DisableAuto10BitRead (I2C_TypeDef *I2Cx)
 Disable automatic RESTART Read request condition for 10bit address header (master mode).
__STATIC_INLINE uint32_t LL_I2C_IsEnabledAuto10BitRead (I2C_TypeDef *I2Cx)
 Check if automatic RESTART Read request condition for 10bit address header is enabled or disabled.
__STATIC_INLINE void LL_I2C_SetTransferRequest (I2C_TypeDef *I2Cx, uint32_t TransferRequest)
 Configure the transfer direction (master mode).
__STATIC_INLINE uint32_t LL_I2C_GetTransferRequest (I2C_TypeDef *I2Cx)
 Get the transfer direction requested (master mode).
__STATIC_INLINE void LL_I2C_SetSlaveAddr (I2C_TypeDef *I2Cx, uint32_t SlaveAddr)
 Configure the slave address for transfer (master mode).
__STATIC_INLINE uint32_t LL_I2C_GetSlaveAddr (I2C_TypeDef *I2Cx)
 Get the slave address programmed for transfer.
__STATIC_INLINE void LL_I2C_HandleTransfer (I2C_TypeDef *I2Cx, uint32_t SlaveAddr, uint32_t SlaveAddrSize, uint32_t TransferSize, uint32_t EndMode, uint32_t Request)
 Handles I2Cx communication when starting transfer or during transfer (TC or TCR flag are set).
__STATIC_INLINE uint32_t LL_I2C_GetTransferDirection (I2C_TypeDef *I2Cx)
 Indicate the value of transfer direction (slave mode).
__STATIC_INLINE uint32_t LL_I2C_GetAddressMatchCode (I2C_TypeDef *I2Cx)
 Return the slave matched address.
__STATIC_INLINE void LL_I2C_EnableSMBusPECCompare (I2C_TypeDef *I2Cx)
 Enable internal comparison of Packet Error byte (transmission or reception mode).
__STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusPECCompare (I2C_TypeDef *I2Cx)
 Check if Packet Error byte internal comparison is requested or not.
__STATIC_INLINE uint32_t LL_I2C_GetSMBusPEC (I2C_TypeDef *I2Cx)
 Get the Packet Error byte calculated.
__STATIC_INLINE uint8_t LL_I2C_ReceiveData8 (I2C_TypeDef *I2Cx)
 Read Receive Data register.
__STATIC_INLINE void LL_I2C_TransmitData8 (I2C_TypeDef *I2Cx, uint8_t Data)
 Write in Transmit Data Register .

Function Documentation

__STATIC_INLINE void LL_I2C_AcknowledgeNextData ( I2C_TypeDef *  I2Cx,
uint32_t  TypeAcknowledge 
)

Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code or next received byte.

Note:
Usage in Slave mode only. CR2 NACK LL_I2C_AcknowledgeNextData
Parameters:
I2CxI2C Instance.
TypeAcknowledgeThis parameter can be one of the following values:

  • LL_I2C_ACK
  • LL_I2C_NACK
Return values:
None

Definition at line 1964 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_DisableAuto10BitRead ( I2C_TypeDef *  I2Cx )

Disable automatic RESTART Read request condition for 10bit address header (master mode).

Note:
The master only sends the first 7 bits of 10bit address in Read direction. CR2 HEAD10R LL_I2C_DisableAuto10BitRead
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 2013 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_DisableAutoEndMode ( I2C_TypeDef *  I2Cx )

Disable automatic STOP condition generation (master mode).

Note:
Software end mode : TC flag is set when NBYTES data are transferre, stretching SCL low. CR2 AUTOEND LL_I2C_DisableAutoEndMode
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1879 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_DisableReloadMode ( I2C_TypeDef *  I2Cx )

Disable reload mode (master mode).

Note:
The transfer is completed after the NBYTES data transfer(STOP or RESTART will follow). CR2 RELOAD LL_I2C_DisableReloadMode
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1914 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_EnableAuto10BitRead ( I2C_TypeDef *  I2Cx )

Enable automatic RESTART Read request condition for 10bit address header (master mode).

Note:
The master sends the complete 10bit slave address read sequence : Start + 2 bytes 10bit address in Write direction + Restart + first 7 bits of 10bit address in Read direction. CR2 HEAD10R LL_I2C_EnableAuto10BitRead
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 2001 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_EnableAutoEndMode ( I2C_TypeDef *  I2Cx )

Enable automatic STOP condition generation (master mode).

Note:
Automatic end mode : a STOP condition is automatically sent when NBYTES data are transferred. This bit has no effect in slave mode or when RELOAD bit is set. CR2 AUTOEND LL_I2C_EnableAutoEndMode
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1867 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_EnableReloadMode ( I2C_TypeDef *  I2Cx )

Enable reload mode (master mode).

Note:
The transfer is not completed after the NBYTES data transfer, NBYTES will be reloaded when TCR flag is set. CR2 RELOAD LL_I2C_EnableReloadMode
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1902 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_EnableSMBusPECCompare ( I2C_TypeDef *  I2Cx )

Enable internal comparison of Packet Error byte (transmission or reception mode).

Note:
Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance.
This feature is cleared by hardware when the PEC byte is transferred, or when a STOP condition or an Address Matched is received. This bit has no effect when RELOAD bit is set. This bit has no effect in device mode when SBC bit is not set. CR2 PECBYTE LL_I2C_EnableSMBusPECCompare
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 2164 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_GenerateStartCondition ( I2C_TypeDef *  I2Cx )

Generate a START or RESTART condition.

Note:
The START bit can be set even if bus is BUSY or I2C is in slave mode. This action has no effect when RELOAD is set. CR2 START LL_I2C_GenerateStartCondition
Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1988 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_GenerateStopCondition ( I2C_TypeDef *  I2Cx )

Generate a STOP condition after the current byte transfer (master mode).

CR2 STOP LL_I2C_GenerateStopCondition

Parameters:
I2CxI2C Instance.
Return values:
None

Definition at line 1975 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetAddressMatchCode ( I2C_TypeDef *  I2Cx )

Return the slave matched address.

ISR ADDCODE LL_I2C_GetAddressMatchCode

Parameters:
I2CxI2C Instance.
Return values:
Valuebetween Min_Data=0x00 and Max_Data=0x3F

Definition at line 2148 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetSlaveAddr ( I2C_TypeDef *  I2Cx )

Get the slave address programmed for transfer.

CR2 SADD LL_I2C_GetSlaveAddr

Parameters:
I2CxI2C Instance.
Return values:
Valuebetween Min_Data=0x0 and Max_Data=0x3F

Definition at line 2076 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetSMBusPEC ( I2C_TypeDef *  I2Cx )

Get the Packet Error byte calculated.

Note:
Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance. PECR PEC LL_I2C_GetSMBusPEC
Parameters:
I2CxI2C Instance.
Return values:
Valuebetween Min_Data=0x00 and Max_Data=0xFF

Definition at line 2190 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetTransferDirection ( I2C_TypeDef *  I2Cx )

Indicate the value of transfer direction (slave mode).

Note:
RESET: Write transfer, Slave enters in receiver mode. SET: Read transfer, Slave enters in transmitter mode. ISR DIR LL_I2C_GetTransferDirection
Parameters:
I2CxI2C Instance.
Return values:
Returnedvalue can be one of the following values:

  • LL_I2C_DIRECTION_WRITE
  • LL_I2C_DIRECTION_READ

Definition at line 2137 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetTransferRequest ( I2C_TypeDef *  I2Cx )

Get the transfer direction requested (master mode).

CR2 RD_WRN LL_I2C_GetTransferRequest

Parameters:
I2CxI2C Instance.
Return values:
Returnedvalue can be one of the following values:

  • LL_I2C_REQUEST_WRITE
  • LL_I2C_REQUEST_READ

Definition at line 2052 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_GetTransferSize ( I2C_TypeDef *  I2Cx )

Get the number of bytes configured for transfer.

CR2 NBYTES LL_I2C_GetTransferSize

Parameters:
I2CxI2C Instance.
Return values:
Valuebetween Min_Data=0x0 and Max_Data=0xFF

Definition at line 1949 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_HandleTransfer ( I2C_TypeDef *  I2Cx,
uint32_t  SlaveAddr,
uint32_t  SlaveAddrSize,
uint32_t  TransferSize,
uint32_t  EndMode,
uint32_t  Request 
)

Handles I2Cx communication when starting transfer or during transfer (TC or TCR flag are set).

CR2 SADD LL_I2C_HandleTransfer
CR2 ADD10 LL_I2C_HandleTransfer
CR2 RD_WRN LL_I2C_HandleTransfer
CR2 START LL_I2C_HandleTransfer
CR2 STOP LL_I2C_HandleTransfer
CR2 RELOAD LL_I2C_HandleTransfer
CR2 NBYTES LL_I2C_HandleTransfer
CR2 AUTOEND LL_I2C_HandleTransfer
CR2 HEAD10R LL_I2C_HandleTransfer

Parameters:
I2CxI2C Instance.
SlaveAddrSpecifies the slave address to be programmed.
SlaveAddrSizeThis parameter can be one of the following values:

  • LL_I2C_ADDRSLAVE_7BIT
  • LL_I2C_ADDRSLAVE_10BIT
TransferSizeSpecifies the number of bytes to be programmed. This parameter must be a value between 0 and 255.
EndModeThis parameter can be one of the following values:

  • LL_I2C_MODE_RELOAD
  • LL_I2C_MODE_AUTOEND
  • LL_I2C_MODE_SOFTEND
  • LL_I2C_MODE_SMBUS_RELOAD
  • LL_I2C_MODE_SMBUS_AUTOEND_NO_PEC
  • LL_I2C_MODE_SMBUS_SOFTEND_NO_PEC
  • LL_I2C_MODE_SMBUS_AUTOEND_WITH_PEC
  • LL_I2C_MODE_SMBUS_SOFTEND_WITH_PEC
RequestThis parameter can be one of the following values:

  • LL_I2C_GENERATE_NOSTARTSTOP
  • LL_I2C_GENERATE_STOP
  • LL_I2C_GENERATE_START_READ
  • LL_I2C_GENERATE_START_WRITE
  • LL_I2C_GENERATE_RESTART_7BIT_READ
  • LL_I2C_GENERATE_RESTART_7BIT_WRITE
  • LL_I2C_GENERATE_RESTART_10BIT_READ
  • LL_I2C_GENERATE_RESTART_10BIT_WRITE
Return values:
None

Definition at line 2119 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_IsEnabledAuto10BitRead ( I2C_TypeDef *  I2Cx )

Check if automatic RESTART Read request condition for 10bit address header is enabled or disabled.

CR2 HEAD10R LL_I2C_IsEnabledAuto10BitRead

Parameters:
I2CxI2C Instance.
Return values:
Stateof bit (1 or 0).

Definition at line 2024 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_IsEnabledAutoEndMode ( I2C_TypeDef *  I2Cx )

Check if automatic STOP condition is enabled or disabled.

CR2 AUTOEND LL_I2C_IsEnabledAutoEndMode

Parameters:
I2CxI2C Instance.
Return values:
Stateof bit (1 or 0).

Definition at line 1890 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_IsEnabledReloadMode ( I2C_TypeDef *  I2Cx )

Check if reload mode is enabled or disabled.

CR2 RELOAD LL_I2C_IsEnabledReloadMode

Parameters:
I2CxI2C Instance.
Return values:
Stateof bit (1 or 0).

Definition at line 1925 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusPECCompare ( I2C_TypeDef *  I2Cx )

Check if Packet Error byte internal comparison is requested or not.

Note:
Macro IS_SMBUS_ALL_INSTANCE(I2Cx) can be used to check whether or not SMBus feature is supported by the I2Cx Instance. CR2 PECBYTE LL_I2C_IsEnabledSMBusPECCompare
Parameters:
I2CxI2C Instance.
Return values:
Stateof bit (1 or 0).

Definition at line 2177 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE uint8_t LL_I2C_ReceiveData8 ( I2C_TypeDef *  I2Cx )

Read Receive Data register.

RXDR RXDATA LL_I2C_ReceiveData8

Parameters:
I2CxI2C Instance.
Return values:
Valuebetween Min_Data=0x00 and Max_Data=0xFF

Definition at line 2201 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_SetSlaveAddr ( I2C_TypeDef *  I2Cx,
uint32_t  SlaveAddr 
)

Configure the slave address for transfer (master mode).

Note:
Changing these bits when START bit is set is not allowed. CR2 SADD LL_I2C_SetSlaveAddr
Parameters:
I2CxI2C Instance.
SlaveAddrThis parameter must be a value between Min_Data=0x00 and Max_Data=0x3F.
Return values:
None

Definition at line 2065 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_SetTransferRequest ( I2C_TypeDef *  I2Cx,
uint32_t  TransferRequest 
)

Configure the transfer direction (master mode).

Note:
Changing these bits when START bit is set is not allowed. CR2 RD_WRN LL_I2C_SetTransferRequest
Parameters:
I2CxI2C Instance.
TransferRequestThis parameter can be one of the following values:

  • LL_I2C_REQUEST_WRITE
  • LL_I2C_REQUEST_READ
Return values:
None

Definition at line 2039 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_SetTransferSize ( I2C_TypeDef *  I2Cx,
uint32_t  TransferSize 
)

Configure the number of bytes for transfer.

Note:
Changing these bits when START bit is set is not allowed. CR2 NBYTES LL_I2C_SetTransferSize
Parameters:
I2CxI2C Instance.
TransferSizeThis parameter must be a value between Min_Data=0x00 and Max_Data=0xFF.
Return values:
None

Definition at line 1938 of file stm32l4xx_ll_i2c.h.

__STATIC_INLINE void LL_I2C_TransmitData8 ( I2C_TypeDef *  I2Cx,
uint8_t  Data 
)

Write in Transmit Data Register .

TXDR TXDATA LL_I2C_TransmitData8

Parameters:
I2CxI2C Instance.
DataValue between Min_Data=0x00 and Max_Data=0xFF
Return values:
None

Definition at line 2213 of file stm32l4xx_ll_i2c.h.