Skip to content

Commit

Permalink
Update esp-hal etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernQ committed Feb 27, 2024
1 parent d200a16 commit 3ed7a2a
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 137 deletions.
16 changes: 5 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ debug = true

[workspace.dependencies]
defmt = "=0.3.5"
esp32c3-hal = { version = "0.15.0", default-features = false }
esp32c2-hal = { version = "0.13.0", default-features = false }
esp32c6-hal = { version = "0.8.0", default-features = false }
esp32h2-hal = { version = "0.6.0", default-features = false }
esp32-hal = { version = "0.18.0", default-features = false }
esp32s3-hal = { version = "0.15.0", default-features = false }
esp32s2-hal = { version = "0.15.0", default-features = false }
esp-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "6a663f8b1a6bd273cd41d49e2096b8c4906e9da4", default-features = false }
smoltcp = { version = "0.11.0", default-features = false, features = [
"medium-ethernet",
"socket-raw",
Expand All @@ -40,7 +34,7 @@ num-traits = { version = "0.2", default-features = false }
esp-wifi-sys = { version = "0.1.0", path = "../esp-wifi-sys" }
embassy-sync = { version = "0.5.0" }
embassy-futures = { version = "0.1.0" }
toml-cfg = "0.1.3"
toml-cfg = "0.2.0"
libm = "0.2.7"
cfg-if = "1.0.0"
static_cell = { version = "2.0", features = ["nightly"] }
Expand All @@ -52,16 +46,16 @@ embassy-net = { version = "0.4.0", features = [
"dhcpv4",
"medium-ethernet",
] }
bleps = { git = "https://github.com/bjoernQ/bleps", package = "bleps", rev = "be90de7", features = [
bleps = { git = "https://github.com/bjoernQ/bleps", package = "bleps", rev = "9371d7d4d510ba5c936c1eef96674f8fd4f63e8a", features = [
"macros",
] }
embassy-executor = { version = "0.5.0", package = "embassy-executor", features = [
"nightly",
"integrated-timers",
] }
embassy-time = { version = "0.3.0" }
esp-println = { version = "0.8.0", default-features = false }
esp-backtrace = { version = "0.10.0" }
esp-println = { version = "0.9.0", default-features = false }
esp-backtrace = { version = "0.11.0" }
embedded-hal-async = { version = "1.0.0" }
embedded-io-async = { version = "0.6.0" }

Expand Down
14 changes: 7 additions & 7 deletions esp-wifi/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# - `embassy-time-timg0` as the examples assume we are using this time driver
# - `embassy-executor-thread` on Xtensa chips to take advantage of the Xtensa specific executor we have in esp-hal
[alias]
esp32 = "run --features esp32 --target xtensa-esp32-none-elf --features esp32-hal/default,esp32-hal/embassy-time-timg0,esp32-hal/embassy-executor-thread,wifi-default"
esp32s2 = "run --features esp32s2 --target xtensa-esp32s2-none-elf --features esp32s2-hal/default,esp32s2-hal/embassy-time-timg0,esp32s2-hal/embassy-executor-thread,wifi-default"
esp32s3 = "run --features esp32s3 --target xtensa-esp32s3-none-elf --features esp32s3-hal/default,esp32s3-hal/embassy-time-timg0,esp32s3-hal/embassy-executor-thread,wifi-default"
esp32c2 = "run --features esp32c2 --target riscv32imc-unknown-none-elf --features esp32c2-hal/default,esp32c2-hal/embassy-time-timg0,esp32c2-hal/embassy-executor-thread,wifi-default"
esp32c3 = "run --features esp32c3 --target riscv32imc-unknown-none-elf --features esp32c3-hal/default,esp32c3-hal/embassy-time-timg0,esp32c3-hal/embassy-executor-thread,wifi-default"
esp32c6 = "run --features esp32c6 --target riscv32imac-unknown-none-elf --features esp32c6-hal/default,esp32c6-hal/embassy-time-timg0,esp32c6-hal/embassy-executor-thread,wifi-default"
esp32h2 = "run --features esp32h2 --target riscv32imac-unknown-none-elf --features esp32h2-hal/default,esp32h2-hal/embassy-time-timg0,esp32h2-hal/embassy-executor-thread"
esp32 = "run --features esp32 --target xtensa-esp32-none-elf --features esp-hal/default,esp-hal/embassy-time-timg0,esp-hal/embassy-executor-thread,wifi-default"
esp32s2 = "run --features esp32s2 --target xtensa-esp32s2-none-elf --features esp-hal/default,esp-hal/embassy-time-timg0,esp-hal/embassy-executor-thread,wifi-default"
esp32s3 = "run --features esp32s3 --target xtensa-esp32s3-none-elf --features esp-hal/default,esp-hal/embassy-time-timg0,esp-hal/embassy-executor-thread,wifi-default"
esp32c2 = "run --features esp32c2 --target riscv32imc-unknown-none-elf --features esp-hal/default,esp-hal/embassy-time-timg0,esp-hal/embassy-executor-thread,wifi-default"
esp32c3 = "run --features esp32c3 --target riscv32imc-unknown-none-elf --features esp-hal/default,esp-hal/embassy-time-timg0,esp-hal/embassy-executor-thread,wifi-default"
esp32c6 = "run --features esp32c6 --target riscv32imac-unknown-none-elf --features esp-hal/default,esp-hal/embassy-time-timg0,esp-hal/embassy-executor-thread,wifi-default"
esp32h2 = "run --features esp32h2 --target riscv32imac-unknown-none-elf --features esp-hal/default,esp-hal/embassy-time-timg0,esp-hal/embassy-executor-thread"

besp32 = "build --features esp32 --target xtensa-esp32-none-elf --features esp32-hal/default,esp32-hal/embassy-time-timg0,esp32-hal/embassy-executor-thread,wifi-default"
besp32s2 = "build --features esp32s2 --target xtensa-esp32s2-none-elf --features esp32s2-hal/default,esp32s2-hal/embassy-time-timg0,esp32s2-hal/embassy-executor-thread,wifi-default"
Expand Down
62 changes: 16 additions & 46 deletions esp-wifi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ categories = [

[dependencies]
defmt = { workspace = true, optional = true }
esp32c3-hal = { workspace = true, optional = true }
esp32c2-hal = { workspace = true, optional = true }
esp32c6-hal = { workspace = true, optional = true }
esp32h2-hal = { workspace = true, optional = true }
esp32-hal = { workspace = true, optional = true }
esp32s3-hal = { workspace = true, optional = true }
esp32s2-hal = { workspace = true, optional = true }
esp-hal = { workspace = true }
smoltcp = { workspace = true, optional = true }
critical-section.workspace = true
log = { workspace = true, optional = true }
Expand Down Expand Up @@ -60,11 +54,11 @@ atomic-waker.workspace = true
toml-cfg.workspace = true

[dev-dependencies]
esp-println = { workspace = true, features = ["log"] }
esp-println = { workspace = true, features = ["log", "uart"] }
esp-backtrace = { workspace = true, features = [
"panic-handler",
"exception-handler",
"print-uart",
"println",
] }
embassy-executor.workspace = true
embassy-time.workspace = true
Expand All @@ -78,33 +72,21 @@ static_cell.workspace = true
default = [ "log" ]

# chip features
esp32c2 = [ "esp32c2-hal", "esp-wifi-sys/esp32c2", "esp-println/esp32c2", "esp-backtrace/esp32c2" ]
esp32c3 = [ "esp32c3-hal", "esp-wifi-sys/esp32c3", "esp-println/esp32c3", "esp-backtrace/esp32c3" ]
esp32c6 = [ "esp32c6-hal", "esp-wifi-sys/esp32c6", "esp-println/esp32c6", "esp-backtrace/esp32c6" ]
esp32h2 = [ "esp32h2-hal", "esp-wifi-sys/esp32h2", "esp-println/esp32h2", "esp-backtrace/esp32h2" ]
esp32 = [ "esp32-hal", "esp-wifi-sys/esp32", "esp-println/esp32", "esp-backtrace/esp32" ]
esp32s2 = [ "esp32s2-hal", "esp-wifi-sys/esp32s2", "esp-println/esp32s2", "esp-backtrace/esp32s2" ]
esp32s3 = [ "esp32s3-hal", "esp-wifi-sys/esp32s3", "esp-println/esp32s3", "esp-backtrace/esp32s3" ]
esp32c2 = [ "esp-hal/esp32c2", "esp-wifi-sys/esp32c2", "esp-println/esp32c2", "esp-backtrace/esp32c2" ]
esp32c3 = [ "esp-hal/esp32c3", "esp-wifi-sys/esp32c3", "esp-println/esp32c3", "esp-backtrace/esp32c3" ]
esp32c6 = [ "esp-hal/esp32c6", "esp-wifi-sys/esp32c6", "esp-println/esp32c6", "esp-backtrace/esp32c6" ]
esp32h2 = [ "esp-hal/esp32h2", "esp-wifi-sys/esp32h2", "esp-println/esp32h2", "esp-backtrace/esp32h2" ]
esp32 = [ "esp-hal/esp32", "esp-wifi-sys/esp32", "esp-println/esp32", "esp-backtrace/esp32" ]
esp32s2 = [ "esp-hal/esp32s2", "esp-wifi-sys/esp32s2", "esp-println/esp32s2", "esp-backtrace/esp32s2" ]
esp32s3 = [ "esp-hal/esp32s3", "esp-wifi-sys/esp32s3", "esp-println/esp32s3", "esp-backtrace/esp32s3" ]

# async features
async = [
"dep:embassy-sync",
"dep:embassy-futures",
"dep:embedded-io-async",
"esp32c3-hal?/embassy",
"esp32c2-hal?/embassy",
"esp32c6-hal?/embassy",
"esp32h2-hal?/embassy",
"esp32-hal?/embassy",
"esp32s2-hal?/embassy",
"esp32s3-hal?/embassy",
"esp32c3-hal?/async",
"esp32c2-hal?/async",
"esp32c6-hal?/async",
"esp32h2-hal?/async",
"esp32-hal?/async",
"esp32s2-hal?/async",
"esp32s3-hal?/async",
"esp-hal/embassy",
"esp-hal/async",
]

embassy-net = ["dep:embassy-net-driver", "async"]
Expand All @@ -118,7 +100,7 @@ utils = [ "smoltcp" ]
enumset = []
wifi = [ "dep:enumset", "dep:no-std-net" ]
embedded-svc = [ "dep:embedded-svc" ]
ble = [ "esp32-hal?/bluetooth" ]
ble = [ "esp-hal/bluetooth" ]
phy-enable-usb = []
ps-min-modem = []
ps-max-modem = []
Expand All @@ -135,27 +117,15 @@ wifi-default = ["ipv4", "tcp", "udp", "icmp", "igmp", "dns", "dhcpv4"]
defmt = [
"dep:defmt",
"smoltcp?/defmt",
"esp32c3-hal?/defmt",
"esp32c2-hal?/defmt",
"esp32c6-hal?/defmt",
"esp32h2-hal?/defmt",
"esp32-hal?/defmt",
"esp32s2-hal?/defmt",
"esp32s3-hal?/defmt",
"esp-hal/defmt",
]
log = [
"dep:log",
"esp32c3-hal?/log",
"esp32c2-hal?/log",
"esp32c6-hal?/log",
"esp32h2-hal?/log",
"esp32-hal?/log",
"esp32s2-hal?/log",
"esp32s3-hal?/log",
"esp-hal/log",
]

[package.metadata.docs.rs]
features = ["esp32c3", "wifi", "ble", "coex", "async", "embassy-net", "esp32c3-hal/embassy-time-systick", "esp32c3-hal/default"]
features = ["esp32c3", "wifi", "ble", "coex", "async", "embassy-net", "esp-hal/embassy-time-systick", "esp-hal/default"]
default-target = "riscv32imc-unknown-none-elf"

# These examples are used in test automation
Expand Down
23 changes: 13 additions & 10 deletions esp-wifi/examples/embassy_ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,22 @@ async fn main(_spawner: Spawner) -> ! {
let counter = RefCell::new(0u8);
let counter = &counter;

let mut notifier = async || {
let mut notifier = || {
// TODO how to check if notifications are enabled for the characteristic?
// maybe pass something into the closure which just can query the characterisic value
// maybe pass something into the closure which just can query the characteristic value
// probably passing in the attribute server won't work?
pin_ref.borrow_mut().wait_for_rising_edge().await.unwrap();
let mut data = [0u8; 13];
data.copy_from_slice(b"Notification0");
{
let mut counter = counter.borrow_mut();
data[data.len() - 1] += *counter;
*counter = (*counter + 1) % 10;

async {
pin_ref.borrow_mut().wait_for_rising_edge().await.unwrap();
let mut data = [0u8; 13];
data.copy_from_slice(b"Notification0");
{
let mut counter = counter.borrow_mut();
data[data.len() - 1] += *counter;
*counter = (*counter + 1) % 10;
}
NotificationData::new(my_characteristic_handle, &data)
}
NotificationData::new(my_characteristic_handle, &data)
};

srv.run(&mut notifier).await.unwrap();
Expand Down
1 change: 0 additions & 1 deletion esp-wifi/src/ble/os_adapter_esp32c3.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::*;
use crate::binary::include::esp_bt_controller_config_t;

pub(crate) static mut BT_INTERRUPT_FUNCTION5: (
*mut crate::binary::c_types::c_void,
Expand Down
19 changes: 4 additions & 15 deletions esp-wifi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
#![allow(rustdoc::bare_urls)]

// allow until num-derive doesn't generate this warning anymore
#![allow(non_local_definitions)]

// MUST be the first module
mod fmt;

Expand All @@ -18,20 +21,7 @@ use core::ptr::addr_of_mut;
use common_adapter::RADIO_CLOCKS;
use critical_section::Mutex;

#[cfg(esp32)]
use esp32_hal as hal;
#[cfg(esp32c2)]
use esp32c2_hal as hal;
#[cfg(esp32c3)]
use esp32c3_hal as hal;
#[cfg(esp32c6)]
use esp32c6_hal as hal;
#[cfg(esp32h2)]
use esp32h2_hal as hal;
#[cfg(esp32s2)]
use esp32s2_hal as hal;
#[cfg(esp32s3)]
use esp32s3_hal as hal;
use esp_hal as hal;

#[cfg(any(esp32c2, esp32c3, esp32c6, esp32h2))]
use hal::systimer::{Alarm, Target};
Expand Down Expand Up @@ -74,7 +64,6 @@ pub mod tasks;

pub(crate) mod memory_fence;

use critical_section;
use timer::{get_systimer_count, ticks_to_millis};

#[cfg(all(feature = "wifi", any(feature = "tcp", feature = "udp")))]
Expand Down
3 changes: 0 additions & 3 deletions esp-wifi/src/wifi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use enumset::EnumSetType;
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;

use core::convert::TryInto;
use core::fmt::Debug;
use core::mem;

Expand Down Expand Up @@ -297,7 +296,6 @@ impl Configuration {
}

pub mod ipv4 {
use core::convert::TryFrom;
use core::fmt::Display;
use core::str::FromStr;

Expand Down Expand Up @@ -2273,7 +2271,6 @@ mod asynch {
use core::task::Poll;

use embassy_sync::waitqueue::AtomicWaker;
use num_traits::FromPrimitive;

use super::*;

Expand Down
15 changes: 1 addition & 14 deletions examples-util/util.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
#![allow(unused)]

#[cfg(feature = "esp32")]
pub use esp32_hal as hal;
#[cfg(feature = "esp32c2")]
pub use esp32c2_hal as hal;
#[cfg(feature = "esp32c3")]
pub use esp32c3_hal as hal;
#[cfg(feature = "esp32c6")]
pub use esp32c6_hal as hal;
#[cfg(feature = "esp32h2")]
pub use esp32h2_hal as hal;
#[cfg(feature = "esp32s2")]
pub use esp32s2_hal as hal;
#[cfg(feature = "esp32s3")]
pub use esp32s3_hal as hal;
pub use esp_hal as hal;

#[cfg(any(
feature = "esp32c2",
Expand Down
Loading

0 comments on commit 3ed7a2a

Please sign in to comment.