fix pulsein incorrect compute
This commit is contained in:
parent
215008f78c
commit
db82160eef
@ -59,6 +59,9 @@ static void _pulsein_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action
|
||||
uint64_t current_ms;
|
||||
current_tick(¤t_ms, ¤t_us);
|
||||
|
||||
// current_tick gives us the remaining us until the next tick but we want the number since the last ms.
|
||||
current_us = 1000 - current_us;
|
||||
|
||||
pulseio_pulsein_obj_t* self = NULL;
|
||||
for(int i = 0; i < NRFX_ARRAY_SIZE(_objs); i++ ) {
|
||||
if ( _objs[i] && _objs[i]->pin == pin ) {
|
||||
@ -66,7 +69,6 @@ static void _pulsein_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !self ) return;
|
||||
|
||||
if (self->first_edge) {
|
||||
|
@ -35,15 +35,17 @@ typedef struct {
|
||||
mp_obj_base_t base;
|
||||
|
||||
uint8_t pin;
|
||||
bool idle_state;
|
||||
bool paused;
|
||||
|
||||
uint16_t* buffer;
|
||||
uint16_t maxlen;
|
||||
bool idle_state;
|
||||
|
||||
volatile uint16_t start;
|
||||
volatile uint16_t len;
|
||||
volatile bool first_edge;
|
||||
bool paused;
|
||||
volatile uint64_t last_ms;
|
||||
volatile uint16_t last_us;
|
||||
volatile uint64_t last_ms;
|
||||
} pulseio_pulsein_obj_t;
|
||||
|
||||
void pulsein_reset(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user