tests/driver_l3g4200d: update with new API

This commit is contained in:
Alexandre Abadie 2018-02-28 18:17:33 +01:00 committed by dylad
parent 53ffe88384
commit bca6868da6
2 changed files with 3 additions and 30 deletions

View File

@ -5,16 +5,4 @@ FEATURES_REQUIRED = periph_i2c periph_gpio
USEMODULE += l3g4200d
USEMODULE += xtimer
# set default device parameters in case they are undefined
TEST_L3G4200D_I2C ?= I2C_DEV\(0\)
TEST_L3G4200D_ADDR ?= 104
TEST_L3G4200D_INT ?= GPIO_PIN\(0,0\)
TEST_L3G4200D_DRDY ?= GPIO_PIN\(0,1\)
# export parameters
CFLAGS += -DTEST_L3G4200D_I2C=$(TEST_L3G4200D_I2C)
CFLAGS += -DTEST_L3G4200D_ADDR=$(TEST_L3G4200D_ADDR)
CFLAGS += -DTEST_L3G4200D_INT=$(TEST_L3G4200D_INT)
CFLAGS += -DTEST_L3G4200D_DRDY=$(TEST_L3G4200D_DRDY)
include $(RIOTBASE)/Makefile.include

View File

@ -18,26 +18,12 @@
* @}
*/
#ifndef TEST_L3G4200D_I2C
#error "TEST_L3G4200D_I2C not defined"
#endif
#ifndef TEST_L3G4200D_ADDR
#error "TEST_L3G4200D_ADDR not defined"
#endif
#ifndef TEST_L3G4200D_INT
#error "TEST_L3G4200D_INT not defined"
#endif
#ifndef TEST_L3G4200D_DRDY
#error "TEST_L3G4200D_DRDY not defined"
#endif
#include <stdio.h>
#include "xtimer.h"
#include "l3g4200d.h"
#include "l3g4200d_params.h"
#define MODE L3G4200D_MODE_100_25
#define SCALE L3G4200D_SCALE_500DPS
#define SLEEP (100 * 1000U)
int main(void)
@ -46,9 +32,8 @@ int main(void)
l3g4200d_data_t acc_data;
puts("L3G4200 gyroscope driver test application\n");
printf("Initializing L3G4200 sensor at I2C_%i... ", TEST_L3G4200D_I2C);
if (l3g4200d_init(&dev, TEST_L3G4200D_I2C, TEST_L3G4200D_ADDR,
TEST_L3G4200D_INT, TEST_L3G4200D_DRDY, MODE, SCALE) == 0) {
puts("Initializing L3G4200 sensor");
if (l3g4200d_init(&dev, &l3g4200d_params[0]) == 0) {
puts("[OK]\n");
}
else {