Nexus Embedded Platform 0.1.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
i2c_bus_clear.h
Go to the documentation of this file.
1
8#ifndef NEXUS_I2C_BUS_CLEAR_H
9#define NEXUS_I2C_BUS_CLEAR_H
10
11#include "nexus/core/time.h"
12#ifdef __cplusplus
13extern "C" {
14#endif
15
17#define NX_I2C_BUS_CLEAR_MAX_PULSES 9U
18
43typedef struct {
44 nx_result_t (*acquire)(void* context);
45 nx_result_t (*drive)(void* context, bool scl_low, bool sda_low);
46 nx_result_t (*sample)(void* context, bool* scl_high, bool* sda_high);
47 nx_result_t (*wait_until)(void* context, nx_time_us_t target);
48 nx_result_t (*release)(void* context);
50
56
66typedef struct {
67 uint32_t low_us;
68 uint32_t high_us;
69 uint32_t stop_setup_us;
72
90
109
127 nx_clock_t clock,
129
159 nx_time_us_t deadline,
160 nx_time_us_t cleanup_deadline,
162
179 nx_time_us_t deadline,
181
182#ifdef __cplusplus
183}
184#endif
185#endif
nx_result_t nx_i2c_bus_clear_run(nx_i2c_bus_clear_t *clear, nx_time_us_t deadline, nx_time_us_t cleanup_deadline, nx_i2c_bus_clear_result_t *result)
Clear one idle, authorized bus with at most nine pulses.
nx_result_t nx_i2c_bus_clear_finish(nx_i2c_bus_clear_t *clear, nx_time_us_t deadline, nx_i2c_bus_clear_result_t *result)
Retry only retained STOP cleanup and ownership return.
nx_result_t nx_i2c_bus_clear_init(nx_i2c_bus_clear_t *clear, nx_i2c_bus_clear_port_t port, nx_clock_t clock, nx_i2c_bus_clear_timing_t timing)
Bind explicit electrical operations without touching pins.
nx_result_t
Operation result; success at submission means admission only.
Definition status.h:21
An explicitly injected clock; its context outlives all borrowers.
Definition time.h:26
Read-only methods for an authorized two-pin GPIO handoff.
nx_result_t(* sample)(void *context, bool *scl_high, bool *sda_high)
nx_result_t(* drive)(void *context, bool scl_low, bool sda_low)
nx_result_t(* release)(void *context)
nx_result_t(* wait_until)(void *context, nx_time_us_t target)
nx_result_t(* acquire)(void *context)
Explicit immutable GPIO methods and caller-owned adapter state.
const nx_i2c_bus_clear_ops_t * ops
Independent recovery and STOP/ownership-return results.
Caller-owned, zero-initialized single-executor session.
nx_time_us_t last_time
nx_i2c_bus_clear_result_t result
nx_i2c_bus_clear_timing_t timing
nx_i2c_bus_clear_port_t port
Caller-selected electrical timings in microseconds.
Absolute monotonic microsecond deadlines and wrap extension.
uint64_t nx_time_us_t
Microseconds in one boot/clock domain; no wall-clock semantics.
Definition time.h:20