tdk-invn-oss / ultrasonic.soniclib

Driver repo for TDK InvenSense consumer ultrasonic sensors
https://tdk-invn-oss.github.io/ultrasonic.soniclib
Other
14 stars 0 forks source link

Cleared events in event_wait #21

Open Marco-Peter opened 6 days ago

Marco-Peter commented 6 days ago

The BSP provides three functions to allow for waiting on events:

During the initial programming int shasta_detect_and_program() they are used so that the application can wait on the sensor reset.

Before programming, chbsp_event_wait_setup() is called to clear any pending events and chdrv_int_interrupt_enable() to enable the interrupts. After programming and reset, event_wait is called to wait for the interrupt.

The problem is now that the called function event_wait() again calls chbsp_event_wait_setup() and chdrv_int_interrupt_enable(). This clears any potentially arrived events.

https://github.com/tdk-invn-oss/ultrasonic.soniclib/blob/a6514c1fe5b01ebe18f75fd2a627f08864bf757b/invn/soniclib/ch_driver.c#L659-L671

I would suggest to remove the calls to

@tdk-invn-oss/ultrasonic-maintainers

tdk-opensource commented 6 days ago

Thank you for opening this issue! We will look into it shortly.

Notifying @tdk-invn-oss/ultrasonic-maintainers