720 B
720 B
TCP → I2C bridge
Authorship
This document was generated using ChatGPT (OpenAI), version 5.2. It has not been independently reviewed or validated yet.
Translation units
i2c_controller.c
i2c_handle_frame(cmd, payload, len, reply_buf, *reply_len)- No transport knowledge.
- Pure logic + hardware calls.
usb_transport.c
- Parses frames from CDC.
- Calls
i2c_handle_frame(). - Writes reply back over USB.
tcp_transport.c
- Same framing.
- Calls same
i2c_handle_frame(). - Writes reply over TCP.
Notes
- The framing + transport layer is swappable.
- The I²C logic is isolated.
Result
- USB for development/debug.
- TCP for deployment.
- Zero duplication of protocol logic.