Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tock-registers README.md #2095

Merged
merged 1 commit into from
Sep 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions libraries/tock-register-interface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ register_structs! {

// The type for a register can be anything. Conveniently, you can use an
// array when there are a bunch of similar registers.
(0x00C => array: [ReadWrite<u32>; 4])
(0x01C => ... )
(0x00C => array: [ReadWrite<u32>; 4]),
(0x01C => ... ),

// Etc.

Expand Down Expand Up @@ -178,7 +178,7 @@ register_bitfields! [
// name OFFSET(shift) NUMBITS(num) [ /* optional values */ ]

// This is a two-bit field which includes bits 4 and 5
RANGE OFFSET(4) NUMBITS(3) [
RANGE OFFSET(4) NUMBITS(2) [
// Each of these defines a name for a value that the bitfield can be
// written with or matched against. Note that this set is not exclusive--
// the field can still be written with arbitrary constants.
Expand Down Expand Up @@ -439,13 +439,13 @@ with a register of the type `ReadWrite<_, Control>` (or `ReadOnly/WriteOnly`,
etc). For instance, if we have the bitfields and registers as defined above,

```rust
// This line compiles, because CR and registers.cr are both associated with the
// Control group of bitfields.
// This line compiles, because registers.cr is associated with the Control group
// of bitfields.
registers.cr.modify(Control::RANGE.val(1));

// This line will not compile, because CR is associated with the Control group,
// while registers.s is associated with the Status group.
registers.s.modify(Control::RANGE.val(1));
// This line will not compile, because registers.s is associated with the Status
// group, not the Control group.
let range = registers.s.read(Control::RANGE);
```

## Naming conventions
Expand Down