Skip to content

Commit

Permalink
Don't use underscores in feature names
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernQ committed Feb 6, 2023
1 parent c54db7a commit 22df2a9
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 43 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,34 +83,35 @@ https://github.com/esp-rs/esp-wireless-drivers-3rdparty/ (commit f4caebff200e8f6

| Chip | Command |
| :------: | ------------------------------------------------------------------------------------------------------------------------------------------ |
| ESP32 | `cargo +esp run --example esp_now --release --target xtensa-esp32-none-elf --features "esp32,esp_now"` |
| ESP32-C2 | `CARGO_PROFILE_RELEASE_LTO=false cargo +nightly run --example esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c2,esp_now"` |
| ESP32-C3 | `cargo +nightly run --example esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c3,esp_now"` |
| ESP32-S2 | `cargo +esp run --example esp_now --release --target xtensa-esp32s2-none-elf --features "esp32s2,esp_now"` |
| ESP32-S3 | `cargo +esp run --example esp_now --release --target xtensa-esp32s3-none-elf --features "esp32s3,esp_now"` |
| ESP32 | `cargo +esp run --example esp_now --release --target xtensa-esp32-none-elf --features "esp32,esp-now"` |
| ESP32-C2 | `CARGO_PROFILE_RELEASE_LTO=false cargo +nightly run --example esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c2,esp-now"` |
| ESP32-C3 | `cargo +nightly run --example esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c3,esp-now"` |
| ESP32-S2 | `cargo +esp run --example esp_now --release --target xtensa-esp32s2-none-elf --features "esp32s2,esp-now"` |
| ESP32-S3 | `cargo +esp run --example esp_now --release --target xtensa-esp32s3-none-elf --features "esp32s3,esp-now"` |

### embassy_esp_now

- broadcasts, receives and sends messages via esp-now in an async way

| Chip | Command |
| :------: | ------------------------------------------------------------------------------------------------------------------------------------------ |
| ESP32 | `cargo +esp run --example embassy_esp_now --release --target xtensa-esp32-none-elf --features "esp32,esp32-async,esp_now"` |
| ESP32-C2 | `CARGO_PROFILE_RELEASE_LTO=false cargo +nightly run --example embassy_esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c2,esp32c2-async,esp_now"` |
| ESP32-C3 | `cargo +nightly run --example embassy_esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c3,esp32c3-async,esp_now"` |
| ESP32-S2 | `cargo +esp run --example embassy_esp_now --release --target xtensa-esp32s2-none-elf --features "esp32s2,esp32s2-async,esp_now"` |
| ESP32-S3 | `cargo +esp run --example embassy_esp_now --release --target xtensa-esp32s3-none-elf --features "esp32s3,esp32s3-async,esp_now"`
| ESP32 | `cargo +esp run --example embassy_esp_now --release --target xtensa-esp32-none-elf --features "esp32,esp32-async,esp-now"` |
| ESP32-C2 | `CARGO_PROFILE_RELEASE_LTO=false cargo +nightly run --example embassy_esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c2,esp32c2-async,esp-now"` |
| ESP32-C3 | `cargo +nightly run --example embassy_esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c3,esp32c3-async,esp-now"` |
| ESP32-S2 | `cargo +esp run --example embassy_esp_now --release --target xtensa-esp32s2-none-elf --features "esp32s2,esp32s2-async,esp-now"` |
| ESP32-S3 | `cargo +esp run --example embassy_esp_now --release --target xtensa-esp32s3-none-elf --features "esp32s3,esp32s3-async,esp-now"`

## Features

| Feature | Meaning |
| ------------ | --------------------------------------------------------------------------------------------------- |
| wifi_logs | logs the WiFi logs from the driver at log level info |
| dump_packets | dumps some packet info at log level info |
| wifi-logs | logs the WiFi logs from the driver at log level info |
| dump-packets | dumps some packet info at log level info |
| utils | Provide utilities for smoltcp initialization, this is a default feature |
| embedded-svc | Provides a (very limited) implementation of the `embedded-svc` WiFi trait, includes `utils` feature |
| ble | Enable BLE support |
| wifi | Enable WiFi support |
| esp-now | Enable esp-now support |

## Important

