Loading...
Searching...
No Matches
adc.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2014-2015 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
53
54#include <limits.h>
55#include <stdint.h>
56
57#include "periph_cpu.h"
58#include "periph_conf.h"
59
60#ifdef __cplusplus
61extern "C" {
62#endif
63
67#ifndef HAVE_ADC_T
68typedef uint_fast8_t adc_t;
69#endif
70
74#ifndef ADC_UNDEF
75#define ADC_UNDEF (UINT_FAST8_MAX)
76#endif
77
81#ifndef ADC_LINE
82#define ADC_LINE(x) (x)
83#endif
84
88#ifndef HAVE_ADC_RES_T
97#endif
98
109int adc_init(adc_t line);
110
125int32_t adc_sample(adc_t line, adc_res_t res);
126
135
144
151
152#ifdef __cplusplus
153}
154#endif
155
int32_t adc_sample(adc_t line, adc_res_t res)
Sample a value from the given ADC line.
int adc_init(adc_t line)
Initialize the given ADC line.
int32_t adc_continuous_sample(adc_t line)
Sample an ADC line without powering off the ADC afterward.
void adc_continuous_stop(void)
Disable the ADC to save power.
uint_fast8_t adc_t
Define default ADC type identifier.
Definition adc.h:68
void adc_continuous_begin(adc_res_t res)
Configure the ADC with a given resolution for continuous sampling.
adc_res_t
Possible ADC resolution settings.
Definition adc.h:89
@ ADC_RES_16BIT
ADC resolution: 16 bit.
Definition adc.h:95
@ ADC_RES_8BIT
ADC resolution: 8 bit.
Definition adc.h:91
@ ADC_RES_14BIT
ADC resolution: 14 bit.
Definition adc.h:94
@ ADC_RES_6BIT
ADC resolution: 6 bit.
Definition adc.h:90
@ ADC_RES_10BIT
ADC resolution: 10 bit.
Definition adc.h:92
@ ADC_RES_12BIT
ADC resolution: 12 bit.
Definition adc.h:93