bug in multplexer address pins

This commit is contained in:
2019-02-19 15:47:46 +01:00
parent a43332e8b5
commit 01e81abdde
6 changed files with 661 additions and 467 deletions
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
[InternetShortcut]
URL=https://docs.platformio.org/page/projectconf/section_platformio.html#build-dir
Binary file not shown.
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1 +1 @@
ff40efac42d76dcfb6ef5cb24bb1f872944d1abf
d53bd8f470f949b5d5179e009803692baf79d4ac
+39 -33
View File
@@ -30,22 +30,28 @@ ShiftRegisterOut shiftRegister(shift_data, shift_clock, shift_latch, MSBFIRST, S
/* keyboard (IN) */
/* Midi links */
//USBDebugMIDI_Interface midiInterface(115200);
USBDebugMIDI_Interface midiInterface(115200);
// Analog potentiometers[] = {
// {multiplexer.pin(4), MIDI_CC::Channel_Volume, 5},
// {multiplexer.pin(5), MIDI_CC::Channel_Volume, 6},
// {multiplexer.pin(6), MIDI_CC::Channel_Volume, 7},
// {multiplexer.pin(7), MIDI_CC::Channel_Volume, 8}
// };
Analog potentiometers[] = {
{multiplexer.pin(0), MIDI_CC::Channel_Volume, 1},
{multiplexer.pin(1), MIDI_CC::Channel_Volume, 2},
{multiplexer.pin(2), MIDI_CC::Channel_Volume, 3},
{multiplexer.pin(3), MIDI_CC::Channel_Volume, 4},
{multiplexer.pin(4), MIDI_CC::Channel_Volume, 5},
{multiplexer.pin(5), MIDI_CC::Channel_Volume, 6},
{multiplexer.pin(6), MIDI_CC::Channel_Volume, 7},
{multiplexer.pin(7), MIDI_CC::Channel_Volume, 8},
{multiplexer.pin(8), MIDI_CC::Channel_Volume, 9},
{multiplexer.pin(9), MIDI_CC::Channel_Volume, 10}
};
bool ref[6*16];
void setup() {
Serial.begin(115200);
while (Serial.available() == 0){
delay(.5 s);
}
// Serial.begin(115200);
// while (Serial.available() == 0){
// delay(.5 s);
// }
for (size_t i = 0; i < KEYBOARD_INSIZE; ++i) {
ExtIO::pinMode(keyboard_in[i], INPUT);
@@ -57,27 +63,27 @@ void setup() {
}
void loop() {
for (size_t i = 0; i < 16; ++i) {
shiftRegister.pin(i);
uint8_t rowValue[KEYBOARD_INSIZE];
bool pressed = false;
for (size_t j = 0; j < 6; ++j) {
if ((rowValue[i] = ExtIO::digitalRead(keyboard_in[j])) == HIGH) {
if (!ref[j * 16 + i]) {
Serial.print("key ");
Serial.print(j * 16 + i);
Serial.print(" pressed (received on pin ");
Serial.print(keyboard_in[j], DEC);
Serial.print(" & emmited on pin ");
Serial.print(i);
Serial.println(")");
ref[j * 16 + i] = true;
}
} else {
ref[j * 16 + i] = false;
}
}
}
// for (size_t i = 0; i < 16; ++i) {
// shiftRegister.pin(i);
// uint8_t rowValue[KEYBOARD_INSIZE];
// bool pressed = false;
// for (size_t j = 0; j < 6; ++j) {
// if ((rowValue[i] = ExtIO::digitalRead(keyboard_in[j])) == HIGH) {
// if (!ref[j * 16 + i]) {
// Serial.print("key ");
// Serial.print(j * 16 + i);
// Serial.print(" pressed (received on pin ");
// Serial.print(keyboard_in[j], DEC);
// Serial.print(" & emmited on pin ");
// Serial.print(i);
// Serial.println(")");
// ref[j * 16 + i] = true;
// }
// } else {
// ref[j * 16 + i] = false;
// }
// }
// }
// for (uint8_t i = 0; i < 8; ++i) {
@@ -102,7 +108,7 @@ void loop() {
// MIDI_Controller.refresh();
MIDI_Controller.refresh();
// lastLoop = millis() - start;
// loopAverage = (loopAverage + lastLoop) / 2;
//delay(.5 s);