Skip to content

Report M5IOE1 PWM frequency write results - #322

Merged
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:ioe1_pwm_frequency_result
Aug 17, 2026
Merged

Report M5IOE1 PWM frequency write results#322
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:ioe1_pwm_frequency_result

Conversation

@ainyan03

Copy link
Copy Markdown
Contributor

Return the I2C write status from M5IOE1_Class::setPwmFrequency instead of
discarding it, and document that the configured frequency is shared by every
PWM channel, so setting it for one channel also retunes a channel that is
already running.

This was part of #319 and was then carried inside #321 until review flagged it
as an undocumented API change there. It is a public API decision of its own
rather than part of the duty renames, so it gets its own change where the exact
compatibility story can be stated.

Breaking change

The return type changes from void to bool. Ordinary calls that discard the
result stay source-compatible; only code that depends on the exact
member-function type has to move from void (M5IOE1_Class::*)(std::uint16_t)
to bool (M5IOE1_Class::*)(std::uint16_t).

M5PM1_Class::setPwmFrequency already returns bool, so the two classes now
agree, and a caller can find out that the write never reached the chip instead
of proceeding on a stale frequency.

Intended for the next release, bumping the minor version to 0.3.0.

Verification

Built for ESP32, ESP32-S3, ESP32-P4 and ESP32-C5 on top of the current develop.

Return the underlying I2C write status from setPwmFrequency and document that the configured frequency is shared by every PWM channel.

BREAKING: the setPwmFrequency return type changes from void to bool. Ordinary calls that discard the result remain source-compatible, but code that depends on the exact member-function type must update from void (M5IOE1_Class::*)(uint16_t) to bool (M5IOE1_Class::*)(uint16_t).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the M5IOE1 PWM frequency setter API so callers can detect I2C write failures, and clarifies in the public API docs that PWM frequency is a shared device-wide setting across channels.

Changes:

  • Change M5IOE1_Class::setPwmFrequency return type from void to bool and return the underlying writeRegister(...) status.
  • Add API documentation noting the PWM frequency is shared across all PWM channels (changing it affects already-running channels).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/utility/M5IOE1_Class.hpp Updates the public API signature to bool and documents the shared-frequency behavior.
src/utility/M5IOE1_Class.cpp Propagates the writeRegister result by returning it from setPwmFrequency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lovyan03
lovyan03 merged commit 97d5fa0 into m5stack:develop Aug 17, 2026
27 checks passed
@ainyan03 ainyan03 mentioned this pull request Aug 17, 2026
@ainyan03
ainyan03 deleted the ioe1_pwm_frequency_result branch August 17, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants