Robobo
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
dacc.h
1 /* ----------------------------------------------------------------------------
2  * SAM Software Package License
3  * ----------------------------------------------------------------------------
4  * Copyright (c) 2011-2012, Atmel Corporation
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following condition is met:
10  *
11  * - Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the disclaimer below.
13  *
14  * Atmel's name may not be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  * ----------------------------------------------------------------------------
28  */
29 
30 #ifndef DACC_H_INCLUDED
31 #define DACC_H_INCLUDED
32 
33 #include "../chip.h"
34 
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 
44 typedef enum dacc_rc {
45  DACC_RC_OK = 0,
46  DACC_RC_INVALID_PARAM
47 } dacc_rc_t;
48 
49 #if SAM3N_SERIES
50 # define DACC_RESOLUTION 10
52 #else
53 # define DACC_RESOLUTION 12
55 #endif
56 #define DACC_MAX_DATA ((1 << DACC_RESOLUTION) - 1)
58 
59 void dacc_reset(Dacc *p_dacc);
60 uint32_t dacc_set_trigger(Dacc *p_dacc, uint32_t ul_trigger);
61 void dacc_disable_trigger(Dacc *p_dacc);
62 uint32_t dacc_set_transfer_mode(Dacc *p_dacc, uint32_t ul_mode);
63 void dacc_enable_interrupt(Dacc *p_dacc, uint32_t ul_interrupt_mask);
64 void dacc_disable_interrupt(Dacc *p_dacc, uint32_t ul_interrupt_mask);
65 uint32_t dacc_get_interrupt_mask(Dacc *p_dacc);
66 uint32_t dacc_get_interrupt_status(Dacc *p_dacc);
67 void dacc_write_conversion_data(Dacc *p_dacc, uint32_t ul_data);
68 void dacc_set_writeprotect(Dacc *p_dacc, uint32_t ul_enable);
69 uint32_t dacc_get_writeprotect_status(Dacc *p_dacc);
70 Pdc *dacc_get_pdc_base(Dacc *p_dacc);
71 
72 #if (SAM3N_SERIES) || defined(__DOXYGEN__)
73 void dacc_enable(Dacc *p_dacc);
74 void dacc_disable(Dacc *p_dacc);
75 uint32_t dacc_set_timing(Dacc *p_dacc, uint32_t ul_startup,
76  uint32_t ul_clock_divider);
77 #endif /* (SAM3N_SERIES) */
78 
79 #if (SAM3S_SERIES) || (SAM3XA_SERIES) || (SAM4S_SERIES) || defined(__DOXYGEN__)
80 uint32_t dacc_set_channel_selection(Dacc *p_dacc, uint32_t ul_channel);
81 void dacc_enable_flexible_selection(Dacc *p_dacc);
82 
83 uint32_t dacc_set_power_save(Dacc *p_dacc, uint32_t ul_sleep_mode,
84  uint32_t ul_fast_wakeup_mode);
85 uint32_t dacc_set_timing(Dacc *p_dacc, uint32_t ul_refresh, uint32_t ul_maxs,
86  uint32_t ul_startup);
87 uint32_t dacc_enable_channel(Dacc *p_dacc, uint32_t ul_channel);
88 uint32_t dacc_disable_channel(Dacc *p_dacc, uint32_t ul_channel);
89 uint32_t dacc_get_channel_status(Dacc *p_dacc);
90 uint32_t dacc_set_analog_control(Dacc *p_dacc, uint32_t ul_analog_control);
91 uint32_t dacc_get_analog_control(Dacc *p_dacc);
92 #endif /* (SAM3S_SERIES) || (SAM3XA_SERIES) */
93 
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 
102 #endif /* DACC_H_INCLUDED */
Pdc hardware registers.
Definition: component_pdc.h:41
Dacc hardware registers.
Definition: component_dacc.h:41