oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
hal_i2c.h
1/*
2 * Copyright (C) 2026 Kamil Lulko <kamil.lulko@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 *
6 * This file is part of oveRTOS.
7 */
8
9#ifndef OVE_HAL_I2C_H
10#define OVE_HAL_I2C_H
11
22#include "ove/i2c.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
39int ove_hal_i2c_open(ove_i2c_t i2c, const struct ove_i2c_cfg *cfg);
40
49
62int ove_hal_i2c_write(ove_i2c_t i2c, uint16_t addr,
63 const void *data, size_t len,
64 uint32_t timeout_ms);
65
78int ove_hal_i2c_read(ove_i2c_t i2c, uint16_t addr,
79 void *buf, size_t len, uint32_t timeout_ms);
80
97int ove_hal_i2c_write_read(ove_i2c_t i2c, uint16_t addr,
98 const void *tx, size_t tx_len,
99 void *rx, size_t rx_len,
100 uint32_t timeout_ms);
101
102#ifdef __cplusplus
103}
104#endif
105
108#endif /* OVE_HAL_I2C_H */
int ove_hal_i2c_open(ove_i2c_t i2c, const struct ove_i2c_cfg *cfg)
Configure and enable the I2C peripheral.
int ove_hal_i2c_read(ove_i2c_t i2c, uint16_t addr, void *buf, size_t len, uint32_t timeout_ms)
Read data from an I2C device.
void ove_hal_i2c_close(ove_i2c_t i2c)
Disable and release the I2C peripheral.
int ove_hal_i2c_write(ove_i2c_t i2c, uint16_t addr, const void *data, size_t len, uint32_t timeout_ms)
Write data to an I2C device.
int ove_hal_i2c_write_read(ove_i2c_t i2c, uint16_t addr, const void *tx, size_t tx_len, void *rx, size_t rx_len, uint32_t timeout_ms)
Combined write-then-read with repeated start.
struct ove_i2c * ove_i2c_t
Opaque handle for an I2C bus controller.
Definition types.h:142
I2C bus configuration descriptor.
Definition i2c.h:60