Hierodule 1.6.2
Utility module set for STM32 MCUs
Loading...
Searching...
No Matches
hierodule_i2c.c File Reference

: Source file for the I2C module. More...

Go to the source code of this file.

Functions

void Idle (HIERODULE_I2C_Wrapper *Wrapper, uint32_t NumberOfPeriods)
 Blocks for given number of I2C clock periods.
 
void EnableClockStretching (HIERODULE_I2C_Wrapper *Wrapper)
 Enables clock stretching for the I2C peripheral of a wrapper.
 
void DisableClockStretching (HIERODULE_I2C_Wrapper *Wrapper)
 Disables clock stretching for the I2C peripheral of a wrapper.
 
static uint8_t ReceiveData (HIERODULE_I2C_Wrapper *Wrapper)
 Read and returns the data register content of the I2C peripheral.
 
void TransmitData (HIERODULE_I2C_Wrapper *Wrapper, uint8_t Byte)
 Writes a byte into the data register of the I2C peripheral.
 
void ACK_Next (HIERODULE_I2C_Wrapper *Wrapper)
 Configure the I2C peripheral to "ACK" the next byte received.
 
void NACK_Next (HIERODULE_I2C_Wrapper *Wrapper)
 Configure the I2C peripheral to "NACK" the next byte received.
 
void Start (HIERODULE_I2C_Wrapper *Wrapper)
 Makes the I2C peripheral generate a start condition.
 
void Stop (HIERODULE_I2C_Wrapper *Wrapper)
 Makes the I2C peripheral generate a stop condition.
 
void ReceiveByteAsMaster (HIERODULE_I2C_Wrapper *Wrapper)
 Handles incoming data for an I2C peripheral in master receiver mode.
 
void ReceiveByteAsSlave (HIERODULE_I2C_Wrapper *Wrapper)
 Handles incoming data for an I2C peripheral in slave receiver mode.
 
void TransmitByteAsMaster (HIERODULE_I2C_Wrapper *Wrapper)
 Transmits the next data in the buffer for an I2C peripheral in master transmitter mode.
 
void TransmitByteAsSlave (HIERODULE_I2C_Wrapper *Wrapper)
 Transmits the next data in the buffer for an I2C peripheral in slave transmitter mode.
 
void ReturnToIdleState (HIERODULE_I2C_Wrapper *Wrapper)
 Invokes the on-SRX-finished routine if assigned and sets the I2C wrapper status back to idle.
 
void Receive_NACK (HIERODULE_I2C_Wrapper *Wrapper)
 Receives the NACK response, invokes the on-SRX-finished routine and sets the wrapper status back to idle.
 
uint8_t HIERODULE_I2C_GetNextByte (HIERODULE_I2C_Wrapper *Wrapper)
 Fetches the next byte in the SRX ring buffer.
 
HIERODULE_I2C_Wrapper ** HIERODULE_I2C_InitWrapper (I2C_TypeDef *_I2C, uint16_t SRX_BufferSize, void(*SRX_Handler)(void), void(*MTX_Handler)(void), void(*STX_Handler)(void), void(*MRX_Handler)(void))
 Initializes a wrapper for the specified I2C peripheral.
 
void HIERODULE_I2C_ReleaseWrapper (HIERODULE_I2C_Wrapper *Wrapper)
 Frees the memory allocated to an I2C wrapper.
 
void HIERODULE_I2C_MasterTransmit (HIERODULE_I2C_Wrapper *Wrapper, uint8_t SlaveAddress, uint8_t *MTX_Buffer, uint32_t Size)
 Puts the peripheral in master transmitter mode and handles the transmission.
 
void HIERODULE_I2C_MasterReceive (HIERODULE_I2C_Wrapper *Wrapper, uint8_t SlaveAddress, uint8_t *MRX_Buffer, uint32_t Size)
 Puts the peripheral in master receiver mode and handles the transmission.
 
void I2C_IRQ_Handler (HIERODULE_I2C_Wrapper *Wrapper)
 The base IRQ body to be used for all I2C IRQs.
 
void I2C1_EV_IRQHandler (void)
 I2C1 IRQ implementation.
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
 
void I2C2_EV_IRQHandler (void)
 I2C2 IRQ implementation.
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
 
void I2C1_IRQHandler (void)
 I2C1 IRQ implementation.
Requires the device specific macro __STM32F030x6_H to be defined.
 
void I2C3_EV_IRQHandler (void)
 I2C3 IRQ implementation.
Requires the device specific macro __STM32F401xC_H to be defined.
 

Variables

static HIERODULE_I2C_WrapperI2C1_Wrapper
 I2C wrapper pointer meant for I2C1.
 
static HIERODULE_I2C_WrapperI2C2_Wrapper
 I2C wrapper pointer meant for I2C2.
Requires the device specific macro __STM32F103xB_H or __STM32F401xC_H to be defined.
 
static HIERODULE_I2C_WrapperI2C3_Wrapper
 I2C wrapper pointer meant for I2C3.
Requires the device specific macro __STM32F401xC_H to be defined.
 

Detailed Description

Author
: ushumgigal
Attention
: Copyrighted (2024) by ushumgigal under MIT License, a copy of which may be found in the root folder of the repository.

Definition in file hierodule_i2c.c.