Skip to content
This repository has been archived by the owner on Dec 15, 2024. It is now read-only.

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jposada202020 committed Jun 28, 2023
1 parent 25e923a commit cb0083f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion examples/bmm150_interrupt_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
print(bmm.status_interrupt)
print()
time.sleep(0.5)

15 changes: 15 additions & 0 deletions micropython_bmm150/bmm150.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cb0083f

Please sign in to comment.