update tick.c (fix LOAD value) update PulseIn.c (do not enable interrupts for trigger_duration > 1000

This commit is contained in:
Jerry Needell 2018-04-17 21:46:15 -04:00
parent e55e06d501
commit e09d95067c
2 changed files with 4 additions and 3 deletions

View File

@ -283,8 +283,9 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self,
if (trigger_duration > 0) {
gpio_set_pin_pull_mode(self->pin, GPIO_PULL_OFF);
gpio_set_pin_direction(self->pin, GPIO_DIRECTION_OUT);
if(trigger_duration < 1000 ){ // only disable interrupts for < 1 ms
common_hal_mcu_disable_interrupts();
}
gpio_set_pin_level(self->pin, !self->idle_state);
common_hal_mcu_delay_us((uint32_t)trigger_duration);
gpio_set_pin_level(self->pin, self->idle_state);

View File

@ -52,7 +52,7 @@ void SysTick_Handler(void) {
void tick_init() {
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);
}