TLx493D 3D Hall Sensor Generic Library  1.3
Generic library for the TLx493D 3D Hall sensor family
Enumerations | Functions
i2c.h File Reference

I2C Driver for XMC1100 USIC Module. More...

#include <stdint.h>

Go to the source code of this file.

Enumerations

enum  I2C_status_t { I2C_STATUS_OK = 0, I2C_STATUS_TIMEOUT = 1, I2C_STATUS_BUSY = 2, I2C_STATUS_NACK = 3 }
 Status values returned by the I2C read/write commands.
 

Functions

void I2C_init (void)
 Initialize the I2C peripheral.
 
void I2C_enable (void)
 Enable the I2C channel.
 
void I2C_disable (void)
 Disable the I2C channel.
 
void I2C_mode_normal (void)
 Connect SDA and SCL pins to the I2C peripheral.
 
void I2C_mode_gpio_input (void)
 Switch I2C pins to GPIO mode Disconnect SDA and SCL pins from the I2C peripheral. Configure them as GPIO inputs (in order to avoid unintended input signals to the I2C peripheral that will cause it to freeze)
 
void I2C_peripheral_recover (void) __attribute__((deprecated))
 Recovery procedure according to XMC1100 Errata Sheet.
 
int32_t I2C_read (uint8_t addr, uint8_t *data, uint8_t count)
 Read a number of bytes from an I2C device to a uint8_t array. More...
 
int32_t I2C_write (uint8_t addr, const uint8_t *data, uint8_t count)
 Write a number of uint8_t bytes to an I2C device. More...
 
void I2C_wait_transmit (void)
 Wait for an I2C transmission to end. More...
 
void I2C_write_recover (void)
 Write FF (the recover value) to the I2C Bus.
 
void I2C_write_reset (void)
 Write 00 (the reset value) to the I2C Bus.
 

Detailed Description

I2C Driver for XMC1100 USIC Module.

Function Documentation

◆ I2C_read()

int32_t I2C_read ( uint8_t  addr,
uint8_t *  data,
uint8_t  count 
)

Read a number of bytes from an I2C device to a uint8_t array.

Read count bytes from the device with the given I2C address to the data array

Parameters
addrI2C device address.
dataAddress where the data should be stored.
countNumber of bytes to be read from the device to the data array

◆ I2C_wait_transmit()

void I2C_wait_transmit ( void  )

Wait for an I2C transmission to end.

Blocks the program execution until the last I2C operation is completed.

◆ I2C_write()

int32_t I2C_write ( uint8_t  addr,
const uint8_t *  data,
uint8_t  count 
)

Write a number of uint8_t bytes to an I2C device.

Read count bytes from the device with the given I2C address to the data array

Parameters
addrI2C device address.
dataAddress where the data should be stored.
countNumber of bytes to be read from the device to the data array