Closed Alexander89 closed 2 years ago
Consider someone calls get_temp(), or measure_temp on an unpowered tempmon, what happens if it's off?
Actually, get_temp()
still works or it just returns old data. So, somehow it doesn't really work, though.
But measure_temp() will just loop to the end of time.
I will add a power_on check and as you mention and I turn the values into a Result
Should I change the messure_temp() into non-blocking and return WouldBlock
in the blocking case. (nb::block!()
compatible)
Should I change the messure_temp() into non-blocking and return
WouldBlock
in the blocking case. (nb::block!()
compatible)
Seems reasonable, a Result return here makes sense as it is fallible if the device isn't on. Perhaps using nb here would be nice, I haven't used it in an async way myself though so I can't comment one way or the other here
ich changed the math to °mC and adopted the docs to that.
In addition, I implemented an error handling to deal with the power_down state.
The temp_mon.measure_temp() is now compatible to nb::block!()
I also ran cargo clippy
and cargo fmt
, I hope the pipeline is now happy :-)
@mciantyre, I created an example app to test this code, should I add it to teensy4-rs/examples?
Thanks for all your patience! I learned a lot about the RAL layer and many other things. :pray: :rocket:
I think this is it now :tada:
Noted the places where I saw units for parameters and returns might be useful, I believe its mC -> C and vice versa, but would be nice to have it noted there.
I got a little bit side trapped by the Temperature Monitor (TEMPMON)
I thought it is barely simple and a great start in getting my hands dirty with the
imxrt-ral
ecosystem.The interrupts are not really handy.
Open to discuss
I played around with the UX a little bit and finally, it is OK.
In my test app, I implemented a static alarm flag to note, when I have to enable the interrupts again. Another method would be, to stop the measurement process, but as soon you read the temperature, the interrupt is triggered again.
If anybody has a great idea on how to improve it, please let me know :smiley: