Description
The OneShot trait defines returning a nb::Result, but it's not fully clear to me what a a WouldBlock means; could be either of
- Can't do, there's another ADC conversion in progress (should really not happen, b/c it takes a
&mut self
, but maybe it's on a shared bus, or maybe there was a channel switch and some calibration time needs to be accounted for or whatever) - Yes I started it, but the result is not ready yet.
If it can be the latter, that begs the question of whether calling .read() incurs the risk of not actually getting a fresh value but the result an earlier read attempt that was aborted – and a caller can't rely on an instant return to mean "this has been requested earlier" either, for some ADCs might give results instantly.
My gut feeling is that nb::Result functions should be "Retry means I ignored you (and when I do something, I return something)" and not "Retry means I heard you (but I'll ignore any future requests until I've once returned something)" – but I might be wrong there and it doesn't need to be so strict to still give reliable oneshot results. What are other peripherals doing there? SPI doesn't have that issue as it has a send and a read method, maybe OneShot should too?