Description
I was attempting to use esp-wifi
along with esp32c3-hal
and was worried that esp wifi might need peripherals used by the embassy time driver.
To my pleasant surprise, I saw that initializing embassy appears to not need any ownership over the peripheral:
However, I was confused when I realized that I was able to use the embassy timer even without calling the init method. To further my confusion, I found this in the hal code:
esp-hal/esp-hal-common/src/embassy/time_driver_systimer.rs
Lines 21 to 26 in 096ff34
I am not knowledgeable on the safety of this, but from my inexperienced perspective, this implies that
esp-hal
is lying to me about the peripherals its using. Instead of passing the alarm peripherals explicitly into the embassy::init()
method, they are being manufactured into existance via the dark arts of unsafe.
My question is: Is the current implementation unsound? Can I use alarm0
in esp-wifi
or something else that needs the alarm? Is this leaving me vulnerable to race conditions (not just data races!) in the state of the peripheral?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status