File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
ports/esp8266/common-hal/pulseio Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self,
9191 self -> len = 0 ;
9292 self -> first_edge = true;
9393 self -> last_us = 0 ;
94+ self -> paused = false;
9495
9596 microcontroller_pin_register_intr_handler (self -> pin -> gpio_number ,
9697 pulseio_pulsein_interrupt_handler , (void * )self );
@@ -111,6 +112,7 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
111112
112113void common_hal_pulseio_pulsein_pause (pulseio_pulsein_obj_t * self ) {
113114 pulsein_set_interrupt (self , false, false);
115+ self -> paused = true;
114116}
115117
116118void common_hal_pulseio_pulsein_resume (pulseio_pulsein_obj_t * self ,
@@ -133,6 +135,7 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self,
133135 self -> first_edge = true;
134136 pulsein_set_interrupt (self , !self -> idle_state , self -> idle_state );
135137 common_hal_mcu_enable_interrupts ();
138+ self -> paused = false;
136139}
137140
138141void common_hal_pulseio_pulsein_clear (pulseio_pulsein_obj_t * self ) {
@@ -160,7 +163,7 @@ uint16_t common_hal_pulseio_pulsein_get_maxlen(pulseio_pulsein_obj_t* self) {
160163}
161164
162165bool common_hal_pulseio_pulsein_get_paused (pulseio_pulsein_obj_t * self ) {
163- return false ;
166+ return self -> paused ;
164167}
165168
166169uint16_t common_hal_pulseio_pulsein_get_len (pulseio_pulsein_obj_t * self ) {
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ typedef struct {
3636 uint16_t * buffer ;
3737 uint16_t maxlen ;
3838 bool idle_state ;
39+ bool paused ;
3940 volatile uint16_t start ;
4041 volatile uint16_t len ;
4142 volatile bool first_edge ;
You can’t perform that action at this time.
0 commit comments