mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-28 04:40:52 +00:00
Rename esp-wifi
to esp-radio
(part 1) (#3858)
* rename `esp-wifi` to `esp-radio` * Add migration guide entry * changelog entry * address reviews * more fixes * address reviews * Thank you for this rebase! * mmm, rebase * Remove unnecessary diff bob * get rid off all `esp-wifi` references * drop the links ƒrom the table
This commit is contained in:
parent
bb55f1152b
commit
73ef8d9227
12
.github/workflows/changelog.yml
vendored
12
.github/workflows/changelog.yml
vendored
@ -56,8 +56,8 @@ jobs:
|
|||||||
- 'esp-rom-sys/**'
|
- 'esp-rom-sys/**'
|
||||||
esp-storage:
|
esp-storage:
|
||||||
- 'esp-storage/**'
|
- 'esp-storage/**'
|
||||||
esp-wifi:
|
esp-radio:
|
||||||
- 'esp-wifi/**'
|
- 'esp-radio/**'
|
||||||
xtensa-lx:
|
xtensa-lx:
|
||||||
- 'xtensa-lx/**'
|
- 'xtensa-lx/**'
|
||||||
xtensa-lx-rt:
|
xtensa-lx-rt:
|
||||||
@ -167,13 +167,13 @@ jobs:
|
|||||||
skipLabels: "skip-changelog"
|
skipLabels: "skip-changelog"
|
||||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-storage/CHANGELOG.md file."
|
missingUpdateErrorMessage: "Please add a changelog entry in the esp-storage/CHANGELOG.md file."
|
||||||
|
|
||||||
- name: Check that changelog updated (esp-wifi)
|
- name: Check that changelog updated (esp-radio)
|
||||||
if: steps.changes.outputs.esp-wifi == 'true'
|
if: steps.changes.outputs.esp-radio == 'true'
|
||||||
uses: dangoslen/changelog-enforcer@v3
|
uses: dangoslen/changelog-enforcer@v3
|
||||||
with:
|
with:
|
||||||
changeLogPath: esp-wifi/CHANGELOG.md
|
changeLogPath: esp-radio/CHANGELOG.md
|
||||||
skipLabels: "skip-changelog"
|
skipLabels: "skip-changelog"
|
||||||
missingUpdateErrorMessage: "Please add a changelog entry in the esp-wifi/CHANGELOG.md file."
|
missingUpdateErrorMessage: "Please add a changelog entry in the esp-radio/CHANGELOG.md file."
|
||||||
|
|
||||||
- name: Check that changelog updated (xtensa-lx)
|
- name: Check that changelog updated (xtensa-lx)
|
||||||
if: steps.changes.outputs.xtensa-lx == 'true'
|
if: steps.changes.outputs.xtensa-lx == 'true'
|
||||||
|
2
.github/workflows/documentation.yml
vendored
2
.github/workflows/documentation.yml
vendored
@ -8,7 +8,7 @@ on:
|
|||||||
packages:
|
packages:
|
||||||
description: >
|
description: >
|
||||||
A JSON structure describing the packages to build.
|
A JSON structure describing the packages to build.
|
||||||
E.g: [{"name":"esp-hal","tag":"v0.23.1"},{"name":"esp-wifi","tag":"esp-wifi-v0.12"}]
|
E.g: [{"name":"esp-hal","tag":"v0.23.1"},{"name":"esp-radio","tag":"esp-radio-v0.12"}]
|
||||||
|
|
||||||
NOTE: You can run `cargo xtask release tag-releases` to get the json output generated for this workflow.
|
NOTE: You can run `cargo xtask release tag-releases` to get the json output generated for this workflow.
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ exclude = [
|
|||||||
"esp-radio-preempt-baremetal",
|
"esp-radio-preempt-baremetal",
|
||||||
"esp-radio-preempt-driver",
|
"esp-radio-preempt-driver",
|
||||||
"esp-riscv-rt",
|
"esp-riscv-rt",
|
||||||
"esp-wifi",
|
"esp-radio",
|
||||||
"esp-storage",
|
"esp-storage",
|
||||||
"examples",
|
"examples",
|
||||||
"extras/bench-server",
|
"extras/bench-server",
|
||||||
|
@ -107,7 +107,7 @@ __bluetooth = []
|
|||||||
# Reserves FROM_CPU_INTR3 for multi-core MCUs.
|
# Reserves FROM_CPU_INTR3 for multi-core MCUs.
|
||||||
__esp_hal_embassy = []
|
__esp_hal_embassy = []
|
||||||
# Reserves FROM_CPU_INTR2 for RISC-V MCUs.
|
# Reserves FROM_CPU_INTR2 for RISC-V MCUs.
|
||||||
__esp_wifi_builtin_scheduler = []
|
__esp_radio_builtin_scheduler = []
|
||||||
__usb_otg = [
|
__usb_otg = [
|
||||||
"dep:embassy-usb-driver",
|
"dep:embassy-usb-driver",
|
||||||
"dep:embassy-usb-synopsys-otg",
|
"dep:embassy-usb-synopsys-otg",
|
||||||
|
@ -170,9 +170,9 @@ pub struct SoftwareInterruptControl<'d> {
|
|||||||
pub software_interrupt0: SoftwareInterrupt<'d, 0>,
|
pub software_interrupt0: SoftwareInterrupt<'d, 0>,
|
||||||
/// Software interrupt 1.
|
/// Software interrupt 1.
|
||||||
pub software_interrupt1: SoftwareInterrupt<'d, 1>,
|
pub software_interrupt1: SoftwareInterrupt<'d, 1>,
|
||||||
/// Software interrupt 2. Not available when using esp-wifi's builtin
|
/// Software interrupt 2. Not available when using esp-radio's builtin
|
||||||
/// scheduler on RISC-V architectures.
|
/// scheduler on RISC-V architectures.
|
||||||
#[cfg(not(all(feature = "__esp_wifi_builtin_scheduler", riscv)))]
|
#[cfg(not(all(feature = "__esp_radio_builtin_scheduler", riscv)))]
|
||||||
pub software_interrupt2: SoftwareInterrupt<'d, 2>,
|
pub software_interrupt2: SoftwareInterrupt<'d, 2>,
|
||||||
#[cfg(not(all(feature = "__esp_hal_embassy", multi_core)))]
|
#[cfg(not(all(feature = "__esp_hal_embassy", multi_core)))]
|
||||||
/// Software interrupt 3. Not available when using `esp-hal-embassy`,
|
/// Software interrupt 3. Not available when using `esp-hal-embassy`,
|
||||||
@ -190,7 +190,7 @@ impl<'d> SoftwareInterruptControl<'d> {
|
|||||||
software_interrupt1: SoftwareInterrupt {
|
software_interrupt1: SoftwareInterrupt {
|
||||||
_lifetime: PhantomData,
|
_lifetime: PhantomData,
|
||||||
},
|
},
|
||||||
#[cfg(not(all(feature = "__esp_wifi_builtin_scheduler", riscv)))]
|
#[cfg(not(all(feature = "__esp_radio_builtin_scheduler", riscv)))]
|
||||||
software_interrupt2: SoftwareInterrupt {
|
software_interrupt2: SoftwareInterrupt {
|
||||||
_lifetime: PhantomData,
|
_lifetime: PhantomData,
|
||||||
},
|
},
|
||||||
|
@ -745,9 +745,9 @@ impl SleepTimeConfig {
|
|||||||
// |<-- PMU guard time, also the maximum time for the SOC -->|
|
// |<-- PMU guard time, also the maximum time for the SOC -->|
|
||||||
// | wake-up delay |
|
// | wake-up delay |
|
||||||
//
|
//
|
||||||
const CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP: bool = true;
|
const CONFIG_ESP_RADIO_ENHANCED_LIGHT_SLEEP: bool = true;
|
||||||
|
|
||||||
let (rf_on_protect_time_us, sync_time_us) = if CONFIG_ESP_WIFI_ENHANCED_LIGHT_SLEEP {
|
let (rf_on_protect_time_us, sync_time_us) = if CONFIG_ESP_RADIO_ENHANCED_LIGHT_SLEEP {
|
||||||
(
|
(
|
||||||
MachineConstants::HP_REGDMA_RF_ON_WORK_TIME_US,
|
MachineConstants::HP_REGDMA_RF_ON_WORK_TIME_US,
|
||||||
MachineConstants::HP_CLOCK_DOMAIN_SYNC_TIME_US,
|
MachineConstants::HP_CLOCK_DOMAIN_SYNC_TIME_US,
|
||||||
|
@ -3,7 +3,7 @@ name = "esp-radio-preempt-baremetal"
|
|||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.86.0"
|
rust-version = "1.86.0"
|
||||||
description = "Bare-metal task scheduler for esp-wifi"
|
description = "Bare-metal task scheduler for esp-radio"
|
||||||
documentation = "https://docs.espressif.com/projects/rust/esp-radio-preempt-baremetal/latest/"
|
documentation = "https://docs.espressif.com/projects/rust/esp-radio-preempt-baremetal/latest/"
|
||||||
keywords = ["esp32", "espressif", "no-std"]
|
keywords = ["esp32", "espressif", "no-std"]
|
||||||
categories = ["embedded", "hardware-support", "no-std"]
|
categories = ["embedded", "hardware-support", "no-std"]
|
||||||
@ -20,7 +20,7 @@ bench = false
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
esp-hal = { version = "1.0.0-rc.0", path = "../esp-hal", features = [
|
esp-hal = { version = "1.0.0-rc.0", path = "../esp-hal", features = [
|
||||||
"requires-unstable",
|
"requires-unstable",
|
||||||
"__esp_wifi_builtin_scheduler",
|
"__esp_radio_builtin_scheduler",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//! This crate allows using esp-wifi on top of esp-hal, without any other OS.
|
//! This crate allows using esp-radio on top of esp-hal, without any other OS.
|
||||||
//!
|
//!
|
||||||
//! This crate needs to be initialized with an esp-hal timer before the scheduler can be started.
|
//! This crate needs to be initialized with an esp-hal timer before the scheduler can be started.
|
||||||
//!
|
//!
|
||||||
@ -9,8 +9,8 @@
|
|||||||
//! let timg0 = TimerGroup::new(peripherals.TIMG0);
|
//! let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
//! esp_radio_preempt_baremetal::init(timg0.timer0);
|
//! esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
//!
|
//!
|
||||||
//! // You can now start esp-wifi:
|
//! // You can now start esp-radio:
|
||||||
//! // let esp_wifi_controller = esp_wifi::init().unwrap();
|
//! // let esp_wifi_controller = esp_radio::init().unwrap();
|
||||||
//! # }
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ name = "esp-radio-preempt-driver"
|
|||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.86.0"
|
rust-version = "1.86.0"
|
||||||
description = "Task scheduler interface for esp-wifi"
|
description = "Task scheduler interface for esp-radio"
|
||||||
documentation = "https://docs.espressif.com/projects/rust/esp-radio-preempt-driver/latest/"
|
documentation = "https://docs.espressif.com/projects/rust/esp-radio-preempt-driver/latest/"
|
||||||
keywords = ["esp32", "espressif", "no-std"]
|
keywords = ["esp32", "espressif", "no-std"]
|
||||||
categories = ["embedded", "hardware-support", "no-std"]
|
categories = ["embedded", "hardware-support", "no-std"]
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||

|

|
||||||
[](https://matrix.to/#/#esp-rs:matrix.org)
|
[](https://matrix.to/#/#esp-rs:matrix.org)
|
||||||
|
|
||||||
This crate provides the interface to create task schedulers for [`esp-wifi`](https://crates.io/crates/esp-wifi).
|
This crate provides the interface to create task schedulers for [`esp-radio`](https://crates.io/crates/esp-radio).
|
||||||
|
|
||||||
## Minimum Supported Rust Version (MSRV)
|
## Minimum Supported Rust Version (MSRV)
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
//! # esp-wifi task scheduler interface.
|
//! # esp-radio task scheduler interface.
|
||||||
//!
|
//!
|
||||||
//! `esp-wifi` requires a task scheduler to operate. This crate allows the task scheduler to be
|
//! `esp-radio` requires a task scheduler to operate. This crate allows the task scheduler to be
|
||||||
//! tailored to specific software platforms (such as ArielOS). Trying to use multiple scheduler
|
//! tailored to specific software platforms (such as ArielOS). Trying to use multiple scheduler
|
||||||
//! crates in a firmware project will not build.
|
//! crates in a firmware project will not build.
|
||||||
//!
|
//!
|
||||||
//! If you want to use esp-wifi without any OS, you can use the [`esp-radio-preempt-baremetal`]
|
//! If you want to use esp-radio without any OS, you can use the [`esp-radio-preempt-baremetal`]
|
||||||
//! crate as the task scheduler.
|
//! crate as the task scheduler.
|
||||||
//!
|
//!
|
||||||
//! ## Implementing a scheduler driver
|
//! ## Implementing a scheduler driver
|
||||||
@ -110,7 +110,7 @@ macro_rules! scheduler_impl {
|
|||||||
|
|
||||||
/// The scheduler interface.
|
/// The scheduler interface.
|
||||||
///
|
///
|
||||||
/// This trait needs to be implemented by a driver crate to integrate esp-wifi with a software
|
/// This trait needs to be implemented by a driver crate to integrate esp-radio with a software
|
||||||
/// platform.
|
/// platform.
|
||||||
pub trait Scheduler: Send + Sync + 'static {
|
pub trait Scheduler: Send + Sync + 'static {
|
||||||
/// This function is called by `esp_wifi::init` to verify that the scheduler is properly set up.
|
/// This function is called by `esp_wifi::init` to verify that the scheduler is properly set up.
|
||||||
@ -120,10 +120,10 @@ pub trait Scheduler: Send + Sync + 'static {
|
|||||||
/// specified number of microseconds.
|
/// specified number of microseconds.
|
||||||
fn usleep(&self, us: u32);
|
fn usleep(&self, us: u32);
|
||||||
|
|
||||||
/// This function is called by `esp-wifi` to start the task scheduler.
|
/// This function is called by `esp-radio` to start the task scheduler.
|
||||||
fn enable(&self);
|
fn enable(&self);
|
||||||
|
|
||||||
/// This function is called by `esp-wifi` to stop the task scheduler.
|
/// This function is called by `esp-radio` to stop the task scheduler.
|
||||||
fn disable(&self);
|
fn disable(&self);
|
||||||
|
|
||||||
/// This function is called by `esp_wifi::init` to yield control to another task.
|
/// This function is called by `esp_wifi::init` to yield control to another task.
|
||||||
@ -155,7 +155,7 @@ pub trait Scheduler: Send + Sync + 'static {
|
|||||||
fn current_task_thread_semaphore(&self) -> *mut c_void;
|
fn current_task_thread_semaphore(&self) -> *mut c_void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// API used (mostly) by esp-wifi
|
// API used (mostly) by esp-radio
|
||||||
|
|
||||||
/// Returns whether the task scheduler has been initialized.
|
/// Returns whether the task scheduler has been initialized.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- `esp_wifi::init` no longer needs an `RNG` driver. (#3829)
|
- `esp_wifi::init` no longer needs an `RNG` driver. (#3829)
|
||||||
- The `builtin-scheduler` feature has been removed. Your project will have to specify a task scheduler. (#3855)
|
- The `builtin-scheduler` feature has been removed. Your project will have to specify a task scheduler. (#3855)
|
||||||
|
- Rename `esp-wifi` to `esp-radio`. (#3858)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "esp-wifi"
|
name = "esp-radio"
|
||||||
version = "0.15.0"
|
version = "0.15.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.88.0"
|
rust-version = "1.88.0"
|
@ -3,7 +3,7 @@
|
|||||||
## Initialization
|
## Initialization
|
||||||
|
|
||||||
The `builtin-scheduler` feature has been removed. The functionality has been moved to `esp_radio_preempt_baremetal`.
|
The `builtin-scheduler` feature has been removed. The functionality has been moved to `esp_radio_preempt_baremetal`.
|
||||||
`esp_radio_preempt_baremetal` needs to be initialized before calling `esp_wifi::init`. Failure to do so will result in an error.
|
`esp_radio_preempt_baremetal` needs to be initialized before calling `esp_radio::init`. Failure to do so will result in an error.
|
||||||
|
|
||||||
Depending on your chosen OS, you may need to use other `esp_radio_preempt_driver` implementations.
|
Depending on your chosen OS, you may need to use other `esp_radio_preempt_driver` implementations.
|
||||||
|
|
||||||
@ -12,5 +12,14 @@ Furthermore, `esp_wifi::init` no longer requires `RNG` or a timer.
|
|||||||
```diff
|
```diff
|
||||||
-let esp_wifi_ctrl = esp_wifi::init(timg0.timer0, Rng::new()).unwrap();
|
-let esp_wifi_ctrl = esp_wifi::init(timg0.timer0, Rng::new()).unwrap();
|
||||||
+esp_radio_preempt_baremetal::init(timg0.timer0);
|
+esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
+let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
+let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Importing
|
||||||
|
|
||||||
|
`esp_wifi` crate has been renamed to `esp_radio`
|
||||||
|
|
||||||
|
```diff
|
||||||
|
- esp-wifi = "0.15.0"
|
||||||
|
+ esp-radio = "{{currentVersion}}"
|
||||||
|
```
|
@ -1,9 +1,9 @@
|
|||||||
# esp-wifi
|
# esp-radio
|
||||||
|
|
||||||
[](https://crates.io/crates/esp-wifi)
|
[](https://crates.io/crates/esp-radio)
|
||||||
[](https://docs.espressif.com/projects/rust/esp-wifi/latest/)
|
[](https://docs.espressif.com/projects/rust/esp-radio/latest/)
|
||||||

|

|
||||||

|

|
||||||
[](https://matrix.to/#/#esp-rs:matrix.org)
|
[](https://matrix.to/#/#esp-rs:matrix.org)
|
||||||
|
|
||||||
A WiFi, BLE and ESP-NOW driver for Espressif microcontrollers.
|
A WiFi, BLE and ESP-NOW driver for Espressif microcontrollers.
|
||||||
@ -14,7 +14,7 @@ Note that this crate currently requires you to enable the `unstable` feature on
|
|||||||
|
|
||||||
If a cell contains an em dash (—) this means that the particular feature is not present for a chip. A check mark (✓) means that some driver implementation exists.
|
If a cell contains an em dash (—) this means that the particular feature is not present for a chip. A check mark (✓) means that some driver implementation exists.
|
||||||
|
|
||||||
| | [Wifi](https://github.com/esp-rs/esp-wifi/issues/94) | [BLE](https://github.com/esp-rs/esp-wifi/issues/93) | [Coex](https://github.com/esp-rs/esp-wifi/issues/92) | ESP-NOW |
|
| | `Wi-Fi`| `BLE` | `Coex` | ESP-NOW |
|
||||||
| :------: | :--------------------------------------------------: | :-------------------------------------------------: | :--------------------------------------------------: | :-----: |
|
| :------: | :--------------------------------------------------: | :-------------------------------------------------: | :--------------------------------------------------: | :-----: |
|
||||||
| ESP32 | ✓ | ✓ | ✓ | ✓ |
|
| ESP32 | ✓ | ✓ | ✓ | ✓ |
|
||||||
| ESP32-C2 | ✓ | ✓ | ✓ | ✓ |
|
| ESP32-C2 | ✓ | ✓ | ✓ | ✓ |
|
@ -49,8 +49,8 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
&& level != "s"
|
&& level != "s"
|
||||||
{
|
{
|
||||||
let message = format!(
|
let message = format!(
|
||||||
"esp-wifi should be built with optimization level 2, 3 or s - yours is {level}.
|
"esp-radio should be built with optimization level 2, 3 or s - yours is {level}.
|
||||||
See https://github.com/esp-rs/esp-wifi",
|
See https://github.com/esp-rs/esp-radio",
|
||||||
);
|
);
|
||||||
print_warning(message);
|
print_warning(message);
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
// `esp_wifi_sys::include::CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM`
|
// `esp_wifi_sys::include::CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM`
|
||||||
println!("cargo:rerun-if-changed=./esp_config.yml");
|
println!("cargo:rerun-if-changed=./esp_config.yml");
|
||||||
let cfg_yaml = std::fs::read_to_string("./esp_config.yml")
|
let cfg_yaml = std::fs::read_to_string("./esp_config.yml")
|
||||||
.expect("Failed to read esp_config.yml for esp-wifi");
|
.expect("Failed to read esp_config.yml for esp-radio");
|
||||||
generate_config_from_yaml_definition(&cfg_yaml, true, true, Some(chip)).unwrap();
|
generate_config_from_yaml_definition(&cfg_yaml, true, true, Some(chip)).unwrap();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
@ -1,4 +1,4 @@
|
|||||||
crate: esp-wifi
|
crate: esp-radio
|
||||||
|
|
||||||
options:
|
options:
|
||||||
- name: rx_queue_size
|
- name: rx_queue_size
|
||||||
@ -216,5 +216,5 @@ options:
|
|||||||
- value: true
|
- value: true
|
||||||
|
|
||||||
checks:
|
checks:
|
||||||
- 'ESP_WIFI_CONFIG_RX_BA_WIN < ESP_WIFI_CONFIG_DYNAMIC_RX_BUF_NUM'
|
- 'ESP_RADIO_CONFIG_RX_BA_WIN < ESP_RADIO_CONFIG_DYNAMIC_RX_BUF_NUM'
|
||||||
- 'ESP_WIFI_CONFIG_RX_BA_WIN < (ESP_WIFI_CONFIG_STATIC_RX_BUF_NUM * 2)'
|
- 'ESP_RADIO_CONFIG_RX_BA_WIN < (ESP_RADIO_CONFIG_STATIC_RX_BUF_NUM * 2)'
|
@ -1,7 +1,7 @@
|
|||||||
use embedded_io::{Error, ErrorType, Read, Write};
|
use embedded_io::{Error, ErrorType, Read, Write};
|
||||||
|
|
||||||
use super::{read_hci, read_next, send_hci};
|
use super::{read_hci, read_next, send_hci};
|
||||||
use crate::EspWifiController;
|
use crate::EspRadioController;
|
||||||
|
|
||||||
/// A blocking HCI connector
|
/// A blocking HCI connector
|
||||||
pub struct BleConnector<'d> {
|
pub struct BleConnector<'d> {
|
||||||
@ -16,7 +16,7 @@ impl Drop for BleConnector<'_> {
|
|||||||
|
|
||||||
impl<'d> BleConnector<'d> {
|
impl<'d> BleConnector<'d> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
_init: &'d EspWifiController<'d>,
|
_init: &'d EspRadioController<'d>,
|
||||||
device: crate::hal::peripherals::BT<'d>,
|
device: crate::hal::peripherals::BT<'d>,
|
||||||
) -> BleConnector<'d> {
|
) -> BleConnector<'d> {
|
||||||
crate::ble::ble_init();
|
crate::ble::ble_init();
|
@ -300,7 +300,7 @@ pub unsafe extern "C" fn strrchr(_s: *const (), _c: u32) -> *const u8 {
|
|||||||
|
|
||||||
static PHY_CLOCK_ENABLE_REF: AtomicU32 = AtomicU32::new(0);
|
static PHY_CLOCK_ENABLE_REF: AtomicU32 = AtomicU32::new(0);
|
||||||
|
|
||||||
// We're use either WIFI or BT here, since esp-wifi also supports the ESP32-H2 as the only
|
// We're use either WIFI or BT here, since esp-radio also supports the ESP32-H2 as the only
|
||||||
// chip, with BT but without WIFI.
|
// chip, with BT but without WIFI.
|
||||||
#[cfg(not(esp32h2))]
|
#[cfg(not(esp32h2))]
|
||||||
type ModemClockControllerPeripheral = esp_hal::peripherals::WIFI<'static>;
|
type ModemClockControllerPeripheral = esp_hal::peripherals::WIFI<'static>;
|
@ -2,7 +2,7 @@
|
|||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
/// Tunable parameters for the WiFi driver
|
/// Tunable parameters for the WiFi driver
|
||||||
#[allow(unused)] // currently there are no ble tunables
|
#[allow(unused)] // currently there are no ble tunables
|
||||||
pub(crate) struct EspWifiConfig {
|
pub(crate) struct EspRadioConfig {
|
||||||
pub(crate) rx_queue_size: usize,
|
pub(crate) rx_queue_size: usize,
|
||||||
pub(crate) tx_queue_size: usize,
|
pub(crate) tx_queue_size: usize,
|
||||||
pub(crate) static_rx_buf_num: usize,
|
pub(crate) static_rx_buf_num: usize,
|
@ -1,6 +1,6 @@
|
|||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
all(docsrs, not(not_really_docsrs)),
|
all(docsrs, not(not_really_docsrs)),
|
||||||
doc = "<div style='padding:30px;background:#810;color:#fff;text-align:center;'><p>You might want to <a href='https://docs.espressif.com/projects/rust/'>browse the <code>esp-wifi</code> documentation on the esp-rs website</a> instead.</p><p>The documentation here on <a href='https://docs.rs'>docs.rs</a> is built for a single chip only (ESP32-C3, in particular), while on the esp-rs website you can select your exact chip from the list of supported devices. Available peripherals and their APIs might change depending on the chip.</p></div>\n\n<br/>\n\n"
|
doc = "<div style='padding:30px;background:#810;color:#fff;text-align:center;'><p>You might want to <a href='https://docs.espressif.com/projects/rust/'>browse the <code>esp-radio</code> documentation on the esp-rs website</a> instead.</p><p>The documentation here on <a href='https://docs.rs'>docs.rs</a> is built for a single chip only (ESP32-C3, in particular), while on the esp-rs website you can select your exact chip from the list of supported devices. Available peripherals and their APIs might change depending on the chip.</p></div>\n\n<br/>\n\n"
|
||||||
)]
|
)]
|
||||||
//! This documentation is built for the
|
//! This documentation is built for the
|
||||||
#![cfg_attr(esp32, doc = "**ESP32**")]
|
#![cfg_attr(esp32, doc = "**ESP32**")]
|
||||||
@ -23,7 +23,7 @@
|
|||||||
//! Ensure that the right features are enabled for your chip. See [Examples](https://github.com/esp-rs/esp-hal/tree/main/examples#examples) for more examples.
|
//! Ensure that the right features are enabled for your chip. See [Examples](https://github.com/esp-rs/esp-hal/tree/main/examples#examples) for more examples.
|
||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! [dependencies.esp-wifi]
|
//! [dependencies.esp-radio]
|
||||||
//! # A supported chip needs to be specified, as well as specific use-case features
|
//! # A supported chip needs to be specified, as well as specific use-case features
|
||||||
#![doc = concat!(r#"features = [""#, chip!(), r#"", "wifi", "esp-now"]"#)]
|
#![doc = concat!(r#"features = [""#, chip!(), r#"", "wifi", "esp-now"]"#)]
|
||||||
//! ```
|
//! ```
|
||||||
@ -35,12 +35,12 @@
|
|||||||
//!
|
//!
|
||||||
//! To make it work also for your debug builds add this to your `Cargo.toml`
|
//! To make it work also for your debug builds add this to your `Cargo.toml`
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! [profile.dev.package.esp-wifi]
|
//! [profile.dev.package.esp-radio]
|
||||||
//! opt-level = 3
|
//! opt-level = 3
|
||||||
//! ```
|
//! ```
|
||||||
//! ## Globally disable logging
|
//! ## Globally disable logging
|
||||||
//!
|
//!
|
||||||
//! `esp-wifi` contains a lot of trace-level logging statements.
|
//! `esp-radio` contains a lot of trace-level logging statements.
|
||||||
//! For maximum performance you might want to disable logging via
|
//! For maximum performance you might want to disable logging via
|
||||||
//! a feature flag of the `log` crate. See [documentation](https://docs.rs/log/0.4.19/log/#compile-time-filters).
|
//! a feature flag of the `log` crate. See [documentation](https://docs.rs/log/0.4.19/log/#compile-time-filters).
|
||||||
//! You should set it to `release_max_level_off`.
|
//! You should set it to `release_max_level_off`.
|
||||||
@ -54,12 +54,12 @@
|
|||||||
//!
|
//!
|
||||||
//! Please note that the configuration keys are usually named slightly different and not all configuration keys apply.
|
//! Please note that the configuration keys are usually named slightly different and not all configuration keys apply.
|
||||||
//!
|
//!
|
||||||
//! By default the power-saving mode is [PowerSaveMode::None](crate::config::PowerSaveMode::None) and `ESP_WIFI_PHY_ENABLE_USB` is enabled by default.
|
//! By default the power-saving mode is [PowerSaveMode::None](crate::config::PowerSaveMode::None) and `ESP_RADIO_PHY_ENABLE_USB` is enabled by default.
|
||||||
//!
|
//!
|
||||||
//! In addition pay attention to these configuration keys:
|
//! In addition pay attention to these configuration keys:
|
||||||
//! - `ESP_WIFI_RX_QUEUE_SIZE`
|
//! - `ESP_RADIO_RX_QUEUE_SIZE`
|
||||||
//! - `ESP_WIFI_TX_QUEUE_SIZE`
|
//! - `ESP_RADIO_TX_QUEUE_SIZE`
|
||||||
//! - `ESP_WIFI_MAX_BURST_SIZE`
|
//! - `ESP_RADIO_MAX_BURST_SIZE`
|
||||||
//!
|
//!
|
||||||
//! # Features flags
|
//! # Features flags
|
||||||
//!
|
//!
|
||||||
@ -78,7 +78,7 @@
|
|||||||
//! section inside `.cargo/config.toml`. Below is a table of tunable parameters
|
//! section inside `.cargo/config.toml`. Below is a table of tunable parameters
|
||||||
//! for this crate:
|
//! for this crate:
|
||||||
#![doc = ""]
|
#![doc = ""]
|
||||||
#![doc = include_str!(concat!(env!("OUT_DIR"), "/esp_wifi_config_table.md"))]
|
#![doc = include_str!(concat!(env!("OUT_DIR"), "/esp_radio_config_table.md"))]
|
||||||
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
|
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![cfg_attr(xtensa, feature(asm_experimental_arch))]
|
#![cfg_attr(xtensa, feature(asm_experimental_arch))]
|
||||||
@ -170,38 +170,38 @@ const _: () = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) const CONFIG: config::EspWifiConfig = config::EspWifiConfig {
|
pub(crate) const CONFIG: config::EspRadioConfig = config::EspRadioConfig {
|
||||||
rx_queue_size: esp_config_int!(usize, "ESP_WIFI_CONFIG_RX_QUEUE_SIZE"),
|
rx_queue_size: esp_config_int!(usize, "ESP_RADIO_CONFIG_RX_QUEUE_SIZE"),
|
||||||
tx_queue_size: esp_config_int!(usize, "ESP_WIFI_CONFIG_TX_QUEUE_SIZE"),
|
tx_queue_size: esp_config_int!(usize, "ESP_RADIO_CONFIG_TX_QUEUE_SIZE"),
|
||||||
static_rx_buf_num: esp_config_int!(usize, "ESP_WIFI_CONFIG_STATIC_RX_BUF_NUM"),
|
static_rx_buf_num: esp_config_int!(usize, "ESP_RADIO_CONFIG_STATIC_RX_BUF_NUM"),
|
||||||
dynamic_rx_buf_num: esp_config_int!(usize, "ESP_WIFI_CONFIG_DYNAMIC_RX_BUF_NUM"),
|
dynamic_rx_buf_num: esp_config_int!(usize, "ESP_RADIO_CONFIG_DYNAMIC_RX_BUF_NUM"),
|
||||||
static_tx_buf_num: esp_config_int!(usize, "ESP_WIFI_CONFIG_STATIC_TX_BUF_NUM"),
|
static_tx_buf_num: esp_config_int!(usize, "ESP_RADIO_CONFIG_STATIC_TX_BUF_NUM"),
|
||||||
dynamic_tx_buf_num: esp_config_int!(usize, "ESP_WIFI_CONFIG_DYNAMIC_TX_BUF_NUM"),
|
dynamic_tx_buf_num: esp_config_int!(usize, "ESP_RADIO_CONFIG_DYNAMIC_TX_BUF_NUM"),
|
||||||
ampdu_rx_enable: esp_config_bool!("ESP_WIFI_CONFIG_AMPDU_RX_ENABLE"),
|
ampdu_rx_enable: esp_config_bool!("ESP_RADIO_CONFIG_AMPDU_RX_ENABLE"),
|
||||||
ampdu_tx_enable: esp_config_bool!("ESP_WIFI_CONFIG_AMPDU_TX_ENABLE"),
|
ampdu_tx_enable: esp_config_bool!("ESP_RADIO_CONFIG_AMPDU_TX_ENABLE"),
|
||||||
amsdu_tx_enable: esp_config_bool!("ESP_WIFI_CONFIG_AMSDU_TX_ENABLE"),
|
amsdu_tx_enable: esp_config_bool!("ESP_RADIO_CONFIG_AMSDU_TX_ENABLE"),
|
||||||
rx_ba_win: esp_config_int!(usize, "ESP_WIFI_CONFIG_RX_BA_WIN"),
|
rx_ba_win: esp_config_int!(usize, "ESP_RADIO_CONFIG_RX_BA_WIN"),
|
||||||
max_burst_size: esp_config_int!(usize, "ESP_WIFI_CONFIG_MAX_BURST_SIZE"),
|
max_burst_size: esp_config_int!(usize, "ESP_RADIO_CONFIG_MAX_BURST_SIZE"),
|
||||||
country_code: esp_config_str!("ESP_WIFI_CONFIG_COUNTRY_CODE"),
|
country_code: esp_config_str!("ESP_RADIO_CONFIG_COUNTRY_CODE"),
|
||||||
country_code_operating_class: esp_config_int!(
|
country_code_operating_class: esp_config_int!(
|
||||||
u8,
|
u8,
|
||||||
"ESP_WIFI_CONFIG_COUNTRY_CODE_OPERATING_CLASS"
|
"ESP_RADIO_CONFIG_COUNTRY_CODE_OPERATING_CLASS"
|
||||||
),
|
),
|
||||||
mtu: esp_config_int!(usize, "ESP_WIFI_CONFIG_MTU"),
|
mtu: esp_config_int!(usize, "ESP_RADIO_CONFIG_MTU"),
|
||||||
listen_interval: esp_config_int!(u16, "ESP_WIFI_CONFIG_LISTEN_INTERVAL"),
|
listen_interval: esp_config_int!(u16, "ESP_RADIO_CONFIG_LISTEN_INTERVAL"),
|
||||||
beacon_timeout: esp_config_int!(u16, "ESP_WIFI_CONFIG_BEACON_TIMEOUT"),
|
beacon_timeout: esp_config_int!(u16, "ESP_RADIO_CONFIG_BEACON_TIMEOUT"),
|
||||||
ap_beacon_timeout: esp_config_int!(u16, "ESP_WIFI_CONFIG_AP_BEACON_TIMEOUT"),
|
ap_beacon_timeout: esp_config_int!(u16, "ESP_RADIO_CONFIG_AP_BEACON_TIMEOUT"),
|
||||||
failure_retry_cnt: esp_config_int!(u8, "ESP_WIFI_CONFIG_FAILURE_RETRY_CNT"),
|
failure_retry_cnt: esp_config_int!(u8, "ESP_RADIO_CONFIG_FAILURE_RETRY_CNT"),
|
||||||
scan_method: esp_config_int!(u32, "ESP_WIFI_CONFIG_SCAN_METHOD"),
|
scan_method: esp_config_int!(u32, "ESP_RADIO_CONFIG_SCAN_METHOD"),
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, PartialOrd)]
|
#[derive(Debug, PartialEq, PartialOrd)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct EspWifiController<'d> {
|
pub struct EspRadioController<'d> {
|
||||||
_inner: PhantomData<&'d ()>,
|
_inner: PhantomData<&'d ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for EspWifiController<'_> {
|
impl Drop for EspRadioController<'_> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
// Disable coexistence
|
// Disable coexistence
|
||||||
#[cfg(coex)]
|
#[cfg(coex)]
|
||||||
@ -220,7 +220,7 @@ impl Drop for EspWifiController<'_> {
|
|||||||
/// Initialize for using WiFi and or BLE.
|
/// Initialize for using WiFi and or BLE.
|
||||||
///
|
///
|
||||||
/// Make sure to **not** call this function while interrupts are disabled.
|
/// Make sure to **not** call this function while interrupts are disabled.
|
||||||
pub fn init<'d>() -> Result<EspWifiController<'d>, InitializationError> {
|
pub fn init<'d>() -> Result<EspRadioController<'d>, InitializationError> {
|
||||||
if crate::is_interrupts_disabled() {
|
if crate::is_interrupts_disabled() {
|
||||||
return Err(InitializationError::InterruptsDisabled);
|
return Err(InitializationError::InterruptsDisabled);
|
||||||
}
|
}
|
||||||
@ -236,7 +236,7 @@ pub fn init<'d>() -> Result<EspWifiController<'d>, InitializationError> {
|
|||||||
return Err(InitializationError::WrongClockConfig);
|
return Err(InitializationError::WrongClockConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("esp-wifi configuration {:?}", crate::CONFIG);
|
info!("esp-radio configuration {:?}", crate::CONFIG);
|
||||||
crate::common_adapter::chip_specific::enable_wifi_power_domain();
|
crate::common_adapter::chip_specific::enable_wifi_power_domain();
|
||||||
phy_mem_init();
|
phy_mem_init();
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ pub fn init<'d>() -> Result<EspWifiController<'d>, InitializationError> {
|
|||||||
error => return Err(InitializationError::General(error)),
|
error => return Err(InitializationError::General(error)),
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(EspWifiController {
|
Ok(EspRadioController {
|
||||||
_inner: PhantomData,
|
_inner: PhantomData,
|
||||||
})
|
})
|
||||||
}
|
}
|
@ -30,7 +30,7 @@ fn default_handler<Event: 'static>() -> Box<Handler<Event>> {
|
|||||||
/// Register a new event handler like:
|
/// Register a new event handler like:
|
||||||
///
|
///
|
||||||
/// ```rust, no_run
|
/// ```rust, no_run
|
||||||
/// # use esp_wifi::wifi::event::{self, *};
|
/// # use esp_radio::wifi::event::{self, *};
|
||||||
/// # fn new_handler(_: &ApStaconnected) {}
|
/// # fn new_handler(_: &ApStaconnected) {}
|
||||||
/// event::ApStaconnected::update_handler(|_cs, event| {
|
/// event::ApStaconnected::update_handler(|_cs, event| {
|
||||||
/// new_handler(event);
|
/// new_handler(event);
|
@ -62,12 +62,12 @@ use smoltcp::phy::{Device, DeviceCapabilities, RxToken, TxToken};
|
|||||||
pub use state::*;
|
pub use state::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
EspWifiController,
|
EspRadioController,
|
||||||
common_adapter::*,
|
common_adapter::*,
|
||||||
config::PowerSaveMode,
|
config::PowerSaveMode,
|
||||||
esp_wifi_result,
|
esp_wifi_result,
|
||||||
hal::ram,
|
hal::ram,
|
||||||
wifi::private::EspWifiPacketBuffer,
|
wifi::private::EspRadioPacketBuffer,
|
||||||
};
|
};
|
||||||
|
|
||||||
const MTU: usize = crate::CONFIG.mtu;
|
const MTU: usize = crate::CONFIG.mtu;
|
||||||
@ -1148,10 +1148,10 @@ impl CsiConfig {
|
|||||||
const RX_QUEUE_SIZE: usize = crate::CONFIG.rx_queue_size;
|
const RX_QUEUE_SIZE: usize = crate::CONFIG.rx_queue_size;
|
||||||
const TX_QUEUE_SIZE: usize = crate::CONFIG.tx_queue_size;
|
const TX_QUEUE_SIZE: usize = crate::CONFIG.tx_queue_size;
|
||||||
|
|
||||||
pub(crate) static DATA_QUEUE_RX_AP: Locked<VecDeque<EspWifiPacketBuffer>> =
|
pub(crate) static DATA_QUEUE_RX_AP: Locked<VecDeque<EspRadioPacketBuffer>> =
|
||||||
Locked::new(VecDeque::new());
|
Locked::new(VecDeque::new());
|
||||||
|
|
||||||
pub(crate) static DATA_QUEUE_RX_STA: Locked<VecDeque<EspWifiPacketBuffer>> =
|
pub(crate) static DATA_QUEUE_RX_STA: Locked<VecDeque<EspRadioPacketBuffer>> =
|
||||||
Locked::new(VecDeque::new());
|
Locked::new(VecDeque::new());
|
||||||
|
|
||||||
/// Common errors.
|
/// Common errors.
|
||||||
@ -1452,10 +1452,10 @@ unsafe extern "C" fn recv_cb_sta(
|
|||||||
len: u16,
|
len: u16,
|
||||||
eb: *mut c_types::c_void,
|
eb: *mut c_types::c_void,
|
||||||
) -> esp_err_t {
|
) -> esp_err_t {
|
||||||
let packet = EspWifiPacketBuffer { buffer, len, eb };
|
let packet = EspRadioPacketBuffer { buffer, len, eb };
|
||||||
// We must handle the result outside of the lock because
|
// We must handle the result outside of the lock because
|
||||||
// EspWifiPacketBuffer::drop must not be called in a critical section.
|
// EspRadioPacketBuffer::drop must not be called in a critical section.
|
||||||
// Dropping an EspWifiPacketBuffer will call `esp_wifi_internal_free_rx_buffer`
|
// Dropping an EspRadioPacketBuffer will call `esp_wifi_internal_free_rx_buffer`
|
||||||
// which will try to lock an internal mutex. If the mutex is already taken,
|
// which will try to lock an internal mutex. If the mutex is already taken,
|
||||||
// the function will try to trigger a context switch, which will fail if we
|
// the function will try to trigger a context switch, which will fail if we
|
||||||
// are in an interrupt-free context.
|
// are in an interrupt-free context.
|
||||||
@ -1483,10 +1483,10 @@ unsafe extern "C" fn recv_cb_ap(
|
|||||||
len: u16,
|
len: u16,
|
||||||
eb: *mut c_types::c_void,
|
eb: *mut c_types::c_void,
|
||||||
) -> esp_err_t {
|
) -> esp_err_t {
|
||||||
let packet = EspWifiPacketBuffer { buffer, len, eb };
|
let packet = EspRadioPacketBuffer { buffer, len, eb };
|
||||||
// We must handle the result outside of the critical section because
|
// We must handle the result outside of the critical section because
|
||||||
// EspWifiPacketBuffer::drop must not be called in a critical section.
|
// EspRadioPacketBuffer::drop must not be called in a critical section.
|
||||||
// Dropping an EspWifiPacketBuffer will call `esp_wifi_internal_free_rx_buffer`
|
// Dropping an EspRadioPacketBuffer will call `esp_wifi_internal_free_rx_buffer`
|
||||||
// which will try to lock an internal mutex. If the mutex is already taken,
|
// which will try to lock an internal mutex. If the mutex is already taken,
|
||||||
// the function will try to trigger a context switch, which will fail if we
|
// the function will try to trigger a context switch, which will fail if we
|
||||||
// are in an interrupt-free context.
|
// are in an interrupt-free context.
|
||||||
@ -1708,27 +1708,27 @@ mod private {
|
|||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
/// Take care not to drop this while in a critical section.
|
/// Take care not to drop this while in a critical section.
|
||||||
///
|
///
|
||||||
/// Dropping an EspWifiPacketBuffer will call
|
/// Dropping an EspRadioPacketBuffer will call
|
||||||
/// `esp_wifi_internal_free_rx_buffer` which will try to lock an
|
/// `esp_wifi_internal_free_rx_buffer` which will try to lock an
|
||||||
/// internal mutex. If the mutex is already taken, the function will try
|
/// internal mutex. If the mutex is already taken, the function will try
|
||||||
/// to trigger a context switch, which will fail if we are in a critical
|
/// to trigger a context switch, which will fail if we are in a critical
|
||||||
/// section.
|
/// section.
|
||||||
pub struct EspWifiPacketBuffer {
|
pub struct EspRadioPacketBuffer {
|
||||||
pub(crate) buffer: *mut c_types::c_void,
|
pub(crate) buffer: *mut c_types::c_void,
|
||||||
pub(crate) len: u16,
|
pub(crate) len: u16,
|
||||||
pub(crate) eb: *mut c_types::c_void,
|
pub(crate) eb: *mut c_types::c_void,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Send for EspWifiPacketBuffer {}
|
unsafe impl Send for EspRadioPacketBuffer {}
|
||||||
|
|
||||||
impl Drop for EspWifiPacketBuffer {
|
impl Drop for EspRadioPacketBuffer {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
trace!("Dropping EspWifiPacketBuffer, freeing memory");
|
trace!("Dropping EspRadioPacketBuffer, freeing memory");
|
||||||
unsafe { esp_wifi_internal_free_rx_buffer(self.eb) };
|
unsafe { esp_wifi_internal_free_rx_buffer(self.eb) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EspWifiPacketBuffer {
|
impl EspRadioPacketBuffer {
|
||||||
pub fn as_slice_mut(&mut self) -> &mut [u8] {
|
pub fn as_slice_mut(&mut self) -> &mut [u8] {
|
||||||
unsafe { core::slice::from_raw_parts_mut(self.buffer as *mut u8, self.len as usize) }
|
unsafe { core::slice::from_raw_parts_mut(self.buffer as *mut u8, self.len as usize) }
|
||||||
}
|
}
|
||||||
@ -1758,7 +1758,7 @@ impl WifiDeviceMode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn data_queue_rx(&self) -> &'static Locked<VecDeque<EspWifiPacketBuffer>> {
|
fn data_queue_rx(&self) -> &'static Locked<VecDeque<EspRadioPacketBuffer>> {
|
||||||
match self {
|
match self {
|
||||||
WifiDeviceMode::Sta => &DATA_QUEUE_RX_STA,
|
WifiDeviceMode::Sta => &DATA_QUEUE_RX_STA,
|
||||||
WifiDeviceMode::Ap => &DATA_QUEUE_RX_AP,
|
WifiDeviceMode::Ap => &DATA_QUEUE_RX_AP,
|
||||||
@ -2213,8 +2213,8 @@ impl WifiRxToken {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// We handle the received data outside of the lock because
|
// We handle the received data outside of the lock because
|
||||||
// EspWifiPacketBuffer::drop must not be called in a critical section.
|
// EspRadioPacketBuffer::drop must not be called in a critical section.
|
||||||
// Dropping an EspWifiPacketBuffer will call `esp_wifi_internal_free_rx_buffer`
|
// Dropping an EspRadioPacketBuffer will call `esp_wifi_internal_free_rx_buffer`
|
||||||
// which will try to lock an internal mutex. If the mutex is already
|
// which will try to lock an internal mutex. If the mutex is already
|
||||||
// taken, the function will try to trigger a context switch, which will
|
// taken, the function will try to trigger a context switch, which will
|
||||||
// fail if we are in an interrupt-free context.
|
// fail if we are in an interrupt-free context.
|
||||||
@ -2652,7 +2652,7 @@ pub struct Interfaces<'d> {
|
|||||||
/// Make sure to **not** call this function while interrupts are disabled, or IEEE 802.15.4 is
|
/// Make sure to **not** call this function while interrupts are disabled, or IEEE 802.15.4 is
|
||||||
/// currently in use.
|
/// currently in use.
|
||||||
pub fn new<'d>(
|
pub fn new<'d>(
|
||||||
_inited: &'d EspWifiController<'d>,
|
_inited: &'d EspRadioController<'d>,
|
||||||
_device: crate::hal::peripherals::WIFI<'d>,
|
_device: crate::hal::peripherals::WIFI<'d>,
|
||||||
) -> Result<(WifiController<'d>, Interfaces<'d>), WifiError> {
|
) -> Result<(WifiController<'d>, Interfaces<'d>), WifiError> {
|
||||||
if crate::is_interrupts_disabled() {
|
if crate::is_interrupts_disabled() {
|
@ -42,7 +42,7 @@ macro_rules! before_snippet {
|
|||||||
pub mod rom;
|
pub mod rom;
|
||||||
|
|
||||||
/// This is needed by `libesp_rom.a` (if used)
|
/// This is needed by `libesp_rom.a` (if used)
|
||||||
/// Other crates (i.e. esp-wifi) also rely on this being defined somewhere
|
/// Other crates (i.e. esp-radio) also rely on this being defined somewhere
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
unsafe extern "C" fn __assert_func(
|
unsafe extern "C" fn __assert_func(
|
||||||
file: *const core::ffi::c_char,
|
file: *const core::ffi::c_char,
|
||||||
|
@ -73,7 +73,7 @@ pub fn ets_set_appcpu_boot_addr(boot_addr: u32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// libphy.a can pull this in on some chips, we provide it here
|
// libphy.a can pull this in on some chips, we provide it here
|
||||||
// so that either ieee or esp-wifi gets it for free without duplicating in both
|
// so that either ieee or esp-radio gets it for free without duplicating in both
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
extern "C" fn rtc_clk_xtal_freq_get() -> i32 {
|
extern "C" fn rtc_clk_xtal_freq_get() -> i32 {
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
|
@ -30,7 +30,7 @@ esp-ieee802154 = { path = "../esp-ieee802154", optional = true }
|
|||||||
esp-println = { path = "../esp-println", features = ["log-04"] }
|
esp-println = { path = "../esp-println", features = ["log-04"] }
|
||||||
esp-radio-preempt-baremetal = { path = "../esp-radio-preempt-baremetal", features = ["log-04"], optional = true }
|
esp-radio-preempt-baremetal = { path = "../esp-radio-preempt-baremetal", features = ["log-04"], optional = true }
|
||||||
esp-storage = { path = "../esp-storage", optional = true }
|
esp-storage = { path = "../esp-storage", optional = true }
|
||||||
esp-wifi = { path = "../esp-wifi", features = ["log-04"], optional = true }
|
esp-radio = { path = "../esp-radio", features = ["log-04"], optional = true }
|
||||||
heapless = "0.8.0"
|
heapless = "0.8.0"
|
||||||
hmac = { version = "0.12.1", default-features = false }
|
hmac = { version = "0.12.1", default-features = false }
|
||||||
ieee80211 = { version = "0.4.0", default-features = false }
|
ieee80211 = { version = "0.4.0", default-features = false }
|
||||||
@ -47,15 +47,15 @@ edge-nal = { version = "0.5.0" }
|
|||||||
edge-nal-embassy = { version = "0.5.0" }
|
edge-nal-embassy = { version = "0.5.0" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
esp32 = ["esp-hal/esp32", "esp-backtrace/esp32", "esp-hal-embassy?/esp32", "esp-println/esp32", "esp-storage?/esp32", "esp-wifi?/esp32", "esp-bootloader-esp-idf/esp32", "esp-radio-preempt-baremetal?/esp32"]
|
esp32 = ["esp-hal/esp32", "esp-backtrace/esp32", "esp-hal-embassy?/esp32", "esp-println/esp32", "esp-storage?/esp32", "esp-radio?/esp32", "esp-bootloader-esp-idf/esp32", "esp-radio-preempt-baremetal?/esp32"]
|
||||||
esp32c2 = ["esp-hal/esp32c2", "esp-backtrace/esp32c2", "esp-hal-embassy?/esp32c2", "esp-println/esp32c2", "esp-storage?/esp32c2", "esp-wifi?/esp32c2", "esp-bootloader-esp-idf/esp32c2", "esp-radio-preempt-baremetal?/esp32c2"]
|
esp32c2 = ["esp-hal/esp32c2", "esp-backtrace/esp32c2", "esp-hal-embassy?/esp32c2", "esp-println/esp32c2", "esp-storage?/esp32c2", "esp-radio?/esp32c2", "esp-bootloader-esp-idf/esp32c2", "esp-radio-preempt-baremetal?/esp32c2"]
|
||||||
esp32c3 = ["esp-hal/esp32c3", "esp-backtrace/esp32c3", "esp-hal-embassy?/esp32c3", "esp-println/esp32c3", "esp-storage?/esp32c3", "esp-wifi?/esp32c3", "esp-bootloader-esp-idf/esp32c3", "esp-radio-preempt-baremetal?/esp32c3"]
|
esp32c3 = ["esp-hal/esp32c3", "esp-backtrace/esp32c3", "esp-hal-embassy?/esp32c3", "esp-println/esp32c3", "esp-storage?/esp32c3", "esp-radio?/esp32c3", "esp-bootloader-esp-idf/esp32c3", "esp-radio-preempt-baremetal?/esp32c3"]
|
||||||
esp32c6 = ["esp-hal/esp32c6", "esp-backtrace/esp32c6", "esp-hal-embassy?/esp32c6", "esp-println/esp32c6", "esp-storage?/esp32c6", "esp-wifi?/esp32c6", "esp-bootloader-esp-idf/esp32c6", "esp-radio-preempt-baremetal?/esp32c6", "esp-ieee802154?/esp32c6"]
|
esp32c6 = ["esp-hal/esp32c6", "esp-backtrace/esp32c6", "esp-hal-embassy?/esp32c6", "esp-println/esp32c6", "esp-storage?/esp32c6", "esp-radio?/esp32c6", "esp-bootloader-esp-idf/esp32c6", "esp-radio-preempt-baremetal?/esp32c6", "esp-ieee802154?/esp32c6"]
|
||||||
esp32h2 = ["esp-hal/esp32h2", "esp-backtrace/esp32h2", "esp-hal-embassy?/esp32h2", "esp-println/esp32h2", "esp-storage?/esp32h2", "esp-wifi?/esp32h2", "esp-bootloader-esp-idf/esp32h2", "esp-radio-preempt-baremetal?/esp32h2", "esp-ieee802154?/esp32h2"]
|
esp32h2 = ["esp-hal/esp32h2", "esp-backtrace/esp32h2", "esp-hal-embassy?/esp32h2", "esp-println/esp32h2", "esp-storage?/esp32h2", "esp-radio?/esp32h2", "esp-bootloader-esp-idf/esp32h2", "esp-radio-preempt-baremetal?/esp32h2", "esp-ieee802154?/esp32h2"]
|
||||||
esp32s2 = ["esp-hal/esp32s2", "esp-backtrace/esp32s2", "esp-hal-embassy?/esp32s2", "esp-println/esp32s2", "esp-storage?/esp32s2", "esp-wifi?/esp32s2", "esp-bootloader-esp-idf/esp32s2", "esp-radio-preempt-baremetal?/esp32s2"]
|
esp32s2 = ["esp-hal/esp32s2", "esp-backtrace/esp32s2", "esp-hal-embassy?/esp32s2", "esp-println/esp32s2", "esp-storage?/esp32s2", "esp-radio?/esp32s2", "esp-bootloader-esp-idf/esp32s2", "esp-radio-preempt-baremetal?/esp32s2"]
|
||||||
esp32s3 = ["esp-hal/esp32s3", "esp-backtrace/esp32s3", "esp-hal-embassy?/esp32s3", "esp-println/esp32s3", "esp-storage?/esp32s3", "esp-wifi?/esp32s3", "esp-bootloader-esp-idf/esp32s3", "esp-radio-preempt-baremetal?/esp32s3"]
|
esp32s3 = ["esp-hal/esp32s3", "esp-backtrace/esp32s3", "esp-hal-embassy?/esp32s3", "esp-println/esp32s3", "esp-storage?/esp32s3", "esp-radio?/esp32s3", "esp-bootloader-esp-idf/esp32s3", "esp-radio-preempt-baremetal?/esp32s3"]
|
||||||
|
|
||||||
esp-wifi = ["dep:esp-wifi", "dep:esp-radio-preempt-baremetal"]
|
esp-radio = ["dep:esp-radio", "dep:esp-radio-preempt-baremetal"]
|
||||||
|
|
||||||
embassy = ["dep:esp-hal-embassy"]
|
embassy = ["dep:esp-hal-embassy"]
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Periodically transmits a beacon frame.
|
//! Periodically transmits a beacon frame.
|
||||||
|
|
||||||
//% FEATURES: esp-wifi esp-wifi/wifi esp-wifi/sniffer esp-hal/unstable
|
//% FEATURES: esp-radio esp-radio/wifi esp-radio/sniffer esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -14,7 +14,7 @@ use esp_alloc as _;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{clock::CpuClock, delay::Delay, main, time::Duration, timer::timg::TimerGroup};
|
use esp_hal::{clock::CpuClock, delay::Delay, main, time::Duration, timer::timg::TimerGroup};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::wifi;
|
use esp_radio::wifi;
|
||||||
use ieee80211::{
|
use ieee80211::{
|
||||||
common::{CapabilitiesInformation, FCFFlags},
|
common::{CapabilitiesInformation, FCFFlags},
|
||||||
element_chain,
|
element_chain,
|
||||||
@ -26,7 +26,7 @@ use ieee80211::{
|
|||||||
|
|
||||||
esp_bootloader_esp_idf::esp_app_desc!();
|
esp_bootloader_esp_idf::esp_app_desc!();
|
||||||
|
|
||||||
const SSID: &str = "esp-wifi 802.11 injection";
|
const SSID: &str = "esp-radio 802.11 injection";
|
||||||
/// This is an arbitrary MAC address, used for the fake beacon frames.
|
/// This is an arbitrary MAC address, used for the fake beacon frames.
|
||||||
const MAC_ADDRESS: [u8; 6] = [0x00, 0x80, 0x41, 0x13, 0x37, 0x42];
|
const MAC_ADDRESS: [u8; 6] = [0x00, 0x80, 0x41, 0x13, 0x37, 0x42];
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ fn main() -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
|
|
||||||
// We must initialize some kind of interface and start it.
|
// We must initialize some kind of interface and start it.
|
||||||
let (mut controller, interfaces) =
|
let (mut controller, interfaces) =
|
||||||
esp_wifi::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
controller.set_mode(wifi::WifiMode::Sta).unwrap();
|
controller.set_mode(wifi::WifiMode::Sta).unwrap();
|
||||||
controller.start().unwrap();
|
controller.start().unwrap();
|
||||||
@ -104,7 +104,7 @@ fn main() -> ! {
|
|||||||
// Only use the actually written bytes.
|
// Only use the actually written bytes.
|
||||||
let beacon = &beacon[..length];
|
let beacon = &beacon[..length];
|
||||||
|
|
||||||
println!("Scan for WiFi networks and find `esp-wifi 802.11 injection`");
|
println!("Scan for WiFi networks and find `esp-radio 802.11 injection`");
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
sniffer.send_raw_frame(true, beacon, false).unwrap();
|
sniffer.send_raw_frame(true, beacon, false).unwrap();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Access point
|
//! Access point
|
||||||
//!
|
//!
|
||||||
//! Creates an open access-point with SSID `esp-wifi`.
|
//! Creates an open access-point with SSID `esp-radio`.
|
||||||
//! You can connect to it using a static IP in range 192.168.2.2 ..
|
//! You can connect to it using a static IP in range 192.168.2.2 ..
|
||||||
//! 192.168.2.255, gateway 192.168.2.1
|
//! 192.168.2.255, gateway 192.168.2.1
|
||||||
//!
|
//!
|
||||||
@ -10,7 +10,7 @@
|
|||||||
//! WiFi has no internet connection, Chrome might not want to load the URL - you
|
//! WiFi has no internet connection, Chrome might not want to load the URL - you
|
||||||
//! can use a shell and try `curl` and `ping`
|
//! can use a shell and try `curl` and `ping`
|
||||||
|
|
||||||
//% FEATURES: esp-wifi esp-wifi/wifi esp-wifi/smoltcp esp-hal/unstable
|
//% FEATURES: esp-radio esp-radio/wifi esp-radio/smoltcp esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -28,7 +28,7 @@ use esp_hal::{
|
|||||||
timer::timg::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::{print, println};
|
use esp_println::{print, println};
|
||||||
use esp_wifi::wifi::{
|
use esp_radio::wifi::{
|
||||||
AccessPointConfiguration,
|
AccessPointConfiguration,
|
||||||
Configuration,
|
Configuration,
|
||||||
event::{self, EventExt},
|
event::{self, EventExt},
|
||||||
@ -66,10 +66,10 @@ fn main() -> ! {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
|
|
||||||
let (mut controller, interfaces) =
|
let (mut controller, interfaces) =
|
||||||
esp_wifi::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
let mut device = interfaces.ap;
|
let mut device = interfaces.ap;
|
||||||
let iface = create_interface(&mut device);
|
let iface = create_interface(&mut device);
|
||||||
@ -82,7 +82,7 @@ fn main() -> ! {
|
|||||||
let mut stack = Stack::new(iface, device, socket_set, now, rng.random());
|
let mut stack = Stack::new(iface, device, socket_set, now, rng.random());
|
||||||
|
|
||||||
let client_config = Configuration::AccessPoint(AccessPointConfiguration {
|
let client_config = Configuration::AccessPoint(AccessPointConfiguration {
|
||||||
ssid: "esp-wifi".into(),
|
ssid: "esp-radio".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
let res = controller.set_configuration(&client_config);
|
let res = controller.set_configuration(&client_config);
|
||||||
@ -112,7 +112,7 @@ fn main() -> ! {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"Start busy loop on main. Connect to the AP `esp-wifi` and point your browser to http://192.168.2.1:8080/"
|
"Start busy loop on main. Connect to the AP `esp-radio` and point your browser to http://192.168.2.1:8080/"
|
||||||
);
|
);
|
||||||
println!("Use a static IP in the range 192.168.2.2 .. 192.168.2.255, use gateway 192.168.2.1");
|
println!("Use a static IP in the range 192.168.2.2 .. 192.168.2.255, use gateway 192.168.2.1");
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ fn main() -> ! {
|
|||||||
b"HTTP/1.0 200 OK\r\n\r\n\
|
b"HTTP/1.0 200 OK\r\n\r\n\
|
||||||
<html>\
|
<html>\
|
||||||
<body>\
|
<body>\
|
||||||
<h1>Hello Rust! Hello esp-wifi!</h1>\
|
<h1>Hello Rust! Hello esp-radio!</h1>\
|
||||||
</body>\
|
</body>\
|
||||||
</html>\r\n\
|
</html>\r\n\
|
||||||
",
|
",
|
||||||
@ -200,7 +200,7 @@ fn timestamp() -> smoltcp::time::Instant {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_interface(device: &mut esp_wifi::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
pub fn create_interface(device: &mut esp_radio::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
||||||
// users could create multiple instances but since they only have one WifiDevice
|
// users could create multiple instances but since they only have one WifiDevice
|
||||||
// they probably can't do anything bad with that
|
// they probably can't do anything bad with that
|
||||||
smoltcp::iface::Interface::new(
|
smoltcp::iface::Interface::new(
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
//! Set SSID and PASSWORD env variable before running this example.
|
//! Set SSID and PASSWORD env variable before running this example.
|
||||||
//!
|
//!
|
||||||
//! Gets an ip address via DHCP, creates an open access-point with SSID
|
//! Gets an ip address via DHCP, creates an open access-point with SSID
|
||||||
//! `esp-wifi` You can connect to it using a static IP in range 192.168.2.2 ..
|
//! `esp-radio` You can connect to it using a static IP in range 192.168.2.2 ..
|
||||||
//! 192.168.2.255, gateway 192.168.2.1 Open http://192.168.2.1:8080/ in your browser - the example will perform an HTTP get request to some "random" server
|
//! 192.168.2.255, gateway 192.168.2.1 Open http://192.168.2.1:8080/ in your browser - the example will perform an HTTP get request to some "random" server
|
||||||
//!
|
//!
|
||||||
//! On Android you might need to choose _Keep Accesspoint_ when it tells you the
|
//! On Android you might need to choose _Keep Accesspoint_ when it tells you the
|
||||||
//! WiFi has no internet connection, Chrome might not want to load the URL - you
|
//! WiFi has no internet connection, Chrome might not want to load the URL - you
|
||||||
//! can use a shell and try `curl` and `ping`
|
//! can use a shell and try `curl` and `ping`
|
||||||
|
|
||||||
//% FEATURES: esp-wifi esp-wifi/wifi esp-wifi/smoltcp esp-hal/unstable
|
//% FEATURES: esp-radio esp-radio/wifi esp-radio/smoltcp esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -30,7 +30,7 @@ use esp_hal::{
|
|||||||
timer::timg::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::{print, println};
|
use esp_println::{print, println};
|
||||||
use esp_wifi::wifi::{AccessPointConfiguration, ClientConfiguration, Configuration};
|
use esp_radio::wifi::{AccessPointConfiguration, ClientConfiguration, Configuration};
|
||||||
use smoltcp::{
|
use smoltcp::{
|
||||||
iface::{SocketSet, SocketStorage},
|
iface::{SocketSet, SocketStorage},
|
||||||
wire::IpAddress,
|
wire::IpAddress,
|
||||||
@ -52,10 +52,10 @@ fn main() -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
|
|
||||||
let (mut controller, interfaces) =
|
let (mut controller, interfaces) =
|
||||||
esp_wifi::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
let mut ap_device = interfaces.ap;
|
let mut ap_device = interfaces.ap;
|
||||||
let ap_interface = create_interface(&mut ap_device);
|
let ap_interface = create_interface(&mut ap_device);
|
||||||
@ -81,7 +81,7 @@ fn main() -> ! {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
AccessPointConfiguration {
|
AccessPointConfiguration {
|
||||||
ssid: "esp-wifi".into(),
|
ssid: "esp-radio".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -125,7 +125,7 @@ fn main() -> ! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"Start busy loop on main. Connect to the AP `esp-wifi` and point your browser to http://192.168.2.1:8080/"
|
"Start busy loop on main. Connect to the AP `esp-radio` and point your browser to http://192.168.2.1:8080/"
|
||||||
);
|
);
|
||||||
println!("Use a static IP in the range 192.168.2.2 .. 192.168.2.255, use gateway 192.168.2.1");
|
println!("Use a static IP in the range 192.168.2.2 .. 192.168.2.255, use gateway 192.168.2.1");
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ fn timestamp() -> smoltcp::time::Instant {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_interface(device: &mut esp_wifi::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
pub fn create_interface(device: &mut esp_radio::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
||||||
// users could create multiple instances but since they only have one WifiDevice
|
// users could create multiple instances but since they only have one WifiDevice
|
||||||
// they probably can't do anything bad with that
|
// they probably can't do anything bad with that
|
||||||
smoltcp::iface::Interface::new(
|
smoltcp::iface::Interface::new(
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
//! variable. E.g `HOST_IP="192.168.0.24"` and also set SSID and PASSWORD env
|
//! variable. E.g `HOST_IP="192.168.0.24"` and also set SSID and PASSWORD env
|
||||||
//! variable before running this example.
|
//! variable before running this example.
|
||||||
|
|
||||||
//% FEATURES: esp-wifi esp-wifi/wifi esp-wifi/smoltcp esp-hal/unstable
|
//% FEATURES: esp-radio esp-radio/wifi esp-radio/smoltcp esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -31,7 +31,7 @@ use esp_hal::{
|
|||||||
timer::timg::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::wifi::{ClientConfiguration, Configuration};
|
use esp_radio::wifi::{ClientConfiguration, Configuration};
|
||||||
use smoltcp::{
|
use smoltcp::{
|
||||||
iface::{SocketSet, SocketStorage},
|
iface::{SocketSet, SocketStorage},
|
||||||
wire::{DhcpOption, IpAddress},
|
wire::{DhcpOption, IpAddress},
|
||||||
@ -64,16 +64,16 @@ fn main() -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
|
|
||||||
let (mut controller, interfaces) =
|
let (mut controller, interfaces) =
|
||||||
esp_wifi::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
let mut device = interfaces.sta;
|
let mut device = interfaces.sta;
|
||||||
let iface = create_interface(&mut device);
|
let iface = create_interface(&mut device);
|
||||||
|
|
||||||
controller
|
controller
|
||||||
.set_power_saving(esp_wifi::config::PowerSaveMode::None)
|
.set_power_saving(esp_radio::config::PowerSaveMode::None)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut socket_set_entries: [SocketStorage; 3] = Default::default();
|
let mut socket_set_entries: [SocketStorage; 3] = Default::default();
|
||||||
@ -82,7 +82,7 @@ fn main() -> ! {
|
|||||||
// we can set a hostname here (or add other DHCP options)
|
// we can set a hostname here (or add other DHCP options)
|
||||||
dhcp_socket.set_outgoing_options(&[DhcpOption {
|
dhcp_socket.set_outgoing_options(&[DhcpOption {
|
||||||
kind: 12,
|
kind: 12,
|
||||||
data: b"esp-wifi",
|
data: b"esp-radio",
|
||||||
}]);
|
}]);
|
||||||
socket_set.add(dhcp_socket);
|
socket_set.add(dhcp_socket);
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ fn timestamp() -> smoltcp::time::Instant {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_interface(device: &mut esp_wifi::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
pub fn create_interface(device: &mut esp_radio::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
||||||
// users could create multiple instances but since they only have one WifiDevice
|
// users could create multiple instances but since they only have one WifiDevice
|
||||||
// they probably can't do anything bad with that
|
// they probably can't do anything bad with that
|
||||||
smoltcp::iface::Interface::new(
|
smoltcp::iface::Interface::new(
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
//! read/write/notify)
|
//! read/write/notify)
|
||||||
//! - pressing the boot-button on a dev-board will send a notification if it is subscribed
|
//! - pressing the boot-button on a dev-board will send a notification if it is subscribed
|
||||||
|
|
||||||
//% FEATURES: esp-wifi esp-wifi/ble esp-hal/unstable
|
//% FEATURES: esp-radio esp-radio/ble esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s3 esp32c2 esp32c3 esp32c6 esp32h2
|
//% CHIPS: esp32 esp32s3 esp32c2 esp32c3 esp32c6 esp32h2
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -33,7 +33,7 @@ use esp_hal::{
|
|||||||
timer::timg::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::ble::controller::BleConnector;
|
use esp_radio::ble::controller::BleConnector;
|
||||||
|
|
||||||
esp_bootloader_esp_idf::esp_app_desc!();
|
esp_bootloader_esp_idf::esp_app_desc!();
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ fn main() -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
|
|
||||||
let config = InputConfig::default().with_pull(Pull::Down);
|
let config = InputConfig::default().with_pull(Pull::Down);
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
//! Note: On ESP32-C2 and ESP32-C3 you need a wifi-heap size of 70000, on
|
//! Note: On ESP32-C2 and ESP32-C3 you need a wifi-heap size of 70000, on
|
||||||
//! ESP32-C6 you need 80000 and a tx_queue_size of 10
|
//! ESP32-C6 you need 80000 and a tx_queue_size of 10
|
||||||
|
|
||||||
//% FEATURES: esp-wifi esp-wifi/wifi esp-wifi/smoltcp esp-wifi/ble esp-wifi/coex esp-hal/unstable
|
|
||||||
//% CHIPS: esp32 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
//% FEATURES: esp-radio esp-radio/wifi esp-radio/smoltcp esp-radio/ble esp-radio/coex
|
||||||
|
//% FEATURES: esp-hal/unstable
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
@ -39,7 +40,7 @@ use esp_hal::{
|
|||||||
timer::timg::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::{print, println};
|
use esp_println::{print, println};
|
||||||
use esp_wifi::{
|
use esp_radio::{
|
||||||
ble::controller::BleConnector,
|
ble::controller::BleConnector,
|
||||||
wifi::{ClientConfiguration, Configuration},
|
wifi::{ClientConfiguration, Configuration},
|
||||||
};
|
};
|
||||||
@ -74,7 +75,7 @@ fn main() -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
|
|
||||||
let now = || time::Instant::now().duration_since_epoch().as_millis();
|
let now = || time::Instant::now().duration_since_epoch().as_millis();
|
||||||
|
|
||||||
@ -102,13 +103,13 @@ fn main() -> ! {
|
|||||||
println!("started advertising");
|
println!("started advertising");
|
||||||
|
|
||||||
let (mut controller, interfaces) =
|
let (mut controller, interfaces) =
|
||||||
esp_wifi::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
let mut device = interfaces.sta;
|
let mut device = interfaces.sta;
|
||||||
let iface = create_interface(&mut device);
|
let iface = create_interface(&mut device);
|
||||||
|
|
||||||
controller
|
controller
|
||||||
.set_power_saving(esp_wifi::config::PowerSaveMode::None)
|
.set_power_saving(esp_radio::config::PowerSaveMode::None)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut socket_set_entries: [SocketStorage; 3] = Default::default();
|
let mut socket_set_entries: [SocketStorage; 3] = Default::default();
|
||||||
@ -117,7 +118,7 @@ fn main() -> ! {
|
|||||||
// we can set a hostname here (or add other DHCP options)
|
// we can set a hostname here (or add other DHCP options)
|
||||||
dhcp_socket.set_outgoing_options(&[DhcpOption {
|
dhcp_socket.set_outgoing_options(&[DhcpOption {
|
||||||
kind: 12,
|
kind: 12,
|
||||||
data: b"esp-wifi",
|
data: b"esp-radio",
|
||||||
}]);
|
}]);
|
||||||
socket_set.add(dhcp_socket);
|
socket_set.add(dhcp_socket);
|
||||||
|
|
||||||
@ -212,7 +213,7 @@ fn timestamp() -> smoltcp::time::Instant {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_interface(device: &mut esp_wifi::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
pub fn create_interface(device: &mut esp_radio::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
||||||
// users could create multiple instances but since they only have one WifiDevice
|
// users could create multiple instances but since they only have one WifiDevice
|
||||||
// they probably can't do anything bad with that
|
// they probably can't do anything bad with that
|
||||||
smoltcp::iface::Interface::new(
|
smoltcp::iface::Interface::new(
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
//!
|
//!
|
||||||
//! Set SSID and PASSWORD env variable before running this example.
|
//! Set SSID and PASSWORD env variable before running this example.
|
||||||
|
|
||||||
//% FEATURES: esp-wifi esp-wifi/wifi esp-wifi/smoltcp esp-wifi/log-04 esp-wifi/csi esp-hal/unstable
|
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
//% FEATURES: esp-radio esp-radio/wifi esp-radio/smoltcp esp-radio/log-04 esp-radio/csi
|
||||||
|
//% FEATURES: esp-hal/unstable
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
@ -16,7 +17,7 @@ use esp_alloc as _;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{clock::CpuClock, main, rng::Rng, time, timer::timg::TimerGroup};
|
use esp_hal::{clock::CpuClock, main, rng::Rng, time, timer::timg::TimerGroup};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::wifi::{ClientConfiguration, Configuration, CsiConfig};
|
use esp_radio::wifi::{ClientConfiguration, Configuration, CsiConfig};
|
||||||
use smoltcp::{
|
use smoltcp::{
|
||||||
iface::{SocketSet, SocketStorage},
|
iface::{SocketSet, SocketStorage},
|
||||||
wire::DhcpOption,
|
wire::DhcpOption,
|
||||||
@ -38,10 +39,10 @@ fn main() -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
|
|
||||||
let (mut controller, interfaces) =
|
let (mut controller, interfaces) =
|
||||||
esp_wifi::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
let mut device = interfaces.sta;
|
let mut device = interfaces.sta;
|
||||||
let iface = create_interface(&mut device);
|
let iface = create_interface(&mut device);
|
||||||
@ -52,7 +53,7 @@ fn main() -> ! {
|
|||||||
// we can set a hostname here (or add other DHCP options)
|
// we can set a hostname here (or add other DHCP options)
|
||||||
dhcp_socket.set_outgoing_options(&[DhcpOption {
|
dhcp_socket.set_outgoing_options(&[DhcpOption {
|
||||||
kind: 12,
|
kind: 12,
|
||||||
data: b"esp-wifi",
|
data: b"esp-radio",
|
||||||
}]);
|
}]);
|
||||||
socket_set.add(dhcp_socket);
|
socket_set.add(dhcp_socket);
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ fn main() -> ! {
|
|||||||
|
|
||||||
let csi = CsiConfig::default();
|
let csi = CsiConfig::default();
|
||||||
controller
|
controller
|
||||||
.set_csi(csi, |data: esp_wifi::wifi::wifi_csi_info_t| {
|
.set_csi(csi, |data: esp_radio::wifi::wifi_csi_info_t| {
|
||||||
let rx_ctrl = data.rx_ctrl;
|
let rx_ctrl = data.rx_ctrl;
|
||||||
// Signed bitfields are broken in rust-bingen, see https://github.com/esp-rs/esp-wifi-sys/issues/482
|
// Signed bitfields are broken in rust-bingen, see https://github.com/esp-rs/esp-wifi-sys/issues/482
|
||||||
let rssi = if rx_ctrl.rssi() > 127 {
|
let rssi = if rx_ctrl.rssi() > 127 {
|
||||||
@ -133,7 +134,7 @@ fn timestamp() -> smoltcp::time::Instant {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_interface(device: &mut esp_wifi::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
pub fn create_interface(device: &mut esp_radio::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
||||||
// users could create multiple instances but since they only have one WifiDevice
|
// users could create multiple instances but since they only have one WifiDevice
|
||||||
// they probably can't do anything bad with that
|
// they probably can't do anything bad with that
|
||||||
smoltcp::iface::Interface::new(
|
smoltcp::iface::Interface::new(
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
//! This gets an ip address via DHCP then performs an HTTP get request to some
|
//! This gets an ip address via DHCP then performs an HTTP get request to some
|
||||||
//! "random" server
|
//! "random" server
|
||||||
|
|
||||||
//% FEATURES: esp-wifi esp-wifi/wifi esp-hal/unstable esp-wifi/smoltcp
|
//% FEATURES: esp-radio esp-radio/wifi esp-hal/unstable esp-radio/smoltcp
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
// esp-wifi/utils
|
// esp-radio/utils
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
@ -29,7 +29,7 @@ use esp_hal::{
|
|||||||
timer::timg::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::{print, println};
|
use esp_println::{print, println};
|
||||||
use esp_wifi::wifi::{ClientConfiguration, Configuration};
|
use esp_radio::wifi::{ClientConfiguration, Configuration};
|
||||||
use smoltcp::{
|
use smoltcp::{
|
||||||
iface::{SocketSet, SocketStorage},
|
iface::{SocketSet, SocketStorage},
|
||||||
wire::{DhcpOption, IpAddress},
|
wire::{DhcpOption, IpAddress},
|
||||||
@ -51,10 +51,10 @@ fn main() -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
|
|
||||||
let (mut controller, interfaces) =
|
let (mut controller, interfaces) =
|
||||||
esp_wifi::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
let mut device = interfaces.sta;
|
let mut device = interfaces.sta;
|
||||||
let iface = create_interface(&mut device);
|
let iface = create_interface(&mut device);
|
||||||
@ -65,7 +65,7 @@ fn main() -> ! {
|
|||||||
// we can set a hostname here (or add other DHCP options)
|
// we can set a hostname here (or add other DHCP options)
|
||||||
dhcp_socket.set_outgoing_options(&[DhcpOption {
|
dhcp_socket.set_outgoing_options(&[DhcpOption {
|
||||||
kind: 12,
|
kind: 12,
|
||||||
data: b"esp-wifi",
|
data: b"esp-radio",
|
||||||
}]);
|
}]);
|
||||||
socket_set.add(dhcp_socket);
|
socket_set.add(dhcp_socket);
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ fn main() -> ! {
|
|||||||
let stack = Stack::new(iface, device, socket_set, now, rng.random());
|
let stack = Stack::new(iface, device, socket_set, now, rng.random());
|
||||||
|
|
||||||
controller
|
controller
|
||||||
.set_power_saving(esp_wifi::config::PowerSaveMode::None)
|
.set_power_saving(esp_radio::config::PowerSaveMode::None)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let client_config = Configuration::Client(ClientConfiguration {
|
let client_config = Configuration::Client(ClientConfiguration {
|
||||||
@ -172,7 +172,7 @@ fn timestamp() -> smoltcp::time::Instant {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_interface(device: &mut esp_wifi::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
pub fn create_interface(device: &mut esp_radio::wifi::WifiDevice) -> smoltcp::iface::Interface {
|
||||||
// users could create multiple instances but since they only have one WifiDevice
|
// users could create multiple instances but since they only have one WifiDevice
|
||||||
// they probably can't do anything bad with that
|
// they probably can't do anything bad with that
|
||||||
smoltcp::iface::Interface::new(
|
smoltcp::iface::Interface::new(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! Embassy access point
|
//! Embassy access point
|
||||||
//!
|
//!
|
||||||
//! - creates an open access-point with SSID `esp-wifi`
|
//! - creates an open access-point with SSID `esp-radio`
|
||||||
//! - you can connect to it using a static IP in range 192.168.2.2 .. 192.168.2.255, gateway
|
//! - you can connect to it using a static IP in range 192.168.2.2 .. 192.168.2.255, gateway
|
||||||
//! 192.168.2.1
|
//! 192.168.2.1
|
||||||
//! - open http://192.168.2.1:8080/ in your browser - the example will perform an HTTP get request
|
//! - open http://192.168.2.1:8080/ in your browser - the example will perform an HTTP get request
|
||||||
@ -10,7 +10,7 @@
|
|||||||
//! WiFi has no internet connection, Chrome might not want to load the URL - you
|
//! WiFi has no internet connection, Chrome might not want to load the URL - you
|
||||||
//! can use a shell and try `curl` and `ping`
|
//! can use a shell and try `curl` and `ping`
|
||||||
|
|
||||||
//% FEATURES: embassy esp-wifi esp-wifi/wifi esp-hal/unstable
|
//% FEATURES: embassy esp-radio esp-radio/wifi esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -33,8 +33,8 @@ use esp_alloc as _;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{clock::CpuClock, rng::Rng, timer::timg::TimerGroup};
|
use esp_hal::{clock::CpuClock, rng::Rng, timer::timg::TimerGroup};
|
||||||
use esp_println::{print, println};
|
use esp_println::{print, println};
|
||||||
use esp_wifi::{
|
use esp_radio::{
|
||||||
EspWifiController,
|
EspRadioController,
|
||||||
wifi::{
|
wifi::{
|
||||||
AccessPointConfiguration,
|
AccessPointConfiguration,
|
||||||
Configuration,
|
Configuration,
|
||||||
@ -70,9 +70,9 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = &*mk_static!(EspWifiController<'static>, esp_wifi::init().unwrap());
|
let esp_wifi_ctrl = &*mk_static!(EspRadioController<'static>, esp_radio::init().unwrap());
|
||||||
|
|
||||||
let (controller, interfaces) = esp_wifi::wifi::new(esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
let (controller, interfaces) = esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
let device = interfaces.ap;
|
let device = interfaces.ap;
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
Timer::after(Duration::from_millis(500)).await;
|
Timer::after(Duration::from_millis(500)).await;
|
||||||
}
|
}
|
||||||
println!(
|
println!(
|
||||||
"Connect to the AP `esp-wifi` and point your browser to http://{gw_ip_addr_str}:8080/"
|
"Connect to the AP `esp-radio` and point your browser to http://{gw_ip_addr_str}:8080/"
|
||||||
);
|
);
|
||||||
println!("DHCP is enabled so there's no need to configure a static IP, just in case:");
|
println!("DHCP is enabled so there's no need to configure a static IP, just in case:");
|
||||||
while !stack.is_config_up() {
|
while !stack.is_config_up() {
|
||||||
@ -182,7 +182,7 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
b"HTTP/1.0 200 OK\r\n\r\n\
|
b"HTTP/1.0 200 OK\r\n\r\n\
|
||||||
<html>\
|
<html>\
|
||||||
<body>\
|
<body>\
|
||||||
<h1>Hello Rust! Hello esp-wifi!</h1>\
|
<h1>Hello Rust! Hello esp-radio!</h1>\
|
||||||
</body>\
|
</body>\
|
||||||
</html>\r\n\
|
</html>\r\n\
|
||||||
",
|
",
|
||||||
@ -250,7 +250,7 @@ async fn connection(mut controller: WifiController<'static>) {
|
|||||||
println!("start connection task");
|
println!("start connection task");
|
||||||
println!("Device capabilities: {:?}", controller.capabilities());
|
println!("Device capabilities: {:?}", controller.capabilities());
|
||||||
loop {
|
loop {
|
||||||
match esp_wifi::wifi::wifi_state() {
|
match esp_radio::wifi::wifi_state() {
|
||||||
WifiState::ApStarted => {
|
WifiState::ApStarted => {
|
||||||
// wait until we're no longer connected
|
// wait until we're no longer connected
|
||||||
controller.wait_for_event(WifiEvent::ApStop).await;
|
controller.wait_for_event(WifiEvent::ApStop).await;
|
||||||
@ -260,7 +260,7 @@ async fn connection(mut controller: WifiController<'static>) {
|
|||||||
}
|
}
|
||||||
if !matches!(controller.is_started(), Ok(true)) {
|
if !matches!(controller.is_started(), Ok(true)) {
|
||||||
let client_config = Configuration::AccessPoint(AccessPointConfiguration {
|
let client_config = Configuration::AccessPoint(AccessPointConfiguration {
|
||||||
ssid: "esp-wifi".try_into().unwrap(),
|
ssid: "esp-radio".try_into().unwrap(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
controller.set_configuration(&client_config).unwrap();
|
controller.set_configuration(&client_config).unwrap();
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
//! Set SSID and PASSWORD env variable before running the example.
|
//! Set SSID and PASSWORD env variable before running the example.
|
||||||
//!
|
//!
|
||||||
//! - gets an ip address via DHCP
|
//! - gets an ip address via DHCP
|
||||||
//! - creates an open access-point with SSID `esp-wifi`
|
//! - creates an open access-point with SSID `esp-radio`
|
||||||
//! - if you either:
|
//! - if you either:
|
||||||
//! - connect to it using a static IP in range 192.168.2.2 .. 192.168.2.255, gateway 192.168.2.1
|
//! - connect to it using a static IP in range 192.168.2.2 .. 192.168.2.255, gateway 192.168.2.1
|
||||||
//! - open http://192.168.2.1:8080/ in your browser
|
//! - open http://192.168.2.1:8080/ in your browser
|
||||||
@ -16,7 +16,7 @@
|
|||||||
//! WiFi has no internet connection, Chrome might not want to load the URL - you
|
//! WiFi has no internet connection, Chrome might not want to load the URL - you
|
||||||
//! can use a shell and try `curl` and `ping`
|
//! can use a shell and try `curl` and `ping`
|
||||||
|
|
||||||
//% FEATURES: embassy esp-wifi esp-wifi/wifi esp-hal/unstable
|
//% FEATURES: embassy esp-radio esp-radio/wifi esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -39,8 +39,8 @@ use esp_alloc as _;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{clock::CpuClock, rng::Rng, timer::timg::TimerGroup};
|
use esp_hal::{clock::CpuClock, rng::Rng, timer::timg::TimerGroup};
|
||||||
use esp_println::{print, println};
|
use esp_println::{print, println};
|
||||||
use esp_wifi::{
|
use esp_radio::{
|
||||||
EspWifiController,
|
EspRadioController,
|
||||||
wifi::{
|
wifi::{
|
||||||
AccessPointConfiguration,
|
AccessPointConfiguration,
|
||||||
ClientConfiguration,
|
ClientConfiguration,
|
||||||
@ -78,10 +78,10 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = &*mk_static!(EspWifiController<'static>, esp_wifi::init().unwrap());
|
let esp_wifi_ctrl = &*mk_static!(EspRadioController<'static>, esp_radio::init().unwrap());
|
||||||
|
|
||||||
let (mut controller, interfaces) =
|
let (mut controller, interfaces) =
|
||||||
esp_wifi::wifi::new(esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
let wifi_ap_device = interfaces.ap;
|
let wifi_ap_device = interfaces.ap;
|
||||||
let wifi_sta_device = interfaces.sta;
|
let wifi_sta_device = interfaces.sta;
|
||||||
@ -128,7 +128,7 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
AccessPointConfiguration {
|
AccessPointConfiguration {
|
||||||
ssid: "esp-wifi".into(),
|
ssid: "esp-radio".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -153,7 +153,7 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
}
|
}
|
||||||
Timer::after(Duration::from_millis(500)).await;
|
Timer::after(Duration::from_millis(500)).await;
|
||||||
}
|
}
|
||||||
println!("Connect to the AP `esp-wifi` and point your browser to http://192.168.2.1:8080/");
|
println!("Connect to the AP `esp-radio` and point your browser to http://192.168.2.1:8080/");
|
||||||
println!("Use a static IP in the range 192.168.2.2 .. 192.168.2.255, use gateway 192.168.2.1");
|
println!("Use a static IP in the range 192.168.2.2 .. 192.168.2.255, use gateway 192.168.2.1");
|
||||||
println!("Or connect to the ap `{SSID}` and point your browser to http://{sta_address}:8080/");
|
println!("Or connect to the ap `{SSID}` and point your browser to http://{sta_address}:8080/");
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
b"HTTP/1.0 500 Internal Server Error\r\n\r\n\
|
b"HTTP/1.0 500 Internal Server Error\r\n\r\n\
|
||||||
<html>\
|
<html>\
|
||||||
<body>\
|
<body>\
|
||||||
<h1>Hello Rust! Hello esp-wifi! STA failed to send request.</h1>\
|
<h1>Hello Rust! Hello esp-radio! STA failed to send request.</h1>\
|
||||||
</body>\
|
</body>\
|
||||||
</html>\r\n\
|
</html>\r\n\
|
||||||
",
|
",
|
||||||
@ -304,7 +304,7 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
b"HTTP/1.0 200 OK\r\n\r\n\
|
b"HTTP/1.0 200 OK\r\n\r\n\
|
||||||
<html>\
|
<html>\
|
||||||
<body>\
|
<body>\
|
||||||
<h1>Hello Rust! Hello esp-wifi! STA is not connected.</h1>\
|
<h1>Hello Rust! Hello esp-radio! STA is not connected.</h1>\
|
||||||
</body>\
|
</body>\
|
||||||
</html>\r\n\
|
</html>\r\n\
|
||||||
",
|
",
|
||||||
@ -335,7 +335,7 @@ async fn connection(mut controller: WifiController<'static>) {
|
|||||||
println!("Wifi started!");
|
println!("Wifi started!");
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match esp_wifi::wifi::ap_state() {
|
match esp_radio::wifi::ap_state() {
|
||||||
WifiState::ApStarted => {
|
WifiState::ApStarted => {
|
||||||
println!("About to connect...");
|
println!("About to connect...");
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
//! Because of the huge task-arena size configured this won't work on ESP32-S2
|
//! Because of the huge task-arena size configured this won't work on ESP32-S2
|
||||||
//! and ESP32-C2
|
//! and ESP32-C2
|
||||||
|
|
||||||
//% FEATURES: embassy esp-wifi esp-wifi/wifi esp-hal/unstable
|
//% FEATURES: embassy esp-radio esp-radio/wifi esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c3 esp32c6
|
||||||
|
|
||||||
#![allow(static_mut_refs)]
|
#![allow(static_mut_refs)]
|
||||||
@ -30,8 +30,8 @@ use esp_alloc as _;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{clock::CpuClock, rng::Rng, timer::timg::TimerGroup};
|
use esp_hal::{clock::CpuClock, rng::Rng, timer::timg::TimerGroup};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::{
|
use esp_radio::{
|
||||||
EspWifiController,
|
EspRadioController,
|
||||||
wifi::{ClientConfiguration, Configuration, WifiController, WifiDevice, WifiEvent, WifiState},
|
wifi::{ClientConfiguration, Configuration, WifiController, WifiDevice, WifiEvent, WifiState},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -78,15 +78,15 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = &*mk_static!(EspWifiController<'static>, esp_wifi::init().unwrap());
|
let esp_wifi_ctrl = &*mk_static!(EspRadioController<'static>, esp_radio::init().unwrap());
|
||||||
|
|
||||||
let (mut controller, interfaces) =
|
let (mut controller, interfaces) =
|
||||||
esp_wifi::wifi::new(esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
let wifi_interface = interfaces.sta;
|
let wifi_interface = interfaces.sta;
|
||||||
|
|
||||||
controller
|
controller
|
||||||
.set_power_saving(esp_wifi::config::PowerSaveMode::None)
|
.set_power_saving(esp_radio::config::PowerSaveMode::None)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
@ -152,7 +152,7 @@ async fn connection(mut controller: WifiController<'static>) {
|
|||||||
println!("start connection task");
|
println!("start connection task");
|
||||||
println!("Device capabilities: {:?}", controller.capabilities());
|
println!("Device capabilities: {:?}", controller.capabilities());
|
||||||
loop {
|
loop {
|
||||||
match esp_wifi::wifi::wifi_state() {
|
match esp_radio::wifi::wifi_state() {
|
||||||
WifiState::StaConnected => {
|
WifiState::StaConnected => {
|
||||||
// wait until we're no longer connected
|
// wait until we're no longer connected
|
||||||
controller.wait_for_event(WifiEvent::StaDisconnected).await;
|
controller.wait_for_event(WifiEvent::StaDisconnected).await;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
//! read/write/notify)
|
//! read/write/notify)
|
||||||
//! - pressing the boot-button on a dev-board will send a notification if it is subscribed
|
//! - pressing the boot-button on a dev-board will send a notification if it is subscribed
|
||||||
|
|
||||||
//% FEATURES: embassy esp-wifi esp-wifi/ble esp-hal/unstable
|
//% FEATURES: embassy esp-radio esp-radio/ble esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s3 esp32c2 esp32c3 esp32c6 esp32h2
|
//% CHIPS: esp32 esp32s3 esp32c2 esp32c3 esp32c6 esp32h2
|
||||||
|
|
||||||
// Embassy offers another compatible BLE crate [trouble](https://github.com/embassy-rs/trouble/tree/main/examples/esp32) with esp32 examples.
|
// Embassy offers another compatible BLE crate [trouble](https://github.com/embassy-rs/trouble/tree/main/examples/esp32) with esp32 examples.
|
||||||
@ -37,7 +37,7 @@ use esp_hal::{
|
|||||||
timer::timg::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::{EspWifiController, ble::controller::BleConnector};
|
use esp_radio::{EspRadioController, ble::controller::BleConnector};
|
||||||
|
|
||||||
esp_bootloader_esp_idf::esp_app_desc!();
|
esp_bootloader_esp_idf::esp_app_desc!();
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ async fn main(_spawner: Spawner) -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = &*mk_static!(EspWifiController<'static>, esp_wifi::init().unwrap());
|
let esp_wifi_ctrl = &*mk_static!(EspRadioController<'static>, esp_radio::init().unwrap());
|
||||||
|
|
||||||
let config = InputConfig::default().with_pull(Pull::Down);
|
let config = InputConfig::default().with_pull(Pull::Down);
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Because of the huge task-arena size configured this won't work on ESP32-S2
|
//! Because of the huge task-arena size configured this won't work on ESP32-S2
|
||||||
|
|
||||||
//% FEATURES: embassy esp-wifi esp-wifi/wifi esp-hal/unstable
|
//% FEATURES: embassy esp-radio esp-radio/wifi esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -23,8 +23,8 @@ use esp_alloc as _;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{clock::CpuClock, rng::Rng, timer::timg::TimerGroup};
|
use esp_hal::{clock::CpuClock, rng::Rng, timer::timg::TimerGroup};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::{
|
use esp_radio::{
|
||||||
EspWifiController,
|
EspRadioController,
|
||||||
wifi::{ClientConfiguration, Configuration, WifiController, WifiDevice, WifiEvent, WifiState},
|
wifi::{ClientConfiguration, Configuration, WifiController, WifiDevice, WifiEvent, WifiState},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -54,9 +54,9 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = &*mk_static!(EspWifiController<'static>, esp_wifi::init().unwrap());
|
let esp_wifi_ctrl = &*mk_static!(EspRadioController<'static>, esp_radio::init().unwrap());
|
||||||
|
|
||||||
let (controller, interfaces) = esp_wifi::wifi::new(esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
let (controller, interfaces) = esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
let wifi_interface = interfaces.sta;
|
let wifi_interface = interfaces.sta;
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ async fn connection(mut controller: WifiController<'static>) {
|
|||||||
println!("start connection task");
|
println!("start connection task");
|
||||||
println!("Device capabilities: {:?}", controller.capabilities());
|
println!("Device capabilities: {:?}", controller.capabilities());
|
||||||
loop {
|
loop {
|
||||||
match esp_wifi::wifi::wifi_state() {
|
match esp_radio::wifi::wifi_state() {
|
||||||
WifiState::StaConnected => {
|
WifiState::StaConnected => {
|
||||||
// wait until we're no longer connected
|
// wait until we're no longer connected
|
||||||
controller.wait_for_event(WifiEvent::StaDisconnected).await;
|
controller.wait_for_event(WifiEvent::StaDisconnected).await;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Because of the huge task-arena size configured this won't work on ESP32-S2
|
//! Because of the huge task-arena size configured this won't work on ESP32-S2
|
||||||
|
|
||||||
//% FEATURES: embassy esp-wifi esp-wifi/esp-now esp-hal/unstable
|
//% FEATURES: embassy esp-radio esp-radio/esp-now esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -17,8 +17,8 @@ use esp_alloc as _;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{clock::CpuClock, timer::timg::TimerGroup};
|
use esp_hal::{clock::CpuClock, timer::timg::TimerGroup};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::{
|
use esp_radio::{
|
||||||
EspWifiController,
|
EspRadioController,
|
||||||
esp_now::{BROADCAST_ADDRESS, PeerInfo},
|
esp_now::{BROADCAST_ADDRESS, PeerInfo},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,11 +45,11 @@ async fn main(_spawner: Spawner) -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = &*mk_static!(EspWifiController<'static>, esp_wifi::init().unwrap());
|
let esp_wifi_ctrl = &*mk_static!(EspRadioController<'static>, esp_radio::init().unwrap());
|
||||||
|
|
||||||
let wifi = peripherals.WIFI;
|
let wifi = peripherals.WIFI;
|
||||||
let (mut controller, interfaces) = esp_wifi::wifi::new(esp_wifi_ctrl, wifi).unwrap();
|
let (mut controller, interfaces) = esp_radio::wifi::new(&esp_wifi_ctrl, wifi).unwrap();
|
||||||
controller.set_mode(esp_wifi::wifi::WifiMode::Sta).unwrap();
|
controller.set_mode(esp_radio::wifi::WifiMode::Sta).unwrap();
|
||||||
controller.start().unwrap();
|
controller.start().unwrap();
|
||||||
|
|
||||||
let mut esp_now = interfaces.esp_now;
|
let mut esp_now = interfaces.esp_now;
|
||||||
@ -77,7 +77,7 @@ async fn main(_spawner: Spawner) -> ! {
|
|||||||
if !esp_now.peer_exists(&r.info.src_address) {
|
if !esp_now.peer_exists(&r.info.src_address) {
|
||||||
esp_now
|
esp_now
|
||||||
.add_peer(PeerInfo {
|
.add_peer(PeerInfo {
|
||||||
interface: esp_wifi::esp_now::EspNowWifiInterface::Sta,
|
interface: esp_radio::esp_now::EspNowWifiInterface::Sta,
|
||||||
peer_address: r.info.src_address,
|
peer_address: r.info.src_address,
|
||||||
lmk: None,
|
lmk: None,
|
||||||
channel: None,
|
channel: None,
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Because of the huge task-arena size configured this won't work on ESP32-S2
|
//! Because of the huge task-arena size configured this won't work on ESP32-S2
|
||||||
|
|
||||||
//% FEATURES: embassy esp-wifi esp-wifi/esp-now esp-hal/unstable
|
//% FEATURES: embassy esp-radio esp-radio/esp-now esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -18,8 +18,8 @@ use esp_alloc as _;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{clock::CpuClock, timer::timg::TimerGroup};
|
use esp_hal::{clock::CpuClock, timer::timg::TimerGroup};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::{
|
use esp_radio::{
|
||||||
EspWifiController,
|
EspRadioController,
|
||||||
esp_now::{BROADCAST_ADDRESS, EspNowManager, EspNowReceiver, EspNowSender, PeerInfo},
|
esp_now::{BROADCAST_ADDRESS, EspNowManager, EspNowReceiver, EspNowSender, PeerInfo},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -46,11 +46,11 @@ async fn main(spawner: Spawner) -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = &*mk_static!(EspWifiController<'static>, esp_wifi::init().unwrap());
|
let esp_wifi_ctrl = &*mk_static!(EspRadioController<'static>, esp_radio::init().unwrap());
|
||||||
|
|
||||||
let wifi = peripherals.WIFI;
|
let wifi = peripherals.WIFI;
|
||||||
let (mut controller, interfaces) = esp_wifi::wifi::new(esp_wifi_ctrl, wifi).unwrap();
|
let (mut controller, interfaces) = esp_radio::wifi::new(&esp_wifi_ctrl, wifi).unwrap();
|
||||||
controller.set_mode(esp_wifi::wifi::WifiMode::Sta).unwrap();
|
controller.set_mode(esp_radio::wifi::WifiMode::Sta).unwrap();
|
||||||
controller.start().unwrap();
|
controller.start().unwrap();
|
||||||
|
|
||||||
let esp_now = interfaces.esp_now;
|
let esp_now = interfaces.esp_now;
|
||||||
@ -122,7 +122,7 @@ async fn listener(manager: &'static EspNowManager<'static>, mut receiver: EspNow
|
|||||||
if !manager.peer_exists(&r.info.src_address) {
|
if !manager.peer_exists(&r.info.src_address) {
|
||||||
manager
|
manager
|
||||||
.add_peer(PeerInfo {
|
.add_peer(PeerInfo {
|
||||||
interface: esp_wifi::esp_now::EspNowWifiInterface::Sta,
|
interface: esp_radio::esp_now::EspNowWifiInterface::Sta,
|
||||||
peer_address: r.info.src_address,
|
peer_address: r.info.src_address,
|
||||||
lmk: None,
|
lmk: None,
|
||||||
channel: None,
|
channel: None,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Broadcasts, receives and sends messages via esp-now
|
//! Broadcasts, receives and sends messages via esp-now
|
||||||
|
|
||||||
//% FEATURES: esp-wifi esp-wifi/wifi esp-wifi/esp-now esp-hal/unstable
|
//% FEATURES: esp-radio esp-radio/wifi esp-radio/esp-now esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -17,7 +17,7 @@ use esp_hal::{
|
|||||||
timer::timg::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::esp_now::{BROADCAST_ADDRESS, PeerInfo};
|
use esp_radio::esp_now::{BROADCAST_ADDRESS, PeerInfo};
|
||||||
|
|
||||||
esp_bootloader_esp_idf::esp_app_desc!();
|
esp_bootloader_esp_idf::esp_app_desc!();
|
||||||
|
|
||||||
@ -32,11 +32,11 @@ fn main() -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
|
|
||||||
let wifi = peripherals.WIFI;
|
let wifi = peripherals.WIFI;
|
||||||
let (mut controller, interfaces) = esp_wifi::wifi::new(&esp_wifi_ctrl, wifi).unwrap();
|
let (mut controller, interfaces) = esp_radio::wifi::new(&esp_wifi_ctrl, wifi).unwrap();
|
||||||
controller.set_mode(esp_wifi::wifi::WifiMode::Sta).unwrap();
|
controller.set_mode(esp_radio::wifi::WifiMode::Sta).unwrap();
|
||||||
controller.start().unwrap();
|
controller.start().unwrap();
|
||||||
|
|
||||||
let mut esp_now = interfaces.esp_now;
|
let mut esp_now = interfaces.esp_now;
|
||||||
@ -55,7 +55,7 @@ fn main() -> ! {
|
|||||||
if !esp_now.peer_exists(&r.info.src_address) {
|
if !esp_now.peer_exists(&r.info.src_address) {
|
||||||
esp_now
|
esp_now
|
||||||
.add_peer(PeerInfo {
|
.add_peer(PeerInfo {
|
||||||
interface: esp_wifi::esp_now::EspNowWifiInterface::Sta,
|
interface: esp_radio::esp_now::EspNowWifiInterface::Sta,
|
||||||
peer_address: r.info.src_address,
|
peer_address: r.info.src_address,
|
||||||
lmk: None,
|
lmk: None,
|
||||||
channel: None,
|
channel: None,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Sniffs for beacon frames.
|
//! Sniffs for beacon frames.
|
||||||
|
|
||||||
//% FEATURES: esp-wifi esp-wifi/wifi esp-wifi/sniffer esp-hal/unstable
|
//% FEATURES: esp-radio esp-radio/wifi esp-radio/sniffer esp-hal/unstable
|
||||||
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
//% CHIPS: esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -20,7 +20,7 @@ use critical_section::Mutex;
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{clock::CpuClock, main, timer::timg::TimerGroup};
|
use esp_hal::{clock::CpuClock, main, timer::timg::TimerGroup};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
use esp_wifi::wifi;
|
use esp_radio::wifi;
|
||||||
use ieee80211::{match_frames, mgmt_frame::BeaconFrame};
|
use ieee80211::{match_frames, mgmt_frame::BeaconFrame};
|
||||||
|
|
||||||
esp_bootloader_esp_idf::esp_app_desc!();
|
esp_bootloader_esp_idf::esp_app_desc!();
|
||||||
@ -38,11 +38,11 @@ fn main() -> ! {
|
|||||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
esp_radio_preempt_baremetal::init(timg0.timer0);
|
esp_radio_preempt_baremetal::init(timg0.timer0);
|
||||||
|
|
||||||
let esp_wifi_ctrl = esp_wifi::init().unwrap();
|
let esp_wifi_ctrl = esp_radio::init().unwrap();
|
||||||
|
|
||||||
// We must initialize some kind of interface and start it.
|
// We must initialize some kind of interface and start it.
|
||||||
let (mut controller, interfaces) =
|
let (mut controller, interfaces) =
|
||||||
esp_wifi::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
esp_radio::wifi::new(&esp_wifi_ctrl, peripherals.WIFI).unwrap();
|
||||||
|
|
||||||
controller.set_mode(wifi::WifiMode::Sta).unwrap();
|
controller.set_mode(wifi::WifiMode::Sta).unwrap();
|
||||||
controller.start().unwrap();
|
controller.start().unwrap();
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user