Rework example code, fix bugs and get to compiling state. Also introduce missing logic for the Matrix code to keep track of what column is active.

This commit is contained in:
Anna Rose Wiggins 2021-11-22 20:10:08 +00:00
parent 8ebc1a5523
commit 690afdbce5
18 changed files with 194 additions and 26 deletions

24
Matrix.h Normal file
View file

@ -0,0 +1,24 @@
// A state-keeping class used with MatrixReader. Keeps track of which column is active,
// switches between them.
#ifndef _MATRIX_H_
#define _MATRIX_H_
#include <Arduino.h>
class Matrix {
public:
Matrix(uint8_t *columns, bool inverted=true);
void Activate(uint8_t column);
private:
void _enable(uint8_t pin);
void _disable(uint8_t pin);
uint8_t* columns;
uint8_t active_pin;
uint8_t num_columns;
bool inverted;
};
#endif