#include <AH/STL/bitset>
constexpr uint8_t rows = 10;
constexpr uint8_t columns = 8;
static_assert(rows <= 10, "Error: TC4028 only has 10 outputs");
{1, 2, 3, 4, 5, 6, 7, 8},
{9, 10, 11, 12, 13, 14, 15, 16},
}};
void selectLine(uint8_t line) {
uint8_t mask = 1;
for (pin_t addressPin : addressPins) {
mask <<= 1;
}
}
void setup() {
for (pin_t addressPin : addressPins)
for (pin_t columnPin : columnPins)
}
std::bitset<rows * columns> previousStates;
void loop() {
for (uint8_t row = 0; row < rows; ++row) {
selectLine(row);
for (uint8_t col = 0; col < columns; ++col) {
uint8_t index = row * columns + col;
if (newState != previousStates[index]) {
uint8_t velocity = newState * 0x7F;
midi.sendNoteOn({notes[row][col], channel}, velocity);
previousStates[index] = newState;
}
}
}
midi.update();
}
constexpr PinStatus_t LOW
constexpr PinMode_t INPUT
constexpr PinStatus_t HIGH
constexpr PinMode_t OUTPUT
constexpr Channel Channel_1
The main header file that includes all Control-Surface header files.
Array2D< uint8_t, NumRows, NumCols > AddressMatrix
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
void begin() override
Initialize the shift register.
A type-safe class for MIDI channels.
A class for debug MIDI interfaces sending and receiving human-readable MIDI messages over the USB CDC...
void pinMode(pin_t pin, PinMode_t mode)
An ExtIO version of the Arduino function.
PinStatus_t digitalRead(pin_t pin)
An ExtIO version of the Arduino function.
void digitalWrite(pin_t pin, PinStatus_t val)
An ExtIO version of the Arduino function.