Skip to content

Add PWM brightness control for the M5ToughC5 backlight - #250

Merged
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:toughc5_brightness
Aug 14, 2026
Merged

Add PWM brightness control for the M5ToughC5 backlight#250
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:toughc5_brightness

Conversation

@ainyan03

Copy link
Copy Markdown
Contributor

The M5ToughC5 backlight control was on/off only, so setBrightness() had no dimming effect between 1 and 255.

This drives the backlight with the I/O expander's PWM channel, the same approach already used for the ChainCaptain (and the PaperMono on its PMIC): 1kHz PWM, 12-bit duty, with a gamma 2.0 curve so the perceived brightness follows the setting. Zero still turns the backlight fully off.

Verified on an M5ToughC5 with a brightness slider sweeping the full range.

The backlight was previously on/off only, so setBrightness had no
dimming effect. Drive it with the IO expander PWM channel in the same
way as the ChainCaptain, with a gamma 2.0 curve so the perceived
brightness follows the setting.
@lovyan03
lovyan03 merged commit 8947df2 into m5stack:develop Aug 14, 2026
27 checks passed
@ainyan03
ainyan03 deleted the toughc5_brightness branch August 26, 2026 07:51
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.

2 participants