OSynaptic-TX
TX-only OpenSynaptic packet encoder for 8-bit MCUs
OSynaptic-TX encodes sensor readings into the OpenSynaptic wire format (FULL frames) using pure C89, no heap, and a stack peak as low as 21 bytes on AVR. Pairs directly with the OpenSynaptic server and OSynaptic-FX gateway over any serial transport.
GitHub: https://github.com/OpenSynaptic/OSynaptic-TX
Why OSynaptic-TX?
| Feature | Details |
|---|---|
| TX-only, no decode code | Flash cost is a fraction of a full-duplex library |
| C89 clean | Compiles on every toolchain targeting 8-bit MCUs: avr-gcc, SDCC, IAR, MPLAB XC8 |
| No heap | Zero malloc/free calls; all buffers are stack or static |
| Three API tiers | Pick the tier that matches your MCU's RAM budget |
| Spec-compatible | Packets decode directly by OpenSynaptic server without glue code |
Try In 30 Seconds
Arduino IDE → Sketch > Include Library > Add .ZIP Library → select OSynaptic-TX.zip
File > Examples > OSynaptic-TX > BasicTX → Upload
Open Serial Monitor at 115200 baud — FULL packets stream out once per second.
Three API Tiers
Choose the tier that matches your MCU's available RAM:
| Tier | Stack peak | Static RAM | Flash (~1 sensor) | When to use |
|---|---|---|---|---|
A — ostx_sensor_pack() | ~137 B | 96 B | ~600 B | Dynamic runtime strings; most flexible |
B — ostx_static_pack() | ~51 B | 96 B | ~430 B | Compile-time sensor descriptor in Flash |
C — ostx_stream_pack() | ~21 B | 0 B | ~760 B | Zero-buffer streaming via callback — minimum RAM |
All three tiers produce identical wire frames. The linker drops unused modules automatically.
Memory Footprint
API C Streaming (recommended for AVR ≤ 4 KB SRAM)
| Resource | Value |
|---|---|
| Stack peak | ~21 bytes |
| Static RAM | 0 bytes |
| Flash (Uno/Nano, 1 sensor) | ~760 bytes |
Minimum supported MCU
| Resource | Value | Example devices |
|---|---|---|
| RAM | ≥ 128 B | ATtiny25 / ATmega48 |
| Flash | ≥ 2 KB | ATtiny25 / ATmega48 |
Quick Navigation
| Section | Description |
|---|---|
| Quick Start | API C, B, and A code examples |
| Installation | Arduino IDE, CMake, find_package |
| API Tiers | When to use A vs B vs C |
| Wire Format | Byte-level packet layout |
| Configuration | ostx_config.h macros |
| Unit Validation | UCUM unit codes and SI prefix rules |
| MCU Deployment | Per-MCU capability table |
| Transport Selection | UART, UDP, LoRa, nRF24 guidance |
| API Reference | Complete function and struct reference |
| Examples | Five annotated examples |