Hi!
I have a really simple project that I need to do and I need some help.
I switched from Arduino to ARM (using chips from STM and Nordic) years ago but I had a bunch of unused Attiny85s laying around and since the project is pretty simple I said why not.
My project is a battery powered device that has a single switch as an input. When the switch is pressed the device needs to do some stuff, then wait a specific amount of time (not always the same - but around 5 minutes max) then after that do some other stuff. Then return back to sleep. If at any time the switch is released it should just return back to sleep (without completing the final task).
My idea is to basically sleep the CPU until I get an interrupt from the switch. And also sleep the CPU when waiting for the time to pass. But I can't figure out how to do that.
I've seen quite a bit of code floating around that does either sleeping x amount of time or reading an external interrupt. But never both. Most of that code is also writing some bits in some registers directly and I have no idea what some of them do.
Any help on how to achieve this will be greatly appreciated.
I must say this though... SDKs for ARM chips from STM and Nordic make stuff like this really easy and the resulting code much more readable than this magic that people use with AVRs.