From c47c911fe347ef488a02a1aff7a81708af413b12 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Sat, 20 Nov 2021 14:26:47 +0100 Subject: [PATCH] Expose acceleration data Signed-off-by: Francesco Gazzetta --- wasp/boards/simulator/watch.py | 4 ++++ wasp/drivers/bma421.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/wasp/boards/simulator/watch.py b/wasp/boards/simulator/watch.py index e5cf2b2..900d1d6 100644 --- a/wasp/boards/simulator/watch.py +++ b/wasp/boards/simulator/watch.py @@ -48,6 +48,10 @@ class Accelerometer: def steps(self, value): self.reset() + def accel_xyz(self): + # TODO randomly alter the values over time + return (0,0,0) + class Backlight(object): def __init__(self, level=1): pass diff --git a/wasp/drivers/bma421.py b/wasp/drivers/bma421.py index 4901462..271b4af 100644 --- a/wasp/drivers/bma421.py +++ b/wasp/drivers/bma421.py @@ -49,3 +49,7 @@ class BMA421: if value != 0: raise ValueError() self._dev.reset_step_counter() + + def accel_xyz(self): + """Return a triple with acceleration values""" + return self._dev.read_accel_xyz()