Skip to content

Commit

Permalink
Make utils a single file module for remaining util items
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev committed Sep 7, 2023
1 parent 2cd80a4 commit 695a291
Show file tree
Hide file tree
Showing 64 changed files with 131 additions and 50 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ members = [
"esp-wifi",
"esp-wifi-sys",
"xtask",
"examples-util",
"examples-esp32c2",
"examples-esp32c3",
"examples-esp32c6",
Expand Down
1 change: 0 additions & 1 deletion examples-esp32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ embassy-net = { workspace = true, optional = true }
embassy-sync.workspace = true

esp32-hal.workspace = true
examples-util = { path = "../examples-util", features = ["esp32"] }
esp-backtrace = { workspace = true, features = ["esp32"] }
esp-wifi = { path = "../esp-wifi", default-features = false, features = ["esp32", "utils"] }
embedded-hal-async = { workspace = true, optional = true }
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32/examples/access_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#![feature(c_variadic)]
#![feature(const_mut_refs)]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embedded_io::blocking::*;
Expand Down
5 changes: 4 additions & 1 deletion examples-esp32/examples/async_ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use esp_println::println;
use esp_wifi::{
ble::controller::asynch::BleConnector, initialize, EspWifiInitFor, EspWifiInitialization,
};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;
use examples_util::BootButton;
use hal::{
Expand Down Expand Up @@ -147,7 +149,8 @@ fn main() -> ! {
)
.unwrap();

let button = examples_util::boot_button!(peripherals);
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
let button = io.pins.gpio0.into_pull_down_input();

// Async requires the GPIO interrupt to wake futures
hal::interrupt::enable(
Expand Down
5 changes: 4 additions & 1 deletion examples-esp32/examples/ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use bleps::{
use esp_backtrace as _;
use esp_println::println;
use esp_wifi::{ble::controller::BleConnector, initialize, EspWifiInitFor};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;
use hal::{clock::ClockControl, peripherals::*, prelude::*, Rng, IO};

Expand Down Expand Up @@ -39,7 +41,8 @@ fn main() -> ! {
)
.unwrap();

let button = examples_util::boot_button!(peripherals);
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
let button = io.pins.gpio0.into_pull_down_input();

let mut debounce_cnt = 500;

Expand Down
2 changes: 2 additions & 0 deletions examples-esp32/examples/coex.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![no_std]
#![no_main]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use bleps::{
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32/examples/dhcp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![no_std]
#![no_main]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embedded_io::blocking::*;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32/examples/embassy_access_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use embassy_net::ConfigV4;
use embassy_net::{
Config, IpListenEndpoint, Ipv4Address, Ipv4Cidr, Stack, StackResources, StaticConfigV4,
};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embassy_executor::Executor;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32/examples/embassy_dhcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use embassy_executor::_export::StaticCell;
use embassy_net::tcp::TcpSocket;
use embassy_net::{Config, Ipv4Address, Stack, StackResources};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embassy_executor::Executor;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32/examples/embassy_esp_now.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use embassy_executor::_export::StaticCell;
use embassy_futures::select::{select, Either};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embassy_executor::Executor;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32/examples/esp_now.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use esp_backtrace as _;
use esp_println::println;
use esp_wifi::esp_now::{PeerInfo, BROADCAST_ADDRESS};
use esp_wifi::{current_millis, initialize, EspWifiInitFor};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;
use hal::clock::ClockControl;
use hal::Rng;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32/examples/static_ip.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![no_std]
#![no_main]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embedded_io::blocking::*;
Expand Down
1 change: 0 additions & 1 deletion examples-esp32c2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ embassy-net = { workspace = true, optional = true }
embassy-sync.workspace = true

esp32c2-hal.workspace = true
examples-util = { path = "../examples-util", features = ["esp32c2"] }
esp-backtrace = { workspace = true, features = ["esp32c2"] }
esp-wifi = { path = "../esp-wifi", default-features = false, features = ["esp32c2", "utils"] }
embedded-hal-async = { workspace = true, optional = true }
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c2/examples/access_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#![feature(c_variadic)]
#![feature(const_mut_refs)]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embedded_io::blocking::*;
Expand Down
5 changes: 4 additions & 1 deletion examples-esp32c2/examples/async_ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use esp_println::println;
use esp_wifi::{
ble::controller::asynch::BleConnector, initialize, EspWifiInitFor, EspWifiInitialization,
};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;
use examples_util::BootButton;
use hal::{
Expand Down Expand Up @@ -142,7 +144,8 @@ fn main() -> ! {
)
.unwrap();

let button = examples_util::boot_button!(peripherals);
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
let button = io.pins.gpio9.into_pull_down_input();

// Async requires the GPIO interrupt to wake futures
hal::interrupt::enable(
Expand Down
5 changes: 4 additions & 1 deletion examples-esp32c2/examples/ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use bleps::{
use esp_backtrace as _;
use esp_println::println;
use esp_wifi::{ble::controller::BleConnector, initialize, EspWifiInitFor};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;
use hal::{clock::ClockControl, peripherals::*, prelude::*, systimer::SystemTimer, Rng, IO};

Expand All @@ -34,7 +36,8 @@ fn main() -> ! {
)
.unwrap();

let button = examples_util::boot_button!(peripherals);
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
let button = io.pins.gpio9.into_pull_down_input();

let mut debounce_cnt = 500;

Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c2/examples/dhcp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![no_std]
#![no_main]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embedded_io::blocking::*;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c2/examples/embassy_access_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use embassy_net::ConfigV4;
use embassy_net::{
Config, IpListenEndpoint, Ipv4Address, Ipv4Cidr, Stack, StackResources, StaticConfigV4,
};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embassy_executor::Executor;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c2/examples/embassy_dhcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use embassy_executor::_export::StaticCell;
use embassy_net::tcp::TcpSocket;
use embassy_net::{Config, Ipv4Address, Stack, StackResources};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embassy_executor::Executor;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c2/examples/embassy_esp_now.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use embassy_executor::_export::StaticCell;
use embassy_futures::select::{select, Either};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embassy_executor::Executor;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c2/examples/esp_now.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use esp_backtrace as _;
use esp_println::println;
use esp_wifi::esp_now::{PeerInfo, BROADCAST_ADDRESS};
use esp_wifi::{current_millis, initialize, EspWifiInitFor};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;
use hal::clock::ClockControl;
use hal::{peripherals::Peripherals, prelude::*};
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c2/examples/static_ip.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![no_std]
#![no_main]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embedded_io::blocking::*;
Expand Down
1 change: 0 additions & 1 deletion examples-esp32c3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ embassy-net = { workspace = true, optional = true }
embassy-sync.workspace = true

esp32c3-hal.workspace = true
examples-util = { path = "../examples-util", features = ["esp32c3"] }
esp-backtrace = { workspace = true, features = ["esp32c3"] }
esp-wifi = { path = "../esp-wifi", default-features = false, features = ["esp32c3", "utils"] }
embedded-hal-async = { workspace = true, optional = true }
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c3/examples/access_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#![feature(c_variadic)]
#![feature(const_mut_refs)]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embedded_io::blocking::*;
Expand Down
5 changes: 4 additions & 1 deletion examples-esp32c3/examples/async_ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use esp_println::println;
use esp_wifi::{
ble::controller::asynch::BleConnector, initialize, EspWifiInitFor, EspWifiInitialization,
};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;
use examples_util::BootButton;
use hal::{
Expand Down Expand Up @@ -142,7 +144,8 @@ fn main() -> ! {
)
.unwrap();

let button = examples_util::boot_button!(peripherals);
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
let button = io.pins.gpio9.into_pull_down_input();

// Async requires the GPIO interrupt to wake futures
hal::interrupt::enable(
Expand Down
5 changes: 4 additions & 1 deletion examples-esp32c3/examples/ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use bleps::{
use esp_backtrace as _;
use esp_println::println;
use esp_wifi::{ble::controller::BleConnector, initialize, EspWifiInitFor};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;
use hal::{clock::ClockControl, peripherals::*, prelude::*, systimer::SystemTimer, Rng, IO};

Expand All @@ -34,7 +36,8 @@ fn main() -> ! {
)
.unwrap();

let button = examples_util::boot_button!(peripherals);
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
let button = io.pins.gpio9.into_pull_down_input();

let mut debounce_cnt = 500;

Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c3/examples/coex.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![no_std]
#![no_main]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use bleps::{
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c3/examples/dhcp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![no_std]
#![no_main]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embedded_io::blocking::*;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c3/examples/embassy_access_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use embassy_net::ConfigV4;
use embassy_net::{
Config, IpListenEndpoint, Ipv4Address, Ipv4Cidr, Stack, StackResources, StaticConfigV4,
};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embassy_executor::Executor;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c3/examples/embassy_dhcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use embassy_executor::_export::StaticCell;
use embassy_net::tcp::TcpSocket;
use embassy_net::{Config, Ipv4Address, Stack, StackResources};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embassy_executor::Executor;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c3/examples/embassy_esp_now.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use embassy_executor::_export::StaticCell;
use embassy_futures::select::{select, Either};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embassy_executor::Executor;
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c3/examples/esp_now.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use esp_backtrace as _;
use esp_println::println;
use esp_wifi::esp_now::{PeerInfo, BROADCAST_ADDRESS};
use esp_wifi::{current_millis, initialize, EspWifiInitFor};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;
use hal::clock::ClockControl;
use hal::{peripherals::Peripherals, prelude::*};
Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c3/examples/static_ip.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![no_std]
#![no_main]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embedded_io::blocking::*;
Expand Down
1 change: 0 additions & 1 deletion examples-esp32c6/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ embassy-net = { workspace = true, optional = true }
embassy-sync.workspace = true

esp32c6-hal.workspace = true
examples-util = { path = "../examples-util", features = ["esp32c6"] }
esp-backtrace = { workspace = true, features = ["esp32c6"] }
esp-wifi = { path = "../esp-wifi", default-features = false, features = ["esp32c6", "utils"] }

Expand Down
2 changes: 2 additions & 0 deletions examples-esp32c6/examples/access_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#![feature(c_variadic)]
#![feature(const_mut_refs)]

#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;

use embedded_io::blocking::*;
Expand Down
5 changes: 4 additions & 1 deletion examples-esp32c6/examples/async_ble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use esp_println::println;
use esp_wifi::{
ble::controller::asynch::BleConnector, initialize, EspWifiInitFor, EspWifiInitialization,
};
#[path = "../../examples-util/util.rs"]
mod examples_util;
use examples_util::hal;
use examples_util::BootButton;
use hal::{
Expand Down Expand Up @@ -142,7 +144,8 @@ fn main() -> ! {
)
.unwrap();

let button = examples_util::boot_button!(peripherals);
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
let button = io.pins.gpio9.into_pull_down_input();

// Async requires the GPIO interrupt to wake futures
hal::interrupt::enable(
Expand Down
Loading

0 comments on commit 695a291

Please sign in to comment.