Loading...
Searching...
No Matches
furi_hal_i2c.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <stdbool.h>
8#include <stddef.h>
9#include <stdint.h>
10#include <furi_hal_i2c_config.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
31
44
47
50
52void furi_hal_i2c_init(void);
53
59
66
78 FuriHalI2cBusHandle* handle,
79 uint8_t address,
80 const uint8_t* data,
81 size_t size,
82 uint32_t timeout);
83
99 FuriHalI2cBusHandle* handle,
100 uint16_t address,
101 bool ten_bit,
102 const uint8_t* data,
103 size_t size,
104 FuriHalI2cBegin begin,
105 FuriHalI2cEnd end,
106 uint32_t timeout);
107
118bool furi_hal_i2c_rx(
119 FuriHalI2cBusHandle* handle,
120 uint8_t address,
121 uint8_t* data,
122 size_t size,
123 uint32_t timeout);
124
139 FuriHalI2cBusHandle* handle,
140 uint16_t address,
141 bool ten_bit,
142 uint8_t* data,
143 size_t size,
144 FuriHalI2cBegin begin,
145 FuriHalI2cEnd end,
146 uint32_t timeout);
147
161 FuriHalI2cBusHandle* handle,
162 uint8_t address,
163 const uint8_t* tx_data,
164 size_t tx_size,
165 uint8_t* rx_data,
166 size_t rx_size,
167 uint32_t timeout);
168
177bool furi_hal_i2c_is_device_ready(FuriHalI2cBusHandle* handle, uint8_t i2c_addr, uint32_t timeout);
178
190 FuriHalI2cBusHandle* handle,
191 uint8_t i2c_addr,
192 uint8_t reg_addr,
193 uint8_t* data,
194 uint32_t timeout);
195
207 FuriHalI2cBusHandle* handle,
208 uint8_t i2c_addr,
209 uint8_t reg_addr,
210 uint16_t* data,
211 uint32_t timeout);
212
225 FuriHalI2cBusHandle* handle,
226 uint8_t i2c_addr,
227 uint8_t mem_addr,
228 uint8_t* data,
229 size_t len,
230 uint32_t timeout);
231
243 FuriHalI2cBusHandle* handle,
244 uint8_t i2c_addr,
245 uint8_t reg_addr,
246 uint8_t data,
247 uint32_t timeout);
248
260 FuriHalI2cBusHandle* handle,
261 uint8_t i2c_addr,
262 uint8_t reg_addr,
263 uint16_t data,
264 uint32_t timeout);
265
278 FuriHalI2cBusHandle* handle,
279 uint8_t i2c_addr,
280 uint8_t mem_addr,
281 const uint8_t* data,
282 size_t len,
283 uint32_t timeout);
284
285#ifdef __cplusplus
286}
287#endif
bool furi_hal_i2c_read_reg_16(FuriHalI2cBusHandle *handle, uint8_t i2c_addr, uint8_t reg_addr, uint16_t *data, uint32_t timeout)
Perform I2C device register read (16-bit)
Definition furi_hal_i2c.c:327
void furi_hal_i2c_acquire(FuriHalI2cBusHandle *handle)
Acquire I2C bus handle.
Definition furi_hal_i2c.c:25
FuriHalI2cEnd
Transaction end signal.
Definition furi_hal_i2c.h:33
@ FuriHalI2cEndStop
Definition furi_hal_i2c.h:35
@ FuriHalI2cEndPause
Definition furi_hal_i2c.h:42
@ FuriHalI2cEndAwaitRestart
Definition furi_hal_i2c.h:39
bool furi_hal_i2c_trx(FuriHalI2cBusHandle *handle, uint8_t address, const uint8_t *tx_data, size_t tx_size, uint8_t *rx_data, size_t rx_size, uint32_t timeout)
Perform I2C TX and RX transfers.
Definition furi_hal_i2c.c:256
bool furi_hal_i2c_tx(FuriHalI2cBusHandle *handle, uint8_t address, const uint8_t *data, size_t size, uint32_t timeout)
Perform I2C TX transfer.
Definition furi_hal_i2c.c:232
bool furi_hal_i2c_read_reg_8(FuriHalI2cBusHandle *handle, uint8_t i2c_addr, uint8_t reg_addr, uint8_t *data, uint32_t timeout)
Perform I2C device register read (8-bit)
Definition furi_hal_i2c.c:316
void furi_hal_i2c_init(void)
Init I2C.
Definition furi_hal_i2c.c:20
bool furi_hal_i2c_rx_ext(FuriHalI2cBusHandle *handle, uint16_t address, bool ten_bit, uint8_t *data, size_t size, FuriHalI2cBegin begin, FuriHalI2cEnd end, uint32_t timeout)
Perform I2C RX transfer, with additional settings.
Definition furi_hal_i2c.c:198
FuriHalI2cBegin
Transaction beginning signal.
Definition furi_hal_i2c.h:17
@ FuriHalI2cBeginRestart
Definition furi_hal_i2c.h:25
@ FuriHalI2cBeginResume
Definition furi_hal_i2c.h:29
@ FuriHalI2cBeginStart
Definition furi_hal_i2c.h:20
bool furi_hal_i2c_write_mem(FuriHalI2cBusHandle *handle, uint8_t i2c_addr, uint8_t mem_addr, const uint8_t *data, size_t len, uint32_t timeout)
Perform I2C device memory.
Definition furi_hal_i2c.c:387
bool furi_hal_i2c_write_reg_16(FuriHalI2cBusHandle *handle, uint8_t i2c_addr, uint8_t reg_addr, uint16_t data, uint32_t timeout)
Perform I2C device register write (16-bit)
Definition furi_hal_i2c.c:370
void furi_hal_i2c_init_early(void)
Early Init I2C.
Definition furi_hal_i2c.c:12
void furi_hal_i2c_deinit_early(void)
Early DeInit I2C.
Definition furi_hal_i2c.c:16
bool furi_hal_i2c_write_reg_8(FuriHalI2cBusHandle *handle, uint8_t i2c_addr, uint8_t reg_addr, uint8_t data, uint32_t timeout)
Perform I2C device register write (8-bit)
Definition furi_hal_i2c.c:354
void furi_hal_i2c_release(FuriHalI2cBusHandle *handle)
Release I2C bus handle.
Definition furi_hal_i2c.c:39
bool furi_hal_i2c_rx(FuriHalI2cBusHandle *handle, uint8_t address, uint8_t *data, size_t size, uint32_t timeout)
Perform I2C RX transfer.
Definition furi_hal_i2c.c:244
bool furi_hal_i2c_tx_ext(FuriHalI2cBusHandle *handle, uint16_t address, bool ten_bit, const uint8_t *data, size_t size, FuriHalI2cBegin begin, FuriHalI2cEnd end, uint32_t timeout)
Perform I2C TX transfer, with additional settings.
Definition furi_hal_i2c.c:215
bool furi_hal_i2c_read_mem(FuriHalI2cBusHandle *handle, uint8_t i2c_addr, uint8_t mem_addr, uint8_t *data, size_t len, uint32_t timeout)
Perform I2C device memory read.
Definition furi_hal_i2c.c:342
bool furi_hal_i2c_is_device_ready(FuriHalI2cBusHandle *handle, uint8_t i2c_addr, uint32_t timeout)
Check if I2C device presents on bus.
Definition furi_hal_i2c.c:284
FuriHal i2c handle.
Definition furi_hal_i2c_types.h:44