update tick.c (fix LOAD value) update PulseIn.c (do not enable interrupts for trigger_duration > 1000
This commit is contained in:
parent
e55e06d501
commit
e09d95067c
|
@ -283,8 +283,9 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self,
|
||||||
if (trigger_duration > 0) {
|
if (trigger_duration > 0) {
|
||||||
gpio_set_pin_pull_mode(self->pin, GPIO_PULL_OFF);
|
gpio_set_pin_pull_mode(self->pin, GPIO_PULL_OFF);
|
||||||
gpio_set_pin_direction(self->pin, GPIO_DIRECTION_OUT);
|
gpio_set_pin_direction(self->pin, GPIO_DIRECTION_OUT);
|
||||||
|
if(trigger_duration < 1000 ){ // only disable interrupts for < 1 ms
|
||||||
common_hal_mcu_disable_interrupts();
|
common_hal_mcu_disable_interrupts();
|
||||||
|
}
|
||||||
gpio_set_pin_level(self->pin, !self->idle_state);
|
gpio_set_pin_level(self->pin, !self->idle_state);
|
||||||
common_hal_mcu_delay_us((uint32_t)trigger_duration);
|
common_hal_mcu_delay_us((uint32_t)trigger_duration);
|
||||||
gpio_set_pin_level(self->pin, self->idle_state);
|
gpio_set_pin_level(self->pin, self->idle_state);
|
||||||
|
|
|
@ -52,7 +52,7 @@ void SysTick_Handler(void) {
|
||||||
|
|
||||||
void tick_init() {
|
void tick_init() {
|
||||||
uint32_t ticks_per_ms = common_hal_mcu_processor_get_frequency() / 1000;
|
uint32_t ticks_per_ms = common_hal_mcu_processor_get_frequency() / 1000;
|
||||||
SysTick_Config(ticks_per_ms);
|
SysTick_Config(ticks_per_ms-1);
|
||||||
NVIC_EnableIRQ(SysTick_IRQn);
|
NVIC_EnableIRQ(SysTick_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue