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:
Anna Bridge
Date:
Wed May 10 11:31:27 2017 +0100
Revision:
142:4eea097334d6
Child:
159:7130f322cb7e
Release 142 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

4059: [Silicon Labs] Rename targets https://github.com/ARMmbed/mbed-os/pull/4059
4187: [NCS36510] Reduce default heap size allocated by IAR to 1/4 of RAM https://github.com/ARMmbed/mbed-os/pull/4187
4225: fixed missing device_name for xDot and removed progen https://github.com/ARMmbed/mbed-os/pull/4225
4251: Fix C++11 build error w/ u-blox EVK-ODIN-W2 https://github.com/ARMmbed/mbed-os/pull/4251
4236: STM32 Fixed warning related to __packed redefinition https://github.com/ARMmbed/mbed-os/pull/4236
4190: LPC4088: Enable LWIP feature https://github.com/ARMmbed/mbed-os/pull/4190
4260: Inherit Xadow M0 target from LPC11U35_501 https://github.com/ARMmbed/mbed-os/pull/4260
4249: Add consistent button names across targets https://github.com/ARMmbed/mbed-os/pull/4249

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