comm-bus-patterns

comm-bus-patterns is a skill for Claude Code, Codex from HermeticOrmus/LibreEmbed-Claude-Code. It costs 0 tokens per session (1,655 once invoked), scanned A, original, MIT.

A collection of production patterns for communication-bus drivers written in embedded C. The examples use STM32 hardware libraries called HAL and LL, which provide different levels of access to the chip's peripherals.

In plain words
What is it for?
Use it as a starting point for I2C sensor register access, I2C bus recovery, and related STM32 HAL or LL driver code.
Why use it?
It provides tested-looking implementation shapes for common driver tasks and shows how to handle details such as I2C addressing, timeouts, and recovery from a stuck bus.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/hermeticormus/libreembed-claude-code/comm-bus-patterns
Any agent
npx skills add HermeticOrmus/LibreEmbed-Claude-Code --skill comm-bus-patterns
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/LibreEmbed-Claude-Code

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for comm-bus-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/comm-bus-patterns.svg)](https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/comm-bus-patterns)
Your own site
<a href="https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/comm-bus-patterns"><img src="https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/comm-bus-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,655 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01655
Opus 5 $0.00000 $0.00827
Sonnet 5 $0.00000 $0.00331
Haiku 4.5 $0.00000 $0.00166

Measured 4d ago against content hash 610ce5bc83c4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

comm-bus-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/communication-buses/skills/comm-bus-patterns/SKILL.md · 191 lines

How it starts

The opening of the file, as written. The whole thing — 191 lines — stays where its author put it; the contents beside it link to each section on GitHub.

comm-bus-patterns

Knowledge Base

Production communication bus patterns for embedded C. STM32 HAL and LL examples.


Pattern 1: I2C Register Read/Write for MEMS Sensors

Generic register-addressed I2C sensor driver (BME280, MPU-6050, etc.):

#define I2C_TIMEOUT_MS  5U

HAL_StatusTypeDef sensor_write_reg(I2C_HandleTypeDef *hi2c,
                                    uint8_t dev_addr, uint8_t reg, uint8_t val)
{
    uint8_t buf[2] = { reg, val };
    return HAL_I2C_Master_Transmit(hi2c, dev_addr << 1, buf, 2, I2C_TIMEOUT_MS);
}

HAL_StatusTypeDef sensor_read_reg(I2C_HandleTypeDef *hi2c,
                                   uint8_t dev_addr, uint8_t reg,
                                   uint8_t *out, uint16_t len)
{
    HAL_StatusTypeDef s;
    s = HAL_I2C_Master_Transmit(hi2c, dev_addr << 1, &reg, 1, I2C_TIMEOUT_MS);
    if (s != HAL_OK) { return s; }
    return HAL_I2C_Master_Receive(hi2c, (dev_addr << 1) | 1,
                                   out, len, I2C_TIMEOUT_MS);
}

/* I2C bus recovery: toggle SCL 9 times to release stuck SDA */
void i2c_bus_recover(GPIO_TypeDef *scl_port, uint16_t scl_pin,
                     GPIO_TypeDef *sda_port, uint16_t sda_pin)
{
    for (int i = 0; i < 9; i++) {
        HAL_GPIO_WritePin(scl_port, scl_pin, GPIO_PIN_SET);
        HAL_Delay(1);
        HAL_GPIO_WritePin(scl_port, scl_pin, GPIO_PIN_RESET);
        HAL_Delay(1);
    }
    /* Generate STOP: SDA low→high while SCL high */
    HAL_GPIO_WritePin(sda_port, sda_pin, GPIO_PIN_RESET);
    HAL_GPIO_WritePin(scl_port, scl_pin, GPIO_PIN_SET);
    HAL_Delay(1);
    HAL_GPIO_WritePin(sda_port, sda_pin, GPIO_PIN_SET);
}

Pattern 2: SPI DMA Transfer with Semaphore

Non-blocking SPI using DMA and FreeRTOS binary semaphore for completion notification:

static SemaphoreHandle_t s_spi_done;

void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi)
{
    if (hspi == &hspi1) {
        BaseType_t woken = pdFALSE;
        xSemaphoreGiveFromISR(s_spi_done, &woken);
        portYIELD_FROM_ISR(woken);
    }
}

void spi_dma_init(void)
{
    s_spi_done = xSemaphoreCreateBinary();
}

bool spi_transfer(const uint8_t *tx, uint8_t *rx, uint16_t len)
{
    spi_cs_assert();
    HAL_SPI_TransmitReceive_DMA(&hspi1, (uint8_t *)tx, rx, len);
    /* Block task until DMA complete (max 10ms) */
    bool ok = xSemaphoreTake(s_spi_done, pdMS_TO_TICKS(10)) == pdTRUE;
    spi_cs_deassert();
    return ok;
}

Read the full file on GitHub · 191 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 191 lines · 0 tokens per session scan A 610ce5bc83c4

Subscribe to this mod's changes

comm-bus-patterns is a skill published in the GitHub repository HermeticOrmus/LibreEmbed-Claude-Code (44 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,655 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

hardware-iot-bus

Low-level I2C and SPI bus peripheral control for embedded Linux boards (Orange Pi, Raspberry Pi, RISC-V).

AbdullahMalik17/malikclaw · 31 tokens

aether-iot-query

Use this skill when the user asks about a live AetherEdge runtime: channels, points, real-time values, history, alarms, rules, models, instances, routing, SHM health, service health, or system status. Use aether CLI commands to answer — do NOT inspect source code, local database files, or config YAMLs to answer…

EvanL1/AetherEdge · 82 tokens

aether-iot

Build, integrate, diagnose, or generate applications for the AetherEdge AI-native edge kernel. Use for AetherEdge onboarding, SDK compositions, device and topology clients, read-only operations UIs, MCP integration, Domain Packs, or governed IoT commands where live-state authority and physical-device safety must be…

EvanL1/AetherEdge · 68 tokens

avr-bare-metal-embedded

Curated Knowledge API for AI Agents — 68 MCP tools, 200+ skill packs, 46K chunks, semantic search over 670K vectors, 5-layer validation pipeline. Works with Claude Code, Cursor, Cline, Windsurf.

MidOSresearch/midos · 6 tokens

smart-product-dev

End-to-end IoT product development orchestration for TuyaOpen projects. Guides from requirements gathering → Tuya Platform product/DP creation → complete embedded firmware generation. State-machine: detects project state and picks up from wherever development currently stands.

tuya/tuyaopen-ide-manifests · 52 tokens

edge-iot

Edge computing, IoT protocols, and embedded systems integration.

miles990/claude-software-skills · 15 tokens