TLx493D 3D Hall Sensor Generic Library  1.3
Generic library for the TLx493D 3D Hall sensor family
i2c.h
Go to the documentation of this file.
1 /*
2 *****************************************************************************
3 * Copyright (C) 2019 Infineon Technologies AG. All rights reserved.
4 *
5 * Infineon Technologies AG (INFINEON) is supplying this file for use
6 * exclusively with Infineon's products. This file can be freely
7 * distributed within development tools and software supporting such microcontroller
8 * products.
9 *
10 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
11 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
13 * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR DIRECT, INDIRECT, INCIDENTAL,
14 * ASPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
15 *
16 ******************************************************************************
17 */
18 
22 #ifndef SRC_PERIPHERALS_I2C_I2C_H_
23 #define SRC_PERIPHERALS_I2C_I2C_H_
24 
25 #include <stdint.h>
26 
28 typedef enum {
29  I2C_STATUS_OK = 0,
30  I2C_STATUS_TIMEOUT = 1,
31  // Deprecated
32  I2C_STATUS_BUSY = 2,
33  I2C_STATUS_NACK = 3,
34 } I2C_status_t;
35 
37 void I2C_init(void);
38 
40 void I2C_enable(void);
41 
43 void I2C_disable(void);
44 
46 void I2C_mode_normal(void);
47 
52 void I2C_mode_gpio_input(void);
53 
55 void I2C_peripheral_recover(void) __attribute__((deprecated));
56 
57 
65 int32_t I2C_read(uint8_t addr, uint8_t *data, uint8_t count);
66 
67 
75 int32_t I2C_write(uint8_t addr, const uint8_t* data, uint8_t count);
76 
77 
81 void I2C_wait_transmit(void);
82 
83 
85 void I2C_write_recover(void);
86 
88 void I2C_write_reset(void);
89 
90 
91 
92 #endif /* SRC_PERIPHERALS_I2C_I2C_H_ */
void I2C_enable(void)
Enable the I2C channel.
Definition: i2c.c:44
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:79
void I2C_write_recover(void)
Write FF (the recover value) to the I2C Bus.
Definition: i2c.c:326
I2C_status_t
Status values returned by the I2C read/write commands.
Definition: i2c.h:28
void I2C_disable(void)
Disable the I2C channel.
Definition: i2c.c:54
void I2C_mode_normal(void)
Connect SDA and SCL pins to the I2C peripheral.
Definition: i2c.c:60
void I2C_wait_transmit(void)
Wait for an I2C transmission to end.
Definition: i2c.c:311
void I2C_write_reset(void)
Write 00 (the reset value) to the I2C Bus.
Definition: i2c.c:339
void I2C_peripheral_recover(void) __attribute__((deprecated))
Recovery procedure according to XMC1100 Errata Sheet.
Definition: i2c.c:299
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:94
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:186
void I2C_init(void)
Initialize the I2C peripheral.
Definition: i2c.c:34