HF-FDO2 Driver 0.1.0-dev
UART driver for PyroScience FDO2-G2 (data sheet v5 §4: #MOXY, #MRAW, #VERS)
Loading...
Searching...
No Matches
HF-FDO2 Driver

Header-only C++17 UART client for the PyroScience FDO2-G2 optical oxygen sensor (data sheet v5, §4 UART API): #VERS, #IDNR, #MOXY, #MRAW, #LOGO, with engineering-unit decoding, optional CRC suffix stripping, and #ERRO codes via LastDeviceErrorCode(). Default baud after power-up is 19200 8N1.

C++ [License: MIT](LICENSE) CI Docs

Table of contents

  1. Overview
  2. Features
  3. Quick start
  4. Documentation
  5. Examples
  6. Official references
  7. License

Overview

Live documentation (GitHub Pages) — Installation, UART protocol tables, CMake, API summary, and troubleshooting.

The driver targets read-only measurement commands suitable for host firmware: fast **#MOXY** for control loops and richer **#MRAW** when you need vent-side pressure P, internal RH H, dphi, and intensities. Flash-writing commands (#CALO, #CAHI, #CRCE, #SETM, #BAUD, …) are intentionally not implemented here (endurance and power-stability constraints in the data sheet).

Features

  • CRTP fdo2::UartInterface<Derived> — no virtual calls; you provide write / read / flush_rx.
  • **fdo2::Driver<UartT>** — ReadVersion, ReadUniqueId, MeasureMoxy, MeasureMraw, FlashLogo; timeouts configurable per command class.
  • No heap allocation in the driver framing path; fits FreeRTOS / bare metal.
  • ESP32-S3 examples (build_app.sh matrix): UART1, default TX=GPIO47 / RX=GPIO21, 19200 8N1, shared template Fdo2EspIdfUart — see examples/esp32/.

Quick start

CMake:

add_subdirectory(/path/to/hf-fdo2-driver)
target_link_libraries(your_target PRIVATE hf::fdo2)

Application:

#include "fdo2.hpp"
struct MyUart : fdo2::UartInterface<MyUart> {
void write(const uint8_t* d, size_t n);
size_t read(uint8_t* o, size_t m, uint32_t t);
void flush_rx();
};
MyUart uart;
auto v = dev.ReadVersion();
auto m = dev.MeasureMraw(); // or MeasureMoxy() for smallest frame
FDO2-G2 UART client.
Definition fdo2_driver.hpp:180
CRTP base for PSUP serial transport.
Definition fdo2_uart_interface.hpp:32
void write(const uint8_t *data, std::size_t length) noexcept
Definition fdo2_uart_interface.hpp:34
void flush_rx() noexcept
Definition fdo2_uart_interface.hpp:42
std::size_t read(uint8_t *out, std::size_t max, uint32_t timeout_ms) noexcept
Definition fdo2_uart_interface.hpp:38
Umbrella header for the HF-FDO2 (FDO2-G2) UART driver.

Documentation

Topic Link
Doc hub docs/index.md
UART protocol docs/uart_protocol.md
API / CMake / hardware docs/
Doxygen _config/Doxyfile → run doxygen _config/Doxyfile from repo root

Examples

  • ESP32 workflow: examples/esp32/README.md
  • Build script: examples/esp32/scripts/build_app.sh

Official references

Use the FDO2-G2 data sheet and firmware notes for calibration, measurement modes, broadcast, and flash lifetime. Other PyroScience products may use different UART command sets.

License

MIT — see [LICENSE](LICENSE).