TLx493D 3D Hall Sensor Generic Library  0.2
Generic library for the TLx493D 3D Hall sensor family
i2c.h
Go to the documentation of this file.
1 /*
2  * i2c.h
3  *
4  * Created on: Sep 4, 2018
5  * Author: nicolaem
6  */
7 
11 #ifndef SRC_PERIPHERALS_I2C_I2C_H_
12 #define SRC_PERIPHERALS_I2C_I2C_H_
13 
14 #include <stdint.h>
15 
17 typedef enum {
18  I2C_STATUS_OK = 0,
19  I2C_STATUS_TIMEOUT = 1,
20  I2C_STATUS_BUSY = 2,
21  I2C_STATUS_NACK = 3,
22 } I2C_status_t;
23 
25 void I2C_init(void);
26 
28 void I2C_enable(void);
29 
31 void I2C_disable(void);
32 
34 void I2C_mode_normal(void);
35 
40 void I2C_mode_gpio_input(void);
41 
43 void I2C_peripheral_recover(void) __attribute__((deprecated));
44 
45 
53 int32_t I2C_read(uint8_t addr, uint8_t *data, uint8_t count);
54 
55 
63 int32_t I2C_write(uint8_t addr, const uint8_t* data, uint8_t count);
64 
65 
69 void I2C_wait_transmit(void);
70 
71 
73 void I2C_write_recover(void);
74 
76 void I2C_write_reset(void);
77 
78 
79 
80 #endif /* SRC_PERIPHERALS_I2C_I2C_H_ */
void I2C_enable(void)
Enable the I2C channel.
Definition: i2c.c:34
void I2C_mode_gpio_input(void)
Switch I2C pins to GPIO mode Disconnect SDA and SCL pins from the I2C peripheral. Configure them as G...
Definition: i2c.c:65
void I2C_write_recover(void)
Write FF (the recover value) to the I2C Bus.
Definition: i2c.c:272
I2C_status_t
Status values returned by the I2C read/write commands.
Definition: i2c.h:17
void I2C_disable(void)
Disable the I2C channel.
Definition: i2c.c:43
void I2C_mode_normal(void)
Connect SDA and SCL pins to the I2C peripheral.
Definition: i2c.c:49
void I2C_wait_transmit(void)
Wait for an I2C transmission to end.
Definition: i2c.c:257
void I2C_write_reset(void)
Write 00 (the reset value) to the I2C Bus.
Definition: i2c.c:285
void I2C_peripheral_recover(void) __attribute__((deprecated))
Recovery procedure according to XMC1100 Errata Sheet.
Definition: i2c.c:245
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.
Definition: i2c.c:79
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.
Definition: i2c.c:157
void I2C_init(void)
Initialize the I2C peripheral.
Definition: i2c.c:22