Skip to content

Commit c62be86

Browse files
committed
esp-hal 1.0.0-rc1 catch-up
1 parent 6bcfb00 commit c62be86

File tree

9 files changed

+227
-341
lines changed

9 files changed

+227
-341
lines changed

examples/esp32/Cargo.lock

Lines changed: 174 additions & 179 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/esp32/Cargo.toml

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,26 @@ edition = "2021"
55
license = "MIT OR Apache-2.0"
66

77
[dependencies]
8-
embassy-executor = "0.9.0"
9-
esp-bootloader-esp-idf = "0.2.0"
10-
esp-backtrace = { version = "0.17.0", features = [ "panic-handler", "println" ] }
11-
esp-hal = { version = "1.0.0-rc.0", features = [ "unstable" ] }
12-
esp-hal-embassy = { version = "0.9.0" }
13-
esp-alloc = { version = "0.8.0" }
14-
esp-println = { version = "0.15.0", features = ["log-04"] }
15-
esp-radio = { version = "0.15.0", features = [ "unstable", "ble" ] }
16-
esp-preempt = { version = "0.0.1", features = ["log-04"] }
8+
embassy-executor = "0.9.1"
9+
esp-bootloader-esp-idf = "0.3.0"
10+
esp-backtrace = { version = "0.18.0", features = [ "panic-handler", "println" ] }
11+
esp-hal = { version = "1.0.0-rc.1", features = [ "unstable" ] }
12+
esp-alloc = { version = "0.9.0" }
13+
esp-println = { version = "0.16.0", features = ["log-04"] }
14+
esp-radio = { version = "0.16.0", features = ["ble", "log-04", "unstable"] }
15+
esp-rtos = { version = "0.1.1", features = ["embassy", "esp-alloc", "esp-radio", "log-04"] }
1716
trouble-example-apps = { version = "0.1.0", path = "../apps", features = ["log"] }
1817
trouble-host = { path = "../../host", features = ["default-packet-pool-mtu-255"] }
19-
static_cell = "2"
2018

2119
[features]
2220
default = ["esp32c3"]
2321

24-
esp32 = ["esp-hal/esp32", "esp-backtrace/esp32", "esp-hal-embassy/esp32", "esp-println/esp32", "esp-radio/esp32", "esp-preempt/esp32", "esp-bootloader-esp-idf/esp32"]
25-
esp32c2 = ["esp-hal/esp32c2", "esp-backtrace/esp32c2", "esp-hal-embassy/esp32c2", "esp-println/esp32c2", "esp-preempt/esp32c2", "esp-radio/esp32c2", "esp-bootloader-esp-idf/esp32c2"]
26-
esp32c3 = ["esp-hal/esp32c3", "esp-backtrace/esp32c3", "esp-hal-embassy/esp32c3", "esp-println/esp32c3", "esp-preempt/esp32c3", "esp-radio/esp32c3", "esp-bootloader-esp-idf/esp32c3"]
27-
esp32c6 = ["esp-hal/esp32c6", "esp-backtrace/esp32c6", "esp-hal-embassy/esp32c6", "esp-println/esp32c6", "esp-preempt/esp32c6", "esp-radio/esp32c6", "esp-bootloader-esp-idf/esp32c6"]
28-
esp32h2 = ["esp-hal/esp32h2", "esp-backtrace/esp32h2", "esp-hal-embassy/esp32h2", "esp-println/esp32h2", "esp-preempt/esp32h2", "esp-radio/esp32h2", "esp-bootloader-esp-idf/esp32h2"]
29-
esp32s3 = ["esp-hal/esp32s3", "esp-backtrace/esp32s3", "esp-hal-embassy/esp32s3", "esp-println/esp32s3", "esp-preempt/esp32s3", "esp-radio/esp32s3", "esp-bootloader-esp-idf/esp32s3"]
22+
esp32 = ["esp-hal/esp32", "esp-backtrace/esp32", "esp-println/esp32", "esp-radio/esp32", "esp-rtos/esp32", "esp-bootloader-esp-idf/esp32"]
23+
esp32c2 = ["esp-hal/esp32c2", "esp-backtrace/esp32c2", "esp-println/esp32c2", "esp-radio/esp32c2", "esp-rtos/esp32c2", "esp-bootloader-esp-idf/esp32c2"]
24+
esp32c3 = ["esp-hal/esp32c3", "esp-backtrace/esp32c3", "esp-println/esp32c3", "esp-radio/esp32c3", "esp-rtos/esp32c3", "esp-bootloader-esp-idf/esp32c3"]
25+
esp32c6 = ["esp-hal/esp32c6", "esp-backtrace/esp32c6", "esp-println/esp32c6", "esp-radio/esp32c6", "esp-rtos/esp32c6", "esp-bootloader-esp-idf/esp32c6"]
26+
esp32h2 = ["esp-hal/esp32h2", "esp-backtrace/esp32h2", "esp-println/esp32h2", "esp-radio/esp32h2", "esp-rtos/esp32h2", "esp-bootloader-esp-idf/esp32h2"]
27+
esp32s3 = ["esp-hal/esp32s3", "esp-backtrace/esp32s3", "esp-println/esp32s3", "esp-radio/esp32s3", "esp-rtos/esp32s3", "esp-bootloader-esp-idf/esp32s3"]
3028

