Skip to content

Commit 6faff07

Browse files
committed
changes in clang format configuration
1 parent 0d4d070 commit 6faff07

10 files changed

+408
-408
lines changed

.clang-format

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ BinPackArguments: false
88
BinPackParameters: false
99
PenaltyBreakBeforeFirstCallParameter: 0
1010
AllowShortCaseLabelsOnASingleLine: true
11-
AlignConsecutiveAssignments: true
11+
AlignConsecutiveAssignments: Consecutive
12+
AlignConsecutiveDeclarations: Consecutive
1213
SpacesBeforeTrailingComments: 1
1314
AllowAllParametersOfDeclarationOnNextLine: true
1415
AllowShortFunctionsOnASingleLine: All
1516
IndentPPDirectives: AfterHash
1617
AlignAfterOpenBracket: Align
17-
#AllowShortLiteralsOnASingleLine: true

common.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#define MAX_NUM_PAD_INPUTS 5 // a maximum of 5 sensors per pad is supported (where one is rim and one is the sum of three)
2727

2828
inline void update_fifo(const float input,
29-
const int fifo_length,
30-
float* fifo_memory)
29+
const int fifo_length,
30+
float* fifo_memory)
3131
{
3232
// move all values in the history one step back and put new value on the top
3333
for (int i = 0; i < fifo_length - 1; i++)
@@ -37,7 +37,7 @@ inline void update_fifo(const float input,
3737
fifo_memory[fifo_length - 1] = input;
3838
}
3939

40-
inline void allocate_initialize(float** array_memory,
40+
inline void allocate_initialize(float** array_memory,
4141
const int array_length)
4242
{
4343
// (delete and) allocate memory
@@ -79,6 +79,6 @@ class FastWriteFIFO
7979

8080
protected:
8181
float* fifo_memory = nullptr;
82-
int pointer;
83-
int fifo_length;
82+
int pointer;
83+
int fifo_length;
8484
};

edrumulus.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Edrumulus::Edrumulus()
5454
dc_offset_iir_one_minus_gamma = 1.0f - dc_offset_iir_gamma;
5555
}
5656

57-
void Edrumulus::setup(const int conf_num_pads,
57+
void Edrumulus::setup(const int conf_num_pads,
5858
const int* conf_analog_pins,
5959
const int* conf_analog_pins_rim_shot)
6060
{
@@ -437,8 +437,8 @@ void Edrumulus::set_coupled_pad_idx(const int pad_idx, const int new_idx)
437437
}
438438
}
439439

440-
void Edrumulus::cancel_ADC_spikes(float& signal,
441-
int& overload_detected,
440+
void Edrumulus::cancel_ADC_spikes(float& signal,
441+
int& overload_detected,
442442
const int pad_index,
443443
const int input_channel_index,
444444
const int level)

edrumulus.h

+102-102
Large diffs are not rendered by default.

edrumulus.ino

+13-13
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ Edrumulus edrumulus;
6060
const int midi_channel = 10; // default for edrums is 10
6161
const int hihat_pad_idx = 2; // this definition should not be changed
6262
const int hihatctrl_pad_idx = 3; // this definition should not be changed
63-
int number_pads = number_pads4; // initialization value, may be overwritten by get_prototype_pins()
64-
int status_LED_pin = 0; // initialization value, will be set in get_prototype_pins()
65-
bool is_status_LED_on = false; // initialization value
66-
int selected_pad = 0; // initialization value
63+
int number_pads = number_pads4; // initialization value, may be overwritten by get_prototype_pins()
64+
int status_LED_pin = 0; // initialization value, will be set in get_prototype_pins()
65+
bool is_status_LED_on = false; // initialization value
66+
int selected_pad = 0; // initialization value
6767

6868
void setup()
6969
{
7070
// get the pin-to-pad assignments
71-
int* analog_pins = analog_pins4; // initialize with the default setup
72-
int* analog_pins_rimshot = analog_pins_rimshot4; // initialize with the default setup
73-
const int prototype = Edrumulus_hardware::get_prototype_pins(&analog_pins,
71+
int* analog_pins = analog_pins4; // initialize with the default setup
72+
int* analog_pins_rimshot = analog_pins_rimshot4; // initialize with the default setup
73+
const int prototype = Edrumulus_hardware::get_prototype_pins(&analog_pins,
7474
&analog_pins_rimshot,
7575
&number_pads,
7676
&status_LED_pin);
@@ -186,7 +186,7 @@ void loop()
186186
{
187187
// get current MIDI note and velocity (maybe note will be overwritten later on)
188188
const int midi_velocity = edrumulus.get_midi_velocity(pad_idx);
189-
int midi_note = edrumulus.get_midi_note(pad_idx);
189+
int midi_note = edrumulus.get_midi_note(pad_idx);
190190

191191
// send midi positional control message if positional sensing is enabled for the current pad
192192
if (edrumulus.get_pos_sense_is_used(pad_idx))
@@ -198,9 +198,9 @@ void loop()
198198
// send Hi-Hat control message right before each Hi-Hat pad hit
199199
if (pad_idx == hihat_pad_idx)
200200
{
201-
const int midi_ctrl_ch = edrumulus.get_midi_ctrl_ch(hihatctrl_pad_idx);
202-
const int midi_ctrl_value = edrumulus.get_midi_ctrl_value(hihatctrl_pad_idx);
203-
const bool hi_hat_is_open = edrumulus.get_midi_ctrl_is_open(hihatctrl_pad_idx);
201+
const int midi_ctrl_ch = edrumulus.get_midi_ctrl_ch(hihatctrl_pad_idx);
202+
const int midi_ctrl_value = edrumulus.get_midi_ctrl_value(hihatctrl_pad_idx);
203+
const bool hi_hat_is_open = edrumulus.get_midi_ctrl_is_open(hihatctrl_pad_idx);
204204
MYMIDI.sendControlChange(midi_ctrl_ch, midi_ctrl_value, midi_channel);
205205

206206
// if Hi-Hat is open, overwrite MIDI note
@@ -461,8 +461,8 @@ void loop()
461461

462462
#ifdef USE_MIDI
463463
// give feedback to the controller GUI via MIDI Note Off
464-
void confirm_setting(const int controller,
465-
const int value,
464+
void confirm_setting(const int controller,
465+
const int value,
466466
const bool send_all)
467467
{
468468
if (send_all)

hardware.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Edrumulus_hardware::Edrumulus_hardware()
3232

3333
int Edrumulus_hardware::get_prototype_pins(int** analog_pins,
3434
int** analog_pins_rimshot,
35-
int* number_pins,
36-
int* status_LED_pin)
35+
int* number_pins,
36+
int* status_LED_pin)
3737
{
3838
// clang-format off
3939
// analog pins setup: snare | kick | hi-hat | hi-hat-ctrl | crash | tom1 | ride | tom2 | tom3
@@ -50,7 +50,7 @@ int Edrumulus_hardware::get_prototype_pins(int** analog_pins,
5050
void Edrumulus_hardware::setup(const int conf_Fs,
5151
const int number_pads,
5252
const int number_inputs[],
53-
int analog_pin[][MAX_NUM_PAD_INPUTS])
53+
int analog_pin[][MAX_NUM_PAD_INPUTS])
5454
{
5555
// set essential parameters
5656
Fs = conf_Fs;
@@ -96,8 +96,8 @@ void Edrumulus_hardware::setup(const int conf_Fs,
9696
myTimer.begin(on_timer, 1000000 / Fs); // here we define the sampling rate (1 MHz / Fs)
9797
}
9898

99-
void Edrumulus_hardware::write_setting(const int pad_index,
100-
const int address,
99+
void Edrumulus_hardware::write_setting(const int pad_index,
100+
const int address,
101101
const byte value)
102102
{
103103
EEPROM.update(pad_index * MAX_NUM_SET_PER_PAD + address, value);
@@ -117,8 +117,8 @@ void Edrumulus_hardware::on_timer()
117117

118118
void Edrumulus_hardware::capture_samples(const int number_pads,
119119
const int number_inputs[],
120-
int analog_pin[][MAX_NUM_PAD_INPUTS],
121-
int sample_org[][MAX_NUM_PAD_INPUTS])
120+
int analog_pin[][MAX_NUM_PAD_INPUTS],
121+
int sample_org[][MAX_NUM_PAD_INPUTS])
122122
{
123123
// wait for the timer to get the correct sampling rate when reading the analog value
124124
while (!timer_ready) delayMicroseconds(5);
@@ -151,8 +151,8 @@ void Edrumulus_hardware::capture_samples(const int number_pads,
151151

152152
int Edrumulus_hardware::get_prototype_pins(int** analog_pins,
153153
int** analog_pins_rimshot,
154-
int* number_pins,
155-
int* status_LED_pin)
154+
int* number_pins,
155+
int* status_LED_pin)
156156
{
157157
# ifdef CONFIG_IDF_TARGET_ESP32
158158
// Definition:
@@ -226,15 +226,15 @@ int Edrumulus_hardware::get_prototype_pins(int** analog_pins,
226226
void Edrumulus_hardware::setup(const int conf_Fs,
227227
const int number_pads,
228228
const int number_inputs[],
229-
int analog_pin[][MAX_NUM_PAD_INPUTS])
229+
int analog_pin[][MAX_NUM_PAD_INPUTS])
230230
{
231231
// set essential parameters
232232
Fs = conf_Fs;
233233
eeprom_settings.begin((number_pads + 1) * MAX_NUM_SET_PER_PAD); // "+ 1" for pad-independent global settings
234234

235235
// create linear vectors containing the pin/ADC information for each pad and pad-input
236236
bool input_is_used[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
237-
int input_adc[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
237+
int input_adc[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
238238
total_number_inputs = 0; // we use it as a counter, too
239239

240240
for (int i = 0; i < number_pads; i++)
@@ -370,8 +370,8 @@ void IRAM_ATTR Edrumulus_hardware::on_timer()
370370

371371
void Edrumulus_hardware::capture_samples(const int number_pads,
372372
const int number_inputs[],
373-
int analog_pin[][MAX_NUM_PAD_INPUTS],
374-
int sample_org[][MAX_NUM_PAD_INPUTS])
373+
int analog_pin[][MAX_NUM_PAD_INPUTS],
374+
int sample_org[][MAX_NUM_PAD_INPUTS])
375375
{
376376
// wait for the timer to get the correct sampling rate when reading the analog value
377377
if (xSemaphoreTake(timer_semaphore, portMAX_DELAY) == pdTRUE)
@@ -503,8 +503,8 @@ uint16_t Edrumulus_hardware::my_analogRead(const uint8_t pin)
503503

504504
void Edrumulus_hardware::my_analogRead_parallel(const uint32_t channel_adc1_bitval,
505505
const uint32_t channel_adc2_bitval,
506-
uint16_t& out_adc1,
507-
uint16_t& out_adc2)
506+
uint16_t& out_adc1,
507+
uint16_t& out_adc2)
508508
{
509509
# ifdef CONFIG_IDF_TARGET_ESP32
510510
// start ADC1

hardware.h

+31-31
Original file line numberDiff line numberDiff line change
@@ -42,31 +42,31 @@ class Edrumulus_hardware
4242

4343
static int get_prototype_pins(int** analog_pins,
4444
int** analog_pins_rimshot,
45-
int* number_pins,
46-
int* status_LED_pin);
45+
int* number_pins,
46+
int* status_LED_pin);
4747

4848
void setup(const int conf_Fs,
4949
const int number_pads,
5050
const int number_inputs[],
51-
int analog_pin[][MAX_NUM_PAD_INPUTS]);
51+
int analog_pin[][MAX_NUM_PAD_INPUTS]);
5252

5353
void capture_samples(const int number_pads,
5454
const int number_inputs[],
55-
int analog_pin[][MAX_NUM_PAD_INPUTS],
56-
int sample_org[][MAX_NUM_PAD_INPUTS]);
55+
int analog_pin[][MAX_NUM_PAD_INPUTS],
56+
int sample_org[][MAX_NUM_PAD_INPUTS]);
5757

5858
void write_setting(const int pad_index, const int address, const byte value);
5959
byte read_setting(const int pad_index, const int address);
6060

6161
protected:
62-
int Fs;
62+
int Fs;
6363
IntervalTimer myTimer;
64-
static void on_timer();
64+
static void on_timer();
6565
volatile bool timer_ready;
66-
ADC adc_obj;
66+
ADC adc_obj;
6767

68-
int total_number_inputs;
69-
int input_pin[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
68+
int total_number_inputs;
69+
int input_pin[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
7070
uint16_t input_sample[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
7171
};
7272

@@ -96,45 +96,45 @@ class Edrumulus_hardware
9696

9797
static int get_prototype_pins(int** analog_pins,
9898
int** analog_pins_rimshot,
99-
int* number_pins,
100-
int* status_LED_pin);
99+
int* number_pins,
100+
int* status_LED_pin);
101101

102102
void setup(const int conf_Fs,
103103
const int number_pads,
104104
const int number_inputs[],
105-
int analog_pin[][MAX_NUM_PAD_INPUTS]);
105+
int analog_pin[][MAX_NUM_PAD_INPUTS]);
106106

107107
void capture_samples(const int number_pads,
108108
const int number_inputs[],
109-
int analog_pin[][MAX_NUM_PAD_INPUTS],
110-
int sample_org[][MAX_NUM_PAD_INPUTS]);
109+
int analog_pin[][MAX_NUM_PAD_INPUTS],
110+
int sample_org[][MAX_NUM_PAD_INPUTS]);
111111

112112
void write_setting(const int, const int, const byte){}; // not supported
113113
byte read_setting(const int, const int) { return 0; }; // not supported
114114

115115
protected:
116-
int Fs;
117-
EEPROMClass eeprom_settings;
116+
int Fs;
117+
EEPROMClass eeprom_settings;
118118
volatile SemaphoreHandle_t timer_semaphore;
119-
hw_timer_t* timer = nullptr;
120-
static void IRAM_ATTR on_timer();
121-
static void start_timer_core0_task(void* param);
119+
hw_timer_t* timer = nullptr;
120+
static void IRAM_ATTR on_timer();
121+
static void start_timer_core0_task(void* param);
122122

123-
void setup_timer();
124-
void init_my_analogRead();
123+
void setup_timer();
124+
void init_my_analogRead();
125125
uint16_t my_analogRead(const uint8_t pin);
126-
void my_analogRead_parallel(const uint32_t channel_adc1_bitval,
127-
const uint32_t channel_adc2_bitval,
128-
uint16_t& out_adc1,
129-
uint16_t& out_adc2);
126+
void my_analogRead_parallel(const uint32_t channel_adc1_bitval,
127+
const uint32_t channel_adc2_bitval,
128+
uint16_t& out_adc1,
129+
uint16_t& out_adc2);
130130

131-
int total_number_inputs;
132-
int input_pin[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
131+
int total_number_inputs;
132+
int input_pin[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
133133
uint16_t input_sample[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
134134

135-
int num_pin_pairs;
136-
int adc1_index[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
137-
int adc2_index[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
135+
int num_pin_pairs;
136+
int adc1_index[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
137+
int adc2_index[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
138138
uint32_t channel_adc1_bitval[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
139139
uint32_t channel_adc2_bitval[MAX_NUM_PADS * MAX_NUM_PAD_INPUTS];
140140

0 commit comments

Comments
 (0)