12#ifndef __HIERODULE_I2C_H
13#define __HIERODULE_I2C_H
125 void (*SRX_Handler)(void);
143 void (*MTX_Handler)(void);
156 void (*STX_Handler)(void);
174 void (*MRX_Handler)(void);
uint8_t HIERODULE_I2C_GetNextByte(HIERODULE_I2C_Wrapper *Wrapper)
Fetches the next byte in the SRX ring buffer.
HIERODULE_I2C_Status
I2C wrapper status enumeration.
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.
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.
@ HIERODULE_I2C_Status_MTX
Master transmitter, transmitting bytes.
@ HIERODULE_I2C_Status_MTX_ADR
Master transmitter, waiting for a slave to acknowledge the address.
@ HIERODULE_I2C_Status_MRX_ADR
Master receiver, waiting for a slave to acknowledge the address.
@ HIERODULE_I2C_Status_IDLE
Peripheral is expecting a start condition.
@ HIERODULE_I2C_Status_MRX_SB
Master receiver, waiting for the start condition to commence.
@ HIERODULE_I2C_Status_STX
Slave transmitter, transmitting bytes.
@ HIERODULE_I2C_Status_MTX_SB
Master transmitter, waiting for the start condition to commence.
@ HIERODULE_I2C_Status_SRX
Slave receiver, receiving bytes.
@ HIERODULE_I2C_Status_MRX
Master receiver, receiving bytes.
HIERODULE_USB_Wrapper Wrapper
Extern declaration for the wrapper instance in the source file.
Struct that keeps variables for the data buffers, a pointer to the I2C peripheral,...
uint32_t SRX_New
Number of new bytes in the ring buffer. .
uint8_t * SRX_Buffer
The ring buffer where the data received in slave receiver mode is appended.
uint32_t MTX_Counter
Used to continue transmission until buffer size is received.
uint8_t * MRX_Buffer
The ring buffer where the data received in master receiver mode is appended.
uint32_t STX_Counter
Used to continue transmission until buffer size is received.
uint16_t SRX_BufferSize
Number of elements in the ring buffer. .
uint32_t MRX_Counter
Used to continue transmission until buffer size is received.
uint32_t MTX_BufferSize
Number of bytes in the buffer.
HIERODULE_I2C_Status Status
I2C wrapper status.
uint8_t SlaveAddress
Target address.
uint32_t SRX_Index
Index of next-byte-to-be-received in the ring buffer. .
uint32_t MRX_BufferSize
Number of bytes in the buffer.
uint32_t I2C_Period_Length
I2C clock to system clock ratio.
uint8_t * STX_Buffer
Buffer that keeps data to be transmitted in slave transmitter mode.
uint8_t * MTX_Buffer
Buffer that keeps data to be transmitted in master transmitter mode.
I2C_TypeDef * _I2C
Pointer to the I2C peripheral.