Saturday, January 3, 2015

The GPIO interrupt problem is way over my head

After some more debugging (which means randomly changing things around and seeing what would happen), I think I've been able to show that the problem lies much deeper in the heart of the program than I am able to access and understand.
In the original code, I had it set up to call the interrupts in order from left to right as I'm looking at the breadboard. That code looked like this:
# Label buttons and pins
button = [4, 12, 16, 20, 21]
LED = [22, 5, 6, 13, 19]

I then rearranged it so that it would go through the buttons in the opposite order (leaving button 0 intact):
# Label buttons and pins
button = [4, 21, 20, 16, 12]
LED = [22, 19, 13, 6, 5]

And now the problem is happening with the left-most buttons instead of the right-most buttons. I don't know exactly what this means, but I think it has something to do with memory allocation or something like that. I think that some piece of code that's supposed to be able to point back to main code (before the interrupt is called) isn't pointing where it's supposed to.
Having speculated that this is the problem, I'm not going to pursue fixing it because I really have no idea how that part of the code functions, and I have no interest in learning that right now. This means that my project now needs to go forward without using interrupts. So I'm going to need to spend some time and rethink how I'm going to try to do this by polling the buttons instead.

No comments:

Post a Comment