Skip to content

Commit d291f76

Browse files
bors[bot]ppannuto
andcommitted
Merge tock#1124
1124: libraries: match example values in documentation r=alevy a=ppannuto ### Pull Request Overview The example usage did not previously match the register definition, now it does. ### Documentation Updated - [x] Updated the relevant files in `/docs`, or no updates are required. ### Formatting - [x] Ran `make formatall`. Co-authored-by: Pat Pannuto <pat.pannuto@gmail.com>
2 parents 3537cd2 + a657ceb commit d291f76

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

libraries/tock-register-interface/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,10 @@ let range: u8 = registers.cr.read(Control::RANGE);
170170
// Or one can read `range` as a enum and `match` over it.
171171
let range = registers.cr.read_as_enum(Control::RANGE);
172172
match range {
173-
Some(Control::RANGE::Value::Zero) => { /* ... */ }
174-
Some(Control::RANGE::Value::One) => { /* ... */ }
175-
Some(Control::RANGE::Value::Two) => { /* ... */ }
176-
Some(Control::RANGE::Value::Three) => { /* ... */ }
177-
173+
Some(Control::RANGE::Value::VeryHigh) => { /* ... */ }
174+
Some(Control::RANGE::Value::High) => { /* ... */ }
175+
Some(Control::RANGE::Value::Low) => { /* ... */ }
176+
178177
None => unreachable!("invalid value")
179178
}
180179

@@ -250,7 +249,7 @@ let mode = registers.cr.read_as_enum(Status::MODE);
250249
match mode {
251250
Some(Status::MODE::FullDuplex) => { /* ... */ }
252251
Some(Status::MODE::HalfDuplex) => { /* ... */ }
253-
252+
254253
None => unreachable!("invalid value")
255254
}
256255

0 commit comments

Comments
 (0)