I'm building a system that should be able to hibernate for hours/days/weeks at a time and wake up on a low-voltage input from a sensor, and given the example project "Enter Hibernate Mode and Wakeup Using PICU" it looks like I should be able to do that. I've even changed the example project pinout to interface with my sensors, and I can get it to enter/exit hibernate mode with them.
My only problem is that I just CANNOT figure out how this code works. I'm pretty good with C, less so with this entire embedded system IDE. In the example project, FLAG_HIBERNATE is initially set to 0, and then in the project's while(1) loop, it will enter hibernate mode if FLAG_HIBERNATE is non-zero. But I just don't see where that happens. Can someone explain this?
Curiously, when I just copy-pasted everything from the example project into a new one, *BOTH* of my pins -- the one I have assigned to the hibernate pin connected to the hibernate interrupt, as well as the one assigned to the wakeup pin connected to the wakeup interrupt -- seem to put the device into hibernate mode, and neither will wake it up. I'm sure there's some interrupt target configuration, or something, somewhere, that I'm missing, but I can't find it.
Any help would be greatly appreciated!
Edit: and a bonus question; when I program the example project onto a CY8CKIT-001, the "PSoC development kit," it works as intended. However, when I program it onto a
CY8CKIT-014 PSoC 5 FirstTouch Starter Kit, and change the hibernate pin to line up with the FirstTouch's lone button (15_3 or something, I believe), it won't register the hibernate button press. My assumption is that this is because the FirstTouch's button uses a slightly different system (maybe a voltage drop instead of voltage spike? I don't know; I don't have a circuits background), but can anyone tell me how it is different and what I would need to do to overcome that? OR even better, could someone point me towards where I can find the specifications for the buttons on each board? I've looked through the documentation that came with them and can't seem to find anything pertinent.