Skip to content

Commit

Permalink
libraries: match example values in documentation
Browse files Browse the repository at this point in the history
The example usage did not previously match the register definition,
now it does.
  • Loading branch information
ppannuto committed Jul 18, 2018
1 parent c710185 commit a657ceb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions libraries/tock-register-interface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@ let range: u8 = registers.cr.read(Control::RANGE);
// Or one can read `range` as a enum and `match` over it.
let range = registers.cr.read_as_enum(Control::RANGE);
match range {
Some(Control::RANGE::Value::Zero) => { /* ... */ }
Some(Control::RANGE::Value::One) => { /* ... */ }
Some(Control::RANGE::Value::Two) => { /* ... */ }
Some(Control::RANGE::Value::Three) => { /* ... */ }

Some(Control::RANGE::Value::VeryHigh) => { /* ... */ }
Some(Control::RANGE::Value::High) => { /* ... */ }
Some(Control::RANGE::Value::Low) => { /* ... */ }

None => unreachable!("invalid value")
}

Expand Down Expand Up @@ -250,7 +249,7 @@ let mode = registers.cr.read_as_enum(Status::MODE);
match mode {
Some(Status::MODE::FullDuplex) => { /* ... */ }
Some(Status::MODE::HalfDuplex) => { /* ... */ }

None => unreachable!("invalid value")
}

Expand Down

0 comments on commit a657ceb

Please sign in to comment.