arduino-joystick/Matrix.h

25 lines
447 B
C
Raw Normal View History

// 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