Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies, ESP-IDF and nigthly version #217

Merged
merged 17 commits into from
Nov 23, 2023
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
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ENV LANG=C.UTF-8
# Arguments
ARG CONTAINER_USER=esp
ARG CONTAINER_GROUP=esp
ARG NIGHTLY_VERSION=nightly-2023-02-28
ARG ESP_IDF_VERSION=v4.4.4
ARG NIGHTLY_VERSION=nightly-2023-11-14
ARG ESP_IDF_VERSION=v4.4.6
ARG ESP_BOARD=esp32c3

# Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// "build": {
// "dockerfile": "Dockerfile",
// "args": {
// "NIGHTLY_VERSION": "nightly-2023-02-28"
// "NIGHTLY_VERSION": "nightly-2023-11-14"
// }
// },
"customizations": {
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ __pycache__
.embuild/
.vale
.vale.ini
components_esp32c3.lock
6 changes: 3 additions & 3 deletions advanced/button-interrupt/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ runner = "espflash flash --monitor"
rustflags = ["-C", "default-linker-libraries"]

[unstable]
build-std = ["std", "panic_abort"]
build-std = ["panic_abort", "std"]
build-std-features = ["panic_immediate_abort"]

[env]
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF (v4.4.4)
ESP_IDF_VERSION = { value = "tag:v4.4.4" }
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF (v4.4.6)
ESP_IDF_VERSION = { value = "tag:v4.4.6" }

# These configurations will pick up your custom "sdkconfig.release", "sdkconfig.debug" or "sdkconfig.defaults[.*]" files
# that you might put in the root of the project
Expand Down
18 changes: 6 additions & 12 deletions advanced/button-interrupt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name = "button-interrupt"
version = "0.1.0"
authors = [
"Anatol Ulrich <[email protected]>",
"Tanks Transfeld <[email protected]>",
"Sergio Gasquez <[email protected]>",
"Tanks Transfeld <[email protected]>",
]
edition = "2021"
resolver = "2"
Expand All @@ -13,19 +13,13 @@ resolver = "2"
opt-level = "s"

[profile.dev]
debug = true # Symbols are nice and they don't increase the size on Flash
debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"

[features]
default = ["native"]
native = ["esp-idf-sys/native"]

[dependencies]
anyhow = "=1.0.71"
esp-idf-hal = "=0.41.1"
esp-idf-sys = { version = "=0.33.0", features = ["binstart"] }
rgb-led = { path = "../../common/lib/rgb-led" }
anyhow = "=1.0.75"
esp-idf-svc = "=0.47.3"
rgb-led = { path = "../../common/lib/rgb-led" }

[build-dependencies]
anyhow = "=1.0.71"
embuild = "=0.31.2"
embuild = "=0.31.4"
6 changes: 2 additions & 4 deletions advanced/button-interrupt/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fn main() -> anyhow::Result<()> {
// Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641
embuild::build::CfgArgs::output_propagated("ESP_IDF")?;
embuild::build::LinkArgs::output_propagated("ESP_IDF")
fn main() {
embuild::espidf::sysenv::output();
}
9 changes: 4 additions & 5 deletions advanced/button-interrupt/examples/solution.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Reference: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html

use anyhow::Result;
use esp_idf_sys::{
use esp_idf_svc::sys::{
esp, gpio_config, gpio_config_t, gpio_install_isr_service, gpio_int_type_t_GPIO_INTR_POSEDGE,
gpio_isr_handler_add, gpio_mode_t_GPIO_MODE_INPUT, xQueueGenericCreate, xQueueGiveFromISR,
xQueueReceive, QueueHandle_t, ESP_INTR_FLAG_IRAM,
Expand Down Expand Up @@ -62,10 +62,9 @@ fn main() -> Result<()> {
let res = xQueueReceive(EVENT_QUEUE.unwrap(), ptr::null_mut(), QUEUE_WAIT_TICKS);

// If the event has the value 0, nothing happens. if it has a different value, the button was pressed.
match res {
1 => println!("Button pressed!"),
_ => {}
};
if res == 1 {
println!("Button pressed!")
}
}
}
}
23 changes: 11 additions & 12 deletions advanced/button-interrupt/examples/solution_led.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// Reference: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html

use anyhow::Result;
use esp_idf_hal::prelude::Peripherals;
use esp_idf_sys::{
esp, esp_random, gpio_config, gpio_config_t, gpio_install_isr_service,
gpio_int_type_t_GPIO_INTR_POSEDGE, gpio_isr_handler_add, gpio_mode_t_GPIO_MODE_INPUT,
xQueueGenericCreate, xQueueGiveFromISR, xQueueReceive, QueueHandle_t, ESP_INTR_FLAG_IRAM,
use esp_idf_svc::{
hal::prelude::Peripherals,
sys::{
esp, esp_random, gpio_config, gpio_config_t, gpio_install_isr_service,
gpio_int_type_t_GPIO_INTR_POSEDGE, gpio_isr_handler_add, gpio_mode_t_GPIO_MODE_INPUT,
xQueueGenericCreate, xQueueGiveFromISR, xQueueReceive, QueueHandle_t, ESP_INTR_FLAG_IRAM,
},
};
use rgb_led::{RGB8, WS2812RMT};
use std::ptr;
Expand Down Expand Up @@ -69,13 +71,10 @@ fn main() -> Result<()> {
// If the event has the value 0, nothing happens. if it has a different value, the button was pressed.
// If the button was pressed, a function that changes the state of the LED is called.

match res {
1 => {
println!("Button pressed!");
// Generates random rgb values and sets them in the led.
random_light(&mut led);
}
_ => {}
if res == 1 {
println!("Button pressed!");
// Generates random rgb values and sets them in the led.
random_light(&mut led);
};
}
}
Expand Down
3 changes: 2 additions & 1 deletion advanced/button-interrupt/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[toolchain]
channel = "nightly-2023-02-28"
channel = "nightly-2023-11-14"
components = ["rust-src"]
4 changes: 2 additions & 2 deletions advanced/button-interrupt/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Rust often needs a bit of an extra main task stack size compared to C (the default is 3K)
CONFIG_ESP_MAIN_TASK_STACK_SIZE=7000
CONFIG_ESP_MAIN_TASK_STACK_SIZE=20000
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4096

# TODO this does not seem to work (should enable log level DEBUG)
CONFIG_LOG_DEFAULT_LEVEL_INFO=n
Expand Down
20 changes: 10 additions & 10 deletions advanced/button-interrupt/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Reference: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html
use anyhow::Result;
use esp_idf_sys::{
use esp_idf_svc::sys::{
esp, esp_random, gpio_config, gpio_config_t, gpio_install_isr_service,
gpio_int_type_t_GPIO_INTR_POSEDGE, gpio_isr_handler_add, gpio_mode_t_GPIO_MODE_INPUT,
xQueueGenericCreate, xQueueGiveFromISR, xQueueReceive, QueueHandle_t, ESP_INTR_FLAG_IRAM,
Expand All @@ -27,22 +27,22 @@ fn main() -> Result<()> {
// ...
// };

// Queue configurations
const QUEUE_TYPE_BASE: u8 = 0;
const ITEM_SIZE: u32 = 0;
const QUEUE_SIZE: u32 = 1;

unsafe {
// 2. Write the GPIO configuration into the register
// esp!(...)?;

// 3. Install the global GPIO interrupt handler
// esp!(...)?;

// Queue configurations
const QUEUE_TYPE_BASE: u8 = 0;
const ITEM_SIZE: u32 = 0;
const QUEUE_SIZE: u32 = 1;

// 5. Create an event queue
// 4. Create an event queue
// EVENT_QUEUE = Some(...);

// 7. Add the button GPIO and the function to the interrupt handler
// 5. Add the button GPIO and the function to the interrupt handler
// esp!(...)?;
}

Expand All @@ -52,10 +52,10 @@ fn main() -> Result<()> {
// Maximum delay
const QUEUE_WAIT_TICKS: u32 = 1000;;

// 8. Receive the event from the queue.
// 6. Receive the event from the queue.
// let res = ...;

// 9. Handle the value of res.
// 7. Handle the value of res.
// ...
}
}
Expand Down
6 changes: 3 additions & 3 deletions advanced/i2c-driver/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ runner = "espflash flash --monitor"
rustflags = ["-C", "default-linker-libraries"]

[unstable]
build-std = ["std", "panic_abort"]
build-std = ["panic_abort", "std"]
build-std-features = ["panic_immediate_abort"]

[env]
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF (v4.4.4)
ESP_IDF_VERSION = { value = "tag:v4.4.4" }
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF (v4.4.6)
ESP_IDF_VERSION = { value = "tag:v4.4.6" }

# These configurations will pick up your custom "sdkconfig.release", "sdkconfig.debug" or "sdkconfig.defaults[.*]" files
# that you might put in the root of the project
Expand Down
16 changes: 5 additions & 11 deletions advanced/i2c-driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name = "i2c-driver"
version = "0.1.0"
authors = [
"Tanks Transfeld <[email protected]>",
"Sergio Gasquez <[email protected]>",
"Tanks Transfeld <[email protected]>",
]
edition = "2021"
resolver = "2"
Expand All @@ -12,19 +12,13 @@ resolver = "2"
opt-level = "s"

[profile.dev]
debug = true # Symbols are nice and they don't increase the size on Flash
debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"

[features]
default = ["native"]
native = ["esp-idf-sys/native"]

[dependencies]
anyhow = "=1.0.71"
anyhow = "=1.0.75"
embedded-hal = "=0.2.7"
esp-idf-hal = "=0.41.1"
esp-idf-sys = { version = "=0.33.0", features = ["binstart"] }
esp-idf-svc = "=0.47.3"

[build-dependencies]
anyhow = "=1.0.71"
embuild = "=0.31.2"
embuild = "=0.31.4"
6 changes: 2 additions & 4 deletions advanced/i2c-driver/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fn main() -> anyhow::Result<()> {
// Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641
embuild::build::CfgArgs::output_propagated("ESP_IDF")?;
embuild::build::LinkArgs::output_propagated("ESP_IDF")
fn main() {
embuild::espidf::sysenv::output();
}
3 changes: 2 additions & 1 deletion advanced/i2c-driver/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[toolchain]
channel = "nightly-2023-02-28"
channel = "nightly-2023-11-14"
components = ["rust-src"]
6 changes: 2 additions & 4 deletions advanced/i2c-driver/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use anyhow::Result;
use embedded_hal::blocking::delay::DelayMs;
use esp_idf_hal::{
use esp_idf_svc::hal::{
delay::FreeRtos,
i2c::{I2cConfig, I2cDriver},
peripherals::Peripherals,
prelude::*,
};
// If using the `binstart` feature of `esp-idf-sys`, always keep this module imported
use esp_idf_sys as _;

// Uncomment the following line to run the solution, check lib.rs for further instructions
use i2c_driver::icm42670p_solution::{DeviceAddr, ICM42670P};
Expand All @@ -18,7 +16,7 @@ use i2c_driver::icm42670p_solution::{DeviceAddr, ICM42670P};
// Dont change this file. Work in the icm42670p.rs and modify it so main.rs runs.

fn main() -> Result<()> {
esp_idf_sys::link_patches();
esp_idf_svc::sys::link_patches();

let peripherals = Peripherals::take().unwrap();

Expand Down
6 changes: 3 additions & 3 deletions advanced/i2c-sensor-reading/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ runner = "espflash flash --monitor"
rustflags = ["-C", "default-linker-libraries"]

[unstable]
build-std = ["std", "panic_abort"]
build-std = ["panic_abort", "std"]
build-std-features = ["panic_immediate_abort"]

[env]
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF (v4.4.4)
ESP_IDF_VERSION = { value = "tag:v4.4.4" }
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF (v4.4.6)
ESP_IDF_VERSION = { value = "tag:v4.4.6" }

# These configurations will pick up your custom "sdkconfig.release", "sdkconfig.debug" or "sdkconfig.defaults[.*]" files
# that you might put in the root of the project
Expand Down
24 changes: 9 additions & 15 deletions advanced/i2c-sensor-reading/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name = "i2c-sensor-reading"
version = "0.1.0"
authors = [
"Tanks Transfeld <[email protected]>",
"Sergio Gasquez <[email protected]>",
"Tanks Transfeld <[email protected]>",
]
edition = "2021"
resolver = "2"
Expand All @@ -12,23 +12,17 @@ resolver = "2"
opt-level = "s"

[profile.dev]
debug = true # Symbols are nice and they don't increase the size on Flash
debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"

[features]
default = ["native"]
native = ["esp-idf-sys/native"]

[dependencies]
anyhow = "=1.0.71"
anyhow = "=1.0.75"
embedded-hal = "=0.2.7"
esp-idf-hal = "=0.41.1"
esp-idf-sys = { version = "=0.33.0", features = ["binstart"] }
icm42670 = "=0.1.1"
lis3dh = "=0.4.2"
shared-bus = "=0.2.5"
shtcx = "=0.11.0"
esp-idf-svc = "=0.47.3"
icm42670 = "=0.1.1"
lis3dh = "=0.4.2"
shared-bus = "=0.3.1"
shtcx = "=0.11.0"

[build-dependencies]
anyhow = "=1.0.71"
embuild = "=0.31.2"
embuild = "=0.31.4"
6 changes: 2 additions & 4 deletions advanced/i2c-sensor-reading/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fn main() -> anyhow::Result<()> {
// Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641
embuild::build::CfgArgs::output_propagated("ESP_IDF")?;
embuild::build::LinkArgs::output_propagated("ESP_IDF")
fn main() {
embuild::espidf::sysenv::output();
}
8 changes: 3 additions & 5 deletions advanced/i2c-sensor-reading/examples/part_1.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
use anyhow::Result;
use embedded_hal::blocking::delay::DelayMs;
use esp_idf_hal::{
use esp_idf_svc::hal::{
delay::FreeRtos,
i2c::{I2cConfig, I2cDriver},
peripherals::Peripherals,
prelude::*,
};
use shtcx::{self, PowerMode};
// If using the `binstart` feature of `esp-idf-sys`, always keep this module imported
use esp_idf_sys as _;

// Goals of this exercise:
// - Part1: Instantiate i2c peripheral
// - Part1: Implement one sensor, print sensor values
// - Part2: Implement second sensor on same bus to solve an ownership problem

fn main() -> Result<()> {
esp_idf_sys::link_patches();
esp_idf_svc::sys::link_patches();

let peripherals = Peripherals::take().unwrap();

Expand All @@ -29,9 +27,9 @@ fn main() -> Result<()> {

// 3. Create an instance of the SHTC3 sensor.
let mut sht = shtcx::shtc3(i2c);
let device_id = sht.device_identifier().unwrap();

// 4. Read and print the sensor's device ID.
let device_id = sht.device_identifier().unwrap();
println!("Device ID SHTC3: {:#02x}", device_id);

loop {
Expand Down
Loading
Loading