The TF-Luna driver layer is the firmware code that reads the 9-byte UART packets from the sensor, parses them, validates them, and exposes a clean stream of (distance_cm, amplitude, valid) tuples to higher layers.
For the ESP32-S3 implementation details — frame sync via scan-for-magic 0x59 0x59, 512-byte UART buffer, health flag, 7-case host unit-test suite — see TF-Luna driver (firmware). That page covers the architectural pattern, code structure, and the two self-inflicted bugs caught by tests.
High-level interface
struct TFLunaFrame {
uint16_t distance_cm;
uint16_t amp_raw;
float temp_c;
bool valid;
};
bool tf_luna_parse_frame(const uint8_t *buf, TFLunaFrame &out);
Pure C++ functions on top, Arduino-class wrapper underneath the #if defined(ARDUINO) boundary — see host-testable Arduino pattern.