So what is the HT16K33? It's the name of the chip on the LED Matrix Backpack.Â
It's a wonderful chip! Not only is it capable of driving a 16x8 LED Matrix, but reading a pushbutton matrix with a maximum size of 13x3. In fact, this is how HT16K33 is used on the Adafruit Trellis to read the 16 pushbuttons.
The HT16K33 refreshes the LED matrix with a frequency of about 100Hz. In each of the 10ms frame, it first refreshes the display, and then scans the button matrix for the state of every single one of those 13x3=39 buttons. But it's gets more interesting! The HT16K33 does not immediately tell you when any of the buttons is pressed. Instead, it waits for one additional cycle, which is a total of 20ms, to confirm the reading on all the buttons, and store the confirmed readings in its internal registers.Â
It debounces the buttons for you! How cool is that?
So instead of writing code for debouncing the buttons on the Pro Trinket, we can ask the HT16K33 over I2C about the state of all buttons once every 20ms (50Hz). That's exactly what we are doing in this tutorial!
Text editor powered by tinymce.