Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Dragosh-C
Copy link
Contributor

@Dragosh-C Dragosh-C commented Nov 10, 2024

Pull Request Overview

This pull request adds an example of the expanded output from the register_bitfields! macro. The example focuses on the central part of the generated code, providing clarity on how the bitfield structure, including field types and operator overloads, is created.

Testing Strategy

I ran the code using the register_bitfields! macro and employed cargo expand to inspect the generated output. After analyzing the code, I incorporated the concise version into the documentation to provide an example of the macro’s behavior.

TODO or Help Wanted

N/A

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@github-actions github-actions bot added the tock-libraries This affects libraries supported by the Tock project label Nov 10, 2024
@lschuermann
Copy link
Member

Fixes #4222.

Copy link
Member

@lschuermann lschuermann left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution, this is great!

I'm slightly worried this might be too detailed for the purposes of a README. On the one hand, we wouldn't want to elide too many details or oversimplify, as it's important for developers to understand exactly what these macros document. However, if we give too many details, then we lose out on the utility of this documentation.

I think this is close. Next to the suggestions in the code, I would maybe remove the expanded Status and InterruptFlags expansions. They don't add too much, Control seems to encompass all the types & values we're generating.

While InterruptFlags could maybe be interesting, it's also just a (seldomly used) simplification of the full syntax. In fact, it might be best to instead expand the InterruptFlags example itself (on lines 181 to 189) to also include an example (in a comment) on how this maps to the full syntax as used by Control and Status.

@lschuermann lschuermann self-assigned this Nov 10, 2024
@Dragosh-C Dragosh-C force-pushed the fix_tock_registers_issue branch from b0d60a3 to 5575d71 Compare November 10, 2024 15:19
@Dragosh-C Dragosh-C force-pushed the fix_tock_registers_issue branch from 5575d71 to f1e6381 Compare November 10, 2024 15:47
@Dragosh-C Dragosh-C force-pushed the fix_tock_registers_issue branch from f1e6381 to c5fa7af Compare November 10, 2024 15:48
lschuermann
lschuermann previously approved these changes Nov 10, 2024
@lschuermann lschuermann added enhancement documentation P-Upkeep This a relatively minor change, or one that is limited in scope, and requires less scrutiny. last-call Final review period for a pull request. labels Nov 10, 2024
@lschuermann lschuermann added this pull request to the merge queue Nov 10, 2024
Merged via the queue into tock:master with commit 6ddf6ef Nov 10, 2024
12 checks passed
@lschuermann lschuermann mentioned this pull request Jun 27, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement last-call Final review period for a pull request. P-Upkeep This a relatively minor change, or one that is limited in scope, and requires less scrutiny. tock-libraries This affects libraries supported by the Tock project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc: tock-registers should have an example of what register_bitfields! expands to
2 participants