Browse Source

tests/driver_mq3: adapted to ADC driver changes

pr/gpio
Hauke Petersen 7 years ago
parent
commit
c46d8ee0ff
  1. 6
      tests/driver_mq3/Makefile
  2. 11
      tests/driver_mq3/main.c

6
tests/driver_mq3/Makefile

@ -7,11 +7,9 @@ USEMODULE += mq3
USEMODULE += xtimer
# set default device parameters in case they are undefined
MQ3_ADC ?= ADC_0
MQ3_CHAN ?= 0
MQ3_ADC_LINE ?= ADC_LINE\(0\)
# export parameters
CFLAGS += -DMQ3_ADC=$(MQ3_ADC)
CFLAGS += -DMQ3_CHAN=$(MQ3_CHAN)
CFLAGS += -DMQ3_ADC_LINE=$(MQ3_ADC_LINE)
include $(RIOTBASE)/Makefile.include

11
tests/driver_mq3/main.c

@ -25,11 +25,8 @@
#include "periph_conf.h"
#include "periph/adc.h"
#ifndef MQ3_ADC
#error "MQ3_ADC is not specified"
#endif
#ifndef MQ3_CHAN
#error "MQ3_CHAN is not specified"
#ifndef MQ3_ADC_LINE
#error "MQ3_ADC_LINE is not specified"
#endif
int main(void)
@ -38,8 +35,8 @@ int main(void)
int res;
puts("MQ-3 alcohol sensor test application\n");
printf("Initializing MQ-3 sensor at ADC_%i, channel %i... ", MQ3_ADC, MQ3_CHAN);
res = mq3_init(&dev, MQ3_ADC, MQ3_CHAN);
printf("Initializing MQ-3 sensor at ADC_LINE(%i)... ", (int)MQ3_ADC_LINE);
res = mq3_init(&dev, MQ3_ADC_LINE);
if (res == 0) {
puts("[ok]\n");
}

Loading…
Cancel
Save