diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt index c1774c2..ce0b6a3 100644 --- a/firmware/CMakeLists.txt +++ b/firmware/CMakeLists.txt @@ -30,4 +30,4 @@ add_custom_target( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) -add_executable(Z_DUMMY_TARGET ${SRC_LIST} src/macros.h) +add_executable(Z_DUMMY_TARGET ${SRC_LIST} src/macros.h src/config.h) diff --git a/firmware/src/config.h b/firmware/src/config.h new file mode 100644 index 0000000..424a98b --- /dev/null +++ b/firmware/src/config.h @@ -0,0 +1,38 @@ +#ifndef FIRMWARE_CONFIG_H +#define FIRMWARE_CONFIG_H + +// ======================================== +// Configuration +// ======================================== + +// 4 1:16 Multiplexers: GPIO pins for each analog multiplexer that handles 12 sensors of an octave +// Notes are connected in order: Mux #1 (0-11), Mux #2 (12-23), Mux #3 (24-35), Mux #4 (36-47), Mux #5 (48-59) +const int NUM_MUX = 5; +const int PINS_PER_MUX = 12; +const int MUX_IN[NUM_MUX] = {34, 34, 35, 34, 34}; // Analog signal input + +// Select pins for every multiplexer, each multiplexer has 4 select pins, all sel0 are connected to 14, etc. +const int NUM_MUX_SEL = 4; +const int MUX_SEL_OUT[NUM_MUX_SEL] = {14, 27, 16, 17}; + +// 3 1:8 Multiplexers for the midi panel +const int P_NUM_MUX = 3; +const int P_PINS_PER_MUX = 8; +const int P_BUTTON_MUX_IN[P_NUM_MUX] = {-1, -1}; // Digital signal inputs for button multiplexers +const int P_KNOB_MUX_IN = -1; // Analog signal inputs for potentiometer + +// Select pins for every multiplexer, each multiplexer has 3 select pins +const int P_NUM_MUX_SEL = 3; +const int P_MUX_SEL_OUT[P_NUM_MUX_SEL] = {-1, -1, -1}; + +// Rotary encoder pins +const int P_NUM_ROTARY = 4; +const int P_ROTARY_A[P_NUM_ROTARY] = {-1, -1, -1, -1}; +const int P_ROTARY_B[P_NUM_ROTARY] = {-1, -1, -1, -1}; + +// LED light strips +const int P_LED_BTN = -1; +const int P_LED_KNOB = -1; +const int P_LED_ROTARY = -1; + +#endif //FIRMWARE_CONFIG_H \ No newline at end of file diff --git a/firmware/src/main.cpp b/firmware/src/main.cpp index bfc0d48..c2fbbde 100644 --- a/firmware/src/main.cpp +++ b/firmware/src/main.cpp @@ -2,40 +2,7 @@ #include #include #include "macros.h" - -// ======================================== -// Configuration -// ======================================== - -// 4 1:16 Multiplexers: GPIO pins for each analog multiplexer that handles 12 sensors of an octave -// Notes are connected in order: Mux #1 (0-11), Mux #2 (12-23), Mux #3 (24-35), Mux #4 (36-47), Mux #5 (48-59) -const int NUM_MUX = 5; -const int PINS_PER_MUX = 12; -const int MUX_IN[NUM_MUX] = {34, 34, 35, 34, 34}; // Analog signal input - -// Select pins for every multiplexer, each multiplexer has 4 select pins, all sel0 are connected to 14, etc. -const int NUM_MUX_SEL = 4; -const int MUX_SEL_OUT[NUM_MUX_SEL] = {14, 27, 16, 17}; - -// 3 1:8 Multiplexers for the midi panel -const int P_NUM_MUX = 3; -const int P_PINS_PER_MUX = 8; -const int P_BUTTON_MUX_IN[P_NUM_MUX] = {-1, -1}; // Digital signal inputs for button multiplexers -const int P_KNOB_MUX_IN = -1; // Analog signal inputs for potentiometer - -// Select pins for every multiplexer, each multiplexer has 3 select pins -const int P_NUM_MUX_SEL = 3; -const int P_MUX_SEL_OUT[P_NUM_MUX_SEL] = {-1, -1, -1}; - -// Rotary encoder pins -const int P_NUM_ROTARY = 4; -const int P_ROTARY_A[P_NUM_ROTARY] = {-1, -1, -1, -1}; -const int P_ROTARY_B[P_NUM_ROTARY] = {-1, -1, -1, -1}; - -// LED light strips -const int P_LED_BTN = -1; -const int P_LED_KNOB = -1; -const int P_LED_ROTARY = -1; +#include "config.h" // ======================================== // Code