3129
security = [
3230
"trouble-example-apps/security",
@@ -54,21 +52,12 @@ required-features = ["security"]
5452
name = "ble_bas_peripheral_sec"
5553
required-features = ["security"]
5654

57-
[patch.crates-io]
58-
esp-radio = {git = "https://github.com/lulf/esp-hal.git", branch = "bt-hci-fix"}
59-
esp-preempt = {git = "https://github.com/lulf/esp-hal.git", branch = "bt-hci-fix"}
60-
esp-backtrace = {git = "https://github.com/lulf/esp-hal.git", branch = "bt-hci-fix"}
61-
esp-hal = {git = "https://github.com/lulf/esp-hal.git", branch = "bt-hci-fix"}
62-
esp-bootloader-esp-idf = {git = "https://github.com/lulf/esp-hal.git", branch = "bt-hci-fix"}
63-
esp-hal-embassy = {git = "https://github.com/lulf/esp-hal.git", branch = "bt-hci-fix"}
64-
esp-alloc = {git = "https://github.com/lulf/esp-hal.git", branch = "bt-hci-fix"}
65-
esp-println = {git = "https://github.com/lulf/esp-hal.git", branch = "bt-hci-fix"}
66-
67-
#esp-backtrace = { path = "../../../esp-hal/esp-backtrace" }
68-
#esp-bootloader-esp-idf = { path = "../../../esp-hal/esp-bootloader-esp-idf" }
69-
#esp-hal = { path = "../../../esp-hal/esp-hal" }
70-
#esp-hal-embassy = { path = "../../../esp-hal/esp-hal-embassy" }
71-
#esp-alloc = { path = "../../../esp-hal/esp-alloc" }
72-
#esp-println = { path = "../../../esp-hal/esp-println" }
73-
#esp-radio = { path = "../../../esp-hal/esp-radio" }
74-
#esp-preempt = { path = "../../../esp-hal/esp-preempt" }
55+
# Enable for using latest 'main'
56+
#[patch.crates-io]
57+
#esp-alloc = { git = "https://github.com/esp-rs/esp-hal.git" }
58+
#esp-backtrace = { git = "https://github.com/esp-rs/esp-hal.git" }
59+
#esp-bootloader-esp-idf ={ git = "https://github.com/esp-rs/esp-hal.git" }
60+
#esp-hal = { git = "https://github.com/esp-rs/esp-hal.git" }
61+
#esp-println = { git = "https://github.com/esp-rs/esp-hal.git" }
62+
#esp-radio = { git = "https://github.com/esp-rs/esp-hal.git" }
63+
#esp-rtos = { git = "https://github.com/esp-rs/esp-hal.git" }

examples/esp32/src/bin/ble_bas_central.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ use embassy_executor::Spawner;
55
use esp_hal::clock::CpuClock;
66
use esp_hal::timer::timg::TimerGroup;
77
use esp_radio::ble::controller::BleConnector;
8-
use esp_radio::Controller;
9-
use static_cell::StaticCell;
108
use trouble_example_apps::ble_bas_central;
119
use trouble_host::prelude::ExternalController;
12-
use {esp_alloc as _, esp_backtrace as _};
10+
use esp_backtrace as _;
1311

1412
esp_bootloader_esp_idf::esp_app_desc!();
1513

16-
#[esp_hal_embassy::main]
14+
#[esp_rtos::main]
1715
async fn main(_s: Spawner) {
1816
esp_println::logger::init_logger_from_env();
1917
let peripherals = esp_hal::init(esp_hal::Config::default().with_cpu_clock(CpuClock::max()));
@@ -23,27 +21,15 @@ async fn main(_s: Spawner) {
2321
#[cfg(target_arch = "riscv32")]
2422
let software_interrupt = esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
2523

26-
esp_preempt::start(
24+
esp_rtos::start(
2725
timg0.timer0,
2826
#[cfg(target_arch = "riscv32")]
2927
software_interrupt.software_interrupt0,
3028
);
3129

32-
static RADIO: StaticCell<Controller<'static>> = StaticCell::new();
33-
let radio = RADIO.init(esp_radio::init().unwrap());
34-
35-
#[cfg(not(feature = "esp32"))]
36-
{
37-
let systimer = esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER);
38-
esp_hal_embassy::init(systimer.alarm0);
39-
}
40-
#[cfg(feature = "esp32")]
41-
{
42-
esp_hal_embassy::init(timg0.timer1);
43-
}
44-
30+
let radio = esp_radio::init().unwrap();
4531
let bluetooth = peripherals.BT;
46-
let connector = BleConnector::new(radio, bluetooth);
32+
let connector = BleConnector::new(&radio, bluetooth, Default::default()).unwrap();
4733
let controller: ExternalController<_, 20> = ExternalController::new(connector);
4834

4935
ble_bas_central::run(controller).await;

examples/esp32/src/bin/ble_bas_central_sec.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ use esp_hal::clock::CpuClock;
66
use esp_hal::rng::{Trng, TrngSource};
77
use esp_hal::timer::timg::TimerGroup;
88
use esp_radio::ble::controller::BleConnector;
9-
use esp_radio::Controller;
10-
use static_cell::StaticCell;
119
use trouble_example_apps::ble_bas_central_sec;
1210
use trouble_host::prelude::ExternalController;
1311
use {esp_alloc as _, esp_backtrace as _};
1412

1513
esp_bootloader_esp_idf::esp_app_desc!();
1614

17-
#[esp_hal_embassy::main]
15+
#[esp_rtos::main]
1816
async fn main(_s: Spawner) {
1917
esp_println::logger::init_logger_from_env();
2018
let peripherals = esp_hal::init(esp_hal::Config::default().with_cpu_clock(CpuClock::max()));
@@ -23,7 +21,7 @@ async fn main(_s: Spawner) {
2321
#[cfg(target_arch = "riscv32")]
2422
let software_interrupt = esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
2523

26-
esp_preempt::start(
24+
esp_rtos::start(
2725
timg0.timer0,
2826
#[cfg(target_arch = "riscv32")]
2927
software_interrupt.software_interrupt0,
@@ -32,21 +30,9 @@ async fn main(_s: Spawner) {
3230
let _trng_source = TrngSource::new(peripherals.RNG, peripherals.ADC1);
3331
let mut trng = Trng::try_new().unwrap(); // Ok when there's a TrngSource accessible
3432

35-
static RADIO: StaticCell<Controller<'static>> = StaticCell::new();
36-
let radio = RADIO.init(esp_radio::init().unwrap());
37-
38-
#[cfg(not(feature = "esp32"))]
39-
{
40-
let systimer = esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER);
41-
esp_hal_embassy::init(systimer.alarm0);
42-
}
43-
#[cfg(feature = "esp32")]
44-
{
45-
esp_hal_embassy::init(timg0.timer1);
46-
}
47-
33+
let radio = esp_radio::init().unwrap();
4834
let bluetooth = peripherals.BT;
49-
let connector = BleConnector::new(radio, bluetooth);
35+
let connector = BleConnector::new(&radio, bluetooth, Default::default()).unwrap();
5036
let controller: ExternalController<_, 20> = ExternalController::new(connector);
5137

5238
ble_bas_central_sec::run(controller, &mut trng).await;

examples/esp32/src/bin/ble_bas_peripheral.rs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ use embassy_executor::Spawner;
55
use esp_hal::clock::CpuClock;
66
use esp_hal::timer::timg::TimerGroup;
77
use esp_radio::ble::controller::BleConnector;
8-
use esp_radio::Controller;
9-
use static_cell::StaticCell;
108
use trouble_example_apps::ble_bas_peripheral;
119
use trouble_host::prelude::ExternalController;
12-
use {esp_alloc as _, esp_backtrace as _};
10+
use esp_backtrace as _;
1311

1412
esp_bootloader_esp_idf::esp_app_desc!();
1513

16-
#[esp_hal_embassy::main]
14+
#[esp_rtos::main]
1715
async fn main(_s: Spawner) {
1816
esp_println::logger::init_logger_from_env();
1917
let peripherals = esp_hal::init(esp_hal::Config::default().with_cpu_clock(CpuClock::max()));
@@ -22,27 +20,15 @@ async fn main(_s: Spawner) {
2220
#[cfg(target_arch = "riscv32")]
2321
let software_interrupt = esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
2422

25-
esp_preempt::start(
23+
esp_rtos::start(
2624
timg0.timer0,
2725
#[cfg(target_arch = "riscv32")]
2826
software_interrupt.software_interrupt0,
2927
);
3028

31-
static RADIO: StaticCell<Controller<'static>> = StaticCell::new();
32-
let radio = RADIO.init(esp_radio::init().unwrap());
33-
34-
#[cfg(not(feature = "esp32"))]
35-
{
36-
let systimer = esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER);
37-
esp_hal_embassy::init(systimer.alarm0);
38-
}
39-
#[cfg(feature = "esp32")]
40-
{
41-
esp_hal_embassy::init(timg0.timer1);
42-
}
43-
29+
let radio = esp_radio::init().unwrap();
4430
let bluetooth = peripherals.BT;
45-
let connector = BleConnector::new(radio, bluetooth);
31+
let connector = BleConnector::new(&radio, bluetooth, Default::default()).unwrap();
4632
let controller: ExternalController<_, 20> = ExternalController::new(connector);
4733

4834
ble_bas_peripheral::run(controller).await;

examples/esp32/src/bin/ble_bas_peripheral_sec.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ use esp_hal::clock::CpuClock;
66
use esp_hal::rng::{Trng, TrngSource};
77
use esp_hal::timer::timg::TimerGroup;
88
use esp_radio::ble::controller::BleConnector;
9-
use esp_radio::Controller;
10-
use static_cell::StaticCell;
119
use trouble_example_apps::ble_bas_peripheral_sec;
1210
use trouble_host::prelude::ExternalController;
1311
use {esp_alloc as _, esp_backtrace as _};
1412

1513
esp_bootloader_esp_idf::esp_app_desc!();
1614

17-
#[esp_hal_embassy::main]
15+
#[esp_rtos::main]
1816
async fn main(_s: Spawner) {
1917
esp_println::logger::init_logger_from_env();
2018
let peripherals = esp_hal::init(esp_hal::Config::default().with_cpu_clock(CpuClock::max()));
@@ -23,7 +21,7 @@ async fn main(_s: Spawner) {
2321
#[cfg(target_arch = "riscv32")]
2422
let software_interrupt = esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
2523

26-
esp_preempt::start(
24+
esp_rtos::start(
2725
timg0.timer0,
2826
#[cfg(target_arch = "riscv32")]
2927
software_interrupt.software_interrupt0,
@@ -32,21 +30,9 @@ async fn main(_s: Spawner) {
3230
let _trng_source = TrngSource::new(peripherals.RNG, peripherals.ADC1);
3331
let mut trng = Trng::try_new().unwrap(); // Ok when there's a TrngSource accessible
3432

35-
static RADIO: StaticCell<Controller<'static>> = StaticCell::new();
36-
let radio = RADIO.init(esp_radio::init().unwrap());
37-
38-
#[cfg(not(feature = "esp32"))]
39-
{
40-
let systimer = esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER);
41-
esp_hal_embassy::init(systimer.alarm0);
42-
}
43-
#[cfg(feature = "esp32")]
44-
{
45-
esp_hal_embassy::init(timg0.timer1);
46-
}
47-
33+
let radio = esp_radio::init().unwrap();
4834
let bluetooth = peripherals.BT;
49-
let connector = BleConnector::new(radio, bluetooth);
35+
let connector = BleConnector::new(&radio, bluetooth, Default::default()).unwrap();
5036
let controller: ExternalController<_, 20> = ExternalController::new(connector);
5137

5238
ble_bas_peripheral_sec::run(controller, &mut trng).await;

examples/esp32/src/bin/ble_l2cap_central.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ use embassy_executor::Spawner;
55
use esp_hal::clock::CpuClock;
66
use esp_hal::timer::timg::TimerGroup;
77
use esp_radio::ble::controller::BleConnector;
8-
use esp_radio::Controller;
9-
use static_cell::StaticCell;
108
use trouble_example_apps::ble_l2cap_central;
119
use trouble_host::prelude::ExternalController;
1210
use {esp_alloc as _, esp_backtrace as _};
1311

1412
esp_bootloader_esp_idf::esp_app_desc!();
1513

16-
#[esp_hal_embassy::main]
14+
#[esp_rtos::main]
1715
async fn main(_s: Spawner) {
1816
esp_println::logger::init_logger_from_env();
1917
let peripherals = esp_hal::init(esp_hal::Config::default().with_cpu_clock(CpuClock::max()));
@@ -22,27 +20,15 @@ async fn main(_s: Spawner) {
2220
#[cfg(target_arch = "riscv32")]
2321
let software_interrupt = esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
2422

25-
esp_preempt::start(
23+
esp_rtos::start(
2624
timg0.timer0,
2725
#[cfg(target_arch = "riscv32")]
2826
software_interrupt.software_interrupt0,
2927
);
3028

31-
static RADIO: StaticCell<Controller<'static>> = StaticCell::new();
32-
let radio = RADIO.init(esp_radio::init().unwrap());
33-
34-
#[cfg(not(feature = "esp32"))]
35-
{
36-
let systimer = esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER);
37-
esp_hal_embassy::init(systimer.alarm0);
38-
}
39-
#[cfg(feature = "esp32")]
40-
{
41-
esp_hal_embassy::init(timg0.timer1);
42-
}
43-
29+
let radio = esp_radio::init().unwrap();
4430
let bluetooth = peripherals.BT;
45-
let connector = BleConnector::new(radio, bluetooth);
31+
let connector = BleConnector::new(&radio, bluetooth, Default::default()).unwrap();
4632
let controller: ExternalController<_, 20> = ExternalController::new(connector);
4733

4834
ble_l2cap_central::run(controller).await;

examples/esp32/src/bin/ble_l2cap_peripheral.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ use embassy_executor::Spawner;
55
use esp_hal::clock::CpuClock;
66
use esp_hal::timer::timg::TimerGroup;
77
use esp_radio::ble::controller::BleConnector;
8-
use esp_radio::Controller;
9-
use static_cell::StaticCell;
108
use trouble_example_apps::ble_l2cap_peripheral;
119
use trouble_host::prelude::ExternalController;
1210
use {esp_alloc as _, esp_backtrace as _};
1311

1412
esp_bootloader_esp_idf::esp_app_desc!();
1513

16-
#[esp_hal_embassy::main]
14+
#[esp_rtos::main]
1715
async fn main(_s: Spawner) {
1816
esp_println::logger::init_logger_from_env();
1917
let peripherals = esp_hal::init(esp_hal::Config::default().with_cpu_clock(CpuClock::max()));
@@ -22,27 +20,15 @@ async fn main(_s: Spawner) {
2220
#[cfg(target_arch = "riscv32")]
2321
let software_interrupt = esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
2422

25-
esp_preempt::start(
23+
esp_rtos::start(
2624
timg0.timer0,
2725
#[cfg(target_arch = "riscv32")]
2826
software_interrupt.software_interrupt0,
2927
);
3028

31-
static RADIO: StaticCell<Controller<'static>> = StaticCell::new();
32-
let radio = RADIO.init(esp_radio::init().unwrap());
33-
34-
#[cfg(not(feature = "esp32"))]
35-
{
36-
let systimer = esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER);
37-
esp_hal_embassy::init(systimer.alarm0);
38-
}
39-
#[cfg(feature = "esp32")]
40-
{
41-
esp_hal_embassy::init(timg0.timer1);
42-
}
43-
29+
let radio = esp_radio::init().unwrap();
4430
let bluetooth = peripherals.BT;
45-
let connector = BleConnector::new(radio, bluetooth);
31+
let connector = BleConnector::new(&radio, bluetooth, Default::default()).unwrap();
4632
let controller: ExternalController<_, 20> = ExternalController::new(connector);
4733

4834
ble_l2cap_peripheral::run(controller).await;

0 commit comments

Comments
 (0)