From 97657c46c5e8ea9e736ac61ea3eabfb95147f508 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Sun, 18 Nov 2018 00:19:51 -0800 Subject: [PATCH] Fix typos in chapter in chapter 4 --- src/static-guarantees/design-contracts.md | 2 +- src/static-guarantees/state-machines.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/static-guarantees/design-contracts.md b/src/static-guarantees/design-contracts.md index d699a89..6c1d54e 100644 --- a/src/static-guarantees/design-contracts.md +++ b/src/static-guarantees/design-contracts.md @@ -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! diff --git a/src/static-guarantees/state-machines.md b/src/static-guarantees/state-machines.md index 1b2fce4..444b365 100644 --- a/src/static-guarantees/state-machines.md +++ b/src/static-guarantees/state-machines.md @@ -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!