FluenTech / embedded-time

Time(ing) library (Instant/Duration/Clock/Timer/Period/Frequency) for bare-metal embedded systems
Apache License 2.0
87 stars 17 forks source link

smarter macros for defining intra-unit conversions #104

Open PTaylor-us opened 3 years ago

PTaylor-us commented 3 years ago

There are many instances when converting from a larger-magnitude unit with width u32 to a smaller-magnitude unit with width u64 could use From/Into rather than their fallible forms. However, my current level of macro expertise limits me to either one or the other (fallible or infallible).

korken89 commented 3 years ago

One option is to move the macro generation to an internal proc-macro. This kind of change would be trivial then.

PTaylor-us commented 3 years ago

I'm not very familiar with proc macros. Is this something you are capable of doing, @korken89?

korken89 commented 3 years ago

I have no problems with proc-macros as with RTIC I mostly write them :) But I am not familiar with all the generation that the current macros are performing. I'll study the current macro to get a better feel for it.