aboutsummaryrefslogtreecommitdiffstats
path: root/source/libmaple/api/adc.rst
blob: fecaeceb58f47feb0b408a7f5a421f8b88cfd3fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
.. highlight:: c
.. _libmaple-adc:

``adc.h``
=========

:ref:`Analog to Digital Conversion <adc>` (ADC) support.

.. contents:: Contents
   :local:

Types
-----

.. doxygenstruct:: adc_dev
.. doxygenstruct:: adc_reg_map
.. doxygenenum:: adc_extsel_event
.. doxygenenum:: adc_smp_rate

Devices
-------

.. doxygenvariable:: ADC1
.. doxygenvariable:: ADC2
.. doxygenvariable:: ADC3

Functions
---------

.. doxygenfunction:: adc_init
.. doxygenfunction:: adc_calibrate
.. doxygenfunction:: adc_set_extsel
.. doxygenfunction:: adc_enable
.. doxygenfunction:: adc_disable
.. doxygenfunction:: adc_disable_all
.. doxygenfunction:: adc_foreach
.. doxygenfunction:: adc_set_sample_rate
.. doxygenfunction:: adc_read
.. doxygenfunction:: adc_set_reg_seqlen
.. doxygenfunction:: adc_set_exttrig

Register Map Base Pointers
--------------------------

.. doxygendefine:: ADC1_BASE
.. doxygendefine:: ADC2_BASE
.. doxygendefine:: ADC3_BASE

Register Bit Definitions
------------------------

Status register
~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_SR_AWD_BIT
.. doxygendefine:: ADC_SR_EOC_BIT
.. doxygendefine:: ADC_SR_JEOC_BIT
.. doxygendefine:: ADC_SR_JSTRT_BIT
.. doxygendefine:: ADC_SR_STRT_BIT

.. doxygendefine:: ADC_SR_AWD
.. doxygendefine:: ADC_SR_EOC
.. doxygendefine:: ADC_SR_JEOC
.. doxygendefine:: ADC_SR_JSTRT
.. doxygendefine:: ADC_SR_STRT

Control register 1
~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_CR1_EOCIE_BIT
.. doxygendefine:: ADC_CR1_AWDIE_BIT
.. doxygendefine:: ADC_CR1_JEOCIE_BIT
.. doxygendefine:: ADC_CR1_SCAN_BIT
.. doxygendefine:: ADC_CR1_AWDSGL_BIT
.. doxygendefine:: ADC_CR1_JAUTO_BIT
.. doxygendefine:: ADC_CR1_DISCEN_BIT
.. doxygendefine:: ADC_CR1_JDISCEN_BIT
.. doxygendefine:: ADC_CR1_JAWDEN_BIT
.. doxygendefine:: ADC_CR1_AWDEN_BIT

.. doxygendefine:: ADC_CR1_AWDCH
.. doxygendefine:: ADC_CR1_EOCIE
.. doxygendefine:: ADC_CR1_AWDIE
.. doxygendefine:: ADC_CR1_JEOCIE
.. doxygendefine:: ADC_CR1_SCAN
.. doxygendefine:: ADC_CR1_AWDSGL
.. doxygendefine:: ADC_CR1_JAUTO
.. doxygendefine:: ADC_CR1_DISCEN
.. doxygendefine:: ADC_CR1_JDISCEN
.. doxygendefine:: ADC_CR1_DISCNUM
.. doxygendefine:: ADC_CR1_JAWDEN
.. doxygendefine:: ADC_CR1_AWDEN

Control register 2
~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_CR2_ADON_BIT
.. doxygendefine:: ADC_CR2_CONT_BIT
.. doxygendefine:: ADC_CR2_CAL_BIT
.. doxygendefine:: ADC_CR2_RSTCAL_BIT
.. doxygendefine:: ADC_CR2_DMA_BIT
.. doxygendefine:: ADC_CR2_ALIGN_BIT
.. doxygendefine:: ADC_CR2_JEXTTRIG_BIT
.. doxygendefine:: ADC_CR2_EXTTRIG_BIT
.. doxygendefine:: ADC_CR2_JSWSTART_BIT
.. doxygendefine:: ADC_CR2_SWSTART_BIT
.. doxygendefine:: ADC_CR2_TSEREFE_BIT

