Embedded C Code Generator
БесплатноЗапускает вложенные скриптыНе проверен嵌入式C代码生成器,提供15类量产级C代码模板(PI控制器/RS485收发切换/低通滤波/CRC校验/环形缓冲区/SVPWM/软件I2C主机/SPI主机/ADC均值滤波/有限状态机框架/DMA环形接收缓冲/软件定时器/命令行shell/轻量断言框架/按键扫描消抖),含Doxygen注释、错误处理和使用示例,全部模板经…
от liujycode176 установок в других каталогахОб этом скилле
Embedded C Code Generator
Current version: 1.1.0 | All 15 template families free to use, no gating
Never let an AI hand-write concurrency- or timing-sensitive modules on the fly — hand-rolled ring buffers leak edge cases, hand-rolled CRC gets polynomials wrong, hand-rolled PI hits integral windup, hand-rolled key debouncing misses bounce and wraparound. This skill ships test-verified, production-grade templates: 15 common module families as .h + .c file pairs, each with complete Doxygen comments, parameter validation, error handling and usage examples — all closed-loop scanned by the companion reviewer (0 critical, 0 major) and verified by gcc test suites (18 tests, 518 assertions).
When to Use It
- Need a ring buffer / PI controller / CRC: don't reinvent the wheel — especially not an untested one. Take the template, configure per the parameter table.
- AI-generated code you dare not ship: every template here carries a 518-assertion test endorsement; algorithmic correctness is documented.
- High quality bar: ISR safety (lock-free SPSC), C99 with no dynamic allocation, C++ compatible, fixed-point support, overflow protection — these pits are already walked through in the templates.
Workflow
- Identify the module: match user need to a module in the table below.
- Read template files: load the corresponding
.hand.cfromtemplates/. - Collect config parameters: confirm configurable items per the parameter table (Kp/Ki, pin assignments, buffer sizes). For unspecified items, use the recommended defaults below directly — do not stall with follow-up questions. Only for platform-specific items (pin numbers, USART instances) output placeholder macros and note them in the usage notes.
- Fill and output: populate config macros and init code per user parameters; output complete compilable
.hand.ccontents. If the user gave an MCU platform (STM32F4, GD32E230), add platform adaptation notes in comments. - Usage notes: briefly explain key cautions (ISR safety, timing requirements).
Module Catalog
| # | Module | Files | Key parameters | Trigger words |
|---|---|---|---|---|
| 1 | PI controller | pi_controller.h/c |
Kp, Ki, Ts, out_min/max, i_min/max | PI, PID, anti-windup |
| 2 | RS485 TX/RX switch | rs485_tc.h/c |
DE/RE pins, USART instance | RS485, half-duplex, DE/RE, TC flag |
| 3 | First-order low-pass | lowpass_filter.h/c |
fc, Ts or alpha | low-pass, LPF, IIR, smoothing |
| 4 | CRC | crc_utils.h/c |
buffer, length; optional CRC_USE_TABLE | CRC8, CRC16, Modbus, CCITT |
| 5 | Ring buffer | ring_buffer.h/c |
size, element type, full policy | ring buffer, FIFO, lock-free, ISR queue |
| 6 | SVPWM | svpwm.h/c |
Vdc, pwm_period | SVPWM, space vector, FOC, PMSM, BLDC |
| 7 | Software I2C master | soft_i2c.h/c |
SCL/SDA macros, bit_delay, clock stretch | I2C, bit-bang, open-drain, WriteThenRead |
| 8 | SPI master | spi_master.h/c |
mode 0-3, msb_first, cs_active_low | SPI, CS, CPOL, CPHA, full duplex |
| 9 | ADC mean filter | adc_avg_filter.h/c |
ReadFn pointer, N, trimmed-mean switch | ADC, averaging, outlier rejection |
| 10 | FSM framework | fsm_framework.h/c |
transition table, guards, actions, on_entry/exit | state machine, table-driven, guard |
| 11 | DMA ring RX buffer | dma_ring.h/c |
buffer (DMA circular target), write-position recovery | DMA, circular, UART RX, idle interrupt, no packet loss |
| 12 | Software timers | soft_timer.h/c |
now tick, period, one-shot/periodic, callback | soft timer, polling, wraparound-safe |
| 13 | Mini shell | mini_shell.h/c |
command table, MAX_ARGS | shell, command parser, argv, serial CLI |
| 14 | Lightweight assert | lite_assert.h/c |
LA_MODE, MAX_RECORDS, reset hook | assert, fault log, production, no-halt |
| 15 | Key scan debounce | key_scan.h/c |
max keys, debounce/long-press/repeat ticks, active level | key scan, debounce, long press, auto-repeat |
Recommended Defaults (apply directly when user gives none)
Produce code with these defaults without asking; list actually-used defaults in the usage notes.
| # | Module | Defaults |
|---|---|---|
| 1 | PI | Ts=0.001s (1 kHz), out/i limits ±1.0 (normalized duty); Kp=0.5, Ki=10.0 placeholders pending tuning |
| 2 | RS485 | DE/RE tied to one GPIO (placeholder RS485_DE_Pin), USART1; wait TC flag before dropping DE |
| 3 | Low-pass | Ts=0.001s, fc=50 Hz (general speed-feedback smoothing) |
| 4 | CRC | CRC16/MODBUS (init 0xFFFF), table-driven CRC_USE_TABLE=1 |
| 5 | Ring buffer | UART stream/log: 256 B, uint8_t, OVERWRITE on full; command parse: 128 B, REJECT |
| 6 | SVPWM | Vdc=24 V, pwm_period=0.0001 s (10 kHz) |
| 7 | Soft I2C | 100 kHz standard mode (half-bit 5 us); pins are platform placeholders |
| 8 | SPI | mode 0, MSB first, CS active-low |
| 9 | ADC filter | N=8, trimmed mean on (needs N>=3) |
| 10 | FSM | guards/actions NULL when unspecified |
| 11 | DMA r |
Установить Embedded C Code Generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Embedded C Code Generator?
嵌入式C代码生成器,提供15类量产级C代码模板(PI控制器/RS485收发切换/低通滤波/CRC校验/环形缓冲区/SVPWM/软件I2C主机/SPI主机/ADC均值滤波/有限状态机框架/DMA环形接收缓冲/软件定时器/命令行shell/轻量断言框架/按键扫描消抖),含Doxygen注释、错误处理和使用示例,全部模板经自家审查器闭环扫描与18个gcc测试套件(518项断言)验证。当用户需要生成、编写、查找嵌入式常用模块代码、不想重复造轮子要现成标准写法、PI控制器代码、RS485方向控制、低通滤波器、CRC校验、环形缓冲区ring buffer、SVPWM空间矢量PWM、FOC电机控制代码、软件I2C模拟IIC、SPI主机、ADC采样均值滤波、状态机FSM、DMA循环模式接收、软件定时器、串口命令解析shell、断言与故障记录、按键扫描、按键消抖、长按短按、连按自动重复等嵌入式C模块时使用。
Как установить скилл Embedded C Code Generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Embedded C Code Generator запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic