Skip to content

Commit fb80cc4

Browse files
authored
Merge pull request #4692 from jepler/fix-codeformat-subdirs
codeformat: Fix filename matching
2 parents d93a9a1 + 1a52cbc commit fb80cc4

File tree

99 files changed

+2694
-2663
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2694
-2663
lines changed

devices/ble_hci/common-hal/_bleio/PacketBuffer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ mp_int_t common_hal_bleio_packet_buffer_get_outgoing_packet_length(bleio_packet_
245245
bleio_connection_internal_t *connection = bleio_conn_handle_to_connection(self->conn_handle);
246246
if (connection) {
247247
return MIN(MIN(common_hal_bleio_connection_get_max_packet_length(connection),
248-
self->max_packet_size),
249-
self->characteristic->max_length);
248+
self->max_packet_size),
249+
self->characteristic->max_length);
250250
}
251251
}
252252
// There's no current connection, so we don't know the MTU, and

mpy-cross/main.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,22 @@ STATIC int compile_and_save(const char *file, const char *output_file, const cha
7676

7777
STATIC int usage(char **argv) {
7878
printf(
79-
"usage: %s [<opts>] [-X <implopt>] <input filename>\n"
80-
"Options:\n"
81-
"--version : show version information\n"
82-
"-o : output file for compiled bytecode (defaults to input with .mpy extension)\n"
83-
"-s : source filename to embed in the compiled bytecode (defaults to input file)\n"
84-
"-v : verbose (trace various operations); can be multiple\n"
85-
"-O[N] : apply bytecode optimizations of level N\n"
86-
"\n"
87-
"Target specific options:\n"
88-
"-msmall-int-bits=number : set the maximum bits used to encode a small-int\n"
89-
"-mno-unicode : don't support unicode in compiled strings\n"
90-
"-mcache-lookup-bc : cache map lookups in the bytecode\n"
91-
"-march=<arch> : set architecture for native emitter; x86, x64, armv6, armv7m, xtensa\n"
92-
"\n"
93-
"Implementation specific options:\n", argv[0]
94-
);
79+
"usage: %s [<opts>] [-X <implopt>] <input filename>\n"
80+
"Options:\n"
81+
"--version : show version information\n"
82+
"-o : output file for compiled bytecode (defaults to input with .mpy extension)\n"
83+
"-s : source filename to embed in the compiled bytecode (defaults to input file)\n"
84+
"-v : verbose (trace various operations); can be multiple\n"
85+
"-O[N] : apply bytecode optimizations of level N\n"
86+
"\n"
87+
"Target specific options:\n"
88+
"-msmall-int-bits=number : set the maximum bits used to encode a small-int\n"
89+
"-mno-unicode : don't support unicode in compiled strings\n"
90+
"-mcache-lookup-bc : cache map lookups in the bytecode\n"
91+
"-march=<arch> : set architecture for native emitter; x86, x64, armv6, armv7m, xtensa\n"
92+
"\n"
93+
"Implementation specific options:\n", argv[0]
94+
);
9595
int impl_opts_cnt = 0;
9696
printf(
9797
" emit={bytecode,native,viper} -- set the default code emitter\n"

ports/atmel-samd/boards/adafruit_slide_trinkey_m0/pins.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "shared-bindings/board/__init__.h"
22

33
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
4-
//{ MP_ROM_QSTR(MP_QSTR_TOUCH), MP_ROM_PTR(&pin_PA07) },
4+
// { MP_ROM_QSTR(MP_QSTR_TOUCH), MP_ROM_PTR(&pin_PA07) },
55
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA06) },
66
{ MP_ROM_QSTR(MP_QSTR_POTENTIOMETER), MP_ROM_PTR(&pin_PA07) },
77
};

ports/atmel-samd/boards/cp_sapling_m0_revb/mpconfigboard.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#define MICROPY_PORT_B (0)
88
#define MICROPY_PORT_C (0)
99

10-
#define IGNORE_PIN_PA04 1
11-
#define IGNORE_PIN_PA05 1
12-
#define IGNORE_PIN_PA06 1
10+
#define IGNORE_PIN_PA04 1
11+
#define IGNORE_PIN_PA05 1
12+
#define IGNORE_PIN_PA06 1
1313
#define IGNORE_PIN_PA12 1
1414
#define IGNORE_PIN_PA13 1
1515
#define IGNORE_PIN_PA20 1

ports/atmel-samd/common-hal/audioio/AudioOut.c

