Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/improve_hardware_config'
Browse files Browse the repository at this point in the history
  • Loading branch information
corrados committed Sep 30, 2023
2 parents 902eb5f + 987faec commit a2fd52f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
29 changes: 19 additions & 10 deletions edrumulus.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@

#define USE_MIDI

// ESP32 default pin definition:
// For older prototypes or custom implementations, simply change the GPIO numbers in the table below
// to match your hardware (note that the GPIO assignment of Prototype 2 is the same as Prototype 4).
// analog pins setup: snare | kick | hi-hat | hi-hat-ctrl | crash | tom1 | ride | tom2 | tom3
static int analog_pins4[] = { 36, 33, 32, 25, 34, 39, 27, 12, 15 };
static int analog_pins_rimshot4[] = { 35, -1, 26, -1, 14, -1, 13, -1, -1 };
const int number_pads4 = sizeof ( analog_pins4 ) / sizeof ( int );


#include "edrumulus.h"

#ifdef USE_MIDI
Expand All @@ -35,21 +44,21 @@ MIDI_CREATE_DEFAULT_INSTANCE();
# endif
#endif

// local variables and defines
Edrumulus edrumulus;
const int midi_channel = 10; // default for edrums is 10
const int hihat_pad_idx = 2;
const int hihatctrl_pad_idx = 3;
int number_pads = 0; // initialization value, will be set in setup()
int status_LED_pin = 0; // initialization value, will be set in setup()
bool is_status_LED_on = false; // initialization value
int selected_pad = 0; // initialization value

const int midi_channel = 10; // default for edrums is 10
const int hihat_pad_idx = 2; // this definition should not be changed
const int hihatctrl_pad_idx = 3; // this definition should not be changed
int number_pads = number_pads4; // initialization value, may be overwritten by get_prototype_pins()
int status_LED_pin = 0; // initialization value, will be set in get_prototype_pins()
bool is_status_LED_on = false; // initialization value
int selected_pad = 0; // initialization value

void setup()
{
// get the pin-to-pad assignments
int* analog_pins = nullptr;
int* analog_pins_rimshot = nullptr;
int* analog_pins = analog_pins4; // initialize with the default setup
int* analog_pins_rimshot = analog_pins_rimshot4; // initialize with the default setup
const int prototype = Edrumulus_hardware::get_prototype_pins ( &analog_pins,
&analog_pins_rimshot,
&number_pads,
Expand Down
14 changes: 2 additions & 12 deletions edrumulus_hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ int Edrumulus_hardware::get_prototype_pins ( int** analog_pins,
int* number_pins,
int* status_LED_pin )
{

// analog pins setup: snare | kick | hi-hat | hi-hat-ctrl | crash | tom1 | ride | tom2 | tom3
static int analog_pins1[] = { 10, 11, 12, 13, 1, 6, 4, 5 };
static int analog_pins_rimshot1[] = { 9, -1, 0, -1, 3, 8, 2, 7 };
Expand Down Expand Up @@ -221,17 +220,8 @@ int Edrumulus_hardware::get_prototype_pins ( int** analog_pins,
}
}

// if no GPIO prototype identification is available, we assume it is Prototype 4,
// for older prototypes or custom implementations, simply change the GPIO numbers in the
// table below to match your hardware (note that the GPIO assignment of Prototype 2 is the
// same as Prototype 4)
// analog pins setup: snare | kick | hi-hat | hi-hat-ctrl | crash | tom1 | ride | tom2 | tom3
static int analog_pins4[] = { 36, 33, 32, 25, 34, 39, 27, 12, 15 };
static int analog_pins_rimshot4[] = { 35, -1, 26, -1, 14, -1, 13, -1, -1 };
*analog_pins = analog_pins4;
*analog_pins_rimshot = analog_pins_rimshot4;
*number_pins = sizeof ( analog_pins4 ) / sizeof ( int );
*status_LED_pin = BOARD_LED_PIN;
// default: assume that analog pins are set outside this function, only update board LED pin
*status_LED_pin = BOARD_LED_PIN;
return 4;
#else // CONFIG_IDF_TARGET_ESP32S3
// analog pins setup: snare | kick | hi-hat | hi-hat-ctrl | crash | tom1 | ride | tom2 | tom3
Expand Down

0 comments on commit a2fd52f

Please sign in to comment.