Expand All @@ -131,7 +132,7 @@ Link time optimization is not yet recommended for use, please ensure `lto = "off

## Using Serial-JTAG

On ESP32-C3 / ESP32-S3 when using Serial-JTAG you have to activate the feature `phy_enable_usb`.
On ESP32-C3 / ESP32-S3 when using Serial-JTAG you have to activate the feature `phy-enable-usb`.

Don't use this feature if your are _not_ using Serial-JTAG since it might reduce WiFi performance.

Expand Down
10 changes: 5 additions & 5 deletions esp-wifi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ esp32c2-async = [ "esp32c2-hal/embassy", "esp32c2-hal/embassy-time-timg0", "asyn
esp32-async = [ "esp32-hal/embassy", "esp32-hal/embassy-time-timg0", "async" ]
esp32s2-async = [ "esp32s2-hal/embassy", "esp32s2-hal/embassy-time-timg0", "async" ]
esp32s3-async = [ "esp32s3-hal/embassy", "esp32s3-hal/embassy-time-timg0", "async" ]
wifi_logs = []
dump_packets = []
wifi-logs = []
dump-packets = []
utils = []
enumset = []
embedded-svc = [ "dep:enumset", "dep:embedded-svc", "utils" ]
wifi = []
ble = [ "esp32-hal?/bluetooth" ]
phy_enable_usb = []
ps_min_modem = []
esp_now = [ "wifi", "embedded-svc" ]
phy-enable-usb = []
ps-min-modem = []
esp-now = [ "wifi", "embedded-svc" ]
async = [ "dep:embassy-sync"]
20 changes: 10 additions & 10 deletions esp-wifi/smoketest.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ cargo "+nightly" run --example ble --release --target riscv32imc-unknown-none-el
cargo "+nightly" run --example dhcp --release --target riscv32imc-unknown-none-elf --features "esp32c3,embedded-svc,wifi"
cargo "+nightly" run --example static_ip --release --target riscv32imc-unknown-none-elf --features "esp32c3,embedded-svc,wifi"
cargo "+nightly" run --example coex --release --target riscv32imc-unknown-none-elf --features "esp32c3,embedded-svc,wifi,ble"
cargo "+nightly" run --example esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c3,esp_now"
cargo "+nightly" run --example embassy_esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c3,esp32c3-async,esp_now"
cargo "+nightly" run --example esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c3,esp-now"
cargo "+nightly" run --example embassy_esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c3,esp32c3-async,esp-now"

set CARGO_PROFILE_RELEASE_OPT_LEVEL=3
set CARGO_PROFILE_RELEASE_LTO=off
Expand All @@ -25,8 +25,8 @@ pause
cargo "+esp" run --example ble --release --target xtensa-esp32-none-elf --features "esp32,ble"
cargo "+esp" run --example dhcp --release --target xtensa-esp32-none-elf --features "esp32,embedded-svc,wifi"
cargo "+esp" run --example static_ip --release --target xtensa-esp32-none-elf --features "esp32,embedded-svc,wifi"
cargo "+esp" run --example esp_now --release --target xtensa-esp32-none-elf --features "esp32,esp_now"
cargo "+esp" run --example embassy_esp_now --release --target xtensa-esp32-none-elf --features "esp32,esp32-async,esp_now"
cargo "+esp" run --example esp_now --release --target xtensa-esp32-none-elf --features "esp32,esp-now"
cargo "+esp" run --example embassy_esp_now --release --target xtensa-esp32-none-elf --features "esp32,esp32-async,esp-now"

set CARGO_PROFILE_RELEASE_OPT_LEVEL=3
set CARGO_PROFILE_RELEASE_LTO=off
Expand All @@ -37,8 +37,8 @@ cargo "+esp" run --example ble --release --target xtensa-esp32s3-none-elf --feat
cargo "+esp" run --example dhcp --release --target xtensa-esp32s3-none-elf --features "esp32s3,embedded-svc,wifi"
cargo "+esp" run --example static_ip --release --target xtensa-esp32s3-none-elf --features "esp32s3,embedded-svc,wifi"
cargo "+esp" run --example coex --release --target xtensa-esp32s3-none-elf --features "esp32s3,embedded-svc,wifi,ble"
cargo "+esp" run --example esp_now --release --target xtensa-esp32s3-none-elf --features "esp32s3,esp_now"
cargo "+esp" run --example embassy_esp_now --release --target xtensa-esp32s3-none-elf --features "esp32s3,esp32s3-async,esp_now"
cargo "+esp" run --example esp_now --release --target xtensa-esp32s3-none-elf --features "esp32s3,esp-now"
cargo "+esp" run --example embassy_esp_now --release --target xtensa-esp32s3-none-elf --features "esp32s3,esp32s3-async,esp-now"

set CARGO_PROFILE_RELEASE_OPT_LEVEL=3
set CARGO_PROFILE_RELEASE_LTO=off
Expand All @@ -47,8 +47,8 @@ echo Connect ESP32-S2
pause
cargo "+esp" run --example dhcp --release --target xtensa-esp32s2-none-elf --features "esp32s2,embedded-svc,wifi"
cargo "+esp" run --example static_ip --release --target xtensa-esp32s2-none-elf --features "esp32s2,embedded-svc,wifi"
cargo "+esp" run --example esp_now --release --target xtensa-esp32s2-none-elf --features "esp32s2,esp_now"
cargo "+esp" run --example embassy_esp_now --release --target xtensa-esp32s2-none-elf --features "esp32s2,esp32s2-async,esp_now"
cargo "+esp" run --example esp_now --release --target xtensa-esp32s2-none-elf --features "esp32s2,esp-now"
cargo "+esp" run --example embassy_esp_now --release --target xtensa-esp32s2-none-elf --features "esp32s2,esp32s2-async,esp-now"

set CARGO_PROFILE_RELEASE_OPT_LEVEL=3
set CARGO_PROFILE_RELEASE_LTO=false
Expand All @@ -58,5 +58,5 @@ pause
cargo "+nightly" run --example ble --release --target riscv32imc-unknown-none-elf --features "esp32c2,ble"
cargo "+nightly" run --example dhcp --release --target riscv32imc-unknown-none-elf --features "esp32c2,embedded-svc,wifi"
cargo "+nightly" run --example static_ip --release --target riscv32imc-unknown-none-elf --features "esp32c2,embedded-svc,wifi"
cargo "+nightly" run --example esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c2,esp_now"
cargo "+nightly" run --example embassy_esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c2,esp32c2-async,esp_now"
cargo "+nightly" run --example esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c2,esp-now"
cargo "+nightly" run --example embassy_esp_now --release --target riscv32imc-unknown-none-elf --features "esp32c2,esp32c2-async,esp-now"
2 changes: 1 addition & 1 deletion esp-wifi/src/ble/btdm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ pub(crate) fn ble_init() {
unsafe {
*(HCI_OUT_COLLECTOR.as_mut_ptr()) = HciOutCollector::new();
// turn on logging
#[cfg(feature = "wifi_logs")]
#[cfg(feature = "wifi-logs")]
{
extern "C" {
static mut g_bt_plf_log_level: u32;
Expand Down
2 changes: 1 addition & 1 deletion esp-wifi/src/ble/npl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ pub(crate) fn ble_init() {
*(HCI_OUT_COLLECTOR.as_mut_ptr()) = HciOutCollector::new();

// turn on logging
#[cfg(feature = "wifi_logs")]
#[cfg(feature = "wifi-logs")]
{
extern "C" {
static mut g_ble_plf_log_level: u32;
Expand Down
2 changes: 1 addition & 1 deletion esp-wifi/src/common_adapter/common_adapter_esp32c2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub(crate) unsafe fn phy_enable() {

let init_data = &PHY_INIT_DATA_DEFAULT;

#[cfg(feature = "phy_enable_usb")]
#[cfg(feature = "phy-enable-usb")]
{
extern "C" {
pub fn phy_bbpll_en_usb(param: bool);
Expand Down
2 changes: 1 addition & 1 deletion esp-wifi/src/common_adapter/common_adapter_esp32c3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub(crate) unsafe fn phy_enable() {

let init_data = &PHY_INIT_DATA_DEFAULT;

#[cfg(feature = "phy_enable_usb")]
#[cfg(feature = "phy-enable-usb")]
{
extern "C" {
pub fn phy_bbpll_en_usb(param: bool);
Expand Down
2 changes: 1 addition & 1 deletion esp-wifi/src/common_adapter/common_adapter_esp32s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub(crate) unsafe fn phy_enable() {

let init_data = &PHY_INIT_DATA_DEFAULT;

#[cfg(feature = "phy_enable_usb")]
#[cfg(feature = "phy-enable-usb")]
{
extern "C" {
pub fn phy_bbpll_en_usb(param: bool);
Expand Down
4 changes: 2 additions & 2 deletions esp-wifi/src/compat/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ impl Write for StrBuf {
}

pub unsafe extern "C" fn syslog(_priority: u32, format: *const u8, mut args: VaListImpl) {
#[cfg(all(feature = "wifi_logs", target_arch = "riscv32"))]
#[cfg(all(feature = "wifi-logs", target_arch = "riscv32"))]
{
let mut buf = [0u8; 512];
vsnprintf(&mut buf as *mut u8, 511, format, args);
let res_str = StrBuf::from(&buf as *const u8);
info!("{}", res_str.as_str_ref());
}
#[cfg(all(feature = "wifi_logs", not(target_arch = "riscv32")))]
#[cfg(all(feature = "wifi-logs", not(target_arch = "riscv32")))]
{
let res_str = StrBuf::from(format);
info!("{}", res_str.as_str_ref());
Expand Down
4 changes: 2 additions & 2 deletions esp-wifi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub mod wifi;
#[cfg(feature = "ble")]
pub mod ble;

#[cfg(feature = "esp_now")]
#[cfg(feature = "esp-now")]
pub mod esp_now;

pub(crate) mod common_adapter;
Expand Down Expand Up @@ -233,7 +233,7 @@ pub fn initialize(
}

pub fn wifi_set_log_verbose() {
#[cfg(feature = "wifi_logs")]
#[cfg(feature = "wifi-logs")]
unsafe {
use crate::binary::include::{esp_wifi_internal_set_log_level, wifi_log_level_t};

Expand Down
8 changes: 4 additions & 4 deletions esp-wifi/src/wifi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ use crate::{
};
use log::{debug, info};

#[cfg(feature = "dump_packets")]
#[cfg(feature = "dump-packets")]
static DUMP_PACKETS: bool = true;
#[cfg(not(feature = "dump_packets"))]
#[cfg(not(feature = "dump-packets"))]
static DUMP_PACKETS: bool = false;

#[derive(Debug, Clone, Copy)]
Expand Down Expand Up @@ -587,10 +587,10 @@ pub fn wifi_start() -> Result<(), WifiError> {
unsafe {
esp_wifi_result!(esp_wifi_start())?;

#[cfg(any(coex, feature = "ps_min_modem"))]
#[cfg(any(coex, feature = "ps-min-modem"))]
esp_wifi_result!(esp_wifi_set_ps(crate::binary::include::wifi_ps_type_t_WIFI_PS_MIN_MODEM))?;

#[cfg(not(any(coex, feature = "ps_min_modem")))]
#[cfg(not(any(coex, feature = "ps-min-modem")))]
esp_wifi_result!(esp_wifi_set_ps(crate::binary::include::wifi_ps_type_t_WIFI_PS_NONE))?;

let cntry_code = [b'C', b'N', 0];
Expand Down
4 changes: 2 additions & 2 deletions esp-wifi/src/wifi/os_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,7 @@ pub unsafe extern "C" fn log_write(
_format: *const crate::binary::c_types::c_char,
_args: ...
) {
#[cfg(not(feature = "wifi_logs"))]
#[cfg(not(feature = "wifi-logs"))]
return;

#[cfg(feature = "esp32c3")]
Expand Down Expand Up @@ -1516,7 +1516,7 @@ pub unsafe extern "C" fn log_writev(
_format: *const crate::binary::c_types::c_char,
_args: va_list,
) {
#[cfg(not(feature = "wifi_logs"))]
#[cfg(not(feature = "wifi-logs"))]
return;

#[cfg(any(feature = "esp32", feature = "esp32s2", feature = "esp32s3"))]
Expand Down

0 comments on commit 22df2a9

Please sign in to comment.