final re-glue; compiles now.

This commit is contained in:
sommersoft 2019-02-25 21:22:52 -06:00
parent a8204f1bf9
commit 4a9f05a44f
3 changed files with 9 additions and 10 deletions

View File

@ -146,7 +146,8 @@ void frequencyin_reference_tc_init() {
return; return;
} }
#ifdef SAMD21 #ifdef SAMD21
turn_on_clocks(true, reference_tc, 0, TC_HANDLER_FREQUENCYIN); set_timer_handler(reference_tc, dpll_gclk, TC_HANDLER_FREQUENCYIN);
turn_on_clocks(true, reference_tc, 0);
#endif #endif
// use the DPLL we setup so that the reference_tc and freqin_tc(s) // use the DPLL we setup so that the reference_tc and freqin_tc(s)
// are using the same clock frequency. // are using the same clock frequency.
@ -384,7 +385,7 @@ void common_hal_frequencyio_frequencyin_deinit(frequencyio_frequencyin_obj_t* se
if (common_hal_frequencyio_frequencyin_deinited(self)) { if (common_hal_frequencyio_frequencyin_deinited(self)) {
return; return;
} }
reset_pin(self->pin); reset_pin_number(self->pin);
// turn off EIC & EVSYS utilized by this TC // turn off EIC & EVSYS utilized by this TC
disable_event_channel(self->event_channel); disable_event_channel(self->event_channel);
@ -480,11 +481,11 @@ void common_hal_frequencyio_frequencyin_pause(frequencyio_frequencyin_obj_t* sel
#ifdef SAMD21 #ifdef SAMD21
uint32_t masked_value = EIC->EVCTRL.vec.EXTINTEO; uint32_t masked_value = EIC->EVCTRL.vec.EXTINTEO;
EIC->EVCTRL.vec.EXTINTEO = masked_value | (0 << self->channel); EIC->EVCTRL.vec.EXTINTEO = masked_value ^ (1 << self->channel);
#endif #endif
#ifdef SAMD51 #ifdef SAMD51
uint32_t masked_value = EIC->EVCTRL.bit.EXTINTEO; uint32_t masked_value = EIC->EVCTRL.bit.EXTINTEO;
EIC->EVCTRL.bit.EXTINTEO = masked_value | (0 << self->channel); EIC->EVCTRL.bit.EXTINTEO = masked_value ^ (1 << self->channel);
#endif #endif
return; return;
} }

View File

@ -71,20 +71,18 @@
//| frequency.clear() //| frequency.clear()
//| //|
STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size_t n_args, STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size_t n_args,
size_t n_kw, const mp_obj_t *pos_args) { const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_arg_check_num(n_args, n_kw, 1, 2, true); mp_arg_check_num(n_args, kw_args, 1, 1, true);
frequencyio_frequencyin_obj_t *self = m_new_obj(frequencyio_frequencyin_obj_t); frequencyio_frequencyin_obj_t *self = m_new_obj(frequencyio_frequencyin_obj_t);
self->base.type = &frequencyio_frequencyin_type; self->base.type = &frequencyio_frequencyin_type;
mp_map_t kw_args;
mp_map_init_fixed_table(&kw_args, n_kw, pos_args + n_args);
enum { ARG_pin, ARG_capture_period }; enum { ARG_pin, ARG_capture_period };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
{ MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_capture_period, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 10} }, { MP_QSTR_capture_period, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 10} },
}; };
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, &kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
assert_pin(args[ARG_pin].u_obj, false); assert_pin(args[ARG_pin].u_obj, false);
mcu_pin_obj_t* pin = MP_OBJ_TO_PTR(args[ARG_pin].u_obj); mcu_pin_obj_t* pin = MP_OBJ_TO_PTR(args[ARG_pin].u_obj);

View File

@ -1,4 +1,4 @@
frequencyio/* /*
* This file is part of the Micro Python project, http://micropython.org/ * This file is part of the Micro Python project, http://micropython.org/
* *
* The MIT License (MIT) * The MIT License (MIT)