mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
41745859bb
The SLEEP define collides with an Arduino header file. Rename the define to resolve the conflict.
55 lines
1.1 KiB
C
55 lines
1.1 KiB
C
/*
|
|
* Copyright (C) 2017 Inria
|
|
*
|
|
* 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 MMA7660 3 axis accelerometer driver.
|
|
*
|
|
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
|
*
|
|
* @}
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "xtimer.h"
|
|
#include "mma7660.h"
|
|
#include "mma7660_params.h"
|
|
|
|
#define SLEEP_USEC (100 * US_PER_MS)
|
|
|
|
static mma7660_t dev;
|
|
|
|
int main(void)
|
|
{
|
|
puts("MMA7660 accelerometer driver test application\n");
|
|
printf("Initializing MMA7660 accelerometer at I2C_DEV(%i)... ",
|
|
mma7660_params->i2c);
|
|
|
|
if (mma7660_init(&dev, &mma7660_params[0]) == MMA7660_OK) {
|
|
puts("[OK]");
|
|
}
|
|
else {
|
|
puts("[Failed]");
|
|
return -1;
|
|
}
|
|
|
|
while (1) {
|
|
mma7660_data_t data;
|
|
mma7660_read(&dev, &data);
|
|
printf("Acceleration [in mg]: X: %d Y: %d Z: %d\n",
|
|
data.x, data.y, data.z);
|
|
xtimer_usleep(SLEEP_USEC);
|
|
}
|
|
|
|
return 0;
|
|
}
|