bma421: Use the INT_STATUS register to distinguish between gestures
Currently we have only one type of hardware-based gesture implemented, but in the future there could be more.
This commit is contained in:
parent
9848f0afd7
commit
949917e3cd
|
@ -25,6 +25,9 @@ _DEFAULT_ORIENTATION = const(0b010010000)
|
||||||
# Y sign ────────────────────┘│
|
# Y sign ────────────────────┘│
|
||||||
# Z sign ─────────────────────┘
|
# Z sign ─────────────────────┘
|
||||||
|
|
||||||
|
# Ref: BMA425 data sheet (register INT_STATUS_0)
|
||||||
|
_STATUS_MASK_WRIST_TILT = const(0b1000)
|
||||||
|
|
||||||
class BMA421:
|
class BMA421:
|
||||||
"""BMA421 driver
|
"""BMA421 driver
|
||||||
|
|
||||||
|
@ -82,7 +85,8 @@ class BMA421:
|
||||||
|
|
||||||
def handle_interrupt(self, pin_obj):
|
def handle_interrupt(self, pin_obj):
|
||||||
"""Interrupt handler for gesture events originating from the sensor"""
|
"""Interrupt handler for gesture events originating from the sensor"""
|
||||||
self._dev.read_int_status() # TODO: Actually read status from the register
|
status = self._dev.read_int_status()
|
||||||
|
if status & _STATUS_MASK_WRIST_TILT:
|
||||||
self._gesture_event = motion.AccelGestureEvent.WRIST_TILT
|
self._gesture_event = motion.AccelGestureEvent.WRIST_TILT
|
||||||
|
|
||||||
def get_gesture_event(self):
|
def get_gesture_event(self):
|
||||||
|
|
Loading…
Reference in a new issue