Skip to content

Commit cb39bfc

Browse files
authored
Merge pull request adafruit#625 from tannewt/pulseio3
Re-enable pulseio for SAMD21 and SAMD51
2 parents fb5f653 + a2b18b7 commit cb39bfc

15 files changed

Lines changed: 1123 additions & 527 deletions

File tree

main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,17 @@ bool start_mp(safe_mode_t safe_mode) {
146146
const char *supported_filenames[] = STRING_LIST("code.txt", "code.py", "main.py", "main.txt");
147147
const char *double_extension_filenames[] = STRING_LIST("code.txt.py", "code.py.txt", "code.txt.txt","code.py.py",
148148
"main.txt.py", "main.py.txt", "main.txt.txt","main.py.py");
149+
reset_mp();
149150
found_main = maybe_run_list(supported_filenames, &result);
150151
if (!found_main){
151152
found_main = maybe_run_list(double_extension_filenames, &result);
152153
if (found_main) {
153154
serial_write(MSG_DOUBLE_FILE_EXTENSION);
154155
}
155156
}
157+
158+
reset_port();
159+
reset_board();
156160
reset_status_led();
157161

158162
if (result.return_code & PYEXEC_FORCED_EXIT) {
@@ -296,6 +300,7 @@ int __attribute__((used)) main(void) {
296300
bool first_run = true;
297301
for (;;) {
298302
if (!skip_repl) {
303+
reset_mp();
299304
autoreload_suspend();
300305
new_status_color(REPL_RUNNING);
301306
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
@@ -306,17 +311,13 @@ int __attribute__((used)) main(void) {
306311
autoreload_resume();
307312
reset_port();
308313
reset_board();
309-
reset_mp();
310314
}
311315
if (exit_code == PYEXEC_FORCED_EXIT) {
312316
if (!first_run) {
313317
serial_write(MSG_SOFT_REBOOT MSG_NEWLINE);
314318
}
315319
first_run = false;
316320
skip_repl = start_mp(safe_mode);
317-
reset_port();
318-
reset_board();
319-
reset_mp();
320321
} else if (exit_code != 0) {
321322
break;
322323
}

ports/atmel-samd/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ SRC_ASF := \
188188
hpl/rtc/hpl_rtc.c \
189189
hpl/sercom/hpl_sercom.c \
190190
hpl/systick/hpl_systick.c \
191-
hpl/tc/hpl_tc.c \
192191
hpl/usb/hpl_usb.c \
193192
usb/class/cdc/device/cdcdf_acm.c \
194193
usb/class/msc/device/mscdf.c \
@@ -227,6 +226,7 @@ SRC_C = \
227226
peripherals.c \
228227
$(CHIP_FAMILY)_pins.c \
229228
tick.c \
229+
timers.c \
230230
usb.c \
231231
usb_mass_storage.c \
232232
boards/$(BOARD)/board.c \
@@ -272,17 +272,17 @@ SRC_COMMON_HAL = \
272272
analogio/__init__.c \
273273
analogio/AnalogIn.c \
274274
analogio/AnalogOut.c \
275+
pulseio/__init__.c \
276+
pulseio/PulseIn.c \
277+
pulseio/PulseOut.c \
278+
pulseio/PWMOut.c \
275279
# audiobusio/__init__.c \
276280
audiobusio/PDMIn.c \
277281
audioio/__init__.c \
278282
audioio/AudioOut.c \
279283
busio/UART.c \
280284
nvm/__init__.c \
281285
nvm/ByteArray.c \
282-
pulseio/__init__.c \
283-
pulseio/PulseIn.c \
284-
pulseio/PulseOut.c \
285-
pulseio/PWMOut.c \
286286
touchio/__init__.c \
287287
touchio/TouchIn.c \
288288
usb_hid/__init__.c \

ports/atmel-samd/common-hal/microcontroller/Pin.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,9 @@ typedef struct {
4040
} pin_sercom_t;
4141

4242
typedef struct {
43-
union {
44-
Tc *const tc;
45-
Tcc *const tcc;
46-
};
47-
#ifdef SAMD21
43+
uint8_t index;
4844
bool is_tc:1;
49-
#endif
50-
uint8_t wave_output:4;
45+
uint8_t wave_output:7;
5146
} pin_timer_t;
5247

5348
#ifdef SAMD21

0 commit comments

Comments
 (0)