Fix typos in chapter in chapter 4

This commit is contained in:
Adam Green
2018-11-18 00:19:51 -08:00
parent a4b7700871
commit 97657c46c5
2 changed files with 2 additions and 2 deletions

View File

@@ -249,6 +249,6 @@ This is defintely a convenient way to store the state of the pin, but why do it
## Compile Time Functional Safety
Because we are enforcing our design constrains entirely at compile time, this incurs no runtime cost. It is impossible to set an output mode when you have a pin in an input mode. Instead, you must walk through the states by converting it to an output pin, and then setting the output mode. Because of this, there is no runtime penalty due to checking the current state before executing a function.
Because we are enforcing our design constraints entirely at compile time, this incurs no runtime cost. It is impossible to set an output mode when you have a pin in an input mode. Instead, you must walk through the states by converting it to an output pin, and then setting the output mode. Because of this, there is no runtime penalty due to checking the current state before executing a function.
Also, because these states are enforced by the type system, there is no longer room for errors by consumers of this interface. If they try to perform an illegal state transition, the code will not compile!

View File

@@ -91,7 +91,7 @@ impl Gpio {
}
```
However, this could allow us to modify certain registers that do not make sense. For example, what happens if we set the `output_mode` field when our GPIO is configured as an input? For some hardware, ths may not matter, but on some hardware, it could cause unexpected or undefined behavior.
However, this could allow us to modify certain registers that do not make sense. For example, what happens if we set the `output_mode` field when our GPIO is configured as an input? For some hardware, this may not matter, but on some hardware, it could cause unexpected or undefined behavior.
This would allow us to reach states not defined by our state machine above: An output that is pulled low, or an input that was set high!