Skip to content

LEDC: Add documentation of valid channels and shared timers#6638

Merged
guillempages merged 2 commits into
esphome:currentfrom
RubenKelevra:ledc_channel_ranges_docs
May 31, 2026
Merged

LEDC: Add documentation of valid channels and shared timers#6638
guillempages merged 2 commits into
esphome:currentfrom
RubenKelevra:ledc_channel_ranges_docs

Conversation

@RubenKelevra
Copy link
Copy Markdown
Contributor

Description

Different ESP32 hardware variants have different amounts of LEDC channels: 16, 8 or 6. Added a table to clarify this to the users.

All ESP32 hardware variants have in common, that the LEDC channel pairs use a shared timer, which still allows different duty cycles and different phase settings, but not different frequencies for those two channels. Improved documentation of this.

Also add a hidden MDX note for ESP32-H21 and ESP32-H4, for future reference when they become ESPHome-supported variants.

References:
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32s2/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32s3/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32c2/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32c3/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32c5/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32c6/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32c61/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32h2/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32p4/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/master/components/soc/esp32h21/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/master/components/soc/esp32h4/include/soc/soc_caps.h

Checklist

  • I am merging into current because this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.

@esphome esphome Bot added the current label May 17, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1da49fc7-f2ad-42e0-890a-e488e78d7bf6

📥 Commits

Reviewing files that changed from the base of the PR and between 0ca227e and e7e7a31.

📒 Files selected for processing (1)
  • src/content/docs/components/output/ledc.mdx

Walkthrough

Documentation update to the LEDC output component channel option: adds ESP32-variant valid channel ranges and replaces the previous manual-channel workaround with guidance that adjacent channels share a hardware timer and cannot use different PWM frequencies.

Changes

LEDC Channel Configuration Documentation

Layer / File(s) Summary
ESP32 variant channel range documentation and timer-sharing note
src/content/docs/components/output/ledc.mdx
Expanded channel docs with variant-specific valid ranges (ESP32 0-15, ESP32-S2/S3/P4 0-7, ESP32-C2/C3/C5/C6/C61/H2 0-5), removed prior instruction to use channels 0,2,4,6, and added guidance that adjacent channels share a hardware timer so they cannot use different PWM frequencies; advises manual assignment and avoiding adjacent pairs when different frequencies are required. Note added about future ESP32-H21/H4 support for 0-5.

Sequence Diagram

sequenceDiagram
  participant Docs
  participant Reader
  Docs->>Reader: displays variant-specific channel ranges
  Docs->>Reader: explains adjacent-channel timer sharing and frequency constraints
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

documentation

Suggested reviewers

  • guillempages
  • jesserockz
  • DjordjeMandic
  • kbx81
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changes: adding documentation of valid channel ranges and shared timer behavior for LEDC output.
Description check ✅ Passed The description is directly related to the changeset, clearly explaining the variant-specific channel counts, shared timer limitations, and future-reference notes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/content/docs/components/output/ledc.mdx`:
- Around line 37-41: Replace the plain-text "Note: Two adjacent channels share
the same hardware timer..." paragraph with a GitHub-flavored alert block using
the GFM alert syntax (use "> [!NOTE]" as the first line), preserving the
existing content and inline code examples (e.g., `0`/`1`, `2`/`3`) and line
breaks so the note renders as an alert box in the MDX file; locate the paragraph
that starts with "Note: Two adjacent channels share the same hardware timer."
and convert it to the alert block format.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 194dde8b-5624-4a8d-9a1a-467d8df1944c

📥 Commits

Reviewing files that changed from the base of the PR and between f33636d and 0ca227e.

📒 Files selected for processing (1)
  • src/content/docs/components/output/ledc.mdx

Comment thread src/content/docs/components/output/ledc.mdx Outdated
@netlify
Copy link
Copy Markdown

netlify Bot commented May 17, 2026

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit e7e7a31
🔍 Latest deploy log https://app.netlify.com/projects/esphome/deploys/6a1c79e4a3561400085ce9f2
😎 Deploy Preview https://deploy-preview-6638--esphome.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@RubenKelevra RubenKelevra force-pushed the ledc_channel_ranges_docs branch from 0ca227e to 8709220 Compare May 17, 2026 14:54
@RubenKelevra

This comment was marked as resolved.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

✅ Actions performed

Full review triggered.

Different ESP32 hardware variants have different amounts of LEDC channels:
16, 8 or 6. Added a table to clarify this to the users.

All ESP32 hardware variants have in common, that the LEDC channel pairs use
a shared timer, which still allows different duty cycles and different
phase settings, but not different frequencies for those two channels.
Improved documentation of this.

Also add a hidden MDX note for ESP32-H21 and ESP32-H4, for future reference
when they become ESPHome-supported variants.

References:
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32s2/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32s3/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32c2/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32c3/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32c5/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32c6/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32c61/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32h2/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/v5.5.3/components/soc/esp32p4/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/master/components/soc/esp32h21/include/soc/soc_caps.h
https://github.com/espressif/esp-idf/blob/master/components/soc/esp32h4/include/soc/soc_caps.h
@RubenKelevra RubenKelevra force-pushed the ledc_channel_ranges_docs branch from 8709220 to 1ac7558 Compare May 17, 2026 14:59
@RubenKelevra
Copy link
Copy Markdown
Contributor Author

Minor correction: Moved the phase angle config options up, so it doesn't hang so weirdly below the additional info about the channels.

Copy link
Copy Markdown
Contributor

@guillempages guillempages left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@guillempages guillempages enabled auto-merge (squash) May 31, 2026 18:12
@guillempages guillempages merged commit 9bc3faa into esphome:current May 31, 2026
6 checks passed
@RubenKelevra RubenKelevra deleted the ledc_channel_ranges_docs branch May 31, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants