I2C HAL API. More...
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <furi_hal_i2c_config.h>
Go to the source code of this file.
Enumerations | |
enum | FuriHalI2cBegin { FuriHalI2cBeginStart , FuriHalI2cBeginRestart , FuriHalI2cBeginResume } |
Transaction beginning signal. More... | |
enum | FuriHalI2cEnd { FuriHalI2cEndStop , FuriHalI2cEndAwaitRestart , FuriHalI2cEndPause } |
Transaction end signal. More... | |
Functions | |
void | furi_hal_i2c_init_early (void) |
Early Init I2C. | |
void | furi_hal_i2c_deinit_early (void) |
Early DeInit I2C. | |
void | furi_hal_i2c_init (void) |
Init I2C. | |
void | furi_hal_i2c_acquire (FuriHalI2cBusHandle *handle) |
Acquire I2C bus handle. | |
void | furi_hal_i2c_release (FuriHalI2cBusHandle *handle) |
Release I2C bus handle. | |
bool | furi_hal_i2c_tx (FuriHalI2cBusHandle *handle, uint8_t address, const uint8_t *data, size_t size, uint32_t timeout) |
Perform I2C TX transfer. | |
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. | |
bool | furi_hal_i2c_rx (FuriHalI2cBusHandle *handle, uint8_t address, uint8_t *data, size_t size, uint32_t timeout) |
Perform I2C RX transfer. | |
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. | |
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. | |
bool | furi_hal_i2c_is_device_ready (FuriHalI2cBusHandle *handle, uint8_t i2c_addr, uint32_t timeout) |
Check if I2C device presents on bus. | |
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) | |
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) | |
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. | |
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) | |
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) | |
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. | |
I2C HAL API.
enum FuriHalI2cBegin |
Transaction beginning signal.
enum FuriHalI2cEnd |
Transaction end signal.
void furi_hal_i2c_acquire | ( | FuriHalI2cBusHandle * | handle | ) |
Acquire I2C bus handle.
handle | Pointer to FuriHalI2cBusHandle instance |
bool furi_hal_i2c_is_device_ready | ( | FuriHalI2cBusHandle * | handle, |
uint8_t | i2c_addr, | ||
uint32_t | timeout ) |
Check if I2C device presents on bus.
handle | Pointer to FuriHalI2cBusHandle instance |
i2c_addr | I2C slave address |
timeout | Timeout in milliseconds |
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.
handle | Pointer to FuriHalI2cBusHandle instance |
i2c_addr | I2C slave address |
mem_addr | Memory start address |
data | Pointer to data buffer |
len | Size of data buffer |
timeout | Timeout in milliseconds |
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)
handle | Pointer to FuriHalI2cBusHandle instance |
i2c_addr | I2C slave address |
reg_addr | Register address |
data | Pointer to register value |
timeout | Timeout in milliseconds |
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)
handle | Pointer to FuriHalI2cBusHandle instance |
i2c_addr | I2C slave address |
reg_addr | Register address |
data | Pointer to register value |
timeout | Timeout in milliseconds |
void furi_hal_i2c_release | ( | FuriHalI2cBusHandle * | handle | ) |
Release I2C bus handle.
handle | Pointer to FuriHalI2cBusHandle instance acquired in furi_hal_i2c_acquire |
bool furi_hal_i2c_rx | ( | FuriHalI2cBusHandle * | handle, |
uint8_t | address, | ||
uint8_t * | data, | ||
size_t | size, | ||
uint32_t | timeout ) |
Perform I2C RX transfer.
handle | Pointer to FuriHalI2cBusHandle instance |
address | I2C slave address |
data | Pointer to data buffer |
size | Size of data buffer |
timeout | Timeout in milliseconds |
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.
handle | Pointer to FuriHalI2cBusHandle instance |
address | I2C slave address |
ten_bit | Whether the address is 10 bits wide |
data | Pointer to data buffer |
size | Size of data buffer |
begin | How to begin the transaction |
end | How to end the transaction |
timeout | Timeout in milliseconds |
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.
handle | Pointer to FuriHalI2cBusHandle instance |
address | I2C slave address |
tx_data | Pointer to TX data buffer |
tx_size | Size of TX data buffer |
rx_data | Pointer to RX data buffer |
rx_size | Size of RX data buffer |
timeout | Timeout in milliseconds |
bool furi_hal_i2c_tx | ( | FuriHalI2cBusHandle * | handle, |
uint8_t | address, | ||
const uint8_t * | data, | ||
size_t | size, | ||
uint32_t | timeout ) |
Perform I2C TX transfer.
handle | Pointer to FuriHalI2cBusHandle instance |
address | I2C slave address |
data | Pointer to data buffer |
size | Size of data buffer |
timeout | Timeout in milliseconds |
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.
handle | Pointer to FuriHalI2cBusHandle instance |
address | I2C slave address |
ten_bit | Whether the address is 10 bits wide |
data | Pointer to data buffer |
size | Size of data buffer |
begin | How to begin the transaction |
end | How to end the transaction |
timeout | Timeout in milliseconds |
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.
handle | Pointer to FuriHalI2cBusHandle instance |
i2c_addr | I2C slave address |
mem_addr | Memory start address |
data | Pointer to data buffer |
len | Size of data buffer |
timeout | Timeout in milliseconds |
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)
handle | Pointer to FuriHalI2cBusHandle instance |
i2c_addr | I2C slave address |
reg_addr | Register address |
data | Register value |
timeout | Timeout in milliseconds |
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)
handle | Pointer to FuriHalI2cBusHandle instance |
i2c_addr | I2C slave address |
reg_addr | Register address |
data | Register value |
timeout | Timeout in milliseconds |