/***************************************************************************//** * \file cy_lvd.h * \version 1.80 * * The header file of the LVD driver. * ******************************************************************************** * \copyright * Copyright (c) (2017-2022), Cypress Semiconductor Corporation (an Infineon company) or * an affiliate of Cypress Semiconductor Corporation. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ /** * \addtogroup group_lvd * \{ * The LVD driver provides an API to manage the Low Voltage Detection block. * * The functions and other declarations used in this driver are in cy_lvd.h. * You can include cy_pdl.h to get access to all functions * and declarations in the PDL. * * The LVD block provides a status of currently observed VDDD voltage * and triggers an interrupt when the observed voltage crosses an adjusted * threshold. * * \section group_lvd_configuration_considerations Configuration Considerations * To set up an LVD, configure the voltage threshold by the * \ref Cy_LVD_SetThreshold function, ensure that the LVD block itself and LVD * interrupt are disabled (by the \ref Cy_LVD_Disable and * \ref Cy_LVD_ClearInterruptMask functions correspondingly) before changing the * threshold to prevent propagating a false interrupt. * Then configure interrupts by the \ref Cy_LVD_SetInterruptConfig function, do * not forget to initialize an interrupt handler (the interrupt source number * is srss_interrupt_IRQn). * Then enable LVD by the \ref Cy_LVD_Enable function, then wait for at least 20us * to get the circuit stabilized and clear the possible false interrupts by the * \ref Cy_LVD_ClearInterrupt, and finally the LVD interrupt can be enabled by * the \ref Cy_LVD_SetInterruptMask function. * * For example: * \snippet lvd/snippet/main.c Cy_LVD_Snippet * * Note that the LVD circuit is available only in Low Power and Ultra Low Power * modes. If an LVD is required in Deep Sleep mode, then the device * should be configured to periodically wake up from Deep Sleep using a * Deep Sleep wakeup source. This makes sure a LVD check is performed during * Low Power or Ultra Low Power modes. * * \section group_lvd_more_information More Information * See the LVD chapter of the device technical reference manual (TRM). * * \section group_lvd_changelog Changelog * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
VersionChangesReason of Change
1.80Added new APIs \ref Cy_LVD_SetActionConfig, \ref Cy_LVD_GetActionConfig * - Added enum \ref cy_en_lvd_action_config_t.LVD set and get config APIs added.
1.70Added support for TRAVEO™ II Body Entry devices.
* Changed pre-processor logic so SRSS version 2 is grouped with version 3 instead of version 1.
Code enhancement and support for new devices.
1.60Added CAT1D device support.Added support for CAT1D family of devices.
1.50Added CAT1B device support.Added support for CAT1B family of devices.
New APIs Added * * Cy_LVD_GetSourceVoltage() * * Cy_LVD_SetSourceVoltage() * Added new APIs to set and get the source voltage.
1.40Added new device support.Added new family of devices.
1.30Fixed/documented MISRA 2012 violations.MISRA 2012 compliance.
1.20 Updated the following functions for the PSoC 64 devices: \ref Cy_LVD_Enable, \ref Cy_LVD_Disable, \ref Cy_LVD_SetThreshold, \ref Cy_LVD_ClearInterrupt, \ref Cy_LVD_SetInterrupt, \ref Cy_LVD_SetInterruptMask, \ref Cy_LVD_ClearInterruptMask, and \ref Cy_LVD_SetInterruptConfig. Added PSoC 64 device support.
1.10Flattened the organization of the driver source code into the single * source directory and the single include directory. * Driver library directory-structure simplification.
Added register access layer. Use register access macros instead * of direct register access using dereferenced pointers.Makes register access device-independent, so that the PDL does * not need to be recompiled for each supported part number.
1.0.1Added Low Power Callback sectionDocumentation update and clarification
1.0Initial Version
* * \defgroup group_lvd_macros Macros * \defgroup group_lvd_functions Functions * \{ * \defgroup group_lvd_functions_syspm_callback Low Power Callback * \} * \defgroup group_lvd_enums Enumerated Types */ #if !defined(CY_LVD_H) #define CY_LVD_H #include "cy_device.h" #if defined (CY_IP_MXS40SSRSS) || (defined (CY_IP_MXS40SRSS) && (CY_IP_MXS40SRSS_VERSION == 1)) || defined (CY_IP_MXS22SRSS) #include "cy_pra.h" #include "cy_syspm.h" #ifdef __cplusplus extern "C" { #endif /** \addtogroup group_lvd_macros * \{ */ /** The driver major version */ #define CY_LVD_DRV_VERSION_MAJOR 1 /** The driver minor version */ #define CY_LVD_DRV_VERSION_MINOR 80 /** The LVD driver identifier */ #define CY_LVD_ID (CY_PDL_DRV_ID(0x39U)) #if defined (CY_IP_MXS40SRSS) /** * \note * These macros are available for CAT1A devices. **/ /** Interrupt mask for \ref Cy_LVD_GetInterruptStatus(), \ref Cy_LVD_ClearInterrupt() */ #define CY_LVD_SRSS_INTR_HVLVD1_MASK (SRSS_SRSS_INTR_HVLVD1_Msk) /** Interrupt mask for \ref Cy_LVD_SetInterrupt() */ #define CY_LVD_SRSS_INTR_SET_HVLVD1_MASK (SRSS_SRSS_INTR_SET_HVLVD1_Msk) /** Interrupt mask for \ref Cy_LVD_GetInterruptMask(), \ref Cy_LVD_SetInterruptMask() and \ref Cy_LVD_ClearInterruptMask() */ #define CY_LVD_SRSS_INTR_MASK_HVLVD1_MASK (SRSS_SRSS_INTR_MASK_HVLVD1_Msk) /** Interrupt mask for \ref Cy_LVD_GetInterruptStatusMasked() */ #define CY_LVD_SRSS_INTR_MASKED_HVLVD1_MASK (SRSS_SRSS_INTR_MASKED_HVLVD1_Msk) /** Enable mask for \ref Cy_LVD_Enable() and /ref Cy_LVD_Disable() */ #define CY_LVD_SRSS_PWR_LVD_CTL_HVLVD_EN_Msk (SRSS_PWR_LVD_CTL_HVLVD1_EN_Msk) #endif #if defined (CY_IP_MXS40SSRSS) /** * \note * These macros are available for devices having MXS40SSRSS IP. **/ /** Interrupt mask for \ref Cy_LVD_GetInterruptStatus(), \ref Cy_LVD_ClearInterrupt() */ #define CY_LVD_SRSS_INTR_HVLVD1_MASK (SRSS_SRSS_AINTR_HVLVD1_Msk) /** Interrupt mask for \ref Cy_LVD_SetInterrupt() */ #define CY_LVD_SRSS_INTR_SET_HVLVD1_MASK (SRSS_SRSS_AINTR_SET_HVLVD1_Msk) /** Interrupt mask for \ref Cy_LVD_GetInterruptMask(), \ref Cy_LVD_SetInterruptMask() and \ref Cy_LVD_ClearInterruptMask() */ #define CY_LVD_SRSS_INTR_MASK_HVLVD1_MASK (SRSS_SRSS_AINTR_MASK_HVLVD1_Msk) /** Interrupt mask for \ref Cy_LVD_GetInterruptStatusMasked() */ #define CY_LVD_SRSS_INTR_MASKED_HVLVD1_MASK (SRSS_SRSS_AINTR_MASKED_HVLVD1_Msk) /** Enable mask for \ref Cy_LVD_Enable() and /ref Cy_LVD_Disable() */ #define CY_LVD_SRSS_PWR_LVD_CTL_HVLVD_EN_Msk (SRSS_PWR_LVD_CTL_HVLVD1_EN_Msk) #endif #if defined (CY_IP_MXS22SRSS) /** * \note * These macros are available for devices having MXS22SRSS IP. **/ /** Interrupt mask for \ref Cy_LVD_GetInterruptStatus(), \ref Cy_LVD_ClearInterrupt() */ #define CY_LVD_SRSS_INTR_HVLVD1_MASK (SRSS_SRSS_AINTR_HVLVD_Msk) /** Interrupt mask for \ref Cy_LVD_SetInterrupt() */ #define CY_LVD_SRSS_INTR_SET_HVLVD1_MASK (SRSS_SRSS_AINTR_SET_HVLVD_Msk) /** Interrupt mask for \ref Cy_LVD_GetInterruptMask(), \ref Cy_LVD_SetInterruptMask() and \ref Cy_LVD_ClearInterruptMask() */ #define CY_LVD_SRSS_INTR_MASK_HVLVD1_MASK (SRSS_SRSS_AINTR_MASK_HVLVD_Msk) /** Interrupt mask for \ref Cy_LVD_GetInterruptStatusMasked() */ #define CY_LVD_SRSS_INTR_MASKED_HVLVD1_MASK (SRSS_SRSS_AINTR_MASKED_HVLVD_Msk) /** Enable mask for \ref Cy_LVD_Enable() and /ref Cy_LVD_Disable() */ #define CY_LVD_SRSS_PWR_LVD_CTL_HVLVD_EN_Msk (SRSS_PWR_LVD_CTL_HVLVD_EN_Msk) #endif /** \} group_lvd_macros */ /** \addtogroup group_lvd_enums * \{ */ /** * LVD reference voltage select. */ #if defined (CY_IP_MXS22SRSS) typedef enum { CY_LVD_THRESHOLD_2_75_V = 0x0U, /**