8000 Prevent freezing USB during high frequency PulseIn. by tannewt · Pull Request #901 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

Prevent freezing USB during high frequency PulseIn. #901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add code size analysis tool and shrink samd.clock a smidge.
  • Loading branch information
tannewt committed Jun 8, 2018
commit 66b79723b6d238f93908a029ed7a1c4619842b52
10 changes: 1 addition & 9 deletions ports/atmel-samd/bindings/samd/Clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,7 @@
STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in);

mp_printf(print, "%q.%q.%s(", MP_QSTR_samd, MP_QSTR_clock, self->name);
if (clock_get_enabled(self->type, self->index)) {
mp_printf(print, "frequency=%u", clock_get_frequency(self->type, self->index));
uint32_t calibration = clock_get_calibration(self->type, self->index);
if (calibration) {
mp_printf(print, ", calibration=%u", calibration);
}
}
mp_printf(print, ")");
mp_printf(print, "%q.%q.%q", MP_QSTR_samd, MP_QSTR_clock, self->name);
}

//| .. attribute:: enabled
Expand Down
10 changes: 5 additions & 5 deletions ports/atmel-samd/bindings/samd/Clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,39 @@

typedef struct {
mp_obj_base_t base;
const char *name;
qstr name;
uint8_t type;
uint8_t index;
} samd_clock_obj_t;

#define CLOCK(_name, _type, _index) \
const samd_clock_obj_t clock_ ## _name = { \
{ &samd_clock_type }, \
.name = #_name, \
.name = MP_QSTR_ ## _name, \
.type = _type, \
.index = _index, \
}

#define CLOCK_SOURCE(_name) \
const samd_clock_obj_t clock_ ## _name = { \
{ &samd_clock_type }, \
.name = #_name, \
.name = MP_QSTR_ ## _name, \
.type = 0, \
.index = GCLK_SOURCE_ ## _name, \
}

#define CLOCK_GCLK(_name) \
const samd_clock_obj_t clock_ ## _name = { \
{ &samd_clock_type }, \
.name = #_name, \
.name = MP_QSTR_ ## _name, \
.type = 1, \
.index = _name ## _GCLK_ID, \
}

#define CLOCK_GCLK_(_name, _extra) \
const samd_clock_obj_t clock_ ## _name ## _ ## _extra = { \
{ &samd_clock_type }, \
.name = #_name "_" #_extra, \
.name = MP_QSTR_ ## _name ## _ ## _extra, \
.type = 1, \
.index = _name ## _GCLK_ID_ ## _extra, \
}
Expand Down
Loading
0