Skip to content
Snippets Groups Projects
Commit b84cd7e9 authored by rahix's avatar rahix
Browse files

Merge 'bhi160: Allow to re-open the sensor from Python'

Closes #210

See merge request !409
parents 903cbcc5 36f4efbc
No related branches found
No related tags found
1 merge request!409fix(bhi160): Allow to re-open the sensor from Python
Pipeline #4759 passed with warnings
......@@ -18,6 +18,11 @@ class BHI160:
def enable_sensor(self):
interrupt.disable_callback(self.interrupt_id)
interrupt.set_callback(self.interrupt_id, self._interrupt)
# If the sensor is already enabled, disable it first.
# The call is allowed to silently fail.
sys_bhi160.disable_sensor(self.sensor_id)
self.stream_id = sys_bhi160.enable_sensor(
self.sensor_id, self.sample_buffer_len, self.sample_rate, self.dynamic_range
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment