From cb0083f46b9ffa99abb16dc031cc8a1f7ca520a3 Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Wed, 28 Jun 2023 15:35:06 -0400 Subject: [PATCH] first commit --- examples/bmm150_interrupt_mode.py | 1 - micropython_bmm150/bmm150.py | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/examples/bmm150_interrupt_mode.py b/examples/bmm150_interrupt_mode.py index 7d6e55a..c4d2b49 100644 --- a/examples/bmm150_interrupt_mode.py +++ b/examples/bmm150_interrupt_mode.py @@ -18,4 +18,3 @@ print(bmm.status_interrupt) print() time.sleep(0.5) - diff --git a/micropython_bmm150/bmm150.py b/micropython_bmm150/bmm150.py index b51174d..ac5fea8 100644 --- a/micropython_bmm150/bmm150.py +++ b/micropython_bmm150/bmm150.py @@ -149,6 +149,12 @@ def operation_mode(self, value: int) -> None: @property def measurements(self) -> Tuple[float, float, float, float]: + """ + Return Magnetometer data and hall resistance. + This is Raw data. There are some code exposed from bosch in their + github to adjust this data, however this is not exposed in the + datasheet. + """ raw_magx, raw_magy, raw_magz, raw_rhall = self._raw_data magx = raw_magx >> 3 @@ -160,6 +166,9 @@ def measurements(self) -> Tuple[float, float, float, float]: @property def high_threshold(self) -> float: + """ + High threshold value + """ return self._high_threshold * 16 @high_threshold.setter @@ -168,6 +177,9 @@ def high_threshold(self, value: int) -> None: @property def low_threshold(self) -> float: + """ + Low threshold value + """ return self._low_threshold * 16 @low_threshold.setter @@ -198,6 +210,9 @@ def interrupt_mode(self, value: int) -> None: @property def status_interrupt(self): + """ + Interrupt Status. + """ data = self._status_interrupt highz = (data & 0x20) >> 5 highy = (data & 0x10) >> 4