You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/src/02_0_preparations.md
+12-1
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,23 @@ This chapter contains information about the course material, the required hardwa
6
6
7
7
We use Icons to mark different kinds of information in the book:
8
8
* ✅ Call for action.
9
-
* ⚠️ Warnings, details that require special attention.
9
+
* ⚠️ Warnings, and details that require special attention.
10
10
* 🔎 Knowledge that dives deeper into a subject but which you aren't required to understand, proceeding.
11
11
* 💡 Hints that might help you during the exercises
12
12
13
13
> Example note: Notes like this one contain helpful information
14
14
15
+
## Code Annotations
16
+
17
+
In some Rust files, you can find some anchor comments:
18
+
```rust,ignore
19
+
// ANCHOR: test
20
+
let foo = 1;
21
+
...
22
+
// ANCHOR_END: test
23
+
```
24
+
Anchor comments can be ignored, they are only used to introduce those parts of code in this book. See [`mdBook` documentation](https://rust-lang.github.io/mdBook/format/mdbook.html#including-portions-of-a-file)
25
+
15
26
## Required Hardware
16
27
17
28
-[Rust ESP Board](https://github.com/esp-rs/esp-rust-board): available on Mouser, Aliexpress. [Full list of vendors](https://github.com/esp-rs/esp-rust-board#where-to-buy).
A successful response has [a status code in the 2xx range](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes). Followed by the raw html of the website.
Copy file name to clipboardExpand all lines: book/src/03_3_3_https_client.md
+2-6
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,14 @@ You will now make changes to your HTTP client files so that it also works for en
4
4
5
5
`intro/http-client/examples/http_client.rs` contains the solution. You can run it with the following command:
6
6
7
-
```shell
7
+
```console
8
8
cargo run --example https_client
9
9
```
10
10
11
11
Create a custom client configuration to use an `esp_idf_svc::http::client::EspHttpConnection` which enables the use of these certificates and uses default values for everything else:
✅ Initialize your HTTP client with this new configuration and verify HTTPS works by downloading from an `https` resource, e.g. `https://espressif.com/`. the download will show as raw HTML in the terminal output.
Copy file name to clipboardExpand all lines: book/src/04_3_1_i2c.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ HUM: [local humidity] %
71
71
Using a bus manager, implement the second sensor. Read out its values and print the values from both sensors.
72
72
73
73
74
-
Continue with your own solution from part one. Alternatively you can start with the provided partial solution of Part 1: `i2c-sensor-reading/examples/part_1.rs`.
74
+
Continue with your own solution from part one. Alternatively, you can start with the provided partial solution of Part 1: `i2c-sensor-reading/examples/part_1.rs`.
75
75
76
76
`i2c-sensor-reading/examples/part_2.rs` contains a working solution of Part 2. You can consult it if you need help, by running:
Copy file name to clipboardExpand all lines: book/src/04_3_2_i2c.md
+7-48
Original file line number
Diff line number
Diff line change
@@ -13,38 +13,21 @@ We're not going to write an entire driver, merely the first step: the `hello wor
13
13
To use a peripheral sensor first you must get an instance of it. The sensor is represented as a struct that contains both its device address, and an object representing the I²C bus itself. This is done using traits defined in the [`embedded-hal`](https://docs.rs/embedded-hal/latest/embedded_hal/) crate. The struct is public as it needs to be accessible from outside this crate, but its fields are private.
We add an `impl` block that will contain all the methods that can be used on the sensor instance. It also defines the Error Handling. In this block, we also implement an instantiating method. Methods can also be public or private. This method needs to be accessible from outside, so it's labelled `pub`. Note that written this way, the sensor instance takes ownership of the I²C bus.
- This I²C device has two possible addresses - `0x68` and `0x69`.
@@ -56,16 +39,7 @@ More information is available in the [datasheet, section 9.3](https://invensense
56
39
The sensor's registers are represented as enums. Each variant has the register's address as value. The type `Register` implements a method that exposes the variant's address.
We define a _read_ and a _write_ method, based on methods provided by the `embedded-hal` crate. They serve as helpers for more specific methods and as an abstraction that is adapted to a sensor with 8-bit registers. Note how the `read_register()` method is based on a `write_read()` method. The reason for this lies in the characteristics of the I²C protocol: We first need to write a command over the I²C bus to specify which register we want to read from. Helper methods can remain private as they don't need to be accessible from outside this crate.
led.set_pixel(RGB8::new(20, 0, 20)).unwrap(); // Remove this line after you tried it once
8
8
```
@@ -31,28 +31,12 @@
31
31
32
32
4.**Optional**: If you intend to reuse this code in another place, it makes sense to put it into its own function. This lets us explore, in detail, which parts of the code need to be in `unsafe` blocks.
33
33
34
-
```rust
35
-
// ...
36
-
loop {
37
-
// enable_interrupt should also be called after each received notification from non-ISR context
0 commit comments