NHAL Interface v0.5.0
Hardware Abstraction Layer Interface for Embedded Systems
Loading...
Searching...
No Matches
nhal_i2c_types.h
Go to the documentation of this file.
1
8#ifndef NHAL_I2C_TYPES_H
9#define NHAL_I2C_TYPES_H
10
11#include <stddef.h>
12#include <stdint.h>
13
14#include "nhal_common.h"
15
16typedef uint8_t nhal_i2c_bus_id;
17typedef uint16_t nhal_i2c_address;
18
21 struct nhal_i2c_impl_config * impl_config;
22};
23
29
30 struct nhal_i2c_impl_ctx * impl_ctx;
31
32 // Async extensions handled separately in async context
33};
34
35
46
52typedef struct {
56 uint16_t flags;
62 union {
66 struct {
67 uint8_t *buffer;
68 size_t length;
69 } read;
73 struct {
74 const uint8_t *bytes;
75 size_t length;
76 } write;
77 };
79
80#endif /* NHAL_I2C_TYPES_H */
nhal_i2c_transfer_bit_flags_t
@ NHAL_I2C_TRANSFER_MSG_NO_ADDR
Do not write the address first in this op.
@ NHAL_I2C_TRANSFER_MSG_READ
Message is a read operation.
@ NHAL_I2C_TRANSFER_MSG_TEN_BIT_ADDR
Use 10-bit addressing for this message.
@ NHAL_I2C_TRANSFER_MSG_NO_STOP
Do not send a STOP condition after this message.
@ NHAL_I2C_TRANSFER_MSG_NO_START
Do not send a START condition before this message.
@ NHAL_I2C_TRANSFER_MSG_WRITE
Message is a write operation (default).
uint16_t nhal_i2c_address
uint8_t nhal_i2c_bus_id
uint32_t clock_speed_hz
struct nhal_i2c_impl_config * impl_config
Base I2C context - always present, minimal footprint.
nhal_i2c_bus_id i2c_bus_id
struct nhal_i2c_impl_ctx * impl_ctx
Structure describing a single I2C message segment within a transaction.
uint8_t * buffer
Pointer to buffer for received data (must be writable).
uint16_t flags
Combination of nhal_i2c_transfer_bit_flags_t for this segment.
const uint8_t * bytes
Pointer to data to send (must be readable).
size_t length
Number of bytes to read into the buffer.
nhal_i2c_address address
7-bit or 10-bit address for this message segment.