I will have an 8x8 switch matrix that's connected to a 16 port I/O expander that's communicated to via I2C. Each switch has a diode attached to it so that when multiple switch closures occur simultaneously there isn't any ghosting. In total there will be 64 switches.
Right now I have just a single uint64_t variable where each bit represents one of the switches. This gets updated once per loop.
In my code I'll want to process events from these switches, but only once per closure and/or release.
The "Bounce" library is basically exactly what I want ... but it's made for directly reading I/O ports rather than through an I2C device (or RAM variable).
What's the best way to implement something like this?
Would I need an array of 64 uint8_t variables to keep track of the state of every switch? That seems like the logical choice, but does consume a chunk of RAM where each would only be keeping track of a few states (around 5 or 6). I can't really think of any way around it though. So that's why I'm here
RAM is there to be used though, so why not? I just hate wasting... don't know why. As an aside: Is there a minimum size of actual RAM used regardless of the type used?
Thanks!
Right now I have just a single uint64_t variable where each bit represents one of the switches. This gets updated once per loop.
In my code I'll want to process events from these switches, but only once per closure and/or release.
The "Bounce" library is basically exactly what I want ... but it's made for directly reading I/O ports rather than through an I2C device (or RAM variable).
What's the best way to implement something like this?
Would I need an array of 64 uint8_t variables to keep track of the state of every switch? That seems like the logical choice, but does consume a chunk of RAM where each would only be keeping track of a few states (around 5 or 6). I can't really think of any way around it though. So that's why I'm here
RAM is there to be used though, so why not? I just hate wasting... don't know why. As an aside: Is there a minimum size of actual RAM used regardless of the type used?
Thanks!