Skip to content

Commit

Permalink
Merge pull request #121 from esp-rs/esp-now
Browse files Browse the repository at this point in the history
Add esp-now support
  • Loading branch information
bjoernQ authored Feb 6, 2023
2 parents 905782c + 22df2a9 commit 53ee2dd
Show file tree
Hide file tree
Showing 24 changed files with 2,814 additions and 152 deletions.
34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ https://github.com/esp-rs/esp-wireless-drivers-3rdparty/ (commit f4caebff200e8f6
| ESP32-C3 | `cargo +nightly run --example ble --release --target riscv32imc-unknown-none-elf --features "esp32c3,ble"` |
| ESP32-S3 | `cargo +esp run --example ble --release --target xtensa-esp32s3-none-elf --features "esp32s3,ble"` |

**NOTE:** Not currently available for the ESP32-S2
**NOTE:** ESP32-S2 doesn't support bluetooth

### coex

Expand All @@ -77,16 +77,41 @@ https://github.com/esp-rs/esp-wireless-drivers-3rdparty/ (commit f4caebff200e8f6

**NOTE:** Not currently available for the ESP32, ESP32-C2, or ESP32-S2

### esp_now

- broadcasts, receives and sends messages via esp-now

| 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"` |

### 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"`

## 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 @@ -107,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 Expand Up @@ -151,7 +176,6 @@ If something doesn't work as expected try a different opt-level.

- lots of refactoring
- make CoEx work on ESP32 (it kind of works when commenting out setting the country in wifi_start, probably some mis-compilation since it then crashes in a totally different code path)
- esp-now
- maybe SoftAP

## Using in your own binary crate
Expand Down
Loading

0 comments on commit 53ee2dd

Please sign in to comment.