Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM debian:bullseye
ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ARG CONTAINER_USER=esp
ARG CONTAINER_GROUP=esp
ARG NIGHTLY_VERSION=nightly-2022-03-10
RUN apt-get update \
&& apt-get install -y vim nano git curl gcc ninja-build cmake libudev-dev \
python3 python3-pip libusb-1.0-0 libssl-dev pkg-config libtinfo5 clang \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
RUN adduser --disabled-password --gecos "" ${CONTAINER_USER}
USER ${CONTAINER_USER}
WORKDIR /home/${CONTAINER_USER}
ENV PATH=${PATH}:$HOME/.cargo/bin
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
--default-toolchain ${NIGHTLY_VERSION} -y \
&& $HOME/.cargo/bin/rustup component add rust-src --toolchain ${NIGHTLY_VERSION} \
&& $HOME/.cargo/bin/rustup target add riscv32i-unknown-none-elf \
&& $HOME/.cargo/bin/cargo install cargo-generate cargo-espflash espmonitor bindgen ldproxy
ENV ESP_BOARD=esp32c3
ENV ESP_IDF_VERSION=release/v4.4
RUN mkdir -p .espressif/frameworks/ \
&& git clone --branch ${ESP_IDF_VERSION} -q --depth 1 --shallow-submodules \
--recursive https://github.com/espressif/esp-idf.git \
.espressif/frameworks/esp-idf-v4.4 \
&& .espressif/frameworks/esp-idf-v4.4/install.sh ${ESP_BOARD} \
&& rm -rf .espressif/dist \
&& rm -rf .espressif/frameworks/esp-idf-v4.4/docs
CMD "/bin/bash"
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "espressif-training",
"build": {
"dockerfile": "Dockerfile",
"args": {
"NIGHTLY_VERSION": "nightly-2022-03-10",
"CONTAINER_USER": "esp"
}
},
"settings": {
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "modifications",
"editor.formatOnType": true,
"lldb.executable": "/usr/bin/lldb",
"files.watcherExclude": {
"**/target/**": true
},
"rust-analyzer.checkOnSave.command": "clippy",
"[rust]": {
"editor.defaultFormatter": "matklad.rust-analyzer"
},
},
"extensions": [
"matklad.rust-analyzer",
"tamasfe.even-better-toml",
"vadimcn.vscode-lldb",
"serayuzgur.crates",
"mutantdino.resourcemonitor",
"yzhang.markdown-all-in-one",
],
"workspaceMount": "source=${localWorkspaceFolder},target=/home/esp/workspace,type=bind,consistency=cached",
"workspaceFolder": "/home/esp/workspace/"
}
2 changes: 1 addition & 1 deletion advanced/button-interrupt/exercise/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
2 changes: 1 addition & 1 deletion advanced/button-interrupt/solution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
2 changes: 1 addition & 1 deletion advanced/i2c-driver/solution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
2 changes: 1 addition & 1 deletion advanced/i2c-sensor-reading/solution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
2 changes: 1 addition & 1 deletion common/lib/esp32-c3-dkc02-bsc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ toml-cfg = "0.1"
riscv = { version = "0.7", features=["inline-asm"] }

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
8 changes: 6 additions & 2 deletions common/lib/esp32-c3-dkc02-bsc/src/wifi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use std::sync::Arc;

use anyhow::bail;
use embedded_svc::wifi::{
self, ClientConfiguration, ClientConnectionStatus, ClientIpStatus, ClientStatus, Wifi as _,
self, AuthMethod, ClientConfiguration, ClientConnectionStatus, ClientIpStatus, ClientStatus,
Wifi as _,
};
use esp_idf_svc::{
netif::EspNetifStack, nvs::EspDefaultNvs, sysloop::EspSysLoopStack, wifi::EspWifi,
Expand All @@ -20,11 +21,13 @@ pub struct Wifi {
}

pub fn wifi(ssid: &str, psk: &str) -> anyhow::Result<Wifi> {
let mut auth_method = AuthMethod::WPA2Personal;
if ssid.len() == 0 {
anyhow::bail!("missing WiFi name")
}
if psk.len() == 0 {
anyhow::bail!("missing WiFi password")
auth_method = AuthMethod::None;
info!("Wifi password is empty");
}
let netif_stack = Arc::new(EspNetifStack::new()?);
let sys_loop_stack = Arc::new(EspSysLoopStack::new()?);
Expand Down Expand Up @@ -60,6 +63,7 @@ pub fn wifi(ssid: &str, psk: &str) -> anyhow::Result<Wifi> {
ssid: ssid.into(),
password: psk.into(),
channel,
auth_method: auth_method,
..Default::default()
}))?;

Expand Down
2 changes: 1 addition & 1 deletion intro/hardware-check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
2 changes: 1 addition & 1 deletion intro/http-client/exercise/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
2 changes: 1 addition & 1 deletion intro/http-client/solution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
2 changes: 1 addition & 1 deletion intro/http-server/exercise/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
2 changes: 1 addition & 1 deletion intro/http-server/solution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
2 changes: 1 addition & 1 deletion intro/mqtt/exercise/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}
2 changes: 1 addition & 1 deletion intro/mqtt/solution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ embuild = "0.28"
anyhow = "1"

[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", branch = "master"}
riscv = { git = "https://github.com/rust-embedded/riscv", rev = "396fb9b"}