adc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2015 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
55 #ifndef PERIPH_ADC_H
56 #define PERIPH_ADC_H
57 
58 #include <limits.h>
59 
60 #include "periph_cpu.h"
61 #include "periph_conf.h"
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
70 #ifndef HAVE_ADC_T
71 typedef unsigned int adc_t;
72 #endif
73 
77 #ifndef ADC_UNDEF
78 #define ADC_UNDEF (UINT_MAX)
79 #endif
80 
84 #ifndef ADC_LINE
85 #define ADC_LINE(x) (x)
86 #endif
87 
91 #ifndef HAVE_ADC_RES_T
92 typedef enum {
99 } adc_res_t;
100 #endif
101 
112 int adc_init(adc_t line);
113 
128 int adc_sample(adc_t line, adc_res_t res);
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /* PERIPH_ADC_H */
135 
ADC resolution: 12 bit.
Definition: adc.h:96
int adc_sample(adc_t line, adc_res_t res)
Sample a value from the given ADC line.
adc_res_t
Possible ADC resolution settings.
Definition: adc.h:92
unsigned int adc_t
Define default ADC type identifier.
Definition: adc.h:71
int adc_init(adc_t line)
Initialize the given ADC line.
ADC resolution: 14 bit.
Definition: adc.h:97
ADC resolution: 10 bit.
Definition: adc.h:95
ADC resolution: 16 bit.
Definition: adc.h:98
ADC resolution: 8 bit.
Definition: adc.h:94
ADC resolution: 6 bit.
Definition: adc.h:93