Repository navigation
rtc: write the RX8130CE and YSN8900 weekday one-hot - #101
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The optional property is accessed as required, causing non-RX8130CE builds to fail preprocessing.
Review effort: Lite
Findings: 1
What changed in this PR
Updates RTC synchronization to encode RX8130CE weekdays as one-hot values while preserving other RTC formats.
Changes:
- Adds the
weekday-one-hotDevicetree binding. - Enables it for RX8130CE devices.
- Applies per-RTC weekday encoding during writes.
| File | Description |
|---|---|
zephcore/dts/bindings/rtc/zephcore,rtc-i2c.yaml |
Documents the optional weekday encoding property. |
zephcore/boards/common/rtc-i2c.dtsi |
Enables one-hot encoding for RX8130CE. |
zephcore/adapters/clock/ZephyrRTCDiscover.c |
Selects binary or one-hot weekday writes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| .zero = COND_CODE_1( \ | ||
| DT_NODE_HAS_PROP(node, zero_mask), \ | ||
| (RTC_ZERO_NAME(node)), (NULL)), \ | ||
| .week_one_hot = DT_PROP(node, weekday_one_hot), \ |
Contributor
Author
There was a problem hiding this comment.
Disproven. A type: boolean property declared in a binding is always generated, with the value 0 on a node that omits it, so DT_PROP() is defined for every node of the compatible.
- Zephyr says so:
include/zephyr/devicetree.h: "Boolean properties defined for a compatible node always exist, as they are generated with a value of 0 when not present on a node." - The build agrees: at this head, the generated
devicetree_generated.hforthinknode_m1hasrtc_ds3231_68_P_weekday_one_hot 0,rtc_pcf8563_51_P_weekday_one_hot 0,rtc_rv3028_52_P_weekday_one_hot 0andrtc_rx8130ce_32_P_weekday_one_hot 1. Formeshtracker_x1it hasrtc_ysn8900_32_P_weekday_one_hot 1. - The builds pass:
thinknode_m1,meshtracker_x1,muziworks_r1neoandrak4631compile with no compiler warnings.rak4631has no node with the property at all.
DT_PROP_OR(..., false) would behave the same and adds nothing.
rtc_time_block() wrote the weekday as a number 0-6 (Sunday 0) for every RTC. The RX8130CE's WEEK register (13h) is one-hot: Epson ETM50E-10 14.1.2, Table 15, p. 27, Sunday 01h to Saturday 40h, with no more than one bit set. So each sync wrote Sunday as no day, Monday as Sunday, and Wednesday, Friday and Saturday as two days at once. ZephCore never reads the weekday back, so its time and date were unaffected. A new boolean descriptor property, weekday-one-hot, is set on the RX8130CE node in rtc-i2c.dtsi, and rtc_time_block() writes BIT(dow) where it is set. That is the encoding of Zephyr's rtc_rx8130ce.c. The DS3231, PCF8563 and RV3028 keep 0-6, as Zephyr's drivers for them write it. The binding and comments no longer call the whole block BCD. meshtracker_x1's YSN8900 sets it too. The board already uses the RX8900 register map for it, and the RX8900's WEEK register (03h) is one-hot: Epson ETM45E-11 8.2.2, Table 15, p. 16. The YSN8900's own data sheet has no register map, and its programming guide is not available. The same defect and fix as meshcore-dev/MeshCore#3550. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ptr727
force-pushed
the
rx8130ce-week-one-hot
branch
from
October 5, 2026 19:35
0e93948 to
2621782
Compare
This was referenced Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The MeshCore counterpart is meshcore-dev/MeshCore#3550.
Code links are permalinks:
devatd1cc647, this PR's commit2621782.The defect
rtc_time_block()writes the weekday as a binary 0-6 (Sunday 0) for every RTC. The RX8130CE's WEEK register (13h) is one-hot: Epson ETM50E-10 §14.1.2, Table 15, p. 27, Sunday01hto Saturday40h, "Do not set '1' to more than one day at the same time". So on every sync, Sunday was written as no day, Monday as Sunday, and Wednesday, Friday and Saturday as two days at once. ZephCore never reads the weekday back, so its time and date were unaffected.The fix
The same encoding as meshcore-dev/MeshCore#3550 and Zephyr's own
rtc_rx8130ce.c(wday2rtc(),1 << wday):weekday-one-hotis a boolean, set on the RX8130CE node inrtc-i2c.dtsi. Every board with an RX8130CE (muziworks_r1neo, thinknode_m1/m3/m6, lilygo_techo, thinknode_m9) gets it from there.rtc_time_block()writesBIT(dow)when it is set, anddowotherwise. That covers the sync write and the RV3028 write retry. The DS3231, PCF8563 and RV3028 keep 0-6, as Zephyr's own drivers for them write it.The meshtracker_x1 YSN8900 too. Its
rtc-ysn8900@32node already uses the RX8900 register map, and the RX8900's WEEK register (03h) is one-hot: Epson RX8900 Application Manual ETM45E-11, §8.2.2, Table 15, p. 16, Sunday01hto Saturday40h. The node now setsweekday-one-hotas well. The YSN8900's own data sheet is a one-page brief with no register map, and its programming guide isn't available, so this rests on it being an RX8900 second source, as the board's DTS comment says.Testing
thinknode_m1companion,muziworks_r1neorepeater,meshtracker_x1companion andrak4631repeater build with no compiler warnings. The generated devicetree hasweekday_one_hot= 1 on the RX8130CE node and 0 on every other RTC node.weekday_one_hot= 1 on the YSN8900 node.80h) accepts every one-hot value01h-40h, so identification is unchanged.Fork issue: ptr727#39. Iteration history and review: ptr727#45.
🤖 Generated with Claude Code