washed / drempelbox

0 stars 0 forks source link

On the way to using interrupts #32

Open tmh-alex opened 4 months ago

tmh-alex commented 4 months ago

@washed I started on the interrupts and ofc I ran into problems. Maybe you can point me to how to move on...?

Multiple problems here:

I could just adapt the existing implementation to use poll_interrupt, using set_async_interrupt, however, is more educational :)

washed commented 4 months ago

@tmh-alex i pushed a possible way out of some of the issues to this branch. I couldn't test it because i can't access the hardware at the moment. But basically:

not tested!

tmh-alex commented 4 months ago

@washed Thanks for the inputs! I'm afraid it doesn't work though. Moving pin into the struct was one of my attempts as well. At least I now learned more about move.

tmh-alex commented 4 months ago

@washed If you don't mind, may I ask you to open a new branch on top of this one for your changes just like you did on the volume buttons PR? I would like to push through with my own attempts here while following your hints and suggestions (like the debounce crate, nice one). Thanks :slightly_smiling_face:

washed commented 4 months ago

Okay, you can try putting the pin into an Rc or Arc (make sure to clone it once to increment the reference counter), if the issue is the pin getting dropped.

Sorry for pushing on your branch, I was in a hurry. Will fix later.