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 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:

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

Application:

1
2
3
4
5
6
7
8
9
10
11
12
#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;
fdo2::Driver<MyUart> dev(uart);
auto v = dev.ReadVersion();
auto m = dev.MeasureMraw();  // or MeasureMoxy() for smallest frame

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

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.


Table of contents