41
41
# For IDE type recognition
42
42
try :
43
43
from typing import Any , Dict , List , Optional , Tuple , Union
44
+ from digitalio import DigitalInOut
44
45
except ImportError :
45
46
pass
46
47
@@ -219,7 +220,7 @@ def _elapsed(start_time: float) -> float:
219
220
220
221
221
222
############ PACKET PARSING ###########################
222
- def _parse_sensor_report_data (report_bytes : bytearray ) -> Tuple [Any , int ]:
223
+ def _parse_sensor_report_data (report_bytes : bytearray ) -> Tuple [Tuple , int ]:
223
224
"""Parses reports with only 16-bit fields"""
224
225
data_offset = 4 # this may not always be true
225
226
report_id = report_bytes [0 ]
@@ -272,7 +273,7 @@ def _parse_get_feature_response_report(report_bytes: bytearray) -> Tuple[Any, ..
272
273
# 4 Page Number + EOS
273
274
# 5 Most likely state
274
275
# 6-15 Classification (10 x Page Number) + confidence
275
- def _parse_activity_classifier_report (report_bytes : bytearray ) -> Dict [str , int ]:
276
+ def _parse_activity_classifier_report (report_bytes : bytearray ) -> Dict [str , str ]:
276
277
activities = [
277
278
"Unknown" ,
278
279
"In-Vehicle" , # look
@@ -491,9 +492,11 @@ class BNO08X: # pylint: disable=too-many-instance-attributes, too-many-public-m
491
492
492
493
"""
493
494
494
- def __init__ (self , reset : Optional [dict ] = None , debug : bool = False ) -> None :
495
+ def __init__ (
496
+ self , reset : Optional [DigitalInOut ] = None , debug : bool = False
497
+ ) -> None :
495
498
self ._debug : bool = debug
496
- self ._reset : Optional [dict ] = reset
499
+ self ._reset : Optional [DigitalInOut ] = reset
497
500
self ._dbg ("********** __init__ *************" )
498
501
self ._data_buffer : bytearray = bytearray (DATA_BUFFER_SIZE )
499
502
self ._command_buffer : bytearray = bytearray (12 )
@@ -503,7 +506,7 @@ def __init__(self, reset: Optional[dict] = None, debug: bool = False) -> None:
503
506
self ._sequence_number : List [int ] = [0 , 0 , 0 , 0 , 0 , 0 ]
504
507
self ._two_ended_sequence_numbers : Dict [int , int ] = {}
505
508
self ._dcd_saved_at : float = - 1
506
- self ._me_calibration_started_at : float = - 1
509
+ self ._me_calibration_started_at : float = - 1.0
507
510
self ._calibration_complete = False
508
511
self ._magnetometer_accuracy = 0
509
512
self ._wait_for_initialize = True
@@ -956,7 +959,7 @@ def _process_report(self, report_id: int, report_bytes: bytearray) -> None:
956
959
@staticmethod
957
960
def _get_feature_enable_report (
958
961
feature_id : int ,
959
- report_interval : Any = _DEFAULT_REPORT_INTERVAL ,
962
+ report_interval : int = _DEFAULT_REPORT_INTERVAL ,
960
963
sensor_specific_config : int = 0 ,
961
964
) -> bytearray :
962
965
set_feature_report = bytearray (17 )
0 commit comments