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