embassy-rs / nrf-softdevice

Apache License 2.0
254 stars 74 forks source link

Implement `NorFlash` for `Flash` #235

Closed HaoboGu closed 4 months ago

HaoboGu commented 4 months ago

In current flash implementation https://github.com/embassy-rs/nrf-softdevice/blob/master/nrf-softdevice/src/flash.rs, the struct Flash implements only blocking ReadNorFlash, and async version of ReadNorFlash and NorFlash. Is there any concern to not implement blocking NorFlash?

Dirbaio commented 4 months ago

the softdevice api is only async (you request the write/erase operation, you get an event later notifying it was done). We can't spin waiting for the operation to be done, because it'll starve the softdevice task so the event won't get processed. Same if you try to use block_on() from your side to convert the async api to blocking.

HaoboGu commented 4 months ago

gotcha! thanks for the explanation:D