timers-pwm-baremetal

timers-pwm-baremetal is a skill for Claude Code, Codex from mohitmishra786/low-level-dev-skills. It costs 56 tokens per session (597 once invoked), scanned A, original, MIT.

A guide to configuring microcontroller timers without an operating system. It covers PWM, which controls output power such as LED brightness, input capture for measuring pulses, and periodic system ticks.

In plain words
What is it for?
Use it to drive motors or LEDs, measure pulse widths, trigger regular hardware sampling, or create a simple millisecond clock on bare-metal firmware.
Why use it?
It removes the guesswork from timer clock settings, timing periods, duty cycles, and capture configuration.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to drive motors or LEDs, measure pulse widths, trigger regular hardware sampling, or create a simple millisecond clock on bare-metal firmware.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mohitmishra786/low-level-dev-skills/timers-pwm-baremetal
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.

Any agent
npx skills add mohitmishra786/low-level-dev-skills --skill timers-pwm-baremetal
Clone the repo
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills

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 timers-pwm-baremetal

README.md
[![agentmods](https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/timers-pwm-baremetal/github.svg)](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/timers-pwm-baremetal)
Your own site
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/timers-pwm-baremetal"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/timers-pwm-baremetal/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for timers-pwm-baremetal

Your own site · 80×15
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/timers-pwm-baremetal"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/timers-pwm-baremetal.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 597 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00056 $0.00597
Opus 5 $0.00028 $0.00298
Sonnet 5 $0.00011 $0.00119
Haiku 4.5 $0.00006 $0.00060

Measured 12d ago against content hash 84505186718b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

timers-pwm-baremetal 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 12d 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.

skills/baremetal/timers-pwm-baremetal/SKILL.md · 77 lines

What it actually says

Timers and PWM (Bare-Metal)

Purpose

Configure MCU timers for PWM output, input capture, and periodic scheduling: prescaler/ARR setup, compare channels, and SysTick as a simple tick source.

When to Use

  • Motor/LED dimming via PWM
  • Measuring pulse width (input capture)
  • Bare-metal millis() without FreeRTOS
  • Hardware periodic sampling trigger

Workflow

1. PWM on TIM2 CH1 (STM32)

f_pwm = f_timer_clk / ((PSC+1) * (ARR+1))
duty = (CCR / (ARR+1)) * 100%
RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;

TIM2->PSC  = 83;      /* 84MHz / 84 = 1 MHz tick */
TIM2->ARR  = 999;     /* 1 kHz PWM */
TIM2->CCR1 = 500;     /* 50% duty */
TIM2->CCMR1 |= (6U << TIM_CCMR1_OC1M_Pos);  /* PWM mode 1 */
TIM2->CCER  |= TIM_CCER_CC1E;
TIM2->CR1   |= TIM_CR1_CEN;

GPIO: PA0 AF1 TIM2_CH1.

2. SysTick tick

volatile uint32_t tick_ms;

void SysTick_Handler(void) {
    tick_ms++;
}

void systick_init(uint32_t hz) {
    SysTick_Config(SystemCoreClock / hz);
}

3. Input capture

Configure channel in CCMR as input, set CCER polarity, read CCR on interrupt when edge captured.

4. Agent usage

/timers-pwm-baremetal 1 kHz 25% duty PWM on TIM2 channel 1

Common Problems

Symptom Cause Fix
Wrong frequency APB timer clock doubling Check RM timer clock x2 rule
No PWM output CCER/CCMR not enabled Enable channel output
Jittery tick SysTick overridden One owner for SysTick
  • skills/baremetal/gpio-baremetal — timer pin AF
  • skills/embedded/freertos — replace SysTick with RTOS tick
  • skills/baremetal/adc-dac-baremetal — timer TRGO for ADC trigger
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. 12d ago First seen · 77 lines · 56 tokens per session scan A 84505186718b

Subscribe to this mod's changes

timers-pwm-baremetal is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (203 stars, last pushed 2mo ago), licensed MIT. It adds 56 tokens to every session and 597 once invoked, about $0.0003 per session on Opus 5. 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.