finds.dev← search

// the find

Jacajack/liblightmodbus

★ 327 · C · GPL-3.0 · updated Jan 2025

A lightweight, header-only, hardware-agnostic Modbus RTU/TCP library

liblightmodbus is a C99 header-only Modbus RTU/TCP library aimed at embedded targets where you control the transport layer yourself. It handles framing, CRC, and function code parsing while staying entirely agnostic about how bytes actually move — you wire in your own read/write callbacks. Good fit for AVR, ESP32, or any bare-metal target where you can't pull in a heavier stack.

Static memory allocation is a first-class option, not an afterthought — you can run this on a device with no heap at all. The callback-based design keeps hardware coupling out of the library entirely; porting to a new UART or RS-485 driver is a matter of writing one function. Fuzz testing is present (libFuzzer, with saved corpus) which is unusual for a library this size and matters a lot for something parsing untrusted wire data. Custom function code support lets you bolt on vendor-specific extensions without forking.

The C++ interface is explicitly marked experimental and looks like a thin wrapper rather than a real API redesign — don't reach for it in production C++ code. Last meaningful activity was early 2025 and the issue tracker has open bugs sitting for years, so you're largely on your own if you hit an edge case. The 'header-only' model means implementation is gated behind macros and split across `.h` / `.impl.h` pairs, which is clever for a single-translation-unit build but can cause link confusion if you're not careful about where you define `LIGHTMODBUS_IMPL`. Documentation lives on GitHub Pages and is good, but the porting guide from v2 signals breaking API changes happened — pin your version if you're embedding this in a product.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →