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, const void *data, size_t len,
63 uint64_t timeout_ns);
64
77int ove_hal_i2c_read(ove_i2c_t i2c, uint16_t addr, void *buf, size_t len, uint64_t timeout_ns);
78
95int ove_hal_i2c_write_read(ove_i2c_t i2c, uint16_t addr, const void *tx, size_t tx_len, void *rx,
96 size_t rx_len, uint64_t timeout_ns);
97
115int ove_hal_i2c_write_read_async(ove_i2c_t i2c, uint16_t addr, const void *tx, size_t tx_len,
116 void *rx, size_t rx_len);
117
126void ove_i2c_async_complete(ove_i2c_t i2c, int result);
127
128#ifdef __cplusplus
129}
130#endif
131
134#endif /* OVE_HAL_I2C_H */
int ove_hal_i2c_write(ove_i2c_t i2c, uint16_t addr, const void *data, size_t len, uint64_t timeout_ns)
Write data to an I2C device.
void ove_i2c_async_complete(ove_i2c_t i2c, int result)
Completion notification from the HAL.
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_write_read_async(ove_i2c_t i2c, uint16_t addr, const void *tx, size_t tx_len, void *rx, size_t rx_len)
Submit an async I2C write+read.
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, uint64_t timeout_ns)
Combined write-then-read with repeated start.
void ove_hal_i2c_close(ove_i2c_t i2c)
Disable and release the I2C peripheral.
int ove_hal_i2c_read(ove_i2c_t i2c, uint16_t addr, void *buf, size_t len, uint64_t timeout_ns)
Read data from an I2C device.
struct ove_i2c * ove_i2c_t
Opaque handle for an I2C bus controller.
Definition types.h:268
I2C bus configuration descriptor.
Definition i2c.h:60