tests/driver_l3g4200d: update with new API
This commit is contained in:
parent
53ffe88384
commit
bca6868da6
@ -5,16 +5,4 @@ FEATURES_REQUIRED = periph_i2c periph_gpio
|
|||||||
USEMODULE += l3g4200d
|
USEMODULE += l3g4200d
|
||||||
USEMODULE += xtimer
|
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
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
|||||||
@ -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 <stdio.h>
|
||||||
|
|
||||||
#include "xtimer.h"
|
#include "xtimer.h"
|
||||||
#include "l3g4200d.h"
|
#include "l3g4200d.h"
|
||||||
|
#include "l3g4200d_params.h"
|
||||||
|
|
||||||
#define MODE L3G4200D_MODE_100_25
|
|
||||||
#define SCALE L3G4200D_SCALE_500DPS
|
|
||||||
#define SLEEP (100 * 1000U)
|
#define SLEEP (100 * 1000U)
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
@ -46,9 +32,8 @@ int main(void)
|
|||||||
l3g4200d_data_t acc_data;
|
l3g4200d_data_t acc_data;
|
||||||
|
|
||||||
puts("L3G4200 gyroscope driver test application\n");
|
puts("L3G4200 gyroscope driver test application\n");
|
||||||
printf("Initializing L3G4200 sensor at I2C_%i... ", TEST_L3G4200D_I2C);
|
puts("Initializing L3G4200 sensor");
|
||||||
if (l3g4200d_init(&dev, TEST_L3G4200D_I2C, TEST_L3G4200D_ADDR,
|
if (l3g4200d_init(&dev, &l3g4200d_params[0]) == 0) {
|
||||||
TEST_L3G4200D_INT, TEST_L3G4200D_DRDY, MODE, SCALE) == 0) {
|
|
||||||
puts("[OK]\n");
|
puts("[OK]\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user