aboutsummaryrefslogtreecommitdiff
path: root/docs/modules/ROOT/pages/layer_by_layer.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'docs/modules/ROOT/pages/layer_by_layer.adoc')
-rw-r--r--docs/modules/ROOT/pages/layer_by_layer.adoc8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/modules/ROOT/pages/layer_by_layer.adoc b/docs/modules/ROOT/pages/layer_by_layer.adoc
index a96dd9fe2..a78a64a97 100644
--- a/docs/modules/ROOT/pages/layer_by_layer.adoc
+++ b/docs/modules/ROOT/pages/layer_by_layer.adoc
@@ -8,7 +8,7 @@ The application we'll write is a simple 'push button, blink led' application, wh
8 8
9== PAC version 9== PAC version
10 10
11The PAC is the lowest API for accessing peripherals and registers, if you don't count reading/writing directly to memory addresses. It provide distinct types 11The PAC is the lowest API for accessing peripherals and registers, if you don't count reading/writing directly to memory addresses. It provides distinct types
12to make accessing peripheral registers easier, but it does not prevent you from writing unsafe code. 12to make accessing peripheral registers easier, but it does not prevent you from writing unsafe code.
13 13
14Writing an application using the PAC directly is therefore not recommended, but if the functionality you want to use is not exposed in the upper layers, that's what you need to use. 14Writing an application using the PAC directly is therefore not recommended, but if the functionality you want to use is not exposed in the upper layers, that's what you need to use.
@@ -20,13 +20,13 @@ The blinky app using PAC is shown below:
20include::example$layer-by-layer/blinky-pac/src/main.rs[] 20include::example$layer-by-layer/blinky-pac/src/main.rs[]
21---- 21----
22 22
23As you can see, there are a lot of code needed to enable the peripheral clocks, configuring the input pins and the output pins of the application. 23As you can see, a lot of code is needed to enable the peripheral clocks and to configure the input pins and the output pins of the application.
24 24
25Another downside of this application is that it is busy-looping while polling the button state. This prevents the microcontroller from utilizing any sleep mode to save power. 25Another downside of this application is that it is busy-looping while polling the button state. This prevents the microcontroller from utilizing any sleep mode to save power.
26 26
27== HAL version 27== HAL version
28 28
29To simplify our application, we can use the HAL instead. The HAL exposes higher level APIs that handle details such 29To simplify our application, we can use the HAL instead. The HAL exposes higher level APIs that handle details such as:
30 30
31* Automatically enabling the peripheral clock when you're using the peripheral 31* Automatically enabling the peripheral clock when you're using the peripheral
32* Deriving and applying register configuration from higher level types 32* Deriving and applying register configuration from higher level types
@@ -39,7 +39,7 @@ The HAL example is shown below:
39include::example$layer-by-layer/blinky-hal/src/main.rs[] 39include::example$layer-by-layer/blinky-hal/src/main.rs[]
40---- 40----
41 41
42As you can see, the application becomes a lot simpler, even without using any async code. The `Input` and `Output` hides all the details accessing the GPIO registers, and allow you to use a much simpler API to query the state of the button and toggle the LED output accordingly. 42As you can see, the application becomes a lot simpler, even without using any async code. The `Input` and `Output` types hide all the details of accessing the GPIO registers and allow you to use a much simpler API for querying the state of the button and toggling the LED output.
43 43
44The same downside from the PAC example still applies though: the application is busy looping and consuming more power than necessary. 44The same downside from the PAC example still applies though: the application is busy looping and consuming more power than necessary.
45 45