1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests/driver_lsm6dsl: add lsm6dsl driver test app

This commit is contained in:
Vincent Dupont 2017-03-31 16:03:33 +02:00
parent 73d8149490
commit f5adafd813
7 changed files with 90 additions and 9 deletions

View File

@ -8,13 +8,13 @@
*/
/**
* @defgroup drivers_lsm6dsl LSM36DSL 3D accelerometer/gyroscope
* @defgroup drivers_lsm6dsl LSM6DSL 3D accelerometer/gyroscope
* @ingroup drivers_sensors
* @brief Device driver for the LSM36DSL 3D accelerometer/gyroscope
* @brief Device driver for the LSM6DSL 3D accelerometer/gyroscope
*
* @{
* @file
* @brief Device driver interface for the LSM36DSL 3D accelerometer/gyroscope.
* @brief Device driver interface for the LSM6DSL 3D accelerometer/gyroscope.
*
* @author Vincent Dupont <vincent@otakeys.com>
*/

View File

@ -8,11 +8,11 @@
*/
/**
* @addtogroup drivers_lsm6dsl
* @ingroup drivers_lsm6dsl
*
* @{
* @file
* @brief Internal configuration for LSM36DSL devices
* @brief Internal configuration for LSM6DSL devices
*
* @author Vincent Dupont <vincent@otakeys.com>
*/

View File

@ -8,11 +8,11 @@
*/
/**
* @addtogroup drivers_lsm6dsl
* @ingroup drivers_lsm6dsl
*
* @{
* @file
* @brief Default configuration for LSM36DSL devices
* @brief Default configuration for LSM6DSL devices
*
* @author Vincent Dupont <vincent@otakeys.com>
*/

View File

@ -9,7 +9,7 @@
/**
* @file
* @brief Device driver implementation for the LSM36DSL 3D accelerometer/gyroscope.
* @brief Device driver implementation for the LSM6DSL 3D accelerometer/gyroscope.
*
* @author Vincent Dupont <vincent@otakeys.com>
*/

View File

@ -9,7 +9,7 @@
/**
* @file
* @brief SAUL implementation for the LSM36DSL 3D accelerometer/gyroscope.
* @brief SAUL implementation for the LSM6DSL 3D accelerometer/gyroscope.
*
* @author Vincent Dupont <vincent@otakeys.com>
*/

View File

@ -0,0 +1,9 @@
APPLICATION = driver_lsm6dsl
include ../Makefile.tests_common
FEATURES_REQUIRED = periph_i2c
USEMODULE += lsm6dsl
USEMODULE += xtimer
include $(RIOTBASE)/Makefile.include

View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2017 OTA keys S.A.
*
* 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.
*/
/**
* @file
* @brief Test application for the LSM6DSL accelerometer/gyroscope driver.
*
* @author Vincent Dupont <vincent@otakeys.com>
*
*/
#include <stdio.h>
#include "xtimer.h"
#include "lsm6dsl.h"
#include "lsm6dsl_params.h"
#define SLEEP (100 * 1000U)
int main(void)
{
lsm6dsl_t dev;
int16_t temp_value;
lsm6dsl_3d_data_t mag_value;
lsm6dsl_3d_data_t acc_value;
puts("LSM6DSL test application\n");
printf("Initializing LSM6DSL sensor at I2C_%i... ", lsm6dsl_params->i2c);
if (lsm6dsl_init(&dev, lsm6dsl_params) == 0) {
puts("[OK]\n");
}
else {
puts("[Failed]");
return 1;
}
while (1) {
if (lsm6dsl_read_acc(&dev, &acc_value) == 0) {
printf("Accelerometer x: %i y: %i z: %i\n", acc_value.x,
acc_value.y,
acc_value.z);
}
else {
puts("\nFailed reading accelerometer values\n");
}
if (lsm6dsl_read_temp(&dev, &temp_value) == 0) {
printf("Temperature value: %i degrees\n", temp_value);
}
else {
puts("\nFailed reading value\n");
}
if (lsm6dsl_read_gyro(&dev, &mag_value) == 0) {
printf("Gyroscope x: %i y: %i z: %i\n", mag_value.x,
mag_value.y,
mag_value.z);
}
else {
puts("\nFailed reading Gyroscope values\n");
}
xtimer_usleep(SLEEP);
}
return 0;
}