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,
91
91
self -> len = 0 ;
92
92
self -> first_edge = true;
93
93
self -> last_us = 0 ;
94
+ self -> paused = false;
94
95
95
96
microcontroller_pin_register_intr_handler (self -> pin -> gpio_number ,
96
97
pulseio_pulsein_interrupt_handler , (void * )self );
@@ -111,6 +112,7 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
111
112
112
113
void common_hal_pulseio_pulsein_pause (pulseio_pulsein_obj_t * self ) {
113
114
pulsein_set_interrupt (self , false, false);
115
+ self -> paused = true;
114
116
}
115
117
116
118
void 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,
133
135
self -> first_edge = true;
134
136
pulsein_set_interrupt (self , !self -> idle_state , self -> idle_state );
135
137
common_hal_mcu_enable_interrupts ();
138
+ self -> paused = false;
136
139
}
137
140
138
141
void 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) {
160
163
}
161
164
162
165
bool common_hal_pulseio_pulsein_get_paused (pulseio_pulsein_obj_t * self ) {
163
- return false ;
166
+ return self -> paused ;
164
167
}
165
168
166
169
uint16_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 {
36
36
uint16_t * buffer ;
37
37
uint16_t maxlen ;
38
38
bool idle_state ;
39
+ bool paused ;
39
40
volatile uint16_t start ;
40
41
volatile uint16_t len ;
41
42
volatile bool first_edge ;
You can’t perform that action at this time.
0 commit comments