mq3.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
9 #pragma once
10 
23 #include "periph/adc.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
32 #define MQ3_MAX_RAW_VALUE (1023U)
33 
37 typedef struct {
39 } mq3_t;
40 
55 int mq3_init(mq3_t *dev, adc_t adc_line);
56 
64 int16_t mq3_read_raw(const mq3_t *dev);
65 
73 int16_t mq3_read(const mq3_t *dev);
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
Low-level ADC peripheral driver interface definitions.
int16_t mq3_read(const mq3_t *dev)
Read the scaled sensor value of PPM of alcohol.
int16_t mq3_read_raw(const mq3_t *dev)
Read the RAW sensor value, can be between 0 and MQ3_MAX_RAW_VALUE.
int mq3_init(mq3_t *dev, adc_t adc_line)
Initialize a MQ-3 alcohol sensor.
uint_fast8_t adc_t
Define default ADC type identifier.
Definition: adc.h:71
device descriptor for a MQ-3 sensor
Definition: mq3.h:37
adc_t adc_line
the used ADC line
Definition: mq3.h:38