1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-02 02:56:26 +02:00

Start or temperature logger exercise.

This commit is contained in:
Andrew Walbran 2023-02-14 04:16:46 +00:00
parent 5e0f4da4b3
commit e21a83d5e8
7 changed files with 143 additions and 1 deletions

View File

@ -1,6 +1,6 @@
[target.thumbv7m-none-eabi]
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "link-arg=-Tmemory.x",
]
[build]

View File

@ -0,0 +1,11 @@
# Exercises
We will read the temperature from an I2C temperature sensor, and log the readings to a serial port.
<details>
After looking at the exercises, you can look at the [solutions] provided.
[solutions]: solutions-morning.md
</details>

View File

@ -0,0 +1,9 @@
# Day 5A Morning Exercise
## Temperature logger
([back to exercise](temperature-logger.md))
```rust
{{#include temperature-logger/src/main.rs}}
```

View File

@ -0,0 +1,7 @@
# Temperature logger
We will read the temperature from an I2C temperature sensor, and log the readings to a serial port.
```rust,should_panic
{{#include temperature-logger/src/main.rs}}
```

View File

@ -0,0 +1,104 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "cortex-m-rt"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6d3328b8b5534f0c90acd66b68950f2763b37e0173cac4d8b4937c4a80761f9"
dependencies = [
"cortex-m-rt-macros",
]
[[package]]
name = "cortex-m-rt-macros"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "embedded-hal"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff"
dependencies = [
"nb 0.1.3",
"void",
]
[[package]]
name = "nb"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f"
dependencies = [
"nb 1.0.0",
]
[[package]]
name = "nb"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae"
[[package]]
name = "panic-halt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812"
[[package]]
name = "proc-macro2"
version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [
"proc-macro2",
]
[[package]]
name = "syn"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "temperature-logger"
version = "0.1.0"
dependencies = [
"cortex-m-rt",
"embedded-hal",
"panic-halt",
]
[[package]]
name = "unicode-ident"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"

View File

@ -0,0 +1,11 @@
[workspace]
[package]
name = "temperature-logger"
version = "0.1.0"
edition = "2021"
[dependencies]
cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6"
panic-halt = "0.2.0"