libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
dac_common_v2.h
Go to the documentation of this file.
1/** @addtogroup dac_defines
2
3@author @htmlonly © @endhtmlonly 2020
4Ben Brewer <ben.brewer@codethink.co.uk>
5
6*/
7
8/*
9 * This file is part of the libopencm3 project.
10 *
11 * Copyright (C) 2020 Ben Brewer <ben.brewer@codethink.co.uk>
12 *
13 * This library is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU Lesser General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this library. If not, see <http://www.gnu.org/licenses/>.
25 */
26
27/**@{*/
28
29/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA DAC.H
30The order of header inclusion is important. dac.h includes the device
31specific memorymap.h header before including this header file.*/
32
33/** @cond */
34#ifdef LIBOPENCM3_DAC_H
35/** @endcond */
36#ifndef LIBOPENCM3_DAC_COMMON_V2_H
37#define LIBOPENCM3_DAC_COMMON_V2_H
38
40
41/**@addtogroup dac_registers
42 @{*/
43
44/** DAC calibration control register (DAC_CCR) */
45#define DAC_CCR(dac) MMIO32((dac) + 0x38)
46
47/** DAC mode control register (DAC_MCR) */
48#define DAC_MCR(dac) MMIO32((dac) + 0x3C)
49
50/** DAC channel1 sample and hold sample time register (DAC_SHSR1) */
51#define DAC_SHSR1(dac) MMIO32((dac) + 0x40)
52
53/** DAC channel2 sample and hold sample time register (DAC_SHSR2) */
54#define DAC_SHSR2(dac) MMIO32((dac) + 0x44)
55
56/** DAC sample and hold time register (DAC_SHHR) */
57#define DAC_SHHR(dac) MMIO32((dac) + 0x48)
58
59/** DAC sample and hold refresh time register (DAC_SHRR) */
60#define DAC_SHRR(dac) MMIO32((dac) + 0x4C)
61
62/** DAC channel1 sawtooth register (DAC_STR1) */
63#define DAC_STR1(dac) MMIO32((dac) + 0x58)
64
65/** DAC channel2 sawtooth register (DAC_STR2) */
66#define DAC_STR2(dac) MMIO32((dac) + 0x5C)
67
68/** DAC sawtooth mode register (DAC_STMODR) */
69#define DAC_STMODR(dac) MMIO32((dac) + 0x60)
70/**@}*/
71
72/**@addtogroup dac_cr_values
73 * @{
74 */
75
76/** CEN2: DAC channel2 calibration enable */
77#define DAC_CR_CEN2 (1 << 30)
78
79/* TSEL2[3:0]: DAC channel2 trigger selection */
80#define DAC_CR_TSEL2_SHIFT 18
81/** @defgroup dac_trig2_sel DAC Channel 2 Trigger Source Selection
82@ingroup dac_defines
83
84@li SW: Software trigger
85@li T8: Timer 8 TRGO event
86@li T7: Timer 7 TRGO event
87@li T15: Timer 15 TRGO event
88@li T2: Timer 2 TRGO event
89@li T4: Timer 4 TRGO event
90@li E9: External line 9
91@li T6: Timer 6 TRGO event
92@li T3: Timer 3 TRGO event
93@li HRR1: hrtim_dac_reset_trg1
94@li HRR2: hrtim_dac_reset_trg2
95@li HRR3: hrtim_dac_reset_trg3
96@li HRR4: hrtim_dac_reset_trg4
97@li HRR5: hrtim_dac_reset_trg5
98@li HRR6: hrtim_dac_reset_trg6
99@li HR2: hrtim_dac_trg2
100
101@note: only used if bit TEN2 is set (DAC channel 2 trigger enabled)
102@{*/
103#define DAC_CR_TSEL2_SW (0x0 << DAC_CR_TSEL2_SHIFT)
104#define DAC_CR_TSEL2_T8 (0x1 << DAC_CR_TSEL2_SHIFT)
105#define DAC_CR_TSEL2_T7 (0x2 << DAC_CR_TSEL2_SHIFT)
106#define DAC_CR_TSEL2_T15 (0x3 << DAC_CR_TSEL2_SHIFT)
107#define DAC_CR_TSEL2_T2 (0x4 << DAC_CR_TSEL2_SHIFT)
108#define DAC_CR_TSEL2_T4 (0x5 << DAC_CR_TSEL2_SHIFT)
109#define DAC_CR_TSEL2_E9 (0x6 << DAC_CR_TSEL2_SHIFT)
110#define DAC_CR_TSEL2_T6 (0x7 << DAC_CR_TSEL2_SHIFT)
111#define DAC_CR_TSEL2_T3 (0x8 << DAC_CR_TSEL2_SHIFT)
112#define DAC_CR_TSEL2_HRR1 (0x9 << DAC_CR_TSEL2_SHIFT)
113#define DAC_CR_TSEL2_HRR2 (0xA << DAC_CR_TSEL2_SHIFT)
114#define DAC_CR_TSEL2_HRR3 (0xB << DAC_CR_TSEL2_SHIFT)
115#define DAC_CR_TSEL2_HRR4 (0xC << DAC_CR_TSEL2_SHIFT)
116#define DAC_CR_TSEL2_HRR5 (0xD << DAC_CR_TSEL2_SHIFT)
117#define DAC_CR_TSEL2_HRR6 (0xE << DAC_CR_TSEL2_SHIFT)
118#define DAC_CR_TSEL2_HR2 (0xF << DAC_CR_TSEL2_SHIFT)
119/**@}*/
120
121/* TEN2: DAC channel2 trigger enable */
122#define DAC_CR_TEN2 (1 << 17)
123
124/* CEN1: DAC channel1 calibration enable */
125#define DAC_CR_CEN1 (1 << 14)
126
127/* TSEL1[3:0]: DAC channel1 trigger selection */
128#define DAC_CR_TSEL1_SHIFT 2
129/** @defgroup dac_trig1_sel DAC Channel 1 Trigger Source Selection
130@ingroup dac_defines
131
132@li CK: ck_lsi or ck_lse (selected in the RCC)
133@li T8: Timer 8 TRGO event
134@li T7: Timer 7 TRGO event in connectivity line devices
135@li T15: Timer 15 TRGO event in high-density and XL-density devices
136@li T2: Timer 2 TRGO event
137@li T4: Timer 4 TRGO event
138@li E9: External line9
139@li T6: Timer 6 TRGO event
140@li T3: Timer 3 TRGO event
141@li HRR1: hrtim_dac_reset_trg1
142@li HRR2: hrtim_dac_reset_trg2
143@li HRR3: hrtim_dac_reset_trg3
144@li HRR4: hrtim_dac_reset_trg4
145@li HRR5: hrtim_dac_reset_trg5
146@li HRR6: hrtim_dac_reset_trg6
147@li HR2: hrtim_dac_trg2
148
149@note: only used if bit TEN1 is set (DAC channel 1 trigger enabled).
150@{*/
151#define DAC_CR_TSEL1_CK (0x0 << DAC_CR_TSEL1_SHIFT)
152#define DAC_CR_TSEL1_T8 (0x1 << DAC_CR_TSEL1_SHIFT)
153#define DAC_CR_TSEL1_T7 (0x2 << DAC_CR_TSEL1_SHIFT)
154#define DAC_CR_TSEL1_T15 (0x3 << DAC_CR_TSEL1_SHIFT)
155#define DAC_CR_TSEL1_T2 (0x4 << DAC_CR_TSEL1_SHIFT)
156#define DAC_CR_TSEL1_T4 (0x5 << DAC_CR_TSEL1_SHIFT)
157#define DAC_CR_TSEL1_E9 (0x6 << DAC_CR_TSEL1_SHIFT)
158#define DAC_CR_TSEL1_T6 (0x7 << DAC_CR_TSEL1_SHIFT)
159#define DAC_CR_TSEL1_T3 (0x8 << DAC_CR_TSEL1_SHIFT)
160#define DAC_CR_TSEL1_HRR1 (0x9 << DAC_CR_TSEL1_SHIFT)
161#define DAC_CR_TSEL1_HRR2 (0xA << DAC_CR_TSEL1_SHIFT)
162#define DAC_CR_TSEL1_HRR3 (0xB << DAC_CR_TSEL1_SHIFT)
163#define DAC_CR_TSEL1_HRR4 (0xC << DAC_CR_TSEL1_SHIFT)
164#define DAC_CR_TSEL1_HRR5 (0xD << DAC_CR_TSEL1_SHIFT)
165#define DAC_CR_TSEL1_HRR6 (0xE << DAC_CR_TSEL1_SHIFT)
166#define DAC_CR_TSEL1_HR3 (0xF << DAC_CR_TSEL1_SHIFT)
167/**@}*/
168
169/** TEN1: DAC channel1 trigger enable */
170#define DAC_CR_TEN1 (1 << 1)
171/**@}*/
172
173
174/** @addtogroup dac_swtrigr_values
175 * @{
176 */
177/** SWTRIG2: DAC channel2 software trigger B */
178#define DAC_SWTRIGR_SWTRIGB2 (1 << 17)
179
180/** SWTRIG1: DAC channel1 software trigger B */
181#define DAC_SWTRIGR_SWTRIGB1 (1 << 16)
182/**@}*/
183
184/** @addtogroup dac_dorx_values
185 * @{
186 */
187/* --- DAC_DOR1 values ----------------------------------------------------- */
188#define DAC_DOR1_DACC1DORB_SHIFT 16
189#define DAC_DOR1_DACC1DORB_MASK 0xFFF
190
191
192/* --- DAC_DOR2 values ----------------------------------------------------- */
193#define DAC_DOR2_DACC2DORB_SHIFT 16
194#define DAC_DOR2_DACC2DORB_MASK 0xFFF
195/**@}*/
196
197/** @addtogroup dac_sr_values
198 * @{
199 */
200/** DAC channel2 busy writing sample time flag */
201#define DAC_SR_BWST2 (1 << 31)
202
203/** DAC channel2 calibration offset status */
204#define DAC_SR_CAL_FLAG2 (1 << 30)
205
206/** DAC channel2 DMA underrun flag */
207#define DAC_SR_DMAUDR2 (1 << 29)
208
209/** DAC channel2 output register status bit */
210#define DAC_SR_DORSTAT2 (1 << 28)
211
212/** DAC channel2 ready status bit */
213#define DAC_SR_DAC2RDY (1 << 27)
214
215/** DAC channel1 busy writing sample time flag */
216#define DAC_SR_BWST1 (1 << 15)
217
218/** DAC channel1 calibration offset status */
219#define DAC_SR_CAL_FLAG1 (1 << 14)
220
221/** DAC channel1 DMA underrun flag */
222#define DAC_SR_DMAUDR1 (1 << 13)
223
224/** DAC channel1 output register status bit */
225#define DAC_SR_DORSTAT1 (1 << 12)
226
227/** DAC channel1 ready status bit */
228#define DAC_SR_DAC1RDY (1 << 11)
229/**@}*/
230
231
232/**@defgroup dac_ccr_values DAC_CCR values
233 * @{
234 */
235/* DAC channel2 offset trimming value */
236#define DAC_CCR_OTRIM2_SHIFT 16
237#define DAC_CCR_OTRIM2_MASK 0x1F
238
239/* DAC channel1 offset trimming value */
240#define DAC_CCR_OTRIM1_SHIFT 0
241#define DAC_CCR_OTRIM1_MASK 0x1F
242/**@}*/
243
244/* --- DAC_MCR values ----------------------------------------------------- */
245
246/**@defgroup dac_mcr_values DAC_MCR values
247 * @{
248 */
249/** Enable signed format for DAC channel2 */
250#define DAC_MCR_SINFORMAT2 (1 << 25)
251
252/** DAC channel2 DMA double data mode */
253#define DAC_MCR_DMADOUBLE2 (1 << 24)
254
255/** MODE2[2:0]: DAC channel2 mode */
256#define DAC_MCR_MODE2_SHIFT 16
257/** @defgroup dac_mode2_sel DAC Channel 2 Mode Selection
258@ingroup dac_defines
259
260@li E_BUFF: External pin with buffer enabled
261@li EP_BUFF: External pin and on-chip peripherals with buffer
262@li E: External pin without buffer
263@li EP: External pin and on-chip peripherals without buffer
264@li SH_E_BUFF: Sample & Hold, External pin with buffer enabled
265@li SH_EP_BUFF: Sample & Hold, External pin and on-chip peripherals with buffer
266@li SH_E: Sample & Hold, External pin without buffer
267@li SH_EP: Sample & Hold, External pin and on-chip peripherals without buffer
268@{*/
269#define DAC_MCR_MODE2_E_BUFF (0x0 << DAC_MCR_MODE2_SHIFT)
270#define DAC_MCR_MODE2_EP_BUFF (0x1 << DAC_MCR_MODE2_SHIFT)
271#define DAC_MCR_MODE2_E (0x2 << DAC_MCR_MODE2_SHIFT)
272#define DAC_MCR_MODE2_EP (0x3 << DAC_MCR_MODE2_SHIFT)
273#define DAC_MCR_MODE2_SH_E_BUFF (0x4 << DAC_MCR_MODE2_SHIFT)
274#define DAC_MCR_MODE2_SH_EP_BUFF (0x5 << DAC_MCR_MODE2_SHIFT)
275#define DAC_MCR_MODE2_SH_E (0x6 << DAC_MCR_MODE2_SHIFT)
276#define DAC_MCR_MODE2_SH_EP (0x7 << DAC_MCR_MODE2_SHIFT)
277/**@}*/
278
279#define DAC_MCR_MODE2_PERIPHERAL (0x1 << DAC_MCR_MODE2_SHIFT)
280#define DAC_MCR_MODE2_UNBUFFERED (0x2 << DAC_MCR_MODE2_SHIFT)
281#define DAC_MCR_MODE2_SAMPLEHOLD (0x4 << DAC_MCR_MODE2_SHIFT)
282
283/* HFSEL[1:0]: High frequency interface mode selection */
284#define DAC_MCR_HFSEL_SHIFT 14
285#define DAC_MCR_HFSEL_MASK 0x3
286/** @defgroup dac_hfsel High frequency interface mode selection
287@ingroup dac_defines
288
289@li DIS: High frequency mode disabled
290@li AHB80: High frequency interface mode compatible to AHB>80MHz enabled
291@li AHB160: High frequency interface mode compatible to AHB>160MHz enabled
292@{*/
293#define DAC_MCR_HFSEL_DIS (0x0 << DAC_MCR_HFSEL_SHIFT)
294#define DAC_MCR_HFSEL_AHB80 (0x1 << DAC_MCR_HFSEL_SHIFT)
295#define DAC_MCR_HFSEL_AHB160 (0x2 << DAC_MCR_HFSEL_SHIFT)
296/**@}*/
297
298/** Enable signed format for DAC channel1 */
299#define DAC_MCR_SINFORMAT1 (1 << 9)
300
301/** DAC channel1 DMA double data mode */
302#define DAC_MCR_DMADOUBLE1 (1 << 8)
303
304/* MODE1[2:0]: DAC channel1 mode */
305#define DAC_MCR_MODE1_SHIFT 0
306/** @defgroup dac_mode1_sel DAC Channel 1 Mode Selection
307@ingroup dac_defines
308
309@li E_BUFF: External pin with buffer enabled
310@li EP_BUFF: External pin and on-chip peripherals with buffer
311@li E: External pin without buffer
312@li EP: External pin and on-chip peripherals without buffer
313@li SH_E_BUFF: Sample & Hold, External pin with buffer enabled
314@li SH_EP_BUFF: Sample & Hold, External pin and on-chip peripherals with buffer
315@li SH_E: Sample & Hold, External pin without buffer
316@li SH_EP: Sample & Hold , External pin and on-chip peripherals without buffer
317@{*/
318#define DAC_MCR_MODE1_E_BUFF (0x0 << DAC_MCR_MODE1_SHIFT)
319#define DAC_MCR_MODE1_EP_BUFF (0x1 << DAC_MCR_MODE1_SHIFT)
320#define DAC_MCR_MODE1_E (0x2 << DAC_MCR_MODE1_SHIFT)
321#define DAC_MCR_MODE1_EP (0x3 << DAC_MCR_MODE1_SHIFT)
322#define DAC_MCR_MODE1_SH_E_BUFF (0x4 << DAC_MCR_MODE1_SHIFT)
323#define DAC_MCR_MODE1_SH_EP_BUFF (0x5 << DAC_MCR_MODE1_SHIFT)
324#define DAC_MCR_MODE1_SH_E (0x6 << DAC_MCR_MODE1_SHIFT)
325#define DAC_MCR_MODE1_SH_EP (0x7 << DAC_MCR_MODE1_SHIFT)
326/**@}*/
327
328#define DAC_MCR_MODE1_PERIPHERAL (0x1 << DAC_MCR_MODE1_SHIFT)
329#define DAC_MCR_MODE1_UNBUFFERED (0x2 << DAC_MCR_MODE1_SHIFT)
330#define DAC_MCR_MODE1_SAMPLEHOLD (0x4 << DAC_MCR_MODE1_SHIFT)
331/**@}*/
332
333/* --- DAC_SHSR1 values ----------------------------------------------------- */
334
335/* DAC channel1 sample time (only valid in Sample and hold mode) */
336#define DAC_SHSR1_TSAMPLE1_SHIFT 0
337#define DAC_SHSR1_TSAMPLE1_MASK 0x1FF
338
339/* --- DAC_SHSR2 values ----------------------------------------------------- */
340
341/* DAC channel2 sample time (only valid in Sample and hold mode) */
342#define DAC_SHSR2_TSAMPLE2_SHIFT 0
343#define DAC_SHSR2_TSAMPLE2_MASK 0x1FF
344
345/* --- DAC_SHHR values ----------------------------------------------------- */
346
347/* DAC channel2 hold time (only valid in Sample and hold mode) */
348#define DAC_SHHSR_THOLD2_SHIFT 16
349#define DAC_SHHSR_THOLD2_MASK 0x1FF
350
351/* DAC channel1 hold time (only valid in Sample and hold mode) */
352#define DAC_SHHSR_THOLD1_SHIFT 0
353#define DAC_SHHSR_THOLD1_MASK 0x1FF
354
355/* --- DAC_STR1 values ----------------------------------------------------- */
356
357/* DAC channel1 sawtooth increment value (12.4 bit format) */
358#define DAC_STR1_STINCDATA1_SHIFT 16
359#define DAC_STR1_STINCDATA1_MASK 0xFFFF
360
361/* STDIR1: DAC channel1 sawtooth direction setting */
362#define DAC_STR1_STDIR1_SHIFT 12
363/** @defgroup dac_stdir1 DAC Channel 1 Sawtooth Direction Setting
364@ingroup dac_defines
365
366@li DEC: Decrement
367@li INC: Increment
368@{*/
369#define DAC_STR1_STDIR1_DEC (0x0 << DAC_STR_STDIR1_SHIFT)
370#define DAC_STR1_STDIR1_INC (0x1 << DAC_STR_STDIR1_SHIFT)
371/**@}*/
372
373/* DAC channel1 sawtooth reset value */
374#define DAC_STR1_STRSTDATA1_SHIFT 0
375#define DAC_STR1_STRSTDATA1_MASK 0xFFF
376
377/* --- DAC_STR2 values ----------------------------------------------------- */
378
379/* DAC channel2 sawtooth increment value (12.4 bit format) */
380#define DAC_STR2_STINCDATA2_SHIFT 16
381#define DAC_STR2_STINCDATA2_MASK 0xFFFF
382
383/* STDIR1: DAC channel2 sawtooth direction setting */
384#define DAC_STR2_STDIR2_SHIFT 12
385/** @defgroup dac_stdir2 DAC Channel 2 Sawtooth Direction Setting
386@ingroup dac_defines
387
388@li DEC: Decrement
389@li INC: Increment
390@{*/
391#define DAC_STR2_STDIR2_DEC (0x0 << DAC_STR_STDIR2_SHIFT)
392#define DAC_STR2_STDIR2_INC (0x1 << DAC_STR_STDIR2_SHIFT)
393/**@}*/
394
395/* DAC channel1 sawtooth reset value */
396#define DAC_STR2_STRSTDATA2_SHIFT 0
397#define DAC_STR2_STRSTDATA2_MASK 0xFFF
398
399/* --- DAC_STMODR values ----------------------------------------------------- */
400
401/* STINCTRIGSEL2[3:0]: DAC channel2 sawtooth increment trigger selection */
402#define DAC_STMODR_STINCTRIGSEL2_SHIFT 24
403/** @defgroup dac_sawtooth2_inc DAC Channel 2 Sawtooth Increment Trigger
404@ingroup dac_defines
405
406@li SW: SWTRIGB2
407@li T1: dac_inc_ch2_trg1
408@li T2: dac_inc_ch2_trg2
409@li T3: dac_inc_ch2_trg3
410@li T4: dac_inc_ch2_trg4
411@li T5: dac_inc_ch2_trg5
412@li T6: dac_inc_ch2_trg6
413@li T7: dac_inc_ch2_trg7
414@li T8: dac_inc_ch2_trg8
415@li T9: dac_inc_ch2_trg9
416@li T10: dac_inc_ch2_trg10
417@li T11: dac_inc_ch2_trg11
418@li T12: dac_inc_ch2_trg12
419@li T13: dac_inc_ch2_trg13
420@li T14: dac_inc_ch2_trg14
421@li T15: dac_inc_ch2_trg15
422
423@note: These bits are only available only on dual-channel DACs.
424@{*/
425#define DAC_STMODR_STINCTRIGSEL2_SW (0x0 << DAC_STMODR_STINCTRIGSEL2_SHIFT)
426#define DAC_STMODR_STINCTRIGSEL2_T1 (0x1 << DAC_STMODR_STINCTRIGSEL2_SHIFT)
427#define DAC_STMODR_STINCTRIGSEL2_T2 (0x2 << DAC_STMODR_STINCTRIGSEL2_SHIFT)
428#define DAC_STMODR_STINCTRIGSEL2_T3 (0x3 << DAC_STMODR_STINCTRIGSEL2_SHIFT)
429#define DAC_STMODR_STINCTRIGSEL2_T4 (0x4 << DAC_STMODR_STINCTRIGSEL2_SHIFT)
430#define DAC_STMODR_STINCTRIGSEL2_T5 (0x5 << DAC_STMODR_STINCTRIGSEL2_SHIFT)
431#define DAC_STMODR_STINCTRIGSEL2_T6 (0x6 << DAC_STMODR_STINCTRIGSEL2_SHIFT)
432#define DAC_STMODR_STINCTRIGSEL2_T7 (0x7 << DAC_STMODR_STINCTRIGSEL2_SHIFT)
433#define DAC_STMODR_STINCTRIGSEL2_T8 (0x8 << DAC_STMODR_STINCTRIGSEL2_SHIFT)
434#define DAC_STMODR_STINCTRIGSEL2_T9 (0x9 << DAC_STMODR_STINCTRIGSEL2_SHIFT)
435#define DAC_STMODR_STINCTRIGSEL2_T10 (0xA << DAC_STMODR_STINCTRIGSEL2_SHIFT)
436#define DAC_STMODR_STINCTRIGSEL2_T11 (0xB << DAC_STMODR_STINCTRIGSEL2_SHIFT)
437#define DAC_STMODR_STINCTRIGSEL2_T12 (0xC << DAC_STMODR_STINCTRIGSEL2_SHIFT)
438#define DAC_STMODR_STINCTRIGSEL2_T13 (0xD << DAC_STMODR_STINCTRIGSEL2_SHIFT)
439#define DAC_STMODR_STINCTRIGSEL2_T14 (0xE << DAC_STMODR_STINCTRIGSEL2_SHIFT)
440#define DAC_STMODR_STINCTRIGSEL2_T15 (0xF << DAC_STMODR_STINCTRIGSEL2_SHIFT)
441/**@}*/
442
443/* STRSTTRIGSEL2[3:0]: DAC channel2 sawtooth reset trigger selection */
444#define DAC_STMODR_STRSTTRIGSEL2_SHIFT 16
445/** @defgroup dac_sawtooth2_rst DAC Channel 2 Sawtooth Reset Trigger
446@ingroup dac_defines
447
448@li SW: SWTRIGB2
449@li T1: dac_ch2_trg1
450@li T2: dac_ch2_trg2
451@li T3: dac_ch2_trg3
452@li T4: dac_ch2_trg4
453@li T5: dac_ch2_trg5
454@li T6: dac_ch2_trg6
455@li T7: dac_ch2_trg7
456@li T8: dac_ch2_trg8
457@li T9: dac_ch2_trg9
458@li T10: dac_ch2_trg10
459@li T11: dac_ch2_trg11
460@li T12: dac_ch2_trg12
461@li T13: dac_ch2_trg13
462@li T14: dac_ch2_trg14
463@li T15: dac_ch2_trg15
464
465@note: These bits are only available only on dual-channel DACs.
466@{*/
467#define DAC_STMODR_STRSTTRIGSEL2_SW (0x0 << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
468#define DAC_STMODR_STRSTTRIGSEL2_T1 (0x1 << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
469#define DAC_STMODR_STRSTTRIGSEL2_T2 (0x2 << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
470#define DAC_STMODR_STRSTTRIGSEL2_T3 (0x3 << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
471#define DAC_STMODR_STRSTTRIGSEL2_T4 (0x4 << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
472#define DAC_STMODR_STRSTTRIGSEL2_T5 (0x5 << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
473#define DAC_STMODR_STRSTTRIGSEL2_T6 (0x6 << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
474#define DAC_STMODR_STRSTTRIGSEL2_T7 (0x7 << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
475#define DAC_STMODR_STRSTTRIGSEL2_T8 (0x8 << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
476#define DAC_STMODR_STRSTTRIGSEL2_T9 (0x9 << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
477#define DAC_STMODR_STRSTTRIGSEL2_T10 (0xA << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
478#define DAC_STMODR_STRSTTRIGSEL2_T11 (0xB << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
479#define DAC_STMODR_STRSTTRIGSEL2_T12 (0xC << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
480#define DAC_STMODR_STRSTTRIGSEL2_T13 (0xD << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
481#define DAC_STMODR_STRSTTRIGSEL2_T14 (0xE << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
482#define DAC_STMODR_STRSTTRIGSEL2_T15 (0xF << DAC_STMODR_STRSTTRIGSEL2_SHIFT)
483/**@}*/
484
485
486/* STINCTRIGSEL1[3:0]: DAC channel1 sawtooth increment trigger selection */
487#define DAC_STMODR_STINCTRIGSEL1_SHIFT 8
488/** @defgroup dac_sawtooth1_inc DAC Channel 1 Sawtooth Increment Trigger
489@ingroup dac_defines
490
491@li SW: SWTRIGB2
492@li T1: dac_inc_ch1_trg1
493@li T2: dac_inc_ch1_trg2
494@li T3: dac_inc_ch1_trg3
495@li T4: dac_inc_ch1_trg4
496@li T5: dac_inc_ch1_trg5
497@li T6: dac_inc_ch1_trg6
498@li T7: dac_inc_ch1_trg7
499@li T8: dac_inc_ch1_trg8
500@li T9: dac_inc_ch1_trg9
501@li T10: dac_inc_ch1_trg10
502@li T11: dac_inc_ch1_trg11
503@li T12: dac_inc_ch1_trg12
504@li T13: dac_inc_ch1_trg13
505@li T14: dac_inc_ch1_trg14
506@li T15: dac_inc_ch1_trg15
507
508@note: These bits are only available only on dual-channel DACs.
509@{*/
510#define DAC_STMODR_STINCTRIGSEL1_SW (0x0 << DAC_STMODR_STINCTRIGSEL1_SHIFT)
511#define DAC_STMODR_STINCTRIGSEL1_T1 (0x1 << DAC_STMODR_STINCTRIGSEL1_SHIFT)
512#define DAC_STMODR_STINCTRIGSEL1_T2 (0x2 << DAC_STMODR_STINCTRIGSEL1_SHIFT)
513#define DAC_STMODR_STINCTRIGSEL1_T3 (0x3 << DAC_STMODR_STINCTRIGSEL1_SHIFT)
514#define DAC_STMODR_STINCTRIGSEL1_T4 (0x4 << DAC_STMODR_STINCTRIGSEL1_SHIFT)
515#define DAC_STMODR_STINCTRIGSEL1_T5 (0x5 << DAC_STMODR_STINCTRIGSEL1_SHIFT)
516#define DAC_STMODR_STINCTRIGSEL1_T6 (0x6 << DAC_STMODR_STINCTRIGSEL1_SHIFT)
517#define DAC_STMODR_STINCTRIGSEL1_T7 (0x7 << DAC_STMODR_STINCTRIGSEL1_SHIFT)
518#define DAC_STMODR_STINCTRIGSEL1_T8 (0x8 << DAC_STMODR_STINCTRIGSEL1_SHIFT)
519#define DAC_STMODR_STINCTRIGSEL1_T9 (0x9 << DAC_STMODR_STINCTRIGSEL1_SHIFT)
520#define DAC_STMODR_STINCTRIGSEL1_T10 (0xA << DAC_STMODR_STINCTRIGSEL1_SHIFT)
521#define DAC_STMODR_STINCTRIGSEL1_T11 (0xB << DAC_STMODR_STINCTRIGSEL1_SHIFT)
522#define DAC_STMODR_STINCTRIGSEL1_T12 (0xC << DAC_STMODR_STINCTRIGSEL1_SHIFT)
523#define DAC_STMODR_STINCTRIGSEL1_T13 (0xD << DAC_STMODR_STINCTRIGSEL1_SHIFT)
524#define DAC_STMODR_STINCTRIGSEL1_T14 (0xE << DAC_STMODR_STINCTRIGSEL1_SHIFT)
525#define DAC_STMODR_STINCTRIGSEL1_T15 (0xF << DAC_STMODR_STINCTRIGSEL1_SHIFT)
526/**@}*/
527
528/* STRSTTRIGSEL1[3:0]: DAC channel1 sawtooth reset trigger selection */
529#define DAC_STMODR_STRSTTRIGSEL1_SHIFT 0
530/** @defgroup dac_sawtooth1_rst DAC Channel 1 Sawtooth Reset Trigger
531@ingroup dac_defines
532
533@li SW: SWTRIGB2
534@li T1: dac_ch1_trg1
535@li T2: dac_ch1_trg2
536@li T3: dac_ch1_trg3
537@li T4: dac_ch1_trg4
538@li T5: dac_ch1_trg5
539@li T6: dac_ch1_trg6
540@li T7: dac_ch1_trg7
541@li T8: dac_ch1_trg8
542@li T9: dac_ch1_trg9
543@li T10: dac_ch1_trg10
544@li T11: dac_ch1_trg11
545@li T12: dac_ch1_trg12
546@li T13: dac_ch1_trg13
547@li T14: dac_ch1_trg14
548@li T15: dac_ch1_trg15
549
550@note: These bits are only available only on dual-channel DACs.
551@{*/
552#define DAC_STMODR_STRSTTRIGSEL1_SW (0x0 << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
553#define DAC_STMODR_STRSTTRIGSEL1_T1 (0x1 << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
554#define DAC_STMODR_STRSTTRIGSEL1_T2 (0x2 << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
555#define DAC_STMODR_STRSTTRIGSEL1_T3 (0x3 << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
556#define DAC_STMODR_STRSTTRIGSEL1_T4 (0x4 << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
557#define DAC_STMODR_STRSTTRIGSEL1_T5 (0x5 << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
558#define DAC_STMODR_STRSTTRIGSEL1_T6 (0x6 << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
559#define DAC_STMODR_STRSTTRIGSEL1_T7 (0x7 << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
560#define DAC_STMODR_STRSTTRIGSEL1_T8 (0x8 << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
561#define DAC_STMODR_STRSTTRIGSEL1_T9 (0x9 << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
562#define DAC_STMODR_STRSTTRIGSEL1_T10 (0xA << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
563#define DAC_STMODR_STRSTTRIGSEL1_T11 (0xB << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
564#define DAC_STMODR_STRSTTRIGSEL1_T12 (0xC << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
565#define DAC_STMODR_STRSTTRIGSEL1_T13 (0xD << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
566#define DAC_STMODR_STRSTTRIGSEL1_T14 (0xE << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
567#define DAC_STMODR_STRSTTRIGSEL1_T15 (0xF << DAC_STMODR_STRSTTRIGSEL1_SHIFT)
568/**@}*/
569
570/* --- Function prototypes ------------------------------------------------- */
571
573
574void dac_set_mode(uint32_t dac, uint32_t mode);
575bool dac_is_ready(uint32_t dac, int channel);
576void dac_wait_on_ready(uint32_t dac, int channel);
577void dac_set_high_frequency_mode(uint32_t dac, uint32_t hfsel);
578
580
581#endif
582/** @cond */
583#else
584#warning "dac_common_v2.h should not be included explicitly, only via dac.h"
585#endif
586/** @endcond */
587
588/**@}*/
589
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
void dac_wait_on_ready(uint32_t dac, int channel)
Wait until DAC channel is ready to receive data.
void dac_set_mode(uint32_t dac, uint32_t mode)
DAC Channel Output Mode.
bool dac_is_ready(uint32_t dac, int channel)
Check if DAC channel is ready to receive data.
void dac_set_high_frequency_mode(uint32_t dac, uint32_t hfsel)
High frequency interface mode selection.