Lines changed: 60 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
#ifdef SAMD21
5858
static void ramp_value(uint16_t start, uint16_t end) {
5959
start = DAC->DATA.reg;
60-
int32_t diff = (int32_t) end - start;
60+
int32_t diff = (int32_t)end - start;
6161
int32_t step = 49;
6262
int32_t steps = diff / step;
6363
if (diff < 0) {
@@ -76,7 +76,7 @@ static void ramp_value(uint16_t start, uint16_t end) {
7676

7777
#ifdef SAM_D5X_E5X
7878
static void ramp_value(uint16_t start, uint16_t end) {
79-
int32_t diff = (int32_t) end - start;
79+
int32_t diff = (int32_t)end - start;
8080
int32_t step = 49;
8181
int32_t steps = diff / step;
8282
if (diff < 0) {
@@ -102,10 +102,12 @@ void audioout_reset(void) {
102102
return;
103103
#endif
104104
#ifdef SAMD21
105-
while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) {}
105+
while (DAC->STATUS.reg & DAC_STATUS_SYNCBUSY) {
106+
}
106107
#endif
107108
#ifdef SAM_D5X_E5X
108-
while (DAC->SYNCBUSY.reg & DAC_SYNCBUSY_SWRST) {}
109+
while (DAC->SYNCBUSY.reg & DAC_SYNCBUSY_SWRST) {
110+
}
109111
#endif
110112
if (DAC->CTRLA.bit.ENABLE) {
111113
ramp_value(0x8000, 0);
@@ -116,8 +118,8 @@ void audioout_reset(void) {
116118
}
117119

118120
// Caller validates that pins are free.
119-
void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
120-
const mcu_pin_obj_t* left_channel, const mcu_pin_obj_t* right_channel, uint16_t quiescent_value) {
121+
void common_hal_audioio_audioout_construct(audioio_audioout_obj_t *self,
122+
const mcu_pin_obj_t *left_channel, const mcu_pin_obj_t *right_channel, uint16_t quiescent_value) {
121123
#ifdef SAM_D5X_E5X
122124
bool dac_clock_enabled = hri_mclk_get_APBDMASK_DAC_bit(MCLK);
123125
#endif
@@ -174,7 +176,8 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
174176
_gclk_enable_channel(DAC_GCLK_ID, CONF_GCLK_DAC_SRC);
175177

176178
DAC->CTRLA.bit.SWRST = 1;
177-
while (DAC->CTRLA.bit.SWRST == 1) {}
179+
while (DAC->CTRLA.bit.SWRST == 1) {
180+
}
178181
// Make sure there are no outstanding access errors. (Reading DATA can cause this.)
179182
#ifdef SAM_D5X_E5X
180183
PAC->INTFLAGD.reg = PAC_INTFLAGD_DAC;
@@ -191,37 +194,41 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
191194
DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI;
192195
// We disable the voltage pump because we always run at 3.3v.
193196
DAC->CTRLB.reg = DAC_CTRLB_REFSEL_AVCC |
194-
DAC_CTRLB_LEFTADJ |
195-
DAC_CTRLB_EOEN |
196-
DAC_CTRLB_VPD;
197+
DAC_CTRLB_LEFTADJ |
198+
DAC_CTRLB_EOEN |
199+
DAC_CTRLB_VPD;
197200
#endif
198201
#ifdef SAM_D5X_E5X
199202
DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI0;
200203
DAC->DACCTRL[0].reg = DAC_DACCTRL_CCTRL_CC12M |
201-
DAC_DACCTRL_ENABLE |
202-
DAC_DACCTRL_LEFTADJ;
204+
DAC_DACCTRL_ENABLE |
205+
DAC_DACCTRL_LEFTADJ;
203206
DAC->CTRLB.reg = DAC_CTRLB_REFSEL_VREFPU;
204207
#endif
205208
}
206209
#ifdef SAM_D5X_E5X
207210
if (channel1_enabled) {
208211
DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI1;
209212
DAC->DACCTRL[1].reg = DAC_DACCTRL_CCTRL_CC12M |
210-
DAC_DACCTRL_ENABLE |
211-
DAC_DACCTRL_LEFTADJ;
213+
DAC_DACCTRL_ENABLE |
214+
DAC_DACCTRL_LEFTADJ;
212215
DAC->CTRLB.reg = DAC_CTRLB_REFSEL_VREFPU;
213216
}
214217
#endif
215218

216219
// Re-enable the DAC
217220
DAC->CTRLA.bit.ENABLE = 1;
218221
#ifdef SAMD21
219-
while (DAC->STATUS.bit.SYNCBUSY == 1) {}
222+
while (DAC->STATUS.bit.SYNCBUSY == 1) {
223+
}
220224
#endif
221225
#ifdef SAM_D5X_E5X
222-
while (DAC->SYNCBUSY.bit.ENABLE == 1) {}
223-
while (channel0_enabled && DAC->STATUS.bit.READY0 == 0) {}
224-
while (channel1_enabled && DAC->STATUS.bit.READY1 == 0) {}
226+
while (DAC->SYNCBUSY.bit.ENABLE == 1) {
227+
}
228+
while (channel0_enabled && DAC->STATUS.bit.READY0 == 0) {
229+
}
230+
while (channel1_enabled && DAC->STATUS.bit.READY1 == 0) {
231+
}
225232
#endif
226233

227234
// Use a timer to coordinate when DAC conversions occur.
@@ -302,11 +309,11 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
302309
// Leave the DMA setup to playback.
303310
}
304311

305-
bool common_hal_audioio_audioout_deinited(audioio_audioout_obj_t* self) {
312+
bool common_hal_audioio_audioout_deinited(audioio_audioout_obj_t *self) {
306313
return self->left_channel == NULL;
307314
}
308315

309-
void common_hal_audioio_audioout_deinit(audioio_audioout_obj_t* self) {
316+
void common_hal_audioio_audioout_deinit(audioio_audioout_obj_t *self) {
310317
if (common_hal_audioio_audioout_deinited(self)) {
311318
return;
312319
}
@@ -320,10 +327,12 @@ void common_hal_audioio_audioout_deinit(audioio_audioout_obj_t* self) {
320327

321328
DAC->CTRLA.bit.ENABLE = 0;
322329
#ifdef SAMD21
323-
while (DAC->STATUS.bit.SYNCBUSY == 1) {}
330+
while (DAC->STATUS.bit.SYNCBUSY == 1) {
331+
}
324332
#endif
325333
#ifdef SAM_D5X_E5X
326-
while (DAC->SYNCBUSY.bit.ENABLE == 1) {}
334+
while (DAC->SYNCBUSY.bit.ENABLE == 1) {
335+
}
327336
#endif
328337

329338
disable_event_channel(self->tc_to_dac_event_channel);
@@ -338,7 +347,7 @@ void common_hal_audioio_audioout_deinit(audioio_audioout_obj_t* self) {
338347
#endif
339348
}
340349

341-
static void set_timer_frequency(Tc* timer, uint32_t frequency) {
350+
static void set_timer_frequency(Tc *timer, uint32_t frequency) {
342351
uint32_t system_clock = 48000000;
343352
uint32_t new_top;
344353
uint8_t new_divisor;
@@ -359,8 +368,8 @@ static void set_timer_frequency(Tc* timer, uint32_t frequency) {
359368
tc_wait_for_sync(timer);
360369
}
361370

362-
void common_hal_audioio_audioout_play(audioio_audioout_obj_t* self,
363-
mp_obj_t sample, bool loop) {
371+
void common_hal_audioio_audioout_play(audioio_audioout_obj_t *self,
372+
mp_obj_t sample, bool loop) {
364373
if (common_hal_audioio_audioout_get_playing(self)) {
365374
common_hal_audioio_audioout_stop(self);
366375
}
@@ -377,40 +386,40 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t* self,
377386
}
378387
#ifdef SAMD21
379388
result = audio_dma_setup_playback(&self->left_dma, sample, loop, true, 0,
380-
false /* output unsigned */,
381-
(uint32_t) &DAC->DATABUF.reg,
382-
DAC_DMAC_ID_EMPTY);
389+
false /* output unsigned */,
390+
(uint32_t)&DAC->DATABUF.reg,
391+
DAC_DMAC_ID_EMPTY);
383392
#endif
384393

385394
#ifdef SAM_D5X_E5X
386-
uint32_t left_channel_reg = (uint32_t) &DAC->DATABUF[0].reg;
395+
uint32_t left_channel_reg = (uint32_t)&DAC->DATABUF[0].reg;
387396
uint8_t tc_trig_id = TC0_DMAC_ID_OVF + 3 * self->tc_index;
388397
uint8_t left_channel_trigger = tc_trig_id;
389398
uint32_t right_channel_reg = 0;
390399
uint8_t right_channel_trigger = tc_trig_id;
391400
if (self->left_channel == &pin_PA05) {
392-
left_channel_reg = (uint32_t) &DAC->DATABUF[1].reg;
401+
left_channel_reg = (uint32_t)&DAC->DATABUF[1].reg;
393402
} else if (self->right_channel == &pin_PA05) {
394-
right_channel_reg = (uint32_t) &DAC->DATABUF[1].reg;
403+
right_channel_reg = (uint32_t)&DAC->DATABUF[1].reg;
395404
}
396405
if (self->right_channel == &pin_PA02) {
397-
right_channel_reg = (uint32_t) &DAC->DATABUF[0].reg;
406+
right_channel_reg = (uint32_t)&DAC->DATABUF[0].reg;
398407
}
399-
if(right_channel_reg == left_channel_reg + 2 && audiosample_bits_per_sample(sample) == 16) {
408+
if (right_channel_reg == left_channel_reg + 2 && audiosample_bits_per_sample(sample) == 16) {
400409
result = audio_dma_setup_playback(&self->left_dma, sample, loop, false, 0,
401-
false /* output unsigned */,
402-
left_channel_reg,
403-
left_channel_trigger);
410+
false /* output unsigned */,
411+
left_channel_reg,
412+
left_channel_trigger);
404413
} else {
405414
result = audio_dma_setup_playback(&self->left_dma, sample, loop, true, 0,
406-
false /* output unsigned */,
407-
left_channel_reg,
408-
left_channel_trigger);
415+
false /* output unsigned */,
416+
left_channel_reg,
417+
left_channel_trigger);
409418
if (right_channel_reg != 0 && result == AUDIO_DMA_OK) {
410419
result = audio_dma_setup_playback(&self->right_dma, sample, loop, true, 1,
411-
false /* output unsigned */,
412-
right_channel_reg,
413-
right_channel_trigger);
420+
false /* output unsigned */,
421+
right_channel_reg,
422+
right_channel_trigger);
414423
}
415424
}
416425
#endif
@@ -425,21 +434,22 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t* self,
425434
mp_raise_RuntimeError(translate("Unable to allocate buffers for signed conversion"));
426435
}
427436
}
428-
Tc* timer = tc_insts[self->tc_index];
437+
Tc *timer = tc_insts[self->tc_index];
429438
set_timer_frequency(timer, audiosample_sample_rate(sample));
430439
timer->COUNT16.CTRLBSET.reg = TC_CTRLBSET_CMD_RETRIGGER;
431-
while (timer->COUNT16.STATUS.bit.STOP == 1) {}
440+
while (timer->COUNT16.STATUS.bit.STOP == 1) {
441+
}
432442
self->playing = true;
433443
}
434444

435-
void common_hal_audioio_audioout_pause(audioio_audioout_obj_t* self) {
445+
void common_hal_audioio_audioout_pause(audioio_audioout_obj_t *self) {
436446
audio_dma_pause(&self->left_dma);
437447
#ifdef SAM_D5X_E5X
438448
audio_dma_pause(&self->right_dma);
439449
#endif
440450
}
441451

442-
void common_hal_audioio_audioout_resume(audioio_audioout_obj_t* self) {
452+
void common_hal_audioio_audioout_resume(audioio_audioout_obj_t *self) {
443453
// Clear any overrun/underrun errors
444454
#ifdef SAMD21
445455
DAC->INTFLAG.reg = DAC_INTFLAG_UNDERRUN;
@@ -454,12 +464,12 @@ void common_hal_audioio_audioout_resume(audioio_audioout_obj_t* self) {
454464
#endif
455465
}
456466

457-
bool common_hal_audioio_audioout_get_paused(audioio_audioout_obj_t* self) {
467+
bool common_hal_audioio_audioout_get_paused(audioio_audioout_obj_t *self) {
458468
return audio_dma_get_paused(&self->left_dma);
459469
}
460470

461-
void common_hal_audioio_audioout_stop(audioio_audioout_obj_t* self) {
462-
Tc* timer = tc_insts[self->tc_index];
471+
void common_hal_audioio_audioout_stop(audioio_audioout_obj_t *self) {
472+
Tc *timer = tc_insts[self->tc_index];
463473
timer->COUNT16.CTRLBSET.reg = TC_CTRLBSET_CMD_STOP;
464474
audio_dma_stop(&self->left_dma);
465475
#ifdef SAM_D5X_E5X
@@ -470,7 +480,7 @@ void common_hal_audioio_audioout_stop(audioio_audioout_obj_t* self) {
470480
ramp_value(self->quiescent_value, self->quiescent_value);
471481
}
472482

473-
bool common_hal_audioio_audioout_get_playing(audioio_audioout_obj_t* self) {
483+
bool common_hal_audioio_audioout_get_playing(audioio_audioout_obj_t *self) {
474484
bool now_playing = audio_dma_get_playing(&self->left_dma);
475485
if (self->playing && !now_playing) {
476486
common_hal_audioio_audioout_stop(self);

0 commit comments

Comments
 (0)