libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
adc.c
Go to the documentation of this file.
1
/** @addtogroup adc_file ADC peripheral API
2
@ingroup peripheral_apis
3
4
@author @htmlonly © @endhtmlonly 2016 Karl Palsson <karlp@tweak.net.au>
5
6
7
LGPL License Terms @ref lgpl_license
8
*/
9
/*
10
* This file is part of the libopencm3 project.
11
*
12
* Copyright (C) 2016 Karl Palsson <karlp@tweak.net.au>
13
*
14
* This library is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU Lesser General Public License as published by
16
* the Free Software Foundation, either version 3 of the License, or
17
* (at your option) any later version.
18
*
19
* This library is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU Lesser General Public License for more details.
23
*
24
* You should have received a copy of the GNU Lesser General Public License
25
* along with this library. If not, see <http://www.gnu.org/licenses/>.
26
*/
27
28
#include <
libopencm3/stm32/adc.h
>
29
30
/**@{*/
31
32
/**
33
* Enable the ADC Voltage regulator
34
* Before any use of the ADC, the ADC Voltage regulator must be enabled.
35
* You must wait up to 10uSecs afterwards before trying anything else.
36
* @param[in] adc ADC block register address base
37
* @sa adc_disable_regulator
38
*/
39
void
adc_enable_regulator
(uint32_t adc)
40
{
41
ADC_CR
(adc) |=
ADC_CR_ADVREGEN
;
42
}
43
44
/**
45
* Disable the ADC Voltage regulator
46
* You can disable the adc vreg when not in use to save power
47
* @param[in] adc ADC block register address base
48
* @sa adc_enable_regulator
49
*/
50
void
adc_disable_regulator
(uint32_t adc)
51
{
52
ADC_CR
(adc) &= ~ADC_CR_ADVREGEN;
53
}
54
55
/**@}*/
56
adc.h
adc_disable_regulator
void adc_disable_regulator(uint32_t adc)
Disable the ADC Voltage regulator You can disable the adc vreg when not in use to save power.
Definition:
adc.c:50
adc_enable_regulator
void adc_enable_regulator(uint32_t adc)
Enable the ADC Voltage regulator Before any use of the ADC, the ADC Voltage regulator must be enabled...
Definition:
adc.c:39
ADC_CR
#define ADC_CR(adc)
Control Register.
Definition:
adc_common_v2.h:46
ADC_CR_ADVREGEN
#define ADC_CR_ADVREGEN
Definition:
l4/adc.h:63
lib
stm32
l4
adc.c
Generated on Tue Mar 7 2023 16:12:11 for libopencm3 by
1.9.4