-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for ESP internal temperature sensor #337
Conversation
@Vollbrecht FYI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i added some comments, piece by piece we will get there.
The interesting point is when you start implement the callback functions provided by the driver. It should allow you to setup a callback on certain temperature condition. In our crate terminology we call it a subscribe, if you want to peak in other drivers how similar things are handled. |
since it seams to work with the flags we are now using in esp-idf-sys. We could also change it here. Rustcompiler give us the flag as |
If you are unsure how to proceed now to get the rest of the exposed api integrated, we can wrap it up here and i can integrate the rest ontop of it, or if you feel advantageous we can go deeper getting the callbacks to work with the api. |
Would that then be
If you don't mind me asking questions and it perhaps taking a bit longer then if you would do it yourself, I would like to try it. If I find out it's too much work we can still only merge my basic support in the future. |
Is there any further progress on this? I’m having problems with a chip overheating and would like to quantify the problem better. Usable basic support would be helpful, if other work is paused. I’d be happy to help out, although I’m new enough to this stuff I don’t know how much use I’d be. |
Code is very rudimentary and still suspect to change. Notably, error handling is not implemented yet.
Since I cannot update the PR myself I opened a rebase of it. |
Sorry for the late reply, I forgot to answer back then. As from my side: I might find some time to work on this in the next few weeks, but I likely need some time to get back into it (which repo of esp-rs does what, what is still missing, ...) and some more help (see question above). If someone else wants to do it instead, feel free :) I'm pinging @ivmarkov too since he was asking about the state of the PR that @lu-zero opened. |
I spent a bit of time to try to get it to at least pass the CI, I guess the remaining bits is to wire in the Peripheral and figure out if there are remaining failures. |
I'm pretty sure we can finish the driver still today or so. It is so simple, that it needs an extra couple of hours at most. And I'll assist of course. :) What I can't help with is putting my own time to test it, but I'm hopeful you can do that. |
I'm back at home and have a few hours free time this evening. I'll try to address (some of) the remaining issues. @lu-zero Do you mind if I cherry-pick your commits into my branch/this PR? |
Can (and should) we use this flag instead of |
@ivmarkov Regarding the peripheral, I've
What do I do with |
It should be instead:
Notice:
Also, you need to initialize the |
Also - and if it is not clear - the |
@GamerBene19 @lu-zero Once you feel this is ready (should be, once you address the non-panicing behavior of the dtor), please un-draft it so that we can see if it builds OK. Post-merge I might implement the usual |
@ivmarkov Do you have an opinion here? |
@GamerBene19 Oh one more thing: unsafe impl<'d> Send for TempSensorDriver<'d> {} This is necessary so that you can create the driver in one thread and then send it to another (as long as the periph is not mutably borrowed, but owned by the driver). |
First of all a small nit: |
@GamerBene19 @lu-zero I guess from your side this is ready for merge? |
I'm happy with what is done and since I have access to this branch I can close my PR in favor of this one. |
Unfortunately I currently don't have a functioning ESP with which I could test this code. I think it should work given that there were no "real" changes to the logic, but I think it makes sense to test it before merging. Also I'd like to try using #[cfg(esp_idf_soc_temp_sensor_supported)] as it is more future proof, I've just pushed a commit to try it out. |
@lu-zero Can you check the PR on an MCU? |
Checked and seems working at least on the c3 and c6, added an example while at it. Shall we keep or remove the get_kelvin and get_fahrenheit? |
Not sure why I cannot really push on the branch but here is the example used https://github.com/GamerBene19/esp-idf-hal/pull/1 |
Ah, keep them - not so important. Can't see the example in the PR though? |
As far as I can tell you should be able to, you have collaborator access and I don't see an option to explicitly grant you write permissions.
It's here now |
Ah, CI failed. Look at the other examples as to how to build the example only for certain mcus. |
Github does not let me push to that branch... @GamerBene19 pick the amended commit from lu-zero@9ce159f |
Sorry, pick the patch again, forgot to move the use inside the main. |
Thank you both! Merging. |
What the title says. Currently very much WIP. PR created to help give feedback.
Closes #333