diff --git a/.gitignore b/.gitignore index 3060fee..9a254d5 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,6 @@ dkms.conf .vscode/ipch .vscode *.code-workspace + +# Libreoffice +.~lock.* \ No newline at end of file diff --git a/res/doc/buttonMatrixMap.ods b/res/doc/buttonMatrixMap.ods index 4a7e9b4..63e26e3 100644 Binary files a/res/doc/buttonMatrixMap.ods and b/res/doc/buttonMatrixMap.ods differ diff --git a/src/main.cpp b/src/main.cpp index 0023f94..e05d7af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -47,40 +47,41 @@ CD74HC4067 multiplexer{mux_sig, mux_addr, mux_en}; /* keyboard (IN) */ CCPotentiometer potentiometers[] = { - {multiplexer.pin(0), {1, channel}}, - {multiplexer.pin(1), {2, channel}}, - {multiplexer.pin(2), {3, channel}}, - {multiplexer.pin(3), {4, channel}}, - {multiplexer.pin(4), {5, channel}}, - {multiplexer.pin(5), {6, channel}}, - {multiplexer.pin(6), {7, channel}}, - {multiplexer.pin(7), {8, channel}}, - {multiplexer.pin(8), {9, channel}}, - {multiplexer.pin(9), {10, channel}}, + {multiplexer.pin(0), {1, channel}}, + {multiplexer.pin(1), {2, channel}}, + {multiplexer.pin(2), {3, channel}}, + {multiplexer.pin(3), {4, channel}}, + {multiplexer.pin(4), {5, channel}}, + {multiplexer.pin(5), {6, channel}}, + {multiplexer.pin(6), {7, channel}}, + {multiplexer.pin(7), {8, channel}}, + {multiplexer.pin(8), {9, channel}}, + {multiplexer.pin(9), {10, channel}}, }; byte matrix[16][6][2] = { -/* 0 | 1 | 2 | 3 | 4 | 5 */ -/*0*/ {{1, 0}, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}}, -/*1*/ {{1, 6}, {1, 7}, {1, 8}, {1, 9}, {1, 10}, {1, 11}}, -/*2*/ {{1, 18}, {1, 19}, {1, 20}, {1, 21}, {1, 22}, {1, 23}}, -/*3*/ {{1, 48}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, -/*4*/ {{1, 42}, {1, 43}, {1, 44}, {1, 45}, {1, 46}, {1, 47}}, -/*5*/ {{1, 36}, {1, 37}, {1, 38}, {1, 39}, {1, 40}, {1, 41}}, -/*6*/ {{1, 30}, {1, 31}, {1, 32}, {1, 33}, {1, 34}, {1, 35}}, -/*7*/ {{1, 24}, {1, 25}, {1, 26}, {1, 27}, {1, 28}, {1, 29}}, -/*8*/ {{1, 12}, {1, 13}, {1, 14}, {1, 15}, {1, 16}, {1, 17}}, -/*a*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, -/*b*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, -/*c*/ {{2, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, -/*d*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, -/*e*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, -/*f*/ {{2, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + /* 0 | 1 | 2 | 3 | 4 | 5 */ + /*0*/ {{1, 0}, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}}, + /*1*/ {{1, 6}, {1, 7}, {1, 8}, {1, 9}, {1, 10}, {1, 11}}, + /*2*/ {{1, 18}, {1, 19}, {1, 20}, {1, 21}, {1, 22}, {1, 23}}, + /*3*/ {{1, 48}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + /*4*/ {{1, 42}, {1, 43}, {1, 44}, {1, 45}, {1, 46}, {1, 47}}, + /*5*/ {{1, 36}, {1, 37}, {1, 38}, {1, 39}, {1, 40}, {1, 41}}, + /*6*/ {{1, 30}, {1, 31}, {1, 32}, {1, 33}, {1, 34}, {1, 35}}, + /*7*/ {{1, 24}, {1, 25}, {1, 26}, {1, 27}, {1, 28}, {1, 29}}, + /*8*/ {{1, 12}, {1, 13}, {1, 14}, {1, 15}, {1, 16}, {1, 17}}, + /*9*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + /*a*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + /*b*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + /*c*/ {{2, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + /*d*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + /*e*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, + /*f*/ {{2, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, }; bool ref[16][6] = {{false}}; -unsigned char shift = 0; +unsigned char shift = 12; void setup() { for (size_t i = 0; i < KEYBOARD_INSIZE; ++i) { @@ -128,13 +129,16 @@ void button_matrix_mgt(void) { #ifndef DEBUG_MATRIX byte type = matrix[i][j][0]; byte key = matrix[i][j][1]; +#ifdef __PLATFORMIO_BUILD_DEBUG__ + midi.sendNoteOn({type, CHANNEL_3}, key); +#endif /* __PLATFORMIO_BUILD_DEBUG__ */ if (type == 1) { midi.sendNoteOn({key + shift, channel}, NOTE_VELOCITY); } else if (type == 2) { - // todo : note off + // todo : note off if (key == 0 && shift >= 12) { shift -= 12; - } else if (key == 1 && shift <= 0xFF - 47 - 12) { + } else if (key == 1 && shift <= 6 * 12) { shift += 12; } } @@ -164,8 +168,7 @@ void capa_sensor_mgt(void) { int static lasttouched; int currtouched = capa_sensor.touched(); - for (uint8_t i = 0; i < 12; i++) - { + for (uint8_t i = 0; i < 12; i++) { // it if *is* touched and *wasnt* touched before, alert! if ((currtouched & _BV(i)) && !(lasttouched & _BV(i))) { midi.sendCC({i, channel}, ON);