The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Anna Bridge 142:4eea097334d6 1 /***************************************************************************//**
Anna Bridge 142:4eea097334d6 2 * @file em_acmp.h
Anna Bridge 142:4eea097334d6 3 * @brief Analog Comparator (ACMP) peripheral API
Anna Bridge 160:5571c4ff569f 4 * @version 5.3.3
Anna Bridge 142:4eea097334d6 5 *******************************************************************************
Anna Bridge 160:5571c4ff569f 6 * # License
Anna Bridge 142:4eea097334d6 7 * <b>Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com</b>
Anna Bridge 142:4eea097334d6 8 *******************************************************************************
Anna Bridge 142:4eea097334d6 9 *
Anna Bridge 142:4eea097334d6 10 * Permission is granted to anyone to use this software for any purpose,
Anna Bridge 142:4eea097334d6 11 * including commercial applications, and to alter it and redistribute it
Anna Bridge 142:4eea097334d6 12 * freely, subject to the following restrictions:
Anna Bridge 142:4eea097334d6 13 *
Anna Bridge 142:4eea097334d6 14 * 1. The origin of this software must not be misrepresented; you must not
Anna Bridge 142:4eea097334d6 15 * claim that you wrote the original software.
Anna Bridge 142:4eea097334d6 16 * 2. Altered source versions must be plainly marked as such, and must not be
Anna Bridge 142:4eea097334d6 17 * misrepresented as being the original software.
Anna Bridge 142:4eea097334d6 18 * 3. This notice may not be removed or altered from any source distribution.
Anna Bridge 142:4eea097334d6 19 *
Anna Bridge 142:4eea097334d6 20 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
Anna Bridge 142:4eea097334d6 21 * obligation to support this Software. Silicon Labs is providing the
Anna Bridge 142:4eea097334d6 22 * Software "AS IS", with no express or implied warranties of any kind,
Anna Bridge 142:4eea097334d6 23 * including, but not limited to, any implied warranties of merchantability
Anna Bridge 142:4eea097334d6 24 * or fitness for any particular purpose or warranties against infringement
Anna Bridge 142:4eea097334d6 25 * of any proprietary rights of a third party.
Anna Bridge 142:4eea097334d6 26 *
Anna Bridge 142:4eea097334d6 27 * Silicon Labs will not be liable for any consequential, incidental, or
Anna Bridge 142:4eea097334d6 28 * special damages, or any other relief, or for any claim by any third party,
Anna Bridge 142:4eea097334d6 29 * arising from your use of this Software.
Anna Bridge 142:4eea097334d6 30 *
Anna Bridge 142:4eea097334d6 31 ******************************************************************************/
Anna Bridge 142:4eea097334d6 32
Anna Bridge 142:4eea097334d6 33 #ifndef EM_ACMP_H
Anna Bridge 142:4eea097334d6 34 #define EM_ACMP_H
Anna Bridge 142:4eea097334d6 35
Anna Bridge 142:4eea097334d6 36 #include "em_device.h"
Anna Bridge 142:4eea097334d6 37 #if defined(ACMP_COUNT) && (ACMP_COUNT > 0)
Anna Bridge 142:4eea097334d6 38
Anna Bridge 142:4eea097334d6 39 #include <stdint.h>
Anna Bridge 142:4eea097334d6 40 #include <stdbool.h>
Anna Bridge 142:4eea097334d6 41
Anna Bridge 142:4eea097334d6 42 #ifdef __cplusplus
Anna Bridge 142:4eea097334d6 43 extern "C" {
Anna Bridge 142:4eea097334d6 44 #endif
Anna Bridge 142:4eea097334d6 45
Anna Bridge 142:4eea097334d6 46 /***************************************************************************//**
Anna Bridge 142:4eea097334d6 47 * @addtogroup emlib
Anna Bridge 142:4eea097334d6 48 * @{
Anna Bridge 142:4eea097334d6 49 ******************************************************************************/
Anna Bridge 142:4eea097334d6 50
Anna Bridge 142:4eea097334d6 51 /***************************************************************************//**
Anna Bridge 142:4eea097334d6 52 * @addtogroup ACMP
Anna Bridge 142:4eea097334d6 53 * @brief Analog comparator (ACMP) Peripheral API
Anna Bridge 142:4eea097334d6 54 *
Anna Bridge 142:4eea097334d6 55 * @details
Anna Bridge 142:4eea097334d6 56 * The Analog Comparator is used to compare the voltage of two analog inputs,
Anna Bridge 142:4eea097334d6 57 * with a digital output indicating which input voltage is higher. Inputs can
Anna Bridge 142:4eea097334d6 58 * either be one of the selectable internal references or from external pins.
Anna Bridge 142:4eea097334d6 59 * Response time and thereby also the current consumption can be configured by
Anna Bridge 142:4eea097334d6 60 * altering the current supply to the comparator.
Anna Bridge 142:4eea097334d6 61 *
Anna Bridge 142:4eea097334d6 62 * The ACMP is available down to EM3 and is able to wakeup the system when
Anna Bridge 142:4eea097334d6 63 * input signals pass a certain threshold. Use @ref ACMP_IntEnable to enable
Anna Bridge 142:4eea097334d6 64 * an edge interrupt to use this functionality.
Anna Bridge 142:4eea097334d6 65 *
Anna Bridge 142:4eea097334d6 66 * Here is an example of how to use the em_acmp.h API for comparing an input
Anna Bridge 142:4eea097334d6 67 * pin to an internal 2.5V reference voltage.
Anna Bridge 142:4eea097334d6 68 *
Anna Bridge 142:4eea097334d6 69 * @if DOXYDOC_P1_DEVICE
Anna Bridge 142:4eea097334d6 70 * @include em_acmp_compare_p1.c
Anna Bridge 142:4eea097334d6 71 * @endif
Anna Bridge 142:4eea097334d6 72 *
Anna Bridge 142:4eea097334d6 73 * @if DOXYDOC_P2_DEVICE
Anna Bridge 142:4eea097334d6 74 * @include em_acmp_compare_p2.c
Anna Bridge 142:4eea097334d6 75 * @endif
Anna Bridge 142:4eea097334d6 76 *
Anna Bridge 142:4eea097334d6 77 * @note
Anna Bridge 142:4eea097334d6 78 * The ACMP can also be used to compare two separate input pins.
Anna Bridge 142:4eea097334d6 79 *
Anna Bridge 142:4eea097334d6 80 * @details
Anna Bridge 142:4eea097334d6 81 * The ACMP also contains specialized hardware for capacitive sensing. This
Anna Bridge 142:4eea097334d6 82 * module contains the function @ref ACMP_CapsenseInit for initializing the
Anna Bridge 142:4eea097334d6 83 * ACMP for capacitive sensing and the function @ref ACMP_CapsenseChannelSet
Anna Bridge 142:4eea097334d6 84 * for selecting the current capsense channel.
Anna Bridge 142:4eea097334d6 85 *
Anna Bridge 142:4eea097334d6 86 * For applications that require capacitive sensing it is recommended to use a
Anna Bridge 142:4eea097334d6 87 * library like cslib which is provided by Silicon Labs.
Anna Bridge 142:4eea097334d6 88 *
Anna Bridge 142:4eea097334d6 89 * @{
Anna Bridge 142:4eea097334d6 90 ******************************************************************************/
Anna Bridge 142:4eea097334d6 91
Anna Bridge 142:4eea097334d6 92 /*******************************************************************************
Anna Bridge 142:4eea097334d6 93 ******************************** ENUMS ************************************
Anna Bridge 142:4eea097334d6 94 ******************************************************************************/
Anna Bridge 142:4eea097334d6 95
Anna Bridge 142:4eea097334d6 96 /** Resistor values used for the internal capacative sense resistor. See the
Anna Bridge 142:4eea097334d6 97 * datasheet for your device for details on each resistor value. */
Anna Bridge 160:5571c4ff569f 98 typedef enum {
Anna Bridge 142:4eea097334d6 99 acmpResistor0 = _ACMP_INPUTSEL_CSRESSEL_RES0, /**< Resistor value 0 */
Anna Bridge 142:4eea097334d6 100 acmpResistor1 = _ACMP_INPUTSEL_CSRESSEL_RES1, /**< Resistor value 1 */
Anna Bridge 142:4eea097334d6 101 acmpResistor2 = _ACMP_INPUTSEL_CSRESSEL_RES2, /**< Resistor value 2 */
Anna Bridge 142:4eea097334d6 102 acmpResistor3 = _ACMP_INPUTSEL_CSRESSEL_RES3, /**< Resistor value 3 */
Anna Bridge 142:4eea097334d6 103 #if defined(_ACMP_INPUTSEL_CSRESSEL_RES4)
Anna Bridge 142:4eea097334d6 104 acmpResistor4 = _ACMP_INPUTSEL_CSRESSEL_RES4, /**< Resistor value 4 */
Anna Bridge 142:4eea097334d6 105 acmpResistor5 = _ACMP_INPUTSEL_CSRESSEL_RES5, /**< Resistor value 5 */
Anna Bridge 142:4eea097334d6 106 acmpResistor6 = _ACMP_INPUTSEL_CSRESSEL_RES6, /**< Resistor value 6 */
Anna Bridge 142:4eea097334d6 107 acmpResistor7 = _ACMP_INPUTSEL_CSRESSEL_RES7, /**< Resistor value 7 */
Anna Bridge 142:4eea097334d6 108 #endif
Anna Bridge 142:4eea097334d6 109 } ACMP_CapsenseResistor_TypeDef;
Anna Bridge 142:4eea097334d6 110
Anna Bridge 142:4eea097334d6 111 /** Hysteresis level. See datasheet for your device for details on each
Anna Bridge 142:4eea097334d6 112 * level. */
Anna Bridge 160:5571c4ff569f 113 typedef enum {
Anna Bridge 142:4eea097334d6 114 #if defined(_ACMP_CTRL_HYSTSEL_MASK)
Anna Bridge 142:4eea097334d6 115 acmpHysteresisLevel0 = _ACMP_CTRL_HYSTSEL_HYST0, /**< Hysteresis level 0 */
Anna Bridge 142:4eea097334d6 116 acmpHysteresisLevel1 = _ACMP_CTRL_HYSTSEL_HYST1, /**< Hysteresis level 1 */
Anna Bridge 142:4eea097334d6 117 acmpHysteresisLevel2 = _ACMP_CTRL_HYSTSEL_HYST2, /**< Hysteresis level 2 */
Anna Bridge 142:4eea097334d6 118 acmpHysteresisLevel3 = _ACMP_CTRL_HYSTSEL_HYST3, /**< Hysteresis level 3 */
Anna Bridge 142:4eea097334d6 119 acmpHysteresisLevel4 = _ACMP_CTRL_HYSTSEL_HYST4, /**< Hysteresis level 4 */
Anna Bridge 142:4eea097334d6 120 acmpHysteresisLevel5 = _ACMP_CTRL_HYSTSEL_HYST5, /**< Hysteresis level 5 */
Anna Bridge 142:4eea097334d6 121 acmpHysteresisLevel6 = _ACMP_CTRL_HYSTSEL_HYST6, /**< Hysteresis level 6 */
Anna Bridge 142:4eea097334d6 122 acmpHysteresisLevel7 = _ACMP_CTRL_HYSTSEL_HYST7 /**< Hysteresis level 7 */
Anna Bridge 142:4eea097334d6 123 #endif
Anna Bridge 142:4eea097334d6 124 #if defined(_ACMP_HYSTERESIS0_HYST_MASK)
Anna Bridge 142:4eea097334d6 125 acmpHysteresisLevel0 = _ACMP_HYSTERESIS0_HYST_HYST0, /**< Hysteresis level 0 */
Anna Bridge 142:4eea097334d6 126 acmpHysteresisLevel1 = _ACMP_HYSTERESIS0_HYST_HYST1, /**< Hysteresis level 1 */
Anna Bridge 142:4eea097334d6 127 acmpHysteresisLevel2 = _ACMP_HYSTERESIS0_HYST_HYST2, /**< Hysteresis level 2 */
Anna Bridge 142:4eea097334d6 128 acmpHysteresisLevel3 = _ACMP_HYSTERESIS0_HYST_HYST3, /**< Hysteresis level 3 */
Anna Bridge 142:4eea097334d6 129 acmpHysteresisLevel4 = _ACMP_HYSTERESIS0_HYST_HYST4, /**< Hysteresis level 4 */
Anna Bridge 142:4eea097334d6 130 acmpHysteresisLevel5 = _ACMP_HYSTERESIS0_HYST_HYST5, /**< Hysteresis level 5 */
Anna Bridge 142:4eea097334d6 131 acmpHysteresisLevel6 = _ACMP_HYSTERESIS0_HYST_HYST6, /**< Hysteresis level 6 */
Anna Bridge 142:4eea097334d6 132 acmpHysteresisLevel7 = _ACMP_HYSTERESIS0_HYST_HYST7, /**< Hysteresis level 7 */
Anna Bridge 142:4eea097334d6 133 acmpHysteresisLevel8 = _ACMP_HYSTERESIS0_HYST_HYST8, /**< Hysteresis level 8 */
Anna Bridge 142:4eea097334d6 134 acmpHysteresisLevel9 = _ACMP_HYSTERESIS0_HYST_HYST9, /**< Hysteresis level 9 */
Anna Bridge 142:4eea097334d6 135 acmpHysteresisLevel10 = _ACMP_HYSTERESIS0_HYST_HYST10, /**< Hysteresis level 10 */
Anna Bridge 142:4eea097334d6 136 acmpHysteresisLevel11 = _ACMP_HYSTERESIS0_HYST_HYST11, /**< Hysteresis level 11 */
Anna Bridge 142:4eea097334d6 137 acmpHysteresisLevel12 = _ACMP_HYSTERESIS0_HYST_HYST12, /**< Hysteresis level 12 */
Anna Bridge 142:4eea097334d6 138 acmpHysteresisLevel13 = _ACMP_HYSTERESIS0_HYST_HYST13, /**< Hysteresis level 13 */
Anna Bridge 142:4eea097334d6 139 acmpHysteresisLevel14 = _ACMP_HYSTERESIS0_HYST_HYST14, /**< Hysteresis level 14 */
Anna Bridge 142:4eea097334d6 140 acmpHysteresisLevel15 = _ACMP_HYSTERESIS0_HYST_HYST15, /**< Hysteresis level 15 */
Anna Bridge 142:4eea097334d6 141 #endif
Anna Bridge 142:4eea097334d6 142 } ACMP_HysteresisLevel_TypeDef;
Anna Bridge 142:4eea097334d6 143
Anna Bridge 142:4eea097334d6 144 #if defined(_ACMP_CTRL_WARMTIME_MASK)
Anna Bridge 142:4eea097334d6 145 /** ACMP warmup time. The delay is measured in HFPERCLK cycles and should
Anna Bridge 142:4eea097334d6 146 * be at least 10 us. */
Anna Bridge 160:5571c4ff569f 147 typedef enum {
Anna Bridge 142:4eea097334d6 148 /** 4 HFPERCLK cycles warmup */
Anna Bridge 142:4eea097334d6 149 acmpWarmTime4 = _ACMP_CTRL_WARMTIME_4CYCLES,
Anna Bridge 142:4eea097334d6 150 /** 8 HFPERCLK cycles warmup */
Anna Bridge 142:4eea097334d6 151 acmpWarmTime8 = _ACMP_CTRL_WARMTIME_8CYCLES,
Anna Bridge 142:4eea097334d6 152 /** 16 HFPERCLK cycles warmup */
Anna Bridge 142:4eea097334d6 153 acmpWarmTime16 = _ACMP_CTRL_WARMTIME_16CYCLES,
Anna Bridge 142:4eea097334d6 154 /** 32 HFPERCLK cycles warmup */
Anna Bridge 142:4eea097334d6 155 acmpWarmTime32 = _ACMP_CTRL_WARMTIME_32CYCLES,
Anna Bridge 142:4eea097334d6 156 /** 64 HFPERCLK cycles warmup */
Anna Bridge 142:4eea097334d6 157 acmpWarmTime64 = _ACMP_CTRL_WARMTIME_64CYCLES,
Anna Bridge 142:4eea097334d6 158 /** 128 HFPERCLK cycles warmup */
Anna Bridge 142:4eea097334d6 159 acmpWarmTime128 = _ACMP_CTRL_WARMTIME_128CYCLES,
Anna Bridge 142:4eea097334d6 160 /** 256 HFPERCLK cycles warmup */
Anna Bridge 142:4eea097334d6 161 acmpWarmTime256 = _ACMP_CTRL_WARMTIME_256CYCLES,
Anna Bridge 142:4eea097334d6 162 /** 512 HFPERCLK cycles warmup */
Anna Bridge 142:4eea097334d6 163 acmpWarmTime512 = _ACMP_CTRL_WARMTIME_512CYCLES
Anna Bridge 142:4eea097334d6 164 } ACMP_WarmTime_TypeDef;
Anna Bridge 142:4eea097334d6 165 #endif
Anna Bridge 142:4eea097334d6 166
Anna Bridge 142:4eea097334d6 167 #if defined(_ACMP_CTRL_INPUTRANGE_MASK)
Anna Bridge 142:4eea097334d6 168 /**
Anna Bridge 142:4eea097334d6 169 * Adjust performance of the ACMP for a given input voltage range
Anna Bridge 142:4eea097334d6 170 */
Anna Bridge 160:5571c4ff569f 171 typedef enum {
Anna Bridge 142:4eea097334d6 172 acmpInputRangeFull = _ACMP_CTRL_INPUTRANGE_FULL, /**< Input can be from 0 to Vdd */
Anna Bridge 142:4eea097334d6 173 acmpInputRangeHigh = _ACMP_CTRL_INPUTRANGE_GTVDDDIV2, /**< Input will always be greater than Vdd/2 */
Anna Bridge 142:4eea097334d6 174 acmpInputRangeLow = _ACMP_CTRL_INPUTRANGE_LTVDDDIV2 /**< Input will always be less than Vdd/2 */
Anna Bridge 142:4eea097334d6 175 } ACMP_InputRange_TypeDef;
Anna Bridge 142:4eea097334d6 176 #endif
Anna Bridge 142:4eea097334d6 177
Anna Bridge 142:4eea097334d6 178 #if defined(_ACMP_CTRL_PWRSEL_MASK)
Anna Bridge 142:4eea097334d6 179 /**
Anna Bridge 142:4eea097334d6 180 * ACMP Power source.
Anna Bridge 142:4eea097334d6 181 */
Anna Bridge 160:5571c4ff569f 182 typedef enum {
Anna Bridge 160:5571c4ff569f 183 acmpPowerSourceAvdd = _ACMP_CTRL_PWRSEL_AVDD, /**< Power the ACMP using the AVDD supply */
Anna Bridge 160:5571c4ff569f 184 acmpPowerSourceVddVreg = _ACMP_CTRL_PWRSEL_VREGVDD, /**< Power the ACMP using the VREGVDD supply */
Anna Bridge 160:5571c4ff569f 185 acmpPowerSourceIOVdd0 = _ACMP_CTRL_PWRSEL_IOVDD0, /**< Power the ACMP using the IOVDD/IOVDD0 supply */
Anna Bridge 160:5571c4ff569f 186 acmpPowerSourceIOVdd1 = _ACMP_CTRL_PWRSEL_IOVDD1, /**< Power the ACMP using the IOVDD1 supply (if part has two I/O voltages) */
Anna Bridge 142:4eea097334d6 187 } ACMP_PowerSource_TypeDef;
Anna Bridge 142:4eea097334d6 188 #endif
Anna Bridge 142:4eea097334d6 189
Anna Bridge 142:4eea097334d6 190 #if defined(_ACMP_CTRL_ACCURACY_MASK)
Anna Bridge 142:4eea097334d6 191 /**
Anna Bridge 142:4eea097334d6 192 * ACMP accuracy mode.
Anna Bridge 142:4eea097334d6 193 */
Anna Bridge 160:5571c4ff569f 194 typedef enum {
Anna Bridge 142:4eea097334d6 195 acmpAccuracyLow = _ACMP_CTRL_ACCURACY_LOW, /**< Low-accuracy mode but consume less current */
Anna Bridge 142:4eea097334d6 196 acmpAccuracyHigh = _ACMP_CTRL_ACCURACY_HIGH /**< High-accuracy mode but consume more current */
Anna Bridge 142:4eea097334d6 197 } ACMP_Accuracy_TypeDef;
Anna Bridge 142:4eea097334d6 198 #endif
Anna Bridge 142:4eea097334d6 199
Anna Bridge 142:4eea097334d6 200 #if defined(_ACMP_INPUTSEL_VASEL_MASK)
Anna Bridge 142:4eea097334d6 201 /** ACMP Input to the VA divider. This enum is used to select the input for
Anna Bridge 142:4eea097334d6 202 * the VA Divider */
Anna Bridge 160:5571c4ff569f 203 typedef enum {
Anna Bridge 142:4eea097334d6 204 acmpVAInputVDD = _ACMP_INPUTSEL_VASEL_VDD,
Anna Bridge 142:4eea097334d6 205 acmpVAInputAPORT2YCH0 = _ACMP_INPUTSEL_VASEL_APORT2YCH0,
Anna Bridge 142:4eea097334d6 206 acmpVAInputAPORT2YCH2 = _ACMP_INPUTSEL_VASEL_APORT2YCH2,
Anna Bridge 142:4eea097334d6 207 acmpVAInputAPORT2YCH4 = _ACMP_INPUTSEL_VASEL_APORT2YCH4,
Anna Bridge 142:4eea097334d6 208 acmpVAInputAPORT2YCH6 = _ACMP_INPUTSEL_VASEL_APORT2YCH6,
Anna Bridge 142:4eea097334d6 209 acmpVAInputAPORT2YCH8 = _ACMP_INPUTSEL_VASEL_APORT2YCH8,
Anna Bridge 142:4eea097334d6 210 acmpVAInputAPORT2YCH10 = _ACMP_INPUTSEL_VASEL_APORT2YCH10,
Anna Bridge 142:4eea097334d6 211 acmpVAInputAPORT2YCH12 = _ACMP_INPUTSEL_VASEL_APORT2YCH12,
Anna Bridge 142:4eea097334d6 212 acmpVAInputAPORT2YCH14 = _ACMP_INPUTSEL_VASEL_APORT2YCH14,
Anna Bridge 142:4eea097334d6 213 acmpVAInputAPORT2YCH16 = _ACMP_INPUTSEL_VASEL_APORT2YCH16,
Anna Bridge 142:4eea097334d6 214 acmpVAInputAPORT2YCH18 = _ACMP_INPUTSEL_VASEL_APORT2YCH18,
Anna Bridge 142:4eea097334d6 215 acmpVAInputAPORT2YCH20 = _ACMP_INPUTSEL_VASEL_APORT2YCH20,
Anna Bridge 142:4eea097334d6 216 acmpVAInputAPORT2YCH22 = _ACMP_INPUTSEL_VASEL_APORT2YCH22,
Anna Bridge 142:4eea097334d6 217 acmpVAInputAPORT2YCH24 = _ACMP_INPUTSEL_VASEL_APORT2YCH24,
Anna Bridge 142:4eea097334d6 218 acmpVAInputAPORT2YCH26 = _ACMP_INPUTSEL_VASEL_APORT2YCH26,
Anna Bridge 142:4eea097334d6 219 acmpVAInputAPORT2YCH28 = _ACMP_INPUTSEL_VASEL_APORT2YCH28,
Anna Bridge 142:4eea097334d6 220 acmpVAInputAPORT2YCH30 = _ACMP_INPUTSEL_VASEL_APORT2YCH30,
Anna Bridge 142:4eea097334d6 221 acmpVAInputAPORT1XCH0 = _ACMP_INPUTSEL_VASEL_APORT1XCH0,
Anna Bridge 142:4eea097334d6 222 acmpVAInputAPORT1YCH1 = _ACMP_INPUTSEL_VASEL_APORT1YCH1,
Anna Bridge 142:4eea097334d6 223 acmpVAInputAPORT1XCH2 = _ACMP_INPUTSEL_VASEL_APORT1XCH2,
Anna Bridge 142:4eea097334d6 224 acmpVAInputAPORT1YCH3 = _ACMP_INPUTSEL_VASEL_APORT1YCH3,
Anna Bridge 142:4eea097334d6 225 acmpVAInputAPORT1XCH4 = _ACMP_INPUTSEL_VASEL_APORT1XCH4,
Anna Bridge 142:4eea097334d6 226 acmpVAInputAPORT1YCH5 = _ACMP_INPUTSEL_VASEL_APORT1YCH5,
Anna Bridge 142:4eea097334d6 227 acmpVAInputAPORT1XCH6 = _ACMP_INPUTSEL_VASEL_APORT1XCH6,
Anna Bridge 142:4eea097334d6 228 acmpVAInputAPORT1YCH7 = _ACMP_INPUTSEL_VASEL_APORT1YCH7,
Anna Bridge 142:4eea097334d6 229 acmpVAInputAPORT1XCH8 = _ACMP_INPUTSEL_VASEL_APORT1XCH8,
Anna Bridge 142:4eea097334d6 230 acmpVAInputAPORT1YCH9 = _ACMP_INPUTSEL_VASEL_APORT1YCH9,
Anna Bridge 142:4eea097334d6 231 acmpVAInputAPORT1XCH10 = _ACMP_INPUTSEL_VASEL_APORT1XCH10,
Anna Bridge 142:4eea097334d6 232 acmpVAInputAPORT1YCH11 = _ACMP_INPUTSEL_VASEL_APORT1YCH11,
Anna Bridge 142:4eea097334d6 233 acmpVAInputAPORT1XCH12 = _ACMP_INPUTSEL_VASEL_APORT1XCH12,
Anna Bridge 142:4eea097334d6 234 acmpVAInputAPORT1YCH13 = _ACMP_INPUTSEL_VASEL_APORT1YCH13,
Anna Bridge 142:4eea097334d6 235 acmpVAInputAPORT1XCH14 = _ACMP_INPUTSEL_VASEL_APORT1XCH14,
Anna Bridge 142:4eea097334d6 236 acmpVAInputAPORT1YCH15 = _ACMP_INPUTSEL_VASEL_APORT1YCH15,
Anna Bridge 142:4eea097334d6 237 acmpVAInputAPORT1XCH16 = _ACMP_INPUTSEL_VASEL_APORT1XCH16,
Anna Bridge 142:4eea097334d6 238 acmpVAInputAPORT1YCH17 = _ACMP_INPUTSEL_VASEL_APORT1YCH17,
Anna Bridge 142:4eea097334d6 239 acmpVAInputAPORT1XCH18 = _ACMP_INPUTSEL_VASEL_APORT1XCH18,
Anna Bridge 142:4eea097334d6 240 acmpVAInputAPORT1YCH19 = _ACMP_INPUTSEL_VASEL_APORT1YCH19,
Anna Bridge 142:4eea097334d6 241 acmpVAInputAPORT1XCH20 = _ACMP_INPUTSEL_VASEL_APORT1XCH20,
Anna Bridge 142:4eea097334d6 242 acmpVAInputAPORT1YCH21 = _ACMP_INPUTSEL_VASEL_APORT1YCH21,
Anna Bridge 142:4eea097334d6 243 acmpVAInputAPORT1XCH22 = _ACMP_INPUTSEL_VASEL_APORT1XCH22,
Anna Bridge 142:4eea097334d6 244 acmpVAInputAPORT1YCH23 = _ACMP_INPUTSEL_VASEL_APORT1YCH23,
Anna Bridge 142:4eea097334d6 245 acmpVAInputAPORT1XCH24 = _ACMP_INPUTSEL_VASEL_APORT1XCH24,
Anna Bridge 142:4eea097334d6 246 acmpVAInputAPORT1YCH25 = _ACMP_INPUTSEL_VASEL_APORT1YCH25,
Anna Bridge 142:4eea097334d6 247 acmpVAInputAPORT1XCH26 = _ACMP_INPUTSEL_VASEL_APORT1XCH26,
Anna Bridge 142:4eea097334d6 248 acmpVAInputAPORT1YCH27 = _ACMP_INPUTSEL_VASEL_APORT1YCH27,
Anna Bridge 142:4eea097334d6 249 acmpVAInputAPORT1XCH28 = _ACMP_INPUTSEL_VASEL_APORT1XCH28,
Anna Bridge 142:4eea097334d6 250 acmpVAInputAPORT1YCH29 = _ACMP_INPUTSEL_VASEL_APORT1YCH29,
Anna Bridge 142:4eea097334d6 251 acmpVAInputAPORT1XCH30 = _ACMP_INPUTSEL_VASEL_APORT1XCH30,
Anna Bridge 142:4eea097334d6 252 acmpVAInputAPORT1YCH31 = _ACMP_INPUTSEL_VASEL_APORT1YCH31
Anna Bridge 142:4eea097334d6 253 } ACMP_VAInput_TypeDef;
Anna Bridge 142:4eea097334d6 254 #endif
Anna Bridge 142:4eea097334d6 255
Anna Bridge 142:4eea097334d6 256 #if defined(_ACMP_INPUTSEL_VBSEL_MASK)
Anna Bridge 142:4eea097334d6 257 /**
Anna Bridge 142:4eea097334d6 258 * ACMP Input to the VB divider. This enum is used to select the input for
Anna Bridge 142:4eea097334d6 259 * the VB divider.
Anna Bridge 142:4eea097334d6 260 */
Anna Bridge 160:5571c4ff569f 261 typedef enum {
Anna Bridge 142:4eea097334d6 262 acmpVBInput1V25 = _ACMP_INPUTSEL_VBSEL_1V25,
Anna Bridge 142:4eea097334d6 263 acmpVBInput2V5 = _ACMP_INPUTSEL_VBSEL_2V5
Anna Bridge 142:4eea097334d6 264 } ACMP_VBInput_TypeDef;
Anna Bridge 142:4eea097334d6 265 #endif
Anna Bridge 142:4eea097334d6 266
Anna Bridge 142:4eea097334d6 267 #if defined(_ACMP_INPUTSEL_VLPSEL_MASK)
Anna Bridge 142:4eea097334d6 268 /**
Anna Bridge 142:4eea097334d6 269 * ACMP Low-Power Input Selection.
Anna Bridge 142:4eea097334d6 270 */
Anna Bridge 160:5571c4ff569f 271 typedef enum {
Anna Bridge 142:4eea097334d6 272 acmpVLPInputVADIV = _ACMP_INPUTSEL_VLPSEL_VADIV,
Anna Bridge 142:4eea097334d6 273 acmpVLPInputVBDIV = _ACMP_INPUTSEL_VLPSEL_VBDIV
Anna Bridge 142:4eea097334d6 274 } ACMP_VLPInput_Typedef;
Anna Bridge 142:4eea097334d6 275 #endif
Anna Bridge 142:4eea097334d6 276
Anna Bridge 142:4eea097334d6 277 #if defined(_ACMP_INPUTSEL_POSSEL_APORT0XCH0)
Anna Bridge 142:4eea097334d6 278 /** ACMP Input Selection */
Anna Bridge 160:5571c4ff569f 279 typedef enum {
Anna Bridge 142:4eea097334d6 280 acmpInputAPORT0XCH0 = _ACMP_INPUTSEL_POSSEL_APORT0XCH0,
Anna Bridge 142:4eea097334d6 281 acmpInputAPORT0XCH1 = _ACMP_INPUTSEL_POSSEL_APORT0XCH1,
Anna Bridge 142:4eea097334d6 282 acmpInputAPORT0XCH2 = _ACMP_INPUTSEL_POSSEL_APORT0XCH2,
Anna Bridge 142:4eea097334d6 283 acmpInputAPORT0XCH3 = _ACMP_INPUTSEL_POSSEL_APORT0XCH3,
Anna Bridge 142:4eea097334d6 284 acmpInputAPORT0XCH4 = _ACMP_INPUTSEL_POSSEL_APORT0XCH4,
Anna Bridge 142:4eea097334d6 285 acmpInputAPORT0XCH5 = _ACMP_INPUTSEL_POSSEL_APORT0XCH5,
Anna Bridge 142:4eea097334d6 286 acmpInputAPORT0XCH6 = _ACMP_INPUTSEL_POSSEL_APORT0XCH6,
Anna Bridge 142:4eea097334d6 287 acmpInputAPORT0XCH7 = _ACMP_INPUTSEL_POSSEL_APORT0XCH7,
Anna Bridge 142:4eea097334d6 288 acmpInputAPORT0XCH8 = _ACMP_INPUTSEL_POSSEL_APORT0XCH8,
Anna Bridge 142:4eea097334d6 289 acmpInputAPORT0XCH9 = _ACMP_INPUTSEL_POSSEL_APORT0XCH9,
Anna Bridge 142:4eea097334d6 290 acmpInputAPORT0XCH10 = _ACMP_INPUTSEL_POSSEL_APORT0XCH10,
Anna Bridge 142:4eea097334d6 291 acmpInputAPORT0XCH11 = _ACMP_INPUTSEL_POSSEL_APORT0XCH11,
Anna Bridge 142:4eea097334d6 292 acmpInputAPORT0XCH12 = _ACMP_INPUTSEL_POSSEL_APORT0XCH12,
Anna Bridge 142:4eea097334d6 293 acmpInputAPORT0XCH13 = _ACMP_INPUTSEL_POSSEL_APORT0XCH13,
Anna Bridge 142:4eea097334d6 294 acmpInputAPORT0XCH14 = _ACMP_INPUTSEL_POSSEL_APORT0XCH14,
Anna Bridge 142:4eea097334d6 295 acmpInputAPORT0XCH15 = _ACMP_INPUTSEL_POSSEL_APORT0XCH15,
Anna Bridge 142:4eea097334d6 296 acmpInputAPORT0YCH0 = _ACMP_INPUTSEL_POSSEL_APORT0YCH0,
Anna Bridge 142:4eea097334d6 297 acmpInputAPORT0YCH1 = _ACMP_INPUTSEL_POSSEL_APORT0YCH1,
Anna Bridge 142:4eea097334d6 298 acmpInputAPORT0YCH2 = _ACMP_INPUTSEL_POSSEL_APORT0YCH2,
Anna Bridge 142:4eea097334d6 299 acmpInputAPORT0YCH3 = _ACMP_INPUTSEL_POSSEL_APORT0YCH3,
Anna Bridge 142:4eea097334d6 300 acmpInputAPORT0YCH4 = _ACMP_INPUTSEL_POSSEL_APORT0YCH4,
Anna Bridge 142:4eea097334d6 301 acmpInputAPORT0YCH5 = _ACMP_INPUTSEL_POSSEL_APORT0YCH5,
Anna Bridge 142:4eea097334d6 302 acmpInputAPORT0YCH6 = _ACMP_INPUTSEL_POSSEL_APORT0YCH6,
Anna Bridge 142:4eea097334d6 303 acmpInputAPORT0YCH7 = _ACMP_INPUTSEL_POSSEL_APORT0YCH7,
Anna Bridge 142:4eea097334d6 304 acmpInputAPORT0YCH8 = _ACMP_INPUTSEL_POSSEL_APORT0YCH8,
Anna Bridge 142:4eea097334d6 305 acmpInputAPORT0YCH9 = _ACMP_INPUTSEL_POSSEL_APORT0YCH9,
Anna Bridge 142:4eea097334d6 306 acmpInputAPORT0YCH10 = _ACMP_INPUTSEL_POSSEL_APORT0YCH10,
Anna Bridge 142:4eea097334d6 307 acmpInputAPORT0YCH11 = _ACMP_INPUTSEL_POSSEL_APORT0YCH11,
Anna Bridge 142:4eea097334d6 308 acmpInputAPORT0YCH12 = _ACMP_INPUTSEL_POSSEL_APORT0YCH12,
Anna Bridge 142:4eea097334d6 309 acmpInputAPORT0YCH13 = _ACMP_INPUTSEL_POSSEL_APORT0YCH13,
Anna Bridge 142:4eea097334d6 310 acmpInputAPORT0YCH14 = _ACMP_INPUTSEL_POSSEL_APORT0YCH14,
Anna Bridge 142:4eea097334d6 311 acmpInputAPORT0YCH15 = _ACMP_INPUTSEL_POSSEL_APORT0YCH15,
Anna Bridge 142:4eea097334d6 312 acmpInputAPORT1XCH0 = _ACMP_INPUTSEL_POSSEL_APORT1XCH0,
Anna Bridge 142:4eea097334d6 313 acmpInputAPORT1YCH1 = _ACMP_INPUTSEL_POSSEL_APORT1YCH1,
Anna Bridge 142:4eea097334d6 314 acmpInputAPORT1XCH2 = _ACMP_INPUTSEL_POSSEL_APORT1XCH2,
Anna Bridge 142:4eea097334d6 315 acmpInputAPORT1YCH3 = _ACMP_INPUTSEL_POSSEL_APORT1YCH3,
Anna Bridge 142:4eea097334d6 316 acmpInputAPORT1XCH4 = _ACMP_INPUTSEL_POSSEL_APORT1XCH4,
Anna Bridge 142:4eea097334d6 317 acmpInputAPORT1YCH5 = _ACMP_INPUTSEL_POSSEL_APORT1YCH5,
Anna Bridge 142:4eea097334d6 318 acmpInputAPORT1XCH6 = _ACMP_INPUTSEL_POSSEL_APORT1XCH6,
Anna Bridge 142:4eea097334d6 319 acmpInputAPORT1YCH7 = _ACMP_INPUTSEL_POSSEL_APORT1YCH7,
Anna Bridge 142:4eea097334d6 320 acmpInputAPORT1XCH8 = _ACMP_INPUTSEL_POSSEL_APORT1XCH8,
Anna Bridge 142:4eea097334d6 321 acmpInputAPORT1YCH9 = _ACMP_INPUTSEL_POSSEL_APORT1YCH9,
Anna Bridge 142:4eea097334d6 322 acmpInputAPORT1XCH10 = _ACMP_INPUTSEL_POSSEL_APORT1XCH10,
Anna Bridge 142:4eea097334d6 323 acmpInputAPORT1YCH11 = _ACMP_INPUTSEL_POSSEL_APORT1YCH11,
Anna Bridge 142:4eea097334d6 324 acmpInputAPORT1XCH12 = _ACMP_INPUTSEL_POSSEL_APORT1XCH12,
Anna Bridge 142:4eea097334d6 325 acmpInputAPORT1YCH13 = _ACMP_INPUTSEL_POSSEL_APORT1YCH13,
Anna Bridge 142:4eea097334d6 326 acmpInputAPORT1XCH14 = _ACMP_INPUTSEL_POSSEL_APORT1XCH14,
Anna Bridge 142:4eea097334d6 327 acmpInputAPORT1YCH15 = _ACMP_INPUTSEL_POSSEL_APORT1YCH15,
Anna Bridge 142:4eea097334d6 328 acmpInputAPORT1XCH16 = _ACMP_INPUTSEL_POSSEL_APORT1XCH16,
Anna Bridge 142:4eea097334d6 329 acmpInputAPORT1YCH17 = _ACMP_INPUTSEL_POSSEL_APORT1YCH17,
Anna Bridge 142:4eea097334d6 330 acmpInputAPORT1XCH18 = _ACMP_INPUTSEL_POSSEL_APORT1XCH18,
Anna Bridge 142:4eea097334d6 331 acmpInputAPORT1YCH19 = _ACMP_INPUTSEL_POSSEL_APORT1YCH19,
Anna Bridge 142:4eea097334d6 332 acmpInputAPORT1XCH20 = _ACMP_INPUTSEL_POSSEL_APORT1XCH20,
Anna Bridge 142:4eea097334d6 333 acmpInputAPORT1YCH21 = _ACMP_INPUTSEL_POSSEL_APORT1YCH21,
Anna Bridge 142:4eea097334d6 334 acmpInputAPORT1XCH22 = _ACMP_INPUTSEL_POSSEL_APORT1XCH22,
Anna Bridge 142:4eea097334d6 335 acmpInputAPORT1YCH23 = _ACMP_INPUTSEL_POSSEL_APORT1YCH23,
Anna Bridge 142:4eea097334d6 336 acmpInputAPORT1XCH24 = _ACMP_INPUTSEL_POSSEL_APORT1XCH24,
Anna Bridge 142:4eea097334d6 337 acmpInputAPORT1YCH25 = _ACMP_INPUTSEL_POSSEL_APORT1YCH25,
Anna Bridge 142:4eea097334d6 338 acmpInputAPORT1XCH26 = _ACMP_INPUTSEL_POSSEL_APORT1XCH26,
Anna Bridge 142:4eea097334d6 339 acmpInputAPORT1YCH27 = _ACMP_INPUTSEL_POSSEL_APORT1YCH27,
Anna Bridge 142:4eea097334d6 340 acmpInputAPORT1XCH28 = _ACMP_INPUTSEL_POSSEL_APORT1XCH28,
Anna Bridge 142:4eea097334d6 341 acmpInputAPORT1YCH29 = _ACMP_INPUTSEL_POSSEL_APORT1YCH29,
Anna Bridge 142:4eea097334d6 342 acmpInputAPORT1XCH30 = _ACMP_INPUTSEL_POSSEL_APORT1XCH30,
Anna Bridge 142:4eea097334d6 343 acmpInputAPORT1YCH31 = _ACMP_INPUTSEL_POSSEL_APORT1YCH31,
Anna Bridge 142:4eea097334d6 344 acmpInputAPORT2YCH0 = _ACMP_INPUTSEL_POSSEL_APORT2YCH0,
Anna Bridge 142:4eea097334d6 345 acmpInputAPORT2XCH1 = _ACMP_INPUTSEL_POSSEL_APORT2XCH1,
Anna Bridge 142:4eea097334d6 346 acmpInputAPORT2YCH2 = _ACMP_INPUTSEL_POSSEL_APORT2YCH2,
Anna Bridge 142:4eea097334d6 347 acmpInputAPORT2XCH3 = _ACMP_INPUTSEL_POSSEL_APORT2XCH3,
Anna Bridge 142:4eea097334d6 348 acmpInputAPORT2YCH4 = _ACMP_INPUTSEL_POSSEL_APORT2YCH4,
Anna Bridge 142:4eea097334d6 349 acmpInputAPORT2XCH5 = _ACMP_INPUTSEL_POSSEL_APORT2XCH5,
Anna Bridge 142:4eea097334d6 350 acmpInputAPORT2YCH6 = _ACMP_INPUTSEL_POSSEL_APORT2YCH6,
Anna Bridge 142:4eea097334d6 351 acmpInputAPORT2XCH7 = _ACMP_INPUTSEL_POSSEL_APORT2XCH7,
Anna Bridge 142:4eea097334d6 352 acmpInputAPORT2YCH8 = _ACMP_INPUTSEL_POSSEL_APORT2YCH8,
Anna Bridge 142:4eea097334d6 353 acmpInputAPORT2XCH9 = _ACMP_INPUTSEL_POSSEL_APORT2XCH9,
Anna Bridge 142:4eea097334d6 354 acmpInputAPORT2YCH10 = _ACMP_INPUTSEL_POSSEL_APORT2YCH10,
Anna Bridge 142:4eea097334d6 355 acmpInputAPORT2XCH11 = _ACMP_INPUTSEL_POSSEL_APORT2XCH11,
Anna Bridge 142:4eea097334d6 356 acmpInputAPORT2YCH12 = _ACMP_INPUTSEL_POSSEL_APORT2YCH12,
Anna Bridge 142:4eea097334d6 357 acmpInputAPORT2XCH13 = _ACMP_INPUTSEL_POSSEL_APORT2XCH13,
Anna Bridge 142:4eea097334d6 358 acmpInputAPORT2YCH14 = _ACMP_INPUTSEL_POSSEL_APORT2YCH14,
Anna Bridge 142:4eea097334d6 359 acmpInputAPORT2XCH15 = _ACMP_INPUTSEL_POSSEL_APORT2XCH15,
Anna Bridge 142:4eea097334d6 360 acmpInputAPORT2YCH16 = _ACMP_INPUTSEL_POSSEL_APORT2YCH16,
Anna Bridge 142:4eea097334d6 361 acmpInputAPORT2XCH17 = _ACMP_INPUTSEL_POSSEL_APORT2XCH17,
Anna Bridge 142:4eea097334d6 362 acmpInputAPORT2YCH18 = _ACMP_INPUTSEL_POSSEL_APORT2YCH18,
Anna Bridge 142:4eea097334d6 363 acmpInputAPORT2XCH19 = _ACMP_INPUTSEL_POSSEL_APORT2XCH19,
Anna Bridge 142:4eea097334d6 364 acmpInputAPORT2YCH20 = _ACMP_INPUTSEL_POSSEL_APORT2YCH20,
Anna Bridge 142:4eea097334d6 365 acmpInputAPORT2XCH21 = _ACMP_INPUTSEL_POSSEL_APORT2XCH21,
Anna Bridge 142:4eea097334d6 366 acmpInputAPORT2YCH22 = _ACMP_INPUTSEL_POSSEL_APORT2YCH22,
Anna Bridge 142:4eea097334d6 367 acmpInputAPORT2XCH23 = _ACMP_INPUTSEL_POSSEL_APORT2XCH23,
Anna Bridge 142:4eea097334d6 368 acmpInputAPORT2YCH24 = _ACMP_INPUTSEL_POSSEL_APORT2YCH24,
Anna Bridge 142:4eea097334d6 369 acmpInputAPORT2XCH25 = _ACMP_INPUTSEL_POSSEL_APORT2XCH25,
Anna Bridge 142:4eea097334d6 370 acmpInputAPORT2YCH26 = _ACMP_INPUTSEL_POSSEL_APORT2YCH26,
Anna Bridge 142:4eea097334d6 371 acmpInputAPORT2XCH27 = _ACMP_INPUTSEL_POSSEL_APORT2XCH27,
Anna Bridge 142:4eea097334d6 372 acmpInputAPORT2YCH28 = _ACMP_INPUTSEL_POSSEL_APORT2YCH28,
Anna Bridge 142:4eea097334d6 373 acmpInputAPORT2XCH29 = _ACMP_INPUTSEL_POSSEL_APORT2XCH29,
Anna Bridge 142:4eea097334d6 374 acmpInputAPORT2YCH30 = _ACMP_INPUTSEL_POSSEL_APORT2YCH30,
Anna Bridge 142:4eea097334d6 375 acmpInputAPORT2XCH31 = _ACMP_INPUTSEL_POSSEL_APORT2XCH31,
Anna Bridge 142:4eea097334d6 376 acmpInputAPORT3XCH0 = _ACMP_INPUTSEL_POSSEL_APORT3XCH0,
Anna Bridge 142:4eea097334d6 377 acmpInputAPORT3YCH1 = _ACMP_INPUTSEL_POSSEL_APORT3YCH1,
Anna Bridge 142:4eea097334d6 378 acmpInputAPORT3XCH2 = _ACMP_INPUTSEL_POSSEL_APORT3XCH2,
Anna Bridge 142:4eea097334d6 379 acmpInputAPORT3YCH3 = _ACMP_INPUTSEL_POSSEL_APORT3YCH3,
Anna Bridge 142:4eea097334d6 380 acmpInputAPORT3XCH4 = _ACMP_INPUTSEL_POSSEL_APORT3XCH4,
Anna Bridge 142:4eea097334d6 381 acmpInputAPORT3YCH5 = _ACMP_INPUTSEL_POSSEL_APORT3YCH5,
Anna Bridge 142:4eea097334d6 382 acmpInputAPORT3XCH6 = _ACMP_INPUTSEL_POSSEL_APORT3XCH6,
Anna Bridge 142:4eea097334d6 383 acmpInputAPORT3YCH7 = _ACMP_INPUTSEL_POSSEL_APORT3YCH7,
Anna Bridge 142:4eea097334d6 384 acmpInputAPORT3XCH8 = _ACMP_INPUTSEL_POSSEL_APORT3XCH8,
Anna Bridge 142:4eea097334d6 385 acmpInputAPORT3YCH9 = _ACMP_INPUTSEL_POSSEL_APORT3YCH9,
Anna Bridge 142:4eea097334d6 386 acmpInputAPORT3XCH10 = _ACMP_INPUTSEL_POSSEL_APORT3XCH10,
Anna Bridge 142:4eea097334d6 387 acmpInputAPORT3YCH11 = _ACMP_INPUTSEL_POSSEL_APORT3YCH11,
Anna Bridge 142:4eea097334d6 388 acmpInputAPORT3XCH12 = _ACMP_INPUTSEL_POSSEL_APORT3XCH12,
Anna Bridge 142:4eea097334d6 389 acmpInputAPORT3YCH13 = _ACMP_INPUTSEL_POSSEL_APORT3YCH13,
Anna Bridge 142:4eea097334d6 390 acmpInputAPORT3XCH14 = _ACMP_INPUTSEL_POSSEL_APORT3XCH14,
Anna Bridge 142:4eea097334d6 391 acmpInputAPORT3YCH15 = _ACMP_INPUTSEL_POSSEL_APORT3YCH15,
Anna Bridge 142:4eea097334d6 392 acmpInputAPORT3XCH16 = _ACMP_INPUTSEL_POSSEL_APORT3XCH16,
Anna Bridge 142:4eea097334d6 393 acmpInputAPORT3YCH17 = _ACMP_INPUTSEL_POSSEL_APORT3YCH17,
Anna Bridge 142:4eea097334d6 394 acmpInputAPORT3XCH18 = _ACMP_INPUTSEL_POSSEL_APORT3XCH18,
Anna Bridge 142:4eea097334d6 395 acmpInputAPORT3YCH19 = _ACMP_INPUTSEL_POSSEL_APORT3YCH19,
Anna Bridge 142:4eea097334d6 396 acmpInputAPORT3XCH20 = _ACMP_INPUTSEL_POSSEL_APORT3XCH20,
Anna Bridge 142:4eea097334d6 397 acmpInputAPORT3YCH21 = _ACMP_INPUTSEL_POSSEL_APORT3YCH21,
Anna Bridge 142:4eea097334d6 398 acmpInputAPORT3XCH22 = _ACMP_INPUTSEL_POSSEL_APORT3XCH22,
Anna Bridge 142:4eea097334d6 399 acmpInputAPORT3YCH23 = _ACMP_INPUTSEL_POSSEL_APORT3YCH23,
Anna Bridge 142:4eea097334d6 400 acmpInputAPORT3XCH24 = _ACMP_INPUTSEL_POSSEL_APORT3XCH24,
Anna Bridge 142:4eea097334d6 401 acmpInputAPORT3YCH25 = _ACMP_INPUTSEL_POSSEL_APORT3YCH25,
Anna Bridge 142:4eea097334d6 402 acmpInputAPORT3XCH26 = _ACMP_INPUTSEL_POSSEL_APORT3XCH26,
Anna Bridge 142:4eea097334d6 403 acmpInputAPORT3YCH27 = _ACMP_INPUTSEL_POSSEL_APORT3YCH27,
Anna Bridge 142:4eea097334d6 404 acmpInputAPORT3XCH28 = _ACMP_INPUTSEL_POSSEL_APORT3XCH28,
Anna Bridge 142:4eea097334d6 405 acmpInputAPORT3YCH29 = _ACMP_INPUTSEL_POSSEL_APORT3YCH29,
Anna Bridge 142:4eea097334d6 406 acmpInputAPORT3XCH30 = _ACMP_INPUTSEL_POSSEL_APORT3XCH30,
Anna Bridge 142:4eea097334d6 407 acmpInputAPORT3YCH31 = _ACMP_INPUTSEL_POSSEL_APORT3YCH31,
Anna Bridge 142:4eea097334d6 408 acmpInputAPORT4YCH0 = _ACMP_INPUTSEL_POSSEL_APORT4YCH0,
Anna Bridge 142:4eea097334d6 409 acmpInputAPORT4XCH1 = _ACMP_INPUTSEL_POSSEL_APORT4XCH1,
Anna Bridge 142:4eea097334d6 410 acmpInputAPORT4YCH2 = _ACMP_INPUTSEL_POSSEL_APORT4YCH2,
Anna Bridge 142:4eea097334d6 411 acmpInputAPORT4XCH3 = _ACMP_INPUTSEL_POSSEL_APORT4XCH3,
Anna Bridge 142:4eea097334d6 412 acmpInputAPORT4YCH4 = _ACMP_INPUTSEL_POSSEL_APORT4YCH4,
Anna Bridge 142:4eea097334d6 413 acmpInputAPORT4XCH5 = _ACMP_INPUTSEL_POSSEL_APORT4XCH5,
Anna Bridge 142:4eea097334d6 414 acmpInputAPORT4YCH6 = _ACMP_INPUTSEL_POSSEL_APORT4YCH6,
Anna Bridge 142:4eea097334d6 415 acmpInputAPORT4XCH7 = _ACMP_INPUTSEL_POSSEL_APORT4XCH7,
Anna Bridge 142:4eea097334d6 416 acmpInputAPORT4YCH8 = _ACMP_INPUTSEL_POSSEL_APORT4YCH8,
Anna Bridge 142:4eea097334d6 417 acmpInputAPORT4XCH9 = _ACMP_INPUTSEL_POSSEL_APORT4XCH9,
Anna Bridge 142:4eea097334d6 418 acmpInputAPORT4YCH10 = _ACMP_INPUTSEL_POSSEL_APORT4YCH10,
Anna Bridge 142:4eea097334d6 419 acmpInputAPORT4XCH11 = _ACMP_INPUTSEL_POSSEL_APORT4XCH11,
Anna Bridge 142:4eea097334d6 420 acmpInputAPORT4YCH12 = _ACMP_INPUTSEL_POSSEL_APORT4YCH12,
Anna Bridge 142:4eea097334d6 421 acmpInputAPORT4XCH13 = _ACMP_INPUTSEL_POSSEL_APORT4XCH13,
Anna Bridge 142:4eea097334d6 422 acmpInputAPORT4YCH16 = _ACMP_INPUTSEL_POSSEL_APORT4YCH16,
Anna Bridge 142:4eea097334d6 423 acmpInputAPORT4XCH17 = _ACMP_INPUTSEL_POSSEL_APORT4XCH17,
Anna Bridge 142:4eea097334d6 424 acmpInputAPORT4YCH18 = _ACMP_INPUTSEL_POSSEL_APORT4YCH18,
Anna Bridge 142:4eea097334d6 425 acmpInputAPORT4XCH19 = _ACMP_INPUTSEL_POSSEL_APORT4XCH19,
Anna Bridge 142:4eea097334d6 426 acmpInputAPORT4YCH20 = _ACMP_INPUTSEL_POSSEL_APORT4YCH20,
Anna Bridge 142:4eea097334d6 427 acmpInputAPORT4XCH21 = _ACMP_INPUTSEL_POSSEL_APORT4XCH21,
Anna Bridge 142:4eea097334d6 428 acmpInputAPORT4YCH22 = _ACMP_INPUTSEL_POSSEL_APORT4YCH22,
Anna Bridge 142:4eea097334d6 429 acmpInputAPORT4XCH23 = _ACMP_INPUTSEL_POSSEL_APORT4XCH23,
Anna Bridge 142:4eea097334d6 430 acmpInputAPORT4YCH24 = _ACMP_INPUTSEL_POSSEL_APORT4YCH24,
Anna Bridge 142:4eea097334d6 431 acmpInputAPORT4XCH25 = _ACMP_INPUTSEL_POSSEL_APORT4XCH25,
Anna Bridge 142:4eea097334d6 432 acmpInputAPORT4YCH26 = _ACMP_INPUTSEL_POSSEL_APORT4YCH26,
Anna Bridge 142:4eea097334d6 433 acmpInputAPORT4XCH27 = _ACMP_INPUTSEL_POSSEL_APORT4XCH27,
Anna Bridge 142:4eea097334d6 434 acmpInputAPORT4YCH28 = _ACMP_INPUTSEL_POSSEL_APORT4YCH28,
Anna Bridge 142:4eea097334d6 435 acmpInputAPORT4XCH29 = _ACMP_INPUTSEL_POSSEL_APORT4XCH29,
Anna Bridge 142:4eea097334d6 436 acmpInputAPORT4YCH30 = _ACMP_INPUTSEL_POSSEL_APORT4YCH30,
Anna Bridge 142:4eea097334d6 437 acmpInputAPORT4YCH14 = _ACMP_INPUTSEL_POSSEL_APORT4YCH14,
Anna Bridge 142:4eea097334d6 438 acmpInputAPORT4XCH15 = _ACMP_INPUTSEL_POSSEL_APORT4XCH15,
Anna Bridge 142:4eea097334d6 439 acmpInputAPORT4XCH31 = _ACMP_INPUTSEL_POSSEL_APORT4XCH31,
Anna Bridge 142:4eea097334d6 440 #if defined(_ACMP_INPUTSEL_POSSEL_DACOUT0)
Anna Bridge 142:4eea097334d6 441 acmpInputDACOUT0 = _ACMP_INPUTSEL_POSSEL_DACOUT0,
Anna Bridge 142:4eea097334d6 442 #endif
Anna Bridge 142:4eea097334d6 443 #if defined(_ACMP_INPUTSEL_POSSEL_DACOUT1)
Anna Bridge 142:4eea097334d6 444 acmpInputDACOUT1 = _ACMP_INPUTSEL_POSSEL_DACOUT1,
Anna Bridge 142:4eea097334d6 445 #endif
Anna Bridge 142:4eea097334d6 446 acmpInputVLP = _ACMP_INPUTSEL_POSSEL_VLP,
Anna Bridge 142:4eea097334d6 447 acmpInputVBDIV = _ACMP_INPUTSEL_POSSEL_VBDIV,
Anna Bridge 142:4eea097334d6 448 acmpInputVADIV = _ACMP_INPUTSEL_POSSEL_VADIV,
Anna Bridge 142:4eea097334d6 449 acmpInputVDD = _ACMP_INPUTSEL_POSSEL_VDD,
Anna Bridge 142:4eea097334d6 450 acmpInputVSS = _ACMP_INPUTSEL_POSSEL_VSS,
Anna Bridge 142:4eea097334d6 451 } ACMP_Channel_TypeDef;
Anna Bridge 142:4eea097334d6 452 #else
Anna Bridge 142:4eea097334d6 453 /** ACMP inputs. Note that scaled VDD and bandgap references can only be used
Anna Bridge 142:4eea097334d6 454 * as negative inputs. */
Anna Bridge 160:5571c4ff569f 455 typedef enum {
Anna Bridge 142:4eea097334d6 456 /** Channel 0 */
Anna Bridge 142:4eea097334d6 457 acmpChannel0 = _ACMP_INPUTSEL_NEGSEL_CH0,
Anna Bridge 142:4eea097334d6 458 /** Channel 1 */
Anna Bridge 142:4eea097334d6 459 acmpChannel1 = _ACMP_INPUTSEL_NEGSEL_CH1,
Anna Bridge 142:4eea097334d6 460 /** Channel 2 */
Anna Bridge 142:4eea097334d6 461 acmpChannel2 = _ACMP_INPUTSEL_NEGSEL_CH2,
Anna Bridge 142:4eea097334d6 462 /** Channel 3 */
Anna Bridge 142:4eea097334d6 463 acmpChannel3 = _ACMP_INPUTSEL_NEGSEL_CH3,
Anna Bridge 142:4eea097334d6 464 /** Channel 4 */
Anna Bridge 142:4eea097334d6 465 acmpChannel4 = _ACMP_INPUTSEL_NEGSEL_CH4,
Anna Bridge 142:4eea097334d6 466 /** Channel 5 */
Anna Bridge 142:4eea097334d6 467 acmpChannel5 = _ACMP_INPUTSEL_NEGSEL_CH5,
Anna Bridge 142:4eea097334d6 468 /** Channel 6 */
Anna Bridge 142:4eea097334d6 469 acmpChannel6 = _ACMP_INPUTSEL_NEGSEL_CH6,
Anna Bridge 142:4eea097334d6 470 /** Channel 7 */
Anna Bridge 142:4eea097334d6 471 acmpChannel7 = _ACMP_INPUTSEL_NEGSEL_CH7,
Anna Bridge 142:4eea097334d6 472 /** 1.25V internal reference */
Anna Bridge 142:4eea097334d6 473 acmpChannel1V25 = _ACMP_INPUTSEL_NEGSEL_1V25,
Anna Bridge 142:4eea097334d6 474 /** 2.5V internal reference */
Anna Bridge 142:4eea097334d6 475 acmpChannel2V5 = _ACMP_INPUTSEL_NEGSEL_2V5,
Anna Bridge 142:4eea097334d6 476 /** Scaled VDD reference */
Anna Bridge 142:4eea097334d6 477 acmpChannelVDD = _ACMP_INPUTSEL_NEGSEL_VDD,
Anna Bridge 142:4eea097334d6 478
Anna Bridge 142:4eea097334d6 479 #if defined(_ACMP_INPUTSEL_NEGSEL_DAC0CH0)
Anna Bridge 142:4eea097334d6 480 /** DAC0 channel 0 */
Anna Bridge 142:4eea097334d6 481 acmpChannelDAC0Ch0 = _ACMP_INPUTSEL_NEGSEL_DAC0CH0,
Anna Bridge 142:4eea097334d6 482 #endif
Anna Bridge 142:4eea097334d6 483
Anna Bridge 142:4eea097334d6 484 #if defined(_ACMP_INPUTSEL_NEGSEL_DAC0CH1)
Anna Bridge 142:4eea097334d6 485 /** DAC0 channel 1 */
Anna Bridge 142:4eea097334d6 486 acmpChannelDAC0Ch1 = _ACMP_INPUTSEL_NEGSEL_DAC0CH1,
Anna Bridge 142:4eea097334d6 487 #endif
Anna Bridge 142:4eea097334d6 488
Anna Bridge 142:4eea097334d6 489 #if defined(_ACMP_INPUTSEL_NEGSEL_CAPSENSE)
Anna Bridge 142:4eea097334d6 490 /** Capacitive sense mode */
Anna Bridge 142:4eea097334d6 491 acmpChannelCapSense = _ACMP_INPUTSEL_NEGSEL_CAPSENSE,
Anna Bridge 142:4eea097334d6 492 #endif
Anna Bridge 142:4eea097334d6 493 } ACMP_Channel_TypeDef;
Anna Bridge 142:4eea097334d6 494 #endif
Anna Bridge 142:4eea097334d6 495
Anna Bridge 142:4eea097334d6 496 #if defined(_ACMP_EXTIFCTRL_MASK)
Anna Bridge 142:4eea097334d6 497 /**
Anna Bridge 142:4eea097334d6 498 * ACMP External input select. This type is used to select which APORT that is
Anna Bridge 142:4eea097334d6 499 * used by an external module like LESENSE when it's taking control over
Anna Bridge 142:4eea097334d6 500 * the ACMP input.
Anna Bridge 142:4eea097334d6 501 */
Anna Bridge 160:5571c4ff569f 502 typedef enum {
Anna Bridge 142:4eea097334d6 503 acmpExternalInputAPORT0X = _ACMP_EXTIFCTRL_APORTSEL_APORT0X,
Anna Bridge 142:4eea097334d6 504 acmpExternalInputAPORT0Y = _ACMP_EXTIFCTRL_APORTSEL_APORT0Y,
Anna Bridge 142:4eea097334d6 505 acmpExternalInputAPORT1X = _ACMP_EXTIFCTRL_APORTSEL_APORT1X,
Anna Bridge 142:4eea097334d6 506 acmpExternalInputAPORT1Y = _ACMP_EXTIFCTRL_APORTSEL_APORT1Y,
Anna Bridge 142:4eea097334d6 507 acmpExternalInputAPORT1XY = _ACMP_EXTIFCTRL_APORTSEL_APORT1XY,
Anna Bridge 142:4eea097334d6 508 acmpExternalInputAPORT2X = _ACMP_EXTIFCTRL_APORTSEL_APORT2X,
Anna Bridge 142:4eea097334d6 509 acmpExternalInputAPORT2Y = _ACMP_EXTIFCTRL_APORTSEL_APORT2Y,
Anna Bridge 142:4eea097334d6 510 acmpExternalInputAPORT2YX = _ACMP_EXTIFCTRL_APORTSEL_APORT2YX,
Anna Bridge 142:4eea097334d6 511 acmpExternalInputAPORT3X = _ACMP_EXTIFCTRL_APORTSEL_APORT3X,
Anna Bridge 142:4eea097334d6 512 acmpExternalInputAPORT3Y = _ACMP_EXTIFCTRL_APORTSEL_APORT3Y,
Anna Bridge 142:4eea097334d6 513 acmpExternalInputAPORT3XY = _ACMP_EXTIFCTRL_APORTSEL_APORT3XY,
Anna Bridge 142:4eea097334d6 514 acmpExternalInputAPORT4X = _ACMP_EXTIFCTRL_APORTSEL_APORT4X,
Anna Bridge 142:4eea097334d6 515 acmpExternalInputAPORT4Y = _ACMP_EXTIFCTRL_APORTSEL_APORT4Y,
Anna Bridge 142:4eea097334d6 516 acmpExternalInputAPORT4YX = _ACMP_EXTIFCTRL_APORTSEL_APORT4YX,
Anna Bridge 142:4eea097334d6 517 } ACMP_ExternalInput_Typedef;
Anna Bridge 142:4eea097334d6 518 #endif
Anna Bridge 142:4eea097334d6 519
Anna Bridge 142:4eea097334d6 520 /*******************************************************************************
Anna Bridge 142:4eea097334d6 521 ****************************** STRUCTS ************************************
Anna Bridge 142:4eea097334d6 522 ******************************************************************************/
Anna Bridge 142:4eea097334d6 523
Anna Bridge 142:4eea097334d6 524 /** Capsense initialization structure. */
Anna Bridge 160:5571c4ff569f 525 typedef struct {
Anna Bridge 142:4eea097334d6 526 /** Full bias current. See the ACMP chapter about bias and response time in
Anna Bridge 142:4eea097334d6 527 * the reference manual for details. */
Anna Bridge 142:4eea097334d6 528 bool fullBias;
Anna Bridge 142:4eea097334d6 529
Anna Bridge 142:4eea097334d6 530 #if defined(_ACMP_CTRL_HALFBIAS_MASK)
Anna Bridge 142:4eea097334d6 531 /** Half bias current. See the ACMP chapter about bias and response time in
Anna Bridge 142:4eea097334d6 532 * the reference manual for details. */
Anna Bridge 142:4eea097334d6 533 bool halfBias;
Anna Bridge 142:4eea097334d6 534 #endif
Anna Bridge 142:4eea097334d6 535
Anna Bridge 142:4eea097334d6 536 /** Bias current. See the ACMP chapter about bias and response time in the
Anna Bridge 142:4eea097334d6 537 * reference manual for details. */
Anna Bridge 142:4eea097334d6 538 uint32_t biasProg;
Anna Bridge 142:4eea097334d6 539
Anna Bridge 142:4eea097334d6 540 #if defined(_ACMP_CTRL_WARMTIME_MASK)
Anna Bridge 142:4eea097334d6 541 /** Warmup time. This is measured in HFPERCLK cycles and should be
Anna Bridge 142:4eea097334d6 542 * about 10us in wall clock time. */
Anna Bridge 142:4eea097334d6 543 ACMP_WarmTime_TypeDef warmTime;
Anna Bridge 142:4eea097334d6 544 #endif
Anna Bridge 142:4eea097334d6 545
Anna Bridge 142:4eea097334d6 546 #if defined(_ACMP_CTRL_HYSTSEL_MASK)
Anna Bridge 142:4eea097334d6 547 /** Hysteresis level */
Anna Bridge 142:4eea097334d6 548 ACMP_HysteresisLevel_TypeDef hysteresisLevel;
Anna Bridge 142:4eea097334d6 549 #else
Anna Bridge 142:4eea097334d6 550 /** Hysteresis level when ACMP output is 0 */
Anna Bridge 142:4eea097334d6 551 ACMP_HysteresisLevel_TypeDef hysteresisLevel_0;
Anna Bridge 142:4eea097334d6 552
Anna Bridge 142:4eea097334d6 553 /** Hysteresis level when ACMP output is 1 */
Anna Bridge 142:4eea097334d6 554 ACMP_HysteresisLevel_TypeDef hysteresisLevel_1;
Anna Bridge 142:4eea097334d6 555 #endif
Anna Bridge 142:4eea097334d6 556
Anna Bridge 142:4eea097334d6 557 /** Resistor used in the capacative sensing circuit. For values see
Anna Bridge 142:4eea097334d6 558 * your device datasheet. */
Anna Bridge 142:4eea097334d6 559 ACMP_CapsenseResistor_TypeDef resistor;
Anna Bridge 142:4eea097334d6 560
Anna Bridge 142:4eea097334d6 561 #if defined(_ACMP_INPUTSEL_LPREF_MASK)
Anna Bridge 142:4eea097334d6 562 /** Low power reference enabled. This setting, if enabled, reduces the
Anna Bridge 142:4eea097334d6 563 * power used by the VDD and bandgap references. */
Anna Bridge 142:4eea097334d6 564 bool lowPowerReferenceEnabled;
Anna Bridge 142:4eea097334d6 565 #endif
Anna Bridge 142:4eea097334d6 566
Anna Bridge 142:4eea097334d6 567 #if defined(_ACMP_INPUTSEL_VDDLEVEL_MASK)
Anna Bridge 142:4eea097334d6 568 /** Vdd reference value. VDD_SCALED = (Vdd * VDDLEVEL) / 63.
Anna Bridge 142:4eea097334d6 569 * Valid values are in the range 0-63. */
Anna Bridge 142:4eea097334d6 570 uint32_t vddLevel;
Anna Bridge 142:4eea097334d6 571 #else
Anna Bridge 142:4eea097334d6 572 /**
Anna Bridge 142:4eea097334d6 573 * This value configures the upper voltage threshold of the capsense
Anna Bridge 142:4eea097334d6 574 * oscillation rail.
Anna Bridge 142:4eea097334d6 575 *
Anna Bridge 142:4eea097334d6 576 * The voltage threshold is calculated as
Anna Bridge 142:4eea097334d6 577 * Vdd * (vddLevelHigh + 1) / 64
Anna Bridge 142:4eea097334d6 578 */
Anna Bridge 142:4eea097334d6 579 uint32_t vddLevelHigh;
Anna Bridge 142:4eea097334d6 580
Anna Bridge 142:4eea097334d6 581 /**
Anna Bridge 142:4eea097334d6 582 * This value configures the lower voltage threshold of the capsense
Anna Bridge 142:4eea097334d6 583 * oscillation rail.
Anna Bridge 142:4eea097334d6 584 *
Anna Bridge 142:4eea097334d6 585 * The voltage threshold is calculated as
Anna Bridge 142:4eea097334d6 586 * Vdd * (vddLevelLow + 1) / 64
Anna Bridge 142:4eea097334d6 587 */
Anna Bridge 142:4eea097334d6 588 uint32_t vddLevelLow;
Anna Bridge 142:4eea097334d6 589 #endif
Anna Bridge 142:4eea097334d6 590
Anna Bridge 142:4eea097334d6 591 /** If true, ACMP is being enabled after configuration. */
Anna Bridge 142:4eea097334d6 592 bool enable;
Anna Bridge 142:4eea097334d6 593 } ACMP_CapsenseInit_TypeDef;
Anna Bridge 142:4eea097334d6 594
Anna Bridge 142:4eea097334d6 595 /** Default config for capacitive sense mode initialization. */
Anna Bridge 142:4eea097334d6 596 #if defined(_ACMP_HYSTERESIS0_HYST_MASK)
Anna Bridge 160:5571c4ff569f 597 #define ACMP_CAPSENSE_INIT_DEFAULT \
Anna Bridge 160:5571c4ff569f 598 { \
Anna Bridge 160:5571c4ff569f 599 false, /* Don't use fullBias to lower power consumption */ \
Anna Bridge 160:5571c4ff569f 600 0x20, /* Using biasProg value of 0x20 (32) */ \
Anna Bridge 160:5571c4ff569f 601 acmpHysteresisLevel8, /* Use hysteresis level 8 when ACMP output is 0 */ \
Anna Bridge 160:5571c4ff569f 602 acmpHysteresisLevel8, /* Use hysteresis level 8 when ACMP output is 1 */ \
Anna Bridge 160:5571c4ff569f 603 acmpResistor5, /* Use internal resistor value 5 */ \
Anna Bridge 160:5571c4ff569f 604 0x30, /* VDD level high */ \
Anna Bridge 160:5571c4ff569f 605 0x10, /* VDD level low */ \
Anna Bridge 160:5571c4ff569f 606 true /* Enable after init. */ \
Anna Bridge 160:5571c4ff569f 607 }
Anna Bridge 142:4eea097334d6 608 #elif defined(_ACMP_CTRL_WARMTIME_MASK)
Anna Bridge 142:4eea097334d6 609 #define ACMP_CAPSENSE_INIT_DEFAULT \
Anna Bridge 160:5571c4ff569f 610 { \
Anna Bridge 160:5571c4ff569f 611 false, /* fullBias */ \
Anna Bridge 160:5571c4ff569f 612 false, /* halfBias */ \
Anna Bridge 160:5571c4ff569f 613 0x7, /* biasProg */ \
Anna Bridge 160:5571c4ff569f 614 acmpWarmTime512, /* 512 cycle warmup to be safe */ \
Anna Bridge 160:5571c4ff569f 615 acmpHysteresisLevel5, \
Anna Bridge 160:5571c4ff569f 616 acmpResistor3, \
Anna Bridge 160:5571c4ff569f 617 false, /* low power reference */ \
Anna Bridge 160:5571c4ff569f 618 0x3D, /* VDD level */ \
Anna Bridge 160:5571c4ff569f 619 true /* Enable after init. */ \
Anna Bridge 160:5571c4ff569f 620 }
Anna Bridge 142:4eea097334d6 621 #else
Anna Bridge 160:5571c4ff569f 622 #define ACMP_CAPSENSE_INIT_DEFAULT \
Anna Bridge 160:5571c4ff569f 623 { \
Anna Bridge 160:5571c4ff569f 624 false, /* fullBias */ \
Anna Bridge 160:5571c4ff569f 625 false, /* halfBias */ \
Anna Bridge 160:5571c4ff569f 626 0x7, /* biasProg */ \
Anna Bridge 160:5571c4ff569f 627 acmpHysteresisLevel5, \
Anna Bridge 160:5571c4ff569f 628 acmpResistor3, \
Anna Bridge 160:5571c4ff569f 629 false, /* low power reference */ \
Anna Bridge 160:5571c4ff569f 630 0x3D, /* VDD level */ \
Anna Bridge 160:5571c4ff569f 631 true /* Enable after init. */ \
Anna Bridge 160:5571c4ff569f 632 }
Anna Bridge 142:4eea097334d6 633 #endif
Anna Bridge 142:4eea097334d6 634
Anna Bridge 142:4eea097334d6 635 /** ACMP initialization structure. */
Anna Bridge 160:5571c4ff569f 636 typedef struct {
Anna Bridge 142:4eea097334d6 637 /** Full bias current. See the ACMP chapter about bias and response time in
Anna Bridge 142:4eea097334d6 638 * the reference manual for details. */
Anna Bridge 142:4eea097334d6 639 bool fullBias;
Anna Bridge 142:4eea097334d6 640
Anna Bridge 142:4eea097334d6 641 #if defined(_ACMP_CTRL_HALFBIAS_MASK)
Anna Bridge 142:4eea097334d6 642 /** Half bias current. See the ACMP chapter about bias and response time in
Anna Bridge 142:4eea097334d6 643 * the reference manual for details. */
Anna Bridge 142:4eea097334d6 644 bool halfBias;
Anna Bridge 142:4eea097334d6 645 #endif
Anna Bridge 142:4eea097334d6 646
Anna Bridge 142:4eea097334d6 647 /** Bias current. See the ACMP chapter about bias and response time in the
Anna Bridge 142:4eea097334d6 648 * reference manual for details. Valid values are in the range 0-7. */
Anna Bridge 142:4eea097334d6 649 uint32_t biasProg;
Anna Bridge 142:4eea097334d6 650
Anna Bridge 142:4eea097334d6 651 /** Enable setting the interrupt flag on falling edge */
Anna Bridge 142:4eea097334d6 652 bool interruptOnFallingEdge;
Anna Bridge 142:4eea097334d6 653
Anna Bridge 142:4eea097334d6 654 /** Enable setting the interrupt flag on rising edge */
Anna Bridge 142:4eea097334d6 655 bool interruptOnRisingEdge;
Anna Bridge 142:4eea097334d6 656
Anna Bridge 142:4eea097334d6 657 #if defined(_ACMP_CTRL_INPUTRANGE_MASK)
Anna Bridge 142:4eea097334d6 658 /** Input range. Adjust this setting to optimize the performance for a
Anna Bridge 142:4eea097334d6 659 * given input voltage range. */
Anna Bridge 142:4eea097334d6 660 ACMP_InputRange_TypeDef inputRange;
Anna Bridge 142:4eea097334d6 661 #endif
Anna Bridge 142:4eea097334d6 662
Anna Bridge 142:4eea097334d6 663 #if defined(_ACMP_CTRL_ACCURACY_MASK)
Anna Bridge 142:4eea097334d6 664 /** ACMP accuracy mode. Select the accuracy mode that matches the
Anna Bridge 142:4eea097334d6 665 * required current usage and accuracy requirement. Low accuracy
Anna Bridge 142:4eea097334d6 666 * consumes less current while high accuracy consumes more current. */
Anna Bridge 142:4eea097334d6 667 ACMP_Accuracy_TypeDef accuracy;
Anna Bridge 142:4eea097334d6 668 #endif
Anna Bridge 142:4eea097334d6 669
Anna Bridge 142:4eea097334d6 670 #if defined(_ACMP_CTRL_PWRSEL_MASK)
Anna Bridge 142:4eea097334d6 671 /** Select the power source for the ACMP. */
Anna Bridge 142:4eea097334d6 672 ACMP_PowerSource_TypeDef powerSource;
Anna Bridge 142:4eea097334d6 673 #endif
Anna Bridge 142:4eea097334d6 674
Anna Bridge 142:4eea097334d6 675 #if defined(_ACMP_CTRL_WARMTIME_MASK)
Anna Bridge 142:4eea097334d6 676 /** Warmup time. This is measured in HFPERCLK cycles and should be
Anna Bridge 142:4eea097334d6 677 * about 10us in wall clock time. */
Anna Bridge 142:4eea097334d6 678 ACMP_WarmTime_TypeDef warmTime;
Anna Bridge 142:4eea097334d6 679 #endif
Anna Bridge 142:4eea097334d6 680
Anna Bridge 142:4eea097334d6 681 #if defined(_ACMP_CTRL_HYSTSEL_MASK)
Anna Bridge 142:4eea097334d6 682 /** Hysteresis level */
Anna Bridge 142:4eea097334d6 683 ACMP_HysteresisLevel_TypeDef hysteresisLevel;
Anna Bridge 142:4eea097334d6 684 #else
Anna Bridge 142:4eea097334d6 685 /** Hysteresis when ACMP output is 0 */
Anna Bridge 142:4eea097334d6 686 ACMP_HysteresisLevel_TypeDef hysteresisLevel_0;
Anna Bridge 142:4eea097334d6 687
Anna Bridge 142:4eea097334d6 688 /** Hysteresis when ACMP output is 1 */
Anna Bridge 142:4eea097334d6 689 ACMP_HysteresisLevel_TypeDef hysteresisLevel_1;
Anna Bridge 142:4eea097334d6 690 #endif
Anna Bridge 142:4eea097334d6 691
Anna Bridge 142:4eea097334d6 692 #if defined(_ACMP_INPUTSEL_VLPSEL_MASK)
Anna Bridge 142:4eea097334d6 693 /** VLP Input source. Select between using VADIV or VBDIV as the VLP
Anna Bridge 142:4eea097334d6 694 * source. */
Anna Bridge 142:4eea097334d6 695 ACMP_VLPInput_Typedef vlpInput;
Anna Bridge 142:4eea097334d6 696 #endif
Anna Bridge 142:4eea097334d6 697
Anna Bridge 142:4eea097334d6 698 /** Inactive value emitted by the ACMP during warmup */
Anna Bridge 142:4eea097334d6 699 bool inactiveValue;
Anna Bridge 142:4eea097334d6 700
Anna Bridge 142:4eea097334d6 701 #if defined(_ACMP_INPUTSEL_LPREF_MASK)
Anna Bridge 142:4eea097334d6 702 /** Low power reference enabled. This setting, if enabled, reduces the
Anna Bridge 142:4eea097334d6 703 * power used by the VDD and bandgap references. */
Anna Bridge 142:4eea097334d6 704 bool lowPowerReferenceEnabled;
Anna Bridge 142:4eea097334d6 705 #endif
Anna Bridge 142:4eea097334d6 706
Anna Bridge 142:4eea097334d6 707 #if defined(_ACMP_INPUTSEL_VDDLEVEL_MASK)
Anna Bridge 142:4eea097334d6 708 /** Vdd reference value. VDD_SCALED = VDD * VDDLEVEL * 50mV/3.8V.
Anna Bridge 142:4eea097334d6 709 * Valid values are in the range 0-63. */
Anna Bridge 142:4eea097334d6 710 uint32_t vddLevel;
Anna Bridge 142:4eea097334d6 711 #endif
Anna Bridge 142:4eea097334d6 712
Anna Bridge 142:4eea097334d6 713 /** If true, ACMP is being enabled after configuration. */
Anna Bridge 142:4eea097334d6 714 bool enable;
Anna Bridge 142:4eea097334d6 715 } ACMP_Init_TypeDef;
Anna Bridge 142:4eea097334d6 716
Anna Bridge 142:4eea097334d6 717 /** Default config for ACMP regular initialization. */
Anna Bridge 142:4eea097334d6 718 #if defined(_ACMP_HYSTERESIS0_HYST_MASK)
Anna Bridge 142:4eea097334d6 719 #define ACMP_INIT_DEFAULT \
Anna Bridge 160:5571c4ff569f 720 { \
Anna Bridge 160:5571c4ff569f 721 false, /* fullBias */ \
Anna Bridge 160:5571c4ff569f 722 0x7, /* biasProg */ \
Anna Bridge 160:5571c4ff569f 723 false, /* No interrupt on falling edge. */ \
Anna Bridge 160:5571c4ff569f 724 false, /* No interrupt on rising edge. */ \
Anna Bridge 160:5571c4ff569f 725 acmpInputRangeFull, /* Input range from 0 to Vdd. */ \
Anna Bridge 160:5571c4ff569f 726 acmpAccuracyLow, /* Low accuracy, less current usage. */ \
Anna Bridge 160:5571c4ff569f 727 acmpPowerSourceAvdd, /* Use the AVDD supply. */ \
Anna Bridge 160:5571c4ff569f 728 acmpHysteresisLevel5, /* Use hysteresis level 5 when output is 0 */ \
Anna Bridge 160:5571c4ff569f 729 acmpHysteresisLevel5, /* Use hysteresis level 5 when output is 1 */ \
Anna Bridge 160:5571c4ff569f 730 acmpVLPInputVADIV, /* Use VADIV as the VLP input source. */ \
Anna Bridge 160:5571c4ff569f 731 false, /* Output 0 when ACMP is inactive. */ \
Anna Bridge 160:5571c4ff569f 732 true /* Enable after init. */ \
Anna Bridge 160:5571c4ff569f 733 }
Anna Bridge 142:4eea097334d6 734 #elif defined(_ACMP_CTRL_WARMTIME_MASK)
Anna Bridge 142:4eea097334d6 735 #define ACMP_INIT_DEFAULT \
Anna Bridge 160:5571c4ff569f 736 { \
Anna Bridge 160:5571c4ff569f 737 false, /* fullBias */ \
Anna Bridge 160:5571c4ff569f 738 false, /* halfBias */ \
Anna Bridge 160:5571c4ff569f 739 0x7, /* biasProg */ \
Anna Bridge 160:5571c4ff569f 740 false, /* No interrupt on falling edge. */ \
Anna Bridge 160:5571c4ff569f 741 false, /* No interrupt on rising edge. */ \
Anna Bridge 160:5571c4ff569f 742 acmpWarmTime512, /* 512 cycle warmup to be safe */ \
Anna Bridge 160:5571c4ff569f 743 acmpHysteresisLevel5, \
Anna Bridge 160:5571c4ff569f 744 false, /* Disabled emitting inactive value during warmup. */ \
Anna Bridge 160:5571c4ff569f 745 false, /* low power reference */ \
Anna Bridge 160:5571c4ff569f 746 0x3D, /* VDD level */ \
Anna Bridge 160:5571c4ff569f 747 true /* Enable after init. */ \
Anna Bridge 160:5571c4ff569f 748 }
Anna Bridge 142:4eea097334d6 749 #else
Anna Bridge 142:4eea097334d6 750 #define ACMP_INIT_DEFAULT \
Anna Bridge 160:5571c4ff569f 751 { \
Anna Bridge 160:5571c4ff569f 752 false, /* fullBias */ \
Anna Bridge 160:5571c4ff569f 753 false, /* halfBias */ \
Anna Bridge 160:5571c4ff569f 754 0x7, /* biasProg */ \
Anna Bridge 160:5571c4ff569f 755 false, /* No interrupt on falling edge. */ \
Anna Bridge 160:5571c4ff569f 756 false, /* No interrupt on rising edge. */ \
Anna Bridge 160:5571c4ff569f 757 acmpHysteresisLevel5, \
Anna Bridge 160:5571c4ff569f 758 false, /* Disabled emitting inactive value during warmup. */ \
Anna Bridge 160:5571c4ff569f 759 false, /* low power reference */ \
Anna Bridge 160:5571c4ff569f 760 0x3D, /* VDD level */ \
Anna Bridge 160:5571c4ff569f 761 true /* Enable after init. */ \
Anna Bridge 160:5571c4ff569f 762 }
Anna Bridge 142:4eea097334d6 763 #endif
Anna Bridge 142:4eea097334d6 764
Anna Bridge 142:4eea097334d6 765 #if defined(_ACMP_INPUTSEL_VASEL_MASK)
Anna Bridge 142:4eea097334d6 766 /** VA Configuration structure. This struct is used to configure the
Anna Bridge 142:4eea097334d6 767 * VA voltage input source and it's dividers. */
Anna Bridge 160:5571c4ff569f 768 typedef struct {
Anna Bridge 142:4eea097334d6 769 ACMP_VAInput_TypeDef input; /**< VA voltage input source */
Anna Bridge 142:4eea097334d6 770
Anna Bridge 142:4eea097334d6 771 /**
Anna Bridge 142:4eea097334d6 772 * Divider for VA voltage input source when ACMP output is 0. This value is
Anna Bridge 142:4eea097334d6 773 * used to divide the VA voltage input source by a specific value. The valid
Anna Bridge 142:4eea097334d6 774 * range is between 0 and 63.
Anna Bridge 142:4eea097334d6 775 *
Anna Bridge 142:4eea097334d6 776 * VA divided = VA input * (div0 + 1) / 64
Anna Bridge 142:4eea097334d6 777 */
Anna Bridge 142:4eea097334d6 778 uint32_t div0;
Anna Bridge 142:4eea097334d6 779
Anna Bridge 142:4eea097334d6 780 /**
Anna Bridge 142:4eea097334d6 781 * Divider for VA voltage input source when ACMP output is 1. This value is
Anna Bridge 142:4eea097334d6 782 * used to divide the VA voltage input source by a specific value. The valid
Anna Bridge 142:4eea097334d6 783 * range is between 0 and 63.
Anna Bridge 142:4eea097334d6 784 *
Anna Bridge 142:4eea097334d6 785 * VA divided = VA input * (div1 + 1) / 64
Anna Bridge 142:4eea097334d6 786 */
Anna Bridge 142:4eea097334d6 787 uint32_t div1;
Anna Bridge 142:4eea097334d6 788 } ACMP_VAConfig_TypeDef;
Anna Bridge 142:4eea097334d6 789
Anna Bridge 160:5571c4ff569f 790 #define ACMP_VACONFIG_DEFAULT \
Anna Bridge 160:5571c4ff569f 791 { \
Anna Bridge 160:5571c4ff569f 792 acmpVAInputVDD, /* Use Vdd as VA voltage input source */ \
Anna Bridge 160:5571c4ff569f 793 63, /* No division of the VA source when ACMP output is 0 */ \
Anna Bridge 160:5571c4ff569f 794 63, /* No division of the VA source when ACMP output is 1 */ \
Anna Bridge 160:5571c4ff569f 795 }
Anna Bridge 142:4eea097334d6 796 #endif
Anna Bridge 142:4eea097334d6 797
Anna Bridge 142:4eea097334d6 798 #if defined(_ACMP_INPUTSEL_VBSEL_MASK)
Anna Bridge 142:4eea097334d6 799 /** VB Configuration structure. This struct is used to configure the
Anna Bridge 142:4eea097334d6 800 * VB voltage input source and it's dividers. */
Anna Bridge 160:5571c4ff569f 801 typedef struct {
Anna Bridge 142:4eea097334d6 802 ACMP_VBInput_TypeDef input; /**< VB Voltage input source */
Anna Bridge 142:4eea097334d6 803
Anna Bridge 142:4eea097334d6 804 /**
Anna Bridge 142:4eea097334d6 805 * Divider for VB voltage input source when ACMP output is 0. This value is
Anna Bridge 142:4eea097334d6 806 * used to divide the VB voltage input source by a specific value. The valid
Anna Bridge 142:4eea097334d6 807 * range is between 0 and 63.
Anna Bridge 142:4eea097334d6 808 *
Anna Bridge 142:4eea097334d6 809 * VB divided = VB input * (div0 + 1) / 64
Anna Bridge 142:4eea097334d6 810 */
Anna Bridge 142:4eea097334d6 811 uint32_t div0;
Anna Bridge 142:4eea097334d6 812
Anna Bridge 142:4eea097334d6 813 /**
Anna Bridge 142:4eea097334d6 814 * Divider for VB voltage input source when ACMP output is 1. This value is
Anna Bridge 142:4eea097334d6 815 * used to divide the VB voltage input source by a specific value. The valid
Anna Bridge 142:4eea097334d6 816 * range is between 0 and 63.
Anna Bridge 142:4eea097334d6 817 *
Anna Bridge 142:4eea097334d6 818 * VB divided = VB input * (div1 + 1) / 64
Anna Bridge 142:4eea097334d6 819 */
Anna Bridge 142:4eea097334d6 820 uint32_t div1;
Anna Bridge 142:4eea097334d6 821 } ACMP_VBConfig_TypeDef;
Anna Bridge 142:4eea097334d6 822
Anna Bridge 142:4eea097334d6 823 #define ACMP_VBCONFIG_DEFAULT \
Anna Bridge 160:5571c4ff569f 824 { \
Anna Bridge 160:5571c4ff569f 825 acmpVBInput1V25, /* Use 1.25 V as VB voltage input source */ \
Anna Bridge 160:5571c4ff569f 826 63, /* No division of the VB source when ACMP output is 0 */ \
Anna Bridge 160:5571c4ff569f 827 63, /* No division of the VB source when ACMP output is 1 */ \
Anna Bridge 160:5571c4ff569f 828 }
Anna Bridge 142:4eea097334d6 829 #endif
Anna Bridge 142:4eea097334d6 830
Anna Bridge 142:4eea097334d6 831 /*******************************************************************************
Anna Bridge 142:4eea097334d6 832 ***************************** PROTOTYPES **********************************
Anna Bridge 142:4eea097334d6 833 ******************************************************************************/
Anna Bridge 142:4eea097334d6 834
Anna Bridge 142:4eea097334d6 835 void ACMP_CapsenseInit(ACMP_TypeDef *acmp, const ACMP_CapsenseInit_TypeDef *init);
Anna Bridge 142:4eea097334d6 836 void ACMP_CapsenseChannelSet(ACMP_TypeDef *acmp, ACMP_Channel_TypeDef channel);
Anna Bridge 142:4eea097334d6 837 void ACMP_ChannelSet(ACMP_TypeDef *acmp, ACMP_Channel_TypeDef negSel, ACMP_Channel_TypeDef posSel);
Anna Bridge 142:4eea097334d6 838 void ACMP_Disable(ACMP_TypeDef *acmp);
Anna Bridge 142:4eea097334d6 839 void ACMP_Enable(ACMP_TypeDef *acmp);
Anna Bridge 142:4eea097334d6 840 #if defined(_ACMP_EXTIFCTRL_MASK)
Anna Bridge 142:4eea097334d6 841 void ACMP_ExternalInputSelect(ACMP_TypeDef *acmp, ACMP_ExternalInput_Typedef aport);
Anna Bridge 142:4eea097334d6 842 #endif
Anna Bridge 142:4eea097334d6 843 void ACMP_GPIOSetup(ACMP_TypeDef *acmp, uint32_t location, bool enable, bool invert);
Anna Bridge 142:4eea097334d6 844 void ACMP_Init(ACMP_TypeDef *acmp, const ACMP_Init_TypeDef *init);
Anna Bridge 142:4eea097334d6 845 void ACMP_Reset(ACMP_TypeDef *acmp);
Anna Bridge 142:4eea097334d6 846 #if defined(_ACMP_INPUTSEL_VASEL_MASK)
Anna Bridge 142:4eea097334d6 847 void ACMP_VASetup(ACMP_TypeDef *acmp, const ACMP_VAConfig_TypeDef *vaconfig);
Anna Bridge 142:4eea097334d6 848 #endif
Anna Bridge 142:4eea097334d6 849 #if defined(_ACMP_INPUTSEL_VBSEL_MASK)
Anna Bridge 142:4eea097334d6 850 void ACMP_VBSetup(ACMP_TypeDef *acmp, const ACMP_VBConfig_TypeDef *vbconfig);
Anna Bridge 142:4eea097334d6 851 #endif
Anna Bridge 142:4eea097334d6 852
Anna Bridge 142:4eea097334d6 853 /***************************************************************************//**
Anna Bridge 142:4eea097334d6 854 * @brief
Anna Bridge 142:4eea097334d6 855 * Clear one or more pending ACMP interrupts.
Anna Bridge 142:4eea097334d6 856 *
Anna Bridge 142:4eea097334d6 857 * @param[in] acmp
Anna Bridge 142:4eea097334d6 858 * Pointer to ACMP peripheral register block.
Anna Bridge 142:4eea097334d6 859 *
Anna Bridge 142:4eea097334d6 860 * @param[in] flags
Anna Bridge 142:4eea097334d6 861 * Pending ACMP interrupt source to clear. Use a bitwise logic OR combination
Anna Bridge 142:4eea097334d6 862 * of valid interrupt flags for the ACMP module. The flags can be for instance
Anna Bridge 142:4eea097334d6 863 * @ref ACMP_IFC_EDGE or @ref ACMP_IFC_WARMUP.
Anna Bridge 142:4eea097334d6 864 ******************************************************************************/
Anna Bridge 142:4eea097334d6 865 __STATIC_INLINE void ACMP_IntClear(ACMP_TypeDef *acmp, uint32_t flags)
Anna Bridge 142:4eea097334d6 866 {
Anna Bridge 142:4eea097334d6 867 acmp->IFC = flags;
Anna Bridge 142:4eea097334d6 868 }
Anna Bridge 142:4eea097334d6 869
Anna Bridge 142:4eea097334d6 870 /***************************************************************************//**
Anna Bridge 142:4eea097334d6 871 * @brief
Anna Bridge 142:4eea097334d6 872 * Disable one or more ACMP interrupts.
Anna Bridge 142:4eea097334d6 873 *
Anna Bridge 142:4eea097334d6 874 * @param[in] acmp
Anna Bridge 142:4eea097334d6 875 * Pointer to ACMP peripheral register block.
Anna Bridge 142:4eea097334d6 876 *
Anna Bridge 142:4eea097334d6 877 * @param[in] flags
Anna Bridge 142:4eea097334d6 878 * ACMP interrupt sources to disable. Use a bitwise logic OR combination of
Anna Bridge 142:4eea097334d6 879 * valid interrupt flags for the ACMP module. The flags can be for instance
Anna Bridge 142:4eea097334d6 880 * @ref ACMP_IEN_EDGE or @ref ACMP_IEN_WARMUP.
Anna Bridge 142:4eea097334d6 881 ******************************************************************************/
Anna Bridge 142:4eea097334d6 882 __STATIC_INLINE void ACMP_IntDisable(ACMP_TypeDef *acmp, uint32_t flags)
Anna Bridge 142:4eea097334d6 883 {
Anna Bridge 142:4eea097334d6 884 acmp->IEN &= ~(flags);
Anna Bridge 142:4eea097334d6 885 }
Anna Bridge 142:4eea097334d6 886
Anna Bridge 142:4eea097334d6 887 /***************************************************************************//**
Anna Bridge 142:4eea097334d6 888 * @brief
Anna Bridge 142:4eea097334d6 889 * Enable one or more ACMP interrupts.
Anna Bridge 142:4eea097334d6 890 *
Anna Bridge 142:4eea097334d6 891 * @note
Anna Bridge 142:4eea097334d6 892 * Depending on the use, a pending interrupt may already be set prior to
Anna Bridge 142:4eea097334d6 893 * enabling the interrupt. Consider using ACMP_IntClear() prior to enabling
Anna Bridge 142:4eea097334d6 894 * if such a pending interrupt should be ignored.
Anna Bridge 142:4eea097334d6 895 *
Anna Bridge 142:4eea097334d6 896 * @param[in] acmp
Anna Bridge 142:4eea097334d6 897 * Pointer to ACMP peripheral register block.
Anna Bridge 142:4eea097334d6 898 *
Anna Bridge 142:4eea097334d6 899 * @param[in] flags
Anna Bridge 142:4eea097334d6 900 * ACMP interrupt sources to enable. Use a bitwise logic OR combination of
Anna Bridge 142:4eea097334d6 901 * valid interrupt flags for the ACMP module. The flags can be for instance
Anna Bridge 142:4eea097334d6 902 * @ref ACMP_IEN_EDGE or @ref ACMP_IEN_WARMUP.
Anna Bridge 142:4eea097334d6 903 ******************************************************************************/
Anna Bridge 142:4eea097334d6 904 __STATIC_INLINE void ACMP_IntEnable(ACMP_TypeDef *acmp, uint32_t flags)
Anna Bridge 142:4eea097334d6 905 {
Anna Bridge 142:4eea097334d6 906 acmp->IEN |= flags;
Anna Bridge 142:4eea097334d6 907 }
Anna Bridge 142:4eea097334d6 908
Anna Bridge 142:4eea097334d6 909 /***************************************************************************//**
Anna Bridge 142:4eea097334d6 910 * @brief
Anna Bridge 142:4eea097334d6 911 * Get pending ACMP interrupt flags.
Anna Bridge 142:4eea097334d6 912 *
Anna Bridge 142:4eea097334d6 913 * @note
Anna Bridge 142:4eea097334d6 914 * The event bits are not cleared by the use of this function.
Anna Bridge 142:4eea097334d6 915 *
Anna Bridge 142:4eea097334d6 916 * @param[in] acmp
Anna Bridge 142:4eea097334d6 917 * Pointer to ACMP peripheral register block.
Anna Bridge 142:4eea097334d6 918 *
Anna Bridge 142:4eea097334d6 919 * @return
Anna Bridge 142:4eea097334d6 920 * ACMP interrupt sources pending. A bitwise logic OR combination of valid
Anna Bridge 142:4eea097334d6 921 * interrupt flags for the ACMP module. The pending interrupt sources can be
Anna Bridge 142:4eea097334d6 922 * for instance @ref ACMP_IF_EDGE or @ref ACMP_IF_WARMUP.
Anna Bridge 142:4eea097334d6 923 ******************************************************************************/
Anna Bridge 142:4eea097334d6 924 __STATIC_INLINE uint32_t ACMP_IntGet(ACMP_TypeDef *acmp)
Anna Bridge 142:4eea097334d6 925 {
Anna Bridge 142:4eea097334d6 926 return acmp->IF;
Anna Bridge 142:4eea097334d6 927 }
Anna Bridge 142:4eea097334d6 928
Anna Bridge 142:4eea097334d6 929 /***************************************************************************//**
Anna Bridge 142:4eea097334d6 930 * @brief
Anna Bridge 142:4eea097334d6 931 * Get enabled and pending ACMP interrupt flags.
Anna Bridge 142:4eea097334d6 932 * Useful for handling more interrupt sources in the same interrupt handler.
Anna Bridge 142:4eea097334d6 933 *
Anna Bridge 142:4eea097334d6 934 * @param[in] acmp
Anna Bridge 142:4eea097334d6 935 * Pointer to ACMP peripheral register block.
Anna Bridge 142:4eea097334d6 936 *
Anna Bridge 142:4eea097334d6 937 * @note
Anna Bridge 142:4eea097334d6 938 * Interrupt flags are not cleared by the use of this function.
Anna Bridge 142:4eea097334d6 939 *
Anna Bridge 142:4eea097334d6 940 * @return
Anna Bridge 142:4eea097334d6 941 * Pending and enabled ACMP interrupt sources.
Anna Bridge 142:4eea097334d6 942 * The return value is the bitwise AND combination of
Anna Bridge 142:4eea097334d6 943 * - the OR combination of enabled interrupt sources in ACMPx_IEN_nnn
Anna Bridge 142:4eea097334d6 944 * register (ACMPx_IEN_nnn) and
Anna Bridge 142:4eea097334d6 945 * - the OR combination of valid interrupt flags of the ACMP module
Anna Bridge 142:4eea097334d6 946 * (ACMPx_IF_nnn).
Anna Bridge 142:4eea097334d6 947 ******************************************************************************/
Anna Bridge 142:4eea097334d6 948 __STATIC_INLINE uint32_t ACMP_IntGetEnabled(ACMP_TypeDef *acmp)
Anna Bridge 142:4eea097334d6 949 {
Anna Bridge 142:4eea097334d6 950 uint32_t tmp;
Anna Bridge 142:4eea097334d6 951
Anna Bridge 142:4eea097334d6 952 /* Store ACMPx->IEN in temporary variable in order to define explicit order
Anna Bridge 142:4eea097334d6 953 * of volatile accesses. */
Anna Bridge 142:4eea097334d6 954 tmp = acmp->IEN;
Anna Bridge 142:4eea097334d6 955
Anna Bridge 142:4eea097334d6 956 /* Bitwise AND of pending and enabled interrupts */
Anna Bridge 142:4eea097334d6 957 return acmp->IF & tmp;
Anna Bridge 142:4eea097334d6 958 }
Anna Bridge 142:4eea097334d6 959
Anna Bridge 142:4eea097334d6 960 /***************************************************************************//**
Anna Bridge 142:4eea097334d6 961 * @brief
Anna Bridge 142:4eea097334d6 962 * Set one or more pending ACMP interrupts from SW.
Anna Bridge 142:4eea097334d6 963 *
Anna Bridge 142:4eea097334d6 964 * @param[in] acmp
Anna Bridge 142:4eea097334d6 965 * Pointer to ACMP peripheral register block.
Anna Bridge 142:4eea097334d6 966 *
Anna Bridge 142:4eea097334d6 967 * @param[in] flags
Anna Bridge 142:4eea097334d6 968 * ACMP interrupt sources to set to pending. Use a bitwise logic OR
Anna Bridge 142:4eea097334d6 969 * combination of valid interrupt flags for the ACMP module. The flags can be
Anna Bridge 142:4eea097334d6 970 * for instance @ref ACMP_IFS_EDGE or @ref ACMP_IFS_WARMUP.
Anna Bridge 142:4eea097334d6 971 ******************************************************************************/
Anna Bridge 142:4eea097334d6 972 __STATIC_INLINE void ACMP_IntSet(ACMP_TypeDef *acmp, uint32_t flags)
Anna Bridge 142:4eea097334d6 973 {
Anna Bridge 142:4eea097334d6 974 acmp->IFS = flags;
Anna Bridge 142:4eea097334d6 975 }
Anna Bridge 142:4eea097334d6 976
Anna Bridge 142:4eea097334d6 977 /** @} (end addtogroup ACMP) */
Anna Bridge 142:4eea097334d6 978 /** @} (end addtogroup emlib) */
Anna Bridge 142:4eea097334d6 979
Anna Bridge 142:4eea097334d6 980 #ifdef __cplusplus
Anna Bridge 142:4eea097334d6 981 }
Anna Bridge 142:4eea097334d6 982 #endif
Anna Bridge 142:4eea097334d6 983
Anna Bridge 142:4eea097334d6 984 #endif /* defined(ACMP_COUNT) && (ACMP_COUNT > 0) */
Anna Bridge 142:4eea097334d6 985 #endif /* EM_ACMP_H */