.. doxygendefine:: ADC_CR2_ADON
.. doxygendefine:: ADC_CR2_CONT
.. doxygendefine:: ADC_CR2_CAL
.. doxygendefine:: ADC_CR2_RSTCAL
.. doxygendefine:: ADC_CR2_DMA
.. doxygendefine:: ADC_CR2_ALIGN
.. doxygendefine:: ADC_CR2_JEXTSEL
.. doxygendefine:: ADC_CR2_JEXTTRIG
.. doxygendefine:: ADC_CR2_EXTSEL
.. doxygendefine:: ADC_CR2_EXTTRIG
.. doxygendefine:: ADC_CR2_JSWSTART
.. doxygendefine:: ADC_CR2_SWSTART
.. doxygendefine:: ADC_CR2_TSEREFE

Sample time register 1
~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_SMPR1_SMP17
.. doxygendefine:: ADC_SMPR1_SMP16
.. doxygendefine:: ADC_SMPR1_SMP15
.. doxygendefine:: ADC_SMPR1_SMP14
.. doxygendefine:: ADC_SMPR1_SMP13
.. doxygendefine:: ADC_SMPR1_SMP12
.. doxygendefine:: ADC_SMPR1_SMP11
.. doxygendefine:: ADC_SMPR1_SMP10

Sample time register 2
~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_SMPR2_SMP9
.. doxygendefine:: ADC_SMPR2_SMP8
.. doxygendefine:: ADC_SMPR2_SMP7
.. doxygendefine:: ADC_SMPR2_SMP6
.. doxygendefine:: ADC_SMPR2_SMP5
.. doxygendefine:: ADC_SMPR2_SMP4
.. doxygendefine:: ADC_SMPR2_SMP3
.. doxygendefine:: ADC_SMPR2_SMP2
.. doxygendefine:: ADC_SMPR2_SMP1
.. doxygendefine:: ADC_SMPR2_SMP0

Injected channel data offset register
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_JOFR_JOFFSET

Watchdog high threshold register
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_HTR_HT

Watchdog low threshold register
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_LTR_LT

Regular sequence register 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_SQR1_L
.. doxygendefine:: ADC_SQR1_SQ16
.. doxygendefine:: ADC_SQR1_SQ15
.. doxygendefine:: ADC_SQR1_SQ14
.. doxygendefine:: ADC_SQR1_SQ13

Regular sequence register 2
~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_SQR2_SQ12
.. doxygendefine:: ADC_SQR2_SQ11
.. doxygendefine:: ADC_SQR2_SQ10
.. doxygendefine:: ADC_SQR2_SQ9
.. doxygendefine:: ADC_SQR2_SQ8
.. doxygendefine:: ADC_SQR2_SQ7

Regular sequence register 3
~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_SQR3_SQ6
.. doxygendefine:: ADC_SQR3_SQ5
.. doxygendefine:: ADC_SQR3_SQ4
.. doxygendefine:: ADC_SQR3_SQ3
.. doxygendefine:: ADC_SQR3_SQ2
.. doxygendefine:: ADC_SQR3_SQ1

Injected sequence register
~~~~~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_JSQR_JL
.. doxygendefine:: ADC_JSQR_JL_1CONV
.. doxygendefine:: ADC_JSQR_JL_2CONV
.. doxygendefine:: ADC_JSQR_JL_3CONV
.. doxygendefine:: ADC_JSQR_JL_4CONV
.. doxygendefine:: ADC_JSQR_JSQ4
.. doxygendefine:: ADC_JSQR_JSQ3
.. doxygendefine:: ADC_JSQR_JSQ2
.. doxygendefine:: ADC_JSQR_JSQ1

Injected data registers
~~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_JDR_JDATA

Regular data register
~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: ADC_DR_ADC2DATA
.. doxygendefine:: ADC_DR_DATA