mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/driver_bmx055: provide test application for bmx055
This commit is contained in:
parent
22c49e99b5
commit
aa0d22a552
10
tests/driver_bmx055/Makefile
Normal file
10
tests/driver_bmx055/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
# include and auto-initialize all available sensors
|
||||
USEMODULE += saul_default
|
||||
# include driver for bmx055 sensor
|
||||
USEMODULE += bmx055
|
||||
# include xtimer for polling
|
||||
USEMODULE += xtimer
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
14
tests/driver_bmx055/README.md
Normal file
14
tests/driver_bmx055/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
# About
|
||||
This is a test application that is polling all three SAUL devices
|
||||
(Magnetometer, Accelerometer, Gyroscope) of the Bosch BMX055
|
||||
9-Axis Sensor.
|
||||
This test is a copy of the standard saul test. Since it utilizes all
|
||||
capabilities of the driver it is a sufficient test of the sensor.
|
||||
|
||||
# Usage
|
||||
The application will initialize the modules with default parameters and read
|
||||
out accel, gyro and compass values each second
|
||||
default parameters are:
|
||||
- Magnetometer Sampling Rate: 10 Hz
|
||||
- Accelerometer Range: 2G
|
||||
- Gyroscope Scale: 2000 DPS
|
58
tests/driver_bmx055/main.c
Normal file
58
tests/driver_bmx055/main.c
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Freie Universität Berlin
|
||||
*
|
||||
* 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 the Bosch BMX055 9-axis Sensor driver
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Semjon Kerner <semjon.kerner@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "phydat.h"
|
||||
#include "saul_reg.h"
|
||||
|
||||
/**
|
||||
* @brief Read the sensors every second
|
||||
*/
|
||||
#define INTERVAL (1LU * US_PER_SEC)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
phydat_t res;
|
||||
xtimer_ticks32_t last_wakeup = xtimer_now();
|
||||
|
||||
puts("Test application for bmx055 module");
|
||||
|
||||
while (1) {
|
||||
saul_reg_t *dev = saul_reg;
|
||||
|
||||
if (dev == NULL) {
|
||||
puts("No SAUL devices present");
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (dev) {
|
||||
int dim = saul_reg_read(dev, &res);
|
||||
printf("\nDev: %s\tType: %s\n", dev->name,
|
||||
saul_class_to_str(dev->driver->type));
|
||||
phydat_dump(&res, dim);
|
||||
dev = dev->next;
|
||||
}
|
||||
puts("\n##########################");
|
||||
|
||||
xtimer_periodic_wakeup(&last_wakeup, INTERVAL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user