Open MabezDev opened 5 years ago
I started poking at this a bit, we might have issues interfacing with them as at least the wifi one seems to use some sort of async task structure? As I'm not sure if we can easily ensure that the required baggage for that is around in a rust program.
Hmm it will be quite awkward, but just about doable I think. One of the idf developers replied to me about the wifi libs on reddit that explains a little bit more.
I suspect we may need more info, hopefully espressif don't mind helping on that front.
Essentially we need to reimplement this file https://github.com/espressif/esp-idf/blob/master/components/esp32/esp_adapter.c , but it's not quite that straight forward as implementing requires:
#[global_allocator]
or would we need to roll our own.* void
to The actual type that we can store on the rust side, I'm hoping only one type gets queued else this might get tricky.xtensa-lx6-rt
I think.I have made a start at: https://github.com/arjanmels/esp32-wifi. Bindgen is up and running and I can call some basic functions. Will start on the OS wrapper for the wifi_init function next.
I chose to make it a separate crate since it pulls in esp-idf binary blobs and I didn't want to pollute the esp32-hal with that. We need to see later how to handle the bluetooth, if that can be a separate crate, or needs to be in this crate as there may be some close cooperation.
I have transferred my esp32_wifi repo to esp-rs: https://github.com/esp-rs/esp32-wifi. Status: It allows todo wifi scan, but currently still returns 0 AP found. (Not certain what the problem is, I think all essential compatibility functions are in place, might be teh PHY not enabled properly.)
Oh excellent! I started something similar, but will now put my efforts into esp-rs/esp32-wifi!
The static libs found in
$IDF/components/esp32/lib
link against the headers inside$IDF/components/esp32/include
, using bindgen we should be able to wrap the c functions in a Rusty way.