Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot integrate esp-wifi into std project based on esp-idf-template #378

Closed
CliffHan opened this issue Dec 7, 2023 · 3 comments
Closed

Comments

@CliffHan
Copy link

CliffHan commented Dec 7, 2023

To re-produce:

  1. follow the The Rust on ESP book, create a project via: cargo generate esp-rs/esp-idf-template cargo, confirm it could work.
  2. follow the README of esp-wifi, add dependency and compile args.

Here's the error log I got:

   Compiling esp-idf-hal v0.42.5
error[E0053]: method `acquire` has an incompatible type for trait
   --> C:\Users\Cliff\.cargo\registry\src\rsproxy.cn-8f6827c7555bfaf8\esp-idf-hal-0.42.5\src\task.rs:749:28
    |
749 |         unsafe fn acquire() {
    |                            ^ expected `u8`, found `()`
    |
    = note: expected signature `unsafe fn() -> u8`
               found signature `unsafe fn()`
help: change the output type to match the trait
    |
749 |         unsafe fn acquire() -> u8 {
    |                             +++++

error[E0053]: method `release` has an incompatible type for trait
   --> C:\Users\Cliff\.cargo\registry\src\rsproxy.cn-8f6827c7555bfaf8\esp-idf-hal-0.42.5\src\task.rs:753:35
    |
753 |         unsafe fn release(_token: ()) {
    |                                   ^^
    |                                   |
    |                                   expected `u8`, found `()`
    |                                   help: change the parameter type to match the trait: `u8`
    |
    = note: expected signature `unsafe fn(u8)`
               found signature `unsafe fn(())`

For more information about this error, try `rustc --explain E0053`.
error: could not compile `esp-idf-hal` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

I know the problem may comes with "std" feature. But I don't know how to solve it.

@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 7, 2023

esp-wifi is to be used with the bare-metal hal (esp-hal). For esp-idf-hal you don't even need it

See https://esp-rs.github.io/std-training/03_3_2_http_client.html

@CliffHan
Copy link
Author

CliffHan commented Dec 7, 2023

esp-wifi is to be used with the bare-metal hal (esp-hal). For esp-idf-hal you don't even need it

See https://esp-rs.github.io/std-training/03_3_2_http_client.html

Looks like that's just an http client example, which used pre-defined wifi configuration.
Seems that example doesn't allow me to control wifi connection at runtime.

@bjoernQ
Copy link
Contributor

bjoernQ commented Dec 7, 2023

Since I only use and work on bare-metal/no-std I cannot really help with esp-idf/std

Maybe this helps: https://github.com/ivmarkov/rust-esp32-std-demo/blob/58b9ea6680d282dcb26c0a77b8108f4ae2494b48/src/main.rs#L1387C4-L1450

Otherwise feel free to ask on our Matrix channel - there are a lot of people around using esp-idf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants