diff --git a/drivers/include/mq3.h b/drivers/include/mq3.h index 55dde35013..f10944e64d 100644 --- a/drivers/include/mq3.h +++ b/drivers/include/mq3.h @@ -33,8 +33,7 @@ extern "C" { * @brief device descriptor for a MQ-3 sensor */ typedef struct { - adc_t adc_dev; /**< the used ADC device */ - int adc_chan; /**< used channel of the ADC */ + adc_t adc_line; /**< the used ADC line */ } mq3_t; /** @@ -47,12 +46,11 @@ typedef struct { * * @param[out] dev device descriptor of an MQ-3 sensor * @param[in] adc the ADC device the sensor is connected to - * @param[in] channel the channel of the ADC device used * * @return 0 on success * @return -1 on error */ -int mq3_init(mq3_t *dev, adc_t adc, int channel); +int mq3_init(mq3_t *dev, adc_t adc_line); /** * @brief Read the RAW sensor value, can be between 0 and MQ3_MAX_RAW_VALUE diff --git a/drivers/mq3/mq3.c b/drivers/mq3/mq3.c index e3fe6285e7..1ad77a95c5 100644 --- a/drivers/mq3/mq3.c +++ b/drivers/mq3/mq3.c @@ -24,16 +24,15 @@ #define MIN (100U) /* TODO: calibrate to useful value */ #define FACTOR (2.33f) /* TODO: calibrate to useful value */ -int mq3_init(mq3_t *dev, adc_t adc, int channel) +int mq3_init(mq3_t *dev, adc_t adc_line) { - dev->adc_dev = adc; - dev->adc_chan = channel; - return adc_init(dev->adc_dev, PRECISION); + dev->adc_line = adc_line; + return adc_init(dev->adc_line); } int mq3_read_raw(mq3_t *dev) { - return adc_sample(dev->adc_dev, dev->adc_chan); + return adc_sample(dev->adc_line, PRECISION); } int mq3_read(mq3_t *dev)