Implementation of RTC continuous synchronization during pulsein
Flags and code to implement RTC continuous synchronization during pulsein
This commit is contained in:
parent
22d67b45f0
commit
94d90742dd
|
@ -125,6 +125,9 @@ void pulsein_interrupt_handler(uint8_t channel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void pulsein_reset() {
|
void pulsein_reset() {
|
||||||
|
#ifdef SAMD21
|
||||||
|
rtc_end_pulsein();
|
||||||
|
#endif
|
||||||
refcount = 0;
|
refcount = 0;
|
||||||
pulsein_tc_index = 0xff;
|
pulsein_tc_index = 0xff;
|
||||||
overflow_count = 0;
|
overflow_count = 0;
|
||||||
|
@ -221,6 +224,10 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self,
|
||||||
|
|
||||||
// Set config will enable the EIC.
|
// Set config will enable the EIC.
|
||||||
pulsein_set_config(self, true);
|
pulsein_set_config(self, true);
|
||||||
|
#ifdef SAMD21
|
||||||
|
rtc_start_pulsein();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) {
|
bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) {
|
||||||
|
@ -231,6 +238,9 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
|
||||||
if (common_hal_pulseio_pulsein_deinited(self)) {
|
if (common_hal_pulseio_pulsein_deinited(self)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#ifdef SAMD21
|
||||||
|
rtc_end_pulsein();
|
||||||
|
#endif
|
||||||
set_eic_handler(self->channel, EIC_HANDLER_NO_INTERRUPT);
|
set_eic_handler(self->channel, EIC_HANDLER_NO_INTERRUPT);
|
||||||
turn_off_eic_channel(self->channel);
|
turn_off_eic_channel(self->channel);
|
||||||
reset_pin_number(self->pin);
|
reset_pin_number(self->pin);
|
||||||
|
|
|
@ -50,5 +50,11 @@ void pulsein_reset(void);
|
||||||
|
|
||||||
void pulsein_interrupt_handler(uint8_t channel);
|
void pulsein_interrupt_handler(uint8_t channel);
|
||||||
void pulsein_timer_interrupt_handler(uint8_t index);
|
void pulsein_timer_interrupt_handler(uint8_t index);
|
||||||
|
#ifdef SAMD21
|
||||||
|
void rtc_set_continuous(void);
|
||||||
|
void rtc_start_pulsein(void);
|
||||||
|
void rtc_end_pulsein(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PULSEIO_PULSEIN_H
|
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PULSEIO_PULSEIN_H
|
||||||
|
|
Loading…
Reference in New Issue