File tree Expand file tree Collapse file tree 2 files changed +2
-17
lines changed Expand file tree Collapse file tree 2 files changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -283,13 +283,9 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self,
283
283
if (trigger_duration > 0 ) {
284
284
gpio_set_pin_pull_mode (self -> pin , GPIO_PULL_OFF );
285
285
gpio_set_pin_direction (self -> pin , GPIO_DIRECTION_OUT );
286
- if (trigger_duration < 1000 ){ // only disable interrupts for < 1 ms
287
- common_hal_mcu_disable_interrupts ();
288
- }
289
286
gpio_set_pin_level (self -> pin , !self -> idle_state );
290
287
common_hal_mcu_delay_us ((uint32_t )trigger_duration );
291
288
gpio_set_pin_level (self -> pin , self -> idle_state );
292
- common_hal_mcu_enable_interrupts ();
293
289
}
294
290
295
291
// Reconfigure the pin and make sure its set to detect the first edge.
Original file line number Diff line number Diff line change @@ -60,26 +60,15 @@ void tick_delay(uint32_t us) {
60
60
uint32_t ticks_per_us = common_hal_mcu_processor_get_frequency () / 1000 / 1000 ;
61
61
uint32_t us_until_next_tick = SysTick -> VAL / ticks_per_us ;
62
62
uint32_t start_tick ;
63
- while (us > 1000 ) {
64
- // check if interrupts are disabled
65
- if (__get_PRIMASK ())
66
- return ; // if not just return
63
+ while (us > us_until_next_tick ) {
67
64
start_tick = SysTick -> VAL ; // wait for SysTick->VAL to RESET
68
65
while (SysTick -> VAL < start_tick ) {}
69
66
us -= us_until_next_tick ;
70
67
us_until_next_tick = 1000 ;
71
68
}
72
- if (us && ( us < us_until_next_tick ) ){
69
+ if (us ){
73
70
while (SysTick -> VAL > ((us_until_next_tick - us ) * ticks_per_us )) {}
74
71
}
75
- else {
76
- start_tick = SysTick -> VAL ; // wait for SysTick->VAL to RESET
77
- while (SysTick -> VAL < start_tick ) {}
78
- us -= us_until_next_tick ;
79
- if (us ){
80
- while (SysTick -> VAL > ((1000 - us ) * ticks_per_us )) {}
81
- }
82
- }
83
72
}
84
73
85
74
// us counts down!
You can’t perform that action at this time.
0 commit comments