9 template <u
int8_t nb_rows, u
int8_t nb_cols>
12 : rowPins(rowPins), colPins(colPins) {
16 template <u
int8_t nb_rows, u
int8_t nb_cols>
18 unsigned long now = millis();
24 for (
size_t row = 0; row < nb_rows; row++) {
26 for (
size_t col = 0; col < nb_cols; col++) {
28 if (state != getPrevState(col, row)) {
31 onButtonChanged(row, col, state);
32 setPrevState(col, row, state);
40 template <u
int8_t nb_rows, u
int8_t nb_cols>
44 for (
const pin_t &colPin : colPins)
47 for (
const pin_t &rowPin : rowPins)
51 template <u
int8_t nb_rows, u
int8_t nb_cols>
55 return col * nb_rows + row;
58 template <u
int8_t nb_rows, u
int8_t nb_cols>
63 template <u
int8_t nb_rows, u
int8_t nb_cols>
65 return 1 << (bits & 7);
68 template <u
int8_t nb_rows, u
int8_t nb_cols>
70 uint8_t bits = positionToBits(col, row);
71 return !!(prevStates[bitsToIndex(bits)] & bitsToBitmask(bits));
74 template <u
int8_t nb_rows, u
int8_t nb_cols>
77 uint8_t bits = positionToBits(col, row);
79 prevStates[bitsToIndex(bits)] |= bitsToBitmask(bits);
81 prevStates[bitsToIndex(bits)] &= ~bitsToBitmask(bits);