1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Native C FFI bindings for the Modbus client stack.
//!
//! This module provides a complete, `no_std`-compatible C API for creating
//! and operating Modbus TCP and Serial (RTU/ASCII) clients.
//!
//! # Design
//!
//! - **Split typed static pools**: TCP clients occupy `tcp_slots[0..MAX_TCP_CLIENTS]`,
//! Serial RTU clients occupy `serial_rtu_slots[0..MAX_SERIAL_CLIENTS]`, and
//! Serial ASCII clients occupy `serial_ascii_slots[0..MAX_SERIAL_CLIENTS]`.
//! Pool sizes are configured via `MBUS_MAX_TCP_CLIENTS` and `MBUS_MAX_SERIAL_CLIENTS`
//! environment variables at build time (both default to 1).
//! - **ID-based API**: C code receives an opaque `MbusClientId` (u16). The high
//! byte encodes the pool type (0x00 = TCP, 0x01 = Serial RTU, 0x02 = Serial ASCII);
//! the low byte is the slot index. `0xFFFF` is the reserved invalid sentinel.
//! - **Zero heap allocation**: Everything is `core`-only + `heapless`.
//! - **Callback-driven**: Responses are delivered via C function-pointer
//! callbacks registered at client creation time.
// ── Sub-modules ──────────────────────────────────────────────────────────────
// ── Re-exports ───────────────────────────────────────────────────────────────
pub use crateMbusStatusCode;
pub use ;