tests/driver_srf08: update with new init scheme
+ cleanup not needed export of variables
This commit is contained in:
parent
2b713f13cb
commit
462f320aaf
@ -3,16 +3,4 @@ include ../Makefile.tests_common
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += srf08
|
||||
|
||||
# set default device parameters in case they are undefined
|
||||
export TEST_SRF08_I2C ?= I2C_DEV\(0\)
|
||||
export TEST_SRF08_SPEED ?= I2C_SPEED_NORMAL
|
||||
export TEST_MODE ?= SRF08_MODE_CM
|
||||
export TEST_NUM_ECHOS ?= 3
|
||||
|
||||
# export parameters
|
||||
CFLAGS += -DTEST_SRF08_I2C=$(TEST_SRF08_I2C)
|
||||
CFLAGS += -DTEST_SRF08_SPEED=$(TEST_SRF08_SPEED)
|
||||
CFLAGS += -DTEST_MODE=$(TEST_MODE)
|
||||
CFLAGS += -DTEST_NUM_ECHOS=$(TEST_NUM_ECHOS)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
@ -19,37 +19,33 @@
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
#ifndef TEST_SRF08_I2C
|
||||
#error "TEST_SRF08_I2C not defined"
|
||||
#endif
|
||||
#ifndef TEST_SRF08_SPEED
|
||||
#error "TEST_SRF08_SPEED not defined"
|
||||
#endif
|
||||
#ifndef TEST_MODE
|
||||
#error "TEST_MODE not defined"
|
||||
#endif
|
||||
#ifndef TEST_NUM_ECHOS
|
||||
#error "TEST_NUM_ECHOS not defined"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "srf08.h"
|
||||
#include "srf08_params.h"
|
||||
#include "periph/i2c.h"
|
||||
|
||||
#define SLEEP_USEC (1000 * 1000U)
|
||||
#ifndef TEST_MODE
|
||||
#define TEST_MODE (SRF08_MODE_CM)
|
||||
#endif
|
||||
#ifndef TEST_NUM_ECHOS
|
||||
#define TEST_NUM_ECHOS (3U)
|
||||
#endif
|
||||
|
||||
static srf08_t srf08_0;
|
||||
#define SLEEP_USEC (1000 * US_PER_MS)
|
||||
|
||||
static srf08_t srf08_0;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
puts("SRF08 ultrasonic ranger test application\n");
|
||||
printf("Initializing SRF08 sensor at I2C_%i... ", TEST_SRF08_I2C);
|
||||
printf("Initializing SRF08 sensor at I2C_%i... ", srf08_params[0].i2c);
|
||||
|
||||
int res;
|
||||
|
||||
res = srf08_init(&srf08_0, TEST_SRF08_I2C, SRF08_DEFAULT_ADDR);
|
||||
res = srf08_init(&srf08_0, &srf08_params[0]);
|
||||
|
||||
if (res < 0) {
|
||||
printf("[Failed]");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user