atsamd icon indicating copy to clipboard operation
atsamd copied to clipboard

Use embedded-time

Open jessebraham opened this issue 5 years ago • 4 comments

Remove time.rs in favour of embedded-time. This will require reworking any peripheral implementations which use frequency and/or time units.

Work on this is already underway in #308.

jessebraham avatar Nov 24 '20 20:11 jessebraham

Ive been working on this slowly with @jacobrosenthal in https://github.com/twitchyliquid64/atsamd/tree/EMBEDDED_TIEM.

One pain-point we are constantly running into the that embedded-time only converts Hertz<u64> into other types via the From trait, which is technically correct, but given we will never need a frequency > 4.1 Ghz this restriction just ends up being a pain.

I'm going to investigate ways to implement From<Hertz<u32>> so we can keep the existing behavior.

twitchyliquid64 avatar Nov 24 '20 21:11 twitchyliquid64

Ugh y they no TryFrom.

sajattack avatar Nov 24 '20 21:11 sajattack

Theres TryFrom, but compared to just writing 400.Khz() / 20.MHz() etc everywhere, the TryFrom is unwieldy, not to mention we then need to import the TryFrom trait in each BSP crate.

twitchyliquid64 avatar Nov 24 '20 21:11 twitchyliquid64

Yeah it's not quite as clean but I think it makes sense to error if an invalid frequency is requested

sajattack avatar Nov 24 '20 21:11 sajattack

I think this crate has switched to the better-supported fugit, so can this issue be closed?

tgross35 avatar Jan 11 '24 02:01 tgross35