GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Vanderhell/microbus: Event pub/sub bus for embedded systems in C99 with zero allocations and ISR-safe deferred queue.

BranchesTags
Open more actions menu

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
cmake
cmake
 
 
docs
docs
 
 
include
include
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 

Repository files navigation

microbus

microbus is a small C99 event bus for embedded and host applications that want caller-owned storage, copied payload bytes, and bounded queued dispatch without heap allocation.

Status

  • Immediate publish is synchronous and deterministic.
  • Deferred queue dispatch is bounded to the events present at mbus_dispatch() entry.
  • MBUS_TOPIC_ANY is subscribe-only.
  • Payload bytes are copied into the event object.
  • Counter fields wrap modulo 2^32.
  • Default mode is single-context only.
  • Optional ISR/main-loop SPSC mode is configuration-driven and requires caller-supplied critical-section hooks.
  • General thread safety is not provided. Use external locking around bus operations outside the supported single-context or configured ISR mode.

Quick Start

#include "mbus.h"

#include <stdint.h>
#include <string.h>

static void on_sensor(const mbus_event_t *event, void *ctx)
{
    uint16_t millivolts = 0;
    (void)ctx;

    if (event->payload_len != sizeof(millivolts)) {
        return;
    }

    memcpy(&millivolts, event->payload, sizeof(millivolts));
}

int main(void)
{
    mbus_t bus;
    uint16_t value = 3300;
    int rc;

    rc = mbus_init(&bus, NULL);
    if (rc != MBUS_OK) {
        return 1;
    }

    rc = mbus_subscribe(&bus, MBUS_TOPIC_SENSOR, on_sensor, NULL);
    if (rc < 0) {
        return 2;
    }

    rc = mbus_publish(&bus, MBUS_TOPIC_SENSOR, &value, sizeof(value));
    if (rc < 0) {
        return 3;
    }

    return 0;
}

Build

CMake

cmake -S . -B out/build -DMBUS_BUILD_TESTS=ON
cmake --build out/build
ctest --test-dir out/build --output-on-failure

Make

make test

The top-level Makefile is a thin wrapper around the CMake build and honors CC, CPPFLAGS, CFLAGS, LDFLAGS, and LDLIBS.

Configuration

The public configuration contract lives in mbus_config.h.

Macro Default Notes
MBUS_MAX_SUBSCRIBERS 16 Must be 1..255.
MBUS_MAX_PAYLOAD 32 Must be 1..255 while payload_len stays uint8_t.
MBUS_ENABLE_QUEUE 1 Must be 0 or 1.
MBUS_QUEUE_DEPTH 8 Must be at least 1 and power-of-two when the queue is enabled.
MBUS_ISR_SAFE_QUEUE 0 Optional ISR/main-loop SPSC mode. Requires critical-section hook macros.

Installed consumers must use the generated mbus_config.h shipped with the package rather than redefining ABI-shaping macros independently.

Support Matrix

Area Status
C99 public API Verified
C11 host build Verified with GCC and Clang
C++ consumer including mbus.h Verified
GCC host build Verified
Clang host build Verified
MSVC host build Verified
Immediate publish Verified
Queue enabled build Verified
Queue disabled build Verified
Install + find_package(microbus CONFIG REQUIRED) consumer Verified
add_subdirectory() consumer Verified
Optional ISR/main-loop SPSC mode with hooks Implemented, not fully verified on this host
General multi-threaded access without external locking Not supported
ARM cross-compilation Not verified on this host

Documentation

  • API reference
  • Design notes
  • Porting guide
  • Cookbook
  • Troubleshooting
  • Verification log
  • Contributing
  • Security

License

MIT. See LICENSE.

About

Event pub/sub bus for embedded systems in C99 with zero allocations and ISR-safe deferred queue.

Topics

cc99embeddedevent-busiotisrpubsubzero-allocation

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity

Stars

1 star

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.