From 7aab4126af2af73338f0b79b879cee27570da1d7 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 3 Jan 2022 16:33:04 +0100 Subject: [PATCH 1/4] pkg/arduino_adafruit_sensor: add Adafruit Unified Sensor Driver A number of Adafruit sensor drivers use the class Adafruit_Sensor from the Adafruit Unified Sensor Driver. To support such drivers, the Adafruit Unified Sensor Driver is imported as package. --- pkg/Kconfig | 1 + pkg/arduino_adafruit_sensor/Kconfig | 11 ++++++++ pkg/arduino_adafruit_sensor/Makefile | 9 +++++++ pkg/arduino_adafruit_sensor/Makefile.dep | 4 +++ pkg/arduino_adafruit_sensor/Makefile.include | 2 ++ pkg/arduino_adafruit_sensor/doc.txt | 6 +++++ .../patches/0001-remove_include_Print_h.patch | 24 ++++++++++++++++++ .../0002-add_F_for_string_literals.patch | 24 ++++++++++++++++++ .../patches/0003-add_include_string_h.patch | 25 +++++++++++++++++++ 9 files changed, 106 insertions(+) create mode 100644 pkg/arduino_adafruit_sensor/Kconfig create mode 100644 pkg/arduino_adafruit_sensor/Makefile create mode 100644 pkg/arduino_adafruit_sensor/Makefile.dep create mode 100644 pkg/arduino_adafruit_sensor/Makefile.include create mode 100644 pkg/arduino_adafruit_sensor/doc.txt create mode 100644 pkg/arduino_adafruit_sensor/patches/0001-remove_include_Print_h.patch create mode 100644 pkg/arduino_adafruit_sensor/patches/0002-add_F_for_string_literals.patch create mode 100644 pkg/arduino_adafruit_sensor/patches/0003-add_include_string_h.patch diff --git a/pkg/Kconfig b/pkg/Kconfig index 4f0269d1a537..4269e9f8f6ab 100644 --- a/pkg/Kconfig +++ b/pkg/Kconfig @@ -6,6 +6,7 @@ # menu "Packages" +rsource "arduino_adafruit_sensor/Kconfig" rsource "arduino_sdi_12/Kconfig" rsource "c25519/Kconfig" rsource "cayenne-lpp/Kconfig" diff --git a/pkg/arduino_adafruit_sensor/Kconfig b/pkg/arduino_adafruit_sensor/Kconfig new file mode 100644 index 000000000000..ac5dc7d5bcd1 --- /dev/null +++ b/pkg/arduino_adafruit_sensor/Kconfig @@ -0,0 +1,11 @@ +# Copyright (c) 2021 Gunar Schorcht +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +config PACKAGE_ARDUINO_ADAFRUIT_SENSOR + bool "Arduino Adafruit Unified Sensor Driver package" + depends on TEST_KCONFIG + select MODULE_ARDUINO diff --git a/pkg/arduino_adafruit_sensor/Makefile b/pkg/arduino_adafruit_sensor/Makefile new file mode 100644 index 000000000000..b7e2976d94af --- /dev/null +++ b/pkg/arduino_adafruit_sensor/Makefile @@ -0,0 +1,9 @@ +PKG_NAME=arduino_adafruit_sensor +PKG_URL=https://github.com/adafruit/Adafruit_Sensor +PKG_VERSION=334044cc0bd087ff93629cef9ae8efc14e88ec73 +PKG_LICENSE=Apache-2.0 + +include $(RIOTBASE)/pkg/pkg.mk + +all: + $(QQ)"$(MAKE)" -C $(PKG_SOURCE_DIR) -f $(RIOTBASE)/Makefile.base diff --git a/pkg/arduino_adafruit_sensor/Makefile.dep b/pkg/arduino_adafruit_sensor/Makefile.dep new file mode 100644 index 000000000000..6b53d608fddb --- /dev/null +++ b/pkg/arduino_adafruit_sensor/Makefile.dep @@ -0,0 +1,4 @@ +FEATURES_REQUIRED += arduino +FEATURES_REQUIRED += cpp + +USEMODULE += arduino diff --git a/pkg/arduino_adafruit_sensor/Makefile.include b/pkg/arduino_adafruit_sensor/Makefile.include new file mode 100644 index 000000000000..bcd54c5878b0 --- /dev/null +++ b/pkg/arduino_adafruit_sensor/Makefile.include @@ -0,0 +1,2 @@ +CFLAGS += "-DARDUINO = 100" +INCLUDES += -I$(PKGDIRBASE)/arduino_adafruit_sensor diff --git a/pkg/arduino_adafruit_sensor/doc.txt b/pkg/arduino_adafruit_sensor/doc.txt new file mode 100644 index 000000000000..e24e00c22663 --- /dev/null +++ b/pkg/arduino_adafruit_sensor/doc.txt @@ -0,0 +1,6 @@ +/** + * @defgroup pkg_adafruit_sensor Adafruit Unified Sensor Driver + * @ingroup pkg + * @brief Adafruit Unified Sensor Driver + * @see https://github.com/adafruit/Adafruit_Sensor + */ diff --git a/pkg/arduino_adafruit_sensor/patches/0001-remove_include_Print_h.patch b/pkg/arduino_adafruit_sensor/patches/0001-remove_include_Print_h.patch new file mode 100644 index 000000000000..3a22fcb3a46c --- /dev/null +++ b/pkg/arduino_adafruit_sensor/patches/0001-remove_include_Print_h.patch @@ -0,0 +1,24 @@ +From 66fe43c08e09331b1810a37c7b0edbedc212f871 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Jan 2022 12:38:18 +0100 +Subject: [PATCH 1/3] remove_include_Print_h + +--- + Adafruit_Sensor.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/Adafruit_Sensor.h b/Adafruit_Sensor.h +index 087eda5..77b70e1 100755 +--- a/Adafruit_Sensor.h ++++ b/Adafruit_Sensor.h +@@ -24,7 +24,6 @@ + #include + #elif ARDUINO >= 100 + #include "Arduino.h" +-#include "Print.h" + #else + #include "WProgram.h" + #endif +-- +2.17.1 + diff --git a/pkg/arduino_adafruit_sensor/patches/0002-add_F_for_string_literals.patch b/pkg/arduino_adafruit_sensor/patches/0002-add_F_for_string_literals.patch new file mode 100644 index 000000000000..360f9eb1e72e --- /dev/null +++ b/pkg/arduino_adafruit_sensor/patches/0002-add_F_for_string_literals.patch @@ -0,0 +1,24 @@ +From 0bc3004057327195bff710cd85961f97dfe4a38f Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Jan 2022 13:58:33 +0100 +Subject: [PATCH 2/3] add_F_for_string_literals + +--- + Adafruit_Sensor.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Adafruit_Sensor.cpp b/Adafruit_Sensor.cpp +index 2a4513e..5b82a10 100644 +--- a/Adafruit_Sensor.cpp ++++ b/Adafruit_Sensor.cpp +@@ -1,5 +1,7 @@ + #include "Adafruit_Sensor.h" + ++#define F(string_literal) (string_literal) ++ + /**************************************************************************/ + /*! + @brief Prints sensor information to serial console +-- +2.17.1 + diff --git a/pkg/arduino_adafruit_sensor/patches/0003-add_include_string_h.patch b/pkg/arduino_adafruit_sensor/patches/0003-add_include_string_h.patch new file mode 100644 index 000000000000..87a673c9c4d9 --- /dev/null +++ b/pkg/arduino_adafruit_sensor/patches/0003-add_include_string_h.patch @@ -0,0 +1,25 @@ +From a72b5fb7f3003ee738706f1949c365860e06e3f0 Mon Sep 17 00:00:00 2001 +From: Gunar Schorcht +Date: Sun, 2 Jan 2022 14:12:38 +0100 +Subject: [PATCH 3/3] add_include_string_h + +--- + Adafruit_Sensor.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Adafruit_Sensor.h b/Adafruit_Sensor.h +index 77b70e1..6844bca 100755 +--- a/Adafruit_Sensor.h ++++ b/Adafruit_Sensor.h +@@ -28,6 +28,8 @@ + #include "WProgram.h" + #endif + ++#include ++ + /* Constants */ + #define SENSORS_GRAVITY_EARTH (9.80665F) /**< Earth's gravity in m/s^2 */ + #define SENSORS_GRAVITY_MOON (1.6F) /**< The moon's gravity in m/s^2 */ +-- +2.17.1 + From 6b9690cdb78666681804832594f163d9d7d67b3f Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 3 Jan 2022 17:43:18 +0100 Subject: [PATCH 2/4] tests/pkg_arduino_adafruit_sensor: add test app --- tests/pkg_arduino_adafruit_sensor/Makefile | 5 ++ tests/pkg_arduino_adafruit_sensor/Makefile.ci | 6 +++ .../app.config.test | 3 ++ tests/pkg_arduino_adafruit_sensor/main.cpp | 49 +++++++++++++++++++ .../tests/01-run.py | 26 ++++++++++ 5 files changed, 89 insertions(+) create mode 100644 tests/pkg_arduino_adafruit_sensor/Makefile create mode 100644 tests/pkg_arduino_adafruit_sensor/Makefile.ci create mode 100644 tests/pkg_arduino_adafruit_sensor/app.config.test create mode 100644 tests/pkg_arduino_adafruit_sensor/main.cpp create mode 100755 tests/pkg_arduino_adafruit_sensor/tests/01-run.py diff --git a/tests/pkg_arduino_adafruit_sensor/Makefile b/tests/pkg_arduino_adafruit_sensor/Makefile new file mode 100644 index 000000000000..45ca1e8ed068 --- /dev/null +++ b/tests/pkg_arduino_adafruit_sensor/Makefile @@ -0,0 +1,5 @@ +include ../Makefile.tests_common + +USEPKG += arduino_adafruit_sensor + +include $(RIOTBASE)/Makefile.include diff --git a/tests/pkg_arduino_adafruit_sensor/Makefile.ci b/tests/pkg_arduino_adafruit_sensor/Makefile.ci new file mode 100644 index 000000000000..13ab4aacc2f4 --- /dev/null +++ b/tests/pkg_arduino_adafruit_sensor/Makefile.ci @@ -0,0 +1,6 @@ +BOARD_INSUFFICIENT_MEMORY := \ + arduino-duemilanove \ + arduino-uno \ + arduino-nano \ + nucleo-l011k4 \ + # diff --git a/tests/pkg_arduino_adafruit_sensor/app.config.test b/tests/pkg_arduino_adafruit_sensor/app.config.test new file mode 100644 index 000000000000..8789d8831dda --- /dev/null +++ b/tests/pkg_arduino_adafruit_sensor/app.config.test @@ -0,0 +1,3 @@ +# this file enables modules defined in Kconfig. Do not use this file for +# application configuration. This is only needed during migration. +CONFIG_PACKAGE_ARDUINO_ADAFRUIT_SENSOR=y diff --git a/tests/pkg_arduino_adafruit_sensor/main.cpp b/tests/pkg_arduino_adafruit_sensor/main.cpp new file mode 100644 index 000000000000..8227bcca84c6 --- /dev/null +++ b/tests/pkg_arduino_adafruit_sensor/main.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2021 Gunar Schorcht + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup tests + * @{ + * + * @file + * @brief Tests the Adafruit Unified Sensor Drive + * + * @author Gunar Schorcht + * + * @} + */ + +#include + +#include "Adafruit_Sensor.h" + +class ADXL345 : public Adafruit_Sensor +{ + public: + bool getEvent(sensors_event_t *) { return false; }; + void getSensor(sensor_t *sensor); +}; + +void ADXL345::getSensor(sensor_t *s) +{ + memset(s, 0, sizeof(sensor_t)); + strncpy(s->name, "ADXL345", ARRAY_SIZE(s->name) - 1); + s->version = 1; + s->sensor_id = 12345; + s->type = SENSOR_TYPE_ACCELEROMETER; + s->min_delay = 0; + s->min_value = -156.9064F; /* -16g = 156.9064 m/s^2 */ + s->max_value = 156.9064F; /* 16g = 156.9064 m/s^2 */ + s->resolution = 0.03923F; /* 4mg = 0.0392266 m/s^2 */ +} + +int main(void) +{ + ADXL345 adxl345; + adxl345.printSensorDetails(); +} diff --git a/tests/pkg_arduino_adafruit_sensor/tests/01-run.py b/tests/pkg_arduino_adafruit_sensor/tests/01-run.py new file mode 100755 index 000000000000..df0092a0bffa --- /dev/null +++ b/tests/pkg_arduino_adafruit_sensor/tests/01-run.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2021 Gunar Schorchtr +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. + +import sys +from testrunner import run + + +def testfunc(child): + child.expect_exact('------------------------------------') + child.expect_exact('Sensor: ADXL345') + child.expect_exact('Type: Acceleration (m/s2)') + child.expect_exact('Driver Ver: 1') + child.expect_exact('Unique ID: 12345') + child.expect_exact('Min Value: -156.90') + child.expect_exact('Max Value: 156.90') + child.expect_exact('Resolution: 0.03') + child.expect_exact('------------------------------------') + + +if __name__ == "__main__": + sys.exit(run(testfunc)) From 1ddce64593282c6e4029a9b65f52a9ff6b642b02 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Tue, 4 Jan 2022 00:16:13 +0100 Subject: [PATCH 3/4] pkg/arduino_adafruit_lsm9ds0: add driver for LSM9DS0 as package --- pkg/Kconfig | 1 + pkg/arduino_adafruit_lsm9ds0/Kconfig | 33 +++++++++++++++++++ pkg/arduino_adafruit_lsm9ds0/Makefile | 9 +++++ pkg/arduino_adafruit_lsm9ds0/Makefile.dep | 5 +++ pkg/arduino_adafruit_lsm9ds0/Makefile.include | 4 +++ pkg/arduino_adafruit_lsm9ds0/doc.txt | 7 ++++ 6 files changed, 59 insertions(+) create mode 100644 pkg/arduino_adafruit_lsm9ds0/Kconfig create mode 100644 pkg/arduino_adafruit_lsm9ds0/Makefile create mode 100644 pkg/arduino_adafruit_lsm9ds0/Makefile.dep create mode 100644 pkg/arduino_adafruit_lsm9ds0/Makefile.include create mode 100644 pkg/arduino_adafruit_lsm9ds0/doc.txt diff --git a/pkg/Kconfig b/pkg/Kconfig index 4269e9f8f6ab..599c0f50564e 100644 --- a/pkg/Kconfig +++ b/pkg/Kconfig @@ -6,6 +6,7 @@ # menu "Packages" +rsource "arduino_adafruit_lsm9ds0/Kconfig" rsource "arduino_adafruit_sensor/Kconfig" rsource "arduino_sdi_12/Kconfig" rsource "c25519/Kconfig" diff --git a/pkg/arduino_adafruit_lsm9ds0/Kconfig b/pkg/arduino_adafruit_lsm9ds0/Kconfig new file mode 100644 index 000000000000..c77a81fb8fe5 --- /dev/null +++ b/pkg/arduino_adafruit_lsm9ds0/Kconfig @@ -0,0 +1,33 @@ +# Copyright (c) 2021 Gunar Schorcht +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +config PACKAGE_ARDUINO_ADAFRUIT_LSM9DS0 + bool "Arduino Adafruit LSM9DS0 driver package" + depends on TEST_KCONFIG + select PACKAGE_ARDUINO_ADAFRUIT_SENSOR + help + Arduino driver package for the Adafruit Accelerometer + Gyro + + Magnetometer 9-DOF breakout module with the ST LSM9DS0 sensor + +choice MODULE_ARDUINO_LSM9DS0 + bool "Device Interface" + depends on PACKAGE_ARDUINO_ADAFRUIT_LSM9DS0 + help + The driver supports LSM9DS0 connected either via SPI or + I2C bus. + + config MODULE_ARDUINO_ADAFRUIT_LSM9DS0_I2C + bool "I2C" + depends on HAS_PERIPH_I2C + select MODULE_PERIPH_I2C + + config MODULE_ARDUINO_ADAFRUIT_LSM9DS0_SPI + bool "SPI" + depends on HAS_PERIPH_SPI + select MODULE_PERIPH_SPI + +endchoice diff --git a/pkg/arduino_adafruit_lsm9ds0/Makefile b/pkg/arduino_adafruit_lsm9ds0/Makefile new file mode 100644 index 000000000000..64dd00e20203 --- /dev/null +++ b/pkg/arduino_adafruit_lsm9ds0/Makefile @@ -0,0 +1,9 @@ +PKG_NAME=arduino_adafruit_lsm9ds0 +PKG_URL=https://github.com/adafruit/Adafruit_LSM9DS0_Library +PKG_VERSION=018133408e41a688c53a2cb4f3473457749ef15f +PKG_LICENSE=BSD + +include $(RIOTBASE)/pkg/pkg.mk + +all: + "$(MAKE)" -C $(PKG_SOURCE_DIR) -f $(RIOTBASE)/Makefile.base MODULE=$(PKG_NAME) diff --git a/pkg/arduino_adafruit_lsm9ds0/Makefile.dep b/pkg/arduino_adafruit_lsm9ds0/Makefile.dep new file mode 100644 index 000000000000..e885f3e1083f --- /dev/null +++ b/pkg/arduino_adafruit_lsm9ds0/Makefile.dep @@ -0,0 +1,5 @@ +# both interfaces are implemented by the driver +FEATURES_REQUIRED += periph_i2c +FEATURES_REQUIRED += periph_spi + +USEPKG += arduino_adafruit_sensor diff --git a/pkg/arduino_adafruit_lsm9ds0/Makefile.include b/pkg/arduino_adafruit_lsm9ds0/Makefile.include new file mode 100644 index 000000000000..589c9f93f273 --- /dev/null +++ b/pkg/arduino_adafruit_lsm9ds0/Makefile.include @@ -0,0 +1,4 @@ +PSEUDOMODULES += arduino_adafruit_lsm9ds0_i2c +PSEUDOMODULES += arduino_adafruit_lsm9ds0_spi + +INCLUDES += -I$(PKGDIRBASE)/arduino_adafruit_lsm9ds0 diff --git a/pkg/arduino_adafruit_lsm9ds0/doc.txt b/pkg/arduino_adafruit_lsm9ds0/doc.txt new file mode 100644 index 000000000000..e4f24a948ad4 --- /dev/null +++ b/pkg/arduino_adafruit_lsm9ds0/doc.txt @@ -0,0 +1,7 @@ +/** + * @defgroup pkg_arduino_lsm9ds0 Arduino driver package Adafruit LSM9DS0 breakout + * @ingroup pkg + * @brief Arduino driver package for the Adafruit Accelerometer + Gyro + + * Magnetometer 9-DOF breakout module with the ST LSM9DS0 sensor + * @see https://github.com/adafruit/Adafruit_LSM9DS0_Library + */ From 9b75d479301d4523e99364085eeee310ae6c93b6 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 3 Jan 2022 23:57:03 +0100 Subject: [PATCH 4/4] tests/pkg_arduino_adafruit_lsm9ds0: test app for LSM9DS0 driver package --- tests/pkg_arduino_adafruit_lsm9ds0/Makefile | 8 ++ .../pkg_arduino_adafruit_lsm9ds0/Makefile.ci | 6 ++ .../app.config.test | 3 + tests/pkg_arduino_adafruit_lsm9ds0/main.cpp | 96 +++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 tests/pkg_arduino_adafruit_lsm9ds0/Makefile create mode 100644 tests/pkg_arduino_adafruit_lsm9ds0/Makefile.ci create mode 100644 tests/pkg_arduino_adafruit_lsm9ds0/app.config.test create mode 100644 tests/pkg_arduino_adafruit_lsm9ds0/main.cpp diff --git a/tests/pkg_arduino_adafruit_lsm9ds0/Makefile b/tests/pkg_arduino_adafruit_lsm9ds0/Makefile new file mode 100644 index 000000000000..4e9e413499a2 --- /dev/null +++ b/tests/pkg_arduino_adafruit_lsm9ds0/Makefile @@ -0,0 +1,8 @@ +include ../Makefile.tests_common + +DRIVER ?= arduino_adafruit_lsm9ds0_i2c + +USEPKG += arduino_adafruit_lsm9ds0 +USEMODULE += $(DRIVER) + +include $(RIOTBASE)/Makefile.include diff --git a/tests/pkg_arduino_adafruit_lsm9ds0/Makefile.ci b/tests/pkg_arduino_adafruit_lsm9ds0/Makefile.ci new file mode 100644 index 000000000000..dfde28fdd5db --- /dev/null +++ b/tests/pkg_arduino_adafruit_lsm9ds0/Makefile.ci @@ -0,0 +1,6 @@ +BOARD_INSUFFICIENT_MEMORY := \ + arduino-duemilanove \ + arduino-nano \ + arduino-uno \ + nucleo-f031k6 \ + # diff --git a/tests/pkg_arduino_adafruit_lsm9ds0/app.config.test b/tests/pkg_arduino_adafruit_lsm9ds0/app.config.test new file mode 100644 index 000000000000..6da8f821d658 --- /dev/null +++ b/tests/pkg_arduino_adafruit_lsm9ds0/app.config.test @@ -0,0 +1,3 @@ +# this file enables modules defined in Kconfig. Do not use this file for +# application configuration. This is only needed during migration. +CONFIG_PACKAGE_ARDUINO_ADAFRUIT_LSM9DS0=y diff --git a/tests/pkg_arduino_adafruit_lsm9ds0/main.cpp b/tests/pkg_arduino_adafruit_lsm9ds0/main.cpp new file mode 100644 index 000000000000..a583c331a21a --- /dev/null +++ b/tests/pkg_arduino_adafruit_lsm9ds0/main.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2021 Gunar Schorcht + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup tests + * @{ + * + * @file + * @brief Test application for Arduino Adafruit LSM9DS0 driver + * + * @author Gunar Schorcht + * @} + */ + +#include "arduino_board.h" + +#include +#include + +#include +#include + +#define LSM9DS0_XM_CS 10 /* Accelerator/Magnetometer CS */ +#define LSM9DS0_G_CS 9 /* Gyroscope CS */ + +int main(void) +{ + /* sensor base ID = 1000 */ +#if IS_USED(MODULE_ARDUINO_ADAFRUIT_LSM9DS0_SPI) + Adafruit_LSM9DS0 sensor(LSM9DS0_XM_CS, LSM9DS0_G_CS, 1000); +#else + Adafruit_LSM9DS0 sensor(1000); +#endif + + Serial.print("Initialize LSM9DS0 ... "); + + if(!sensor.begin()) { + Serial.print("not found"); + return 1; + } + Serial.println("ok"); + + sensor.getAccel().printSensorDetails(); + sensor.getMag().printSensorDetails(); + sensor.getGyro().printSensorDetails(); + sensor.getTemp().printSensorDetails(); + + sensor.setupAccel(sensor.LSM9DS0_ACCELRANGE_2G); + sensor.setupMag(sensor.LSM9DS0_MAGGAIN_2GAUSS); + sensor.setupGyro(sensor.LSM9DS0_GYROSCALE_245DPS); + + + while (1) { + sensors_event_t e_accel, e_mag, e_gyro, e_temp; + + sensor.getEvent(&e_accel, &e_mag, &e_gyro, &e_temp); + + Serial.print("Accel\tX: "); + Serial.print(e_accel.acceleration.x); + Serial.print(" \tY: "); + Serial.print(e_accel.acceleration.y); + Serial.print(" \tZ: "); + Serial.print(e_accel.acceleration.z); + Serial.println(" \tm/s^2"); + + Serial.print("Magn.\tX: "); + Serial.print(e_mag.magnetic.x); + Serial.print(" \tY: "); + Serial.print(e_mag.magnetic.y); + Serial.print(" \tZ: "); + Serial.print(e_mag.magnetic.z); + Serial.println(" \tuT"); + + Serial.print("Gyro\tX: "); + Serial.print(e_gyro.gyro.x); + Serial.print(" \tY: "); + Serial.print(e_gyro.gyro.y); + Serial.print(" \tZ: "); + Serial.print(e_gyro.gyro.z); + Serial.println(" \trad/s"); + + Serial.print("Temp: "); + Serial.print(e_temp.temperature); + Serial.println(" \t°C"); + + Serial.println("**********************\n"); + + delay(250); + } + return 0; +}