embassy/embassy-rp/src
bors[bot] e5097a8866
Merge #959
959: Generic, executor-agnostic queue implementation r=ivmarkov a=ivmarkov

Hopefully relatively well documented.

Implementation relies on a fixed-size `SortedLinkedList` from `heapless`. (By default, for up to 128 timer schedules, but we can lower this number to - say - 64.)

As discussed earlier, on queue overflow, the `WakerRegistration` approach is utilized, whereas the waker that is ordered first in the queue is awoken to make room for the incoming one (which might be the waker that would be awoken after all!). Wakers are compared with `Waker::will_wake`, so the queue should actually not fill up that easily, if at all.

I've left provisions for the user to manually instantiate the queue using a dedicated macro - `generic_queue!` so that users willing to adjust the queue size, or users (like me) who have to use the queue in a complex "on-top-of-RTOS-but-the-timer-driver-calling-back-from-ISR" scenario can customize the mutex that protects the queue.

The one thing I'm not completely happy with is the need to call `{ embassy_time::queue::initialize() }` early on before any futures using embassy-time are polled, which is currently on the shoulders of the user. I'm open to any ideas where we can get rid of this and do it on the first call to `_embassy_time_schedule_wake`, without introducing very complex combinations of critical sections, atomics and whatnot.




Co-authored-by: ivmarkov <ivan.markov@gmail.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2022-10-26 19:14:12 +00:00
..
rtc Correctly enable RTC_IRQ when scheduling an RTC alarm 2022-10-12 10:54:47 +02:00
uart Update Rust nightly. 2022-10-26 16:47:29 +02:00
boot2.bin rp: add precompiled boot2 to avoid depending on gcc 2021-03-29 22:28:36 +02:00
clocks.rs Add further i2c error types 2022-09-27 22:08:49 +02:00
dma.rs Replace futures::future::poll_fn -> core::future::poll_fn. 2022-09-22 16:42:49 +02:00
fmt.rs fmt: Add dunmy use to avoid "unused variable" errors when no log is enabled. 2021-06-07 03:21:37 +02:00
gpio.rs Expose Pin::pin() and Pin::bank() as public 2022-10-08 11:44:06 +08:00
i2c.rs Associate state with the instance rather than having a separate array 2022-10-17 21:50:40 -07:00
interrupt.rs Remove HAL initialization from #[embassy::main] macro. 2022-08-17 22:16:46 +02:00
intrinsics.rs rp: Disable intrinsics by default. 2022-09-26 19:53:22 +02:00
lib.rs Add preliminary I2C implementation for RP2040 2022-09-27 22:08:49 +02:00
reset.rs Run rustfmt. 2022-06-12 22:22:31 +02:00
rom_data.rs Add credits to rp-hal 2022-09-26 11:57:26 +02:00
spi.rs Update embedded-hal versions and explicitly pin 2022-09-29 11:27:46 +02:00
timer.rs Address review feedback 2022-10-24 11:10:59 +03:00
usb.rs Merge #1020 2022-10-21 20:43:14 +00:00