Provides access to the low-power comparators implemented using the fixed-function low-power comparator block. More...
Modules | |
Macros | |
Functions | |
Data Structures | |
Enumerated Types | |
Provides access to the low-power comparators implemented using the fixed-function low-power comparator block.
The functions and other declarations used in this driver are in cy_lpcomp.h. You can include cy_pdl.h to get access to all the functions and declarations in the PDL.
These comparators can perform fast analog signal comparison of external analog signals in all system power modes. The low-power comparator output can be inspected by the CPU, used as an interrupt/wakeup source to the CPU when in Low-power mode (Sleep or Deep Sleep) or fed to DSI as an asynchronous or synchronous signal (level or pulse).
To set up a comparator, configure the inputs, output, mode, interrupts, and other configuration parameters.
1) Configure the inputs and the output using the GPIO API. The high-impedance Analog drive mode is for the inputs and Strong drive mode is for the output.
a. Connecting inputs using dedicated pins:
b. Connecting low-power comparator's inputs using AMUXBUS:
2) Initialize and enable the driver:
3) Configure the interrupt requests if the interrupt event triggering is needed. Additionally, enable the global interrupts and initialize the referenced interrupt by setting the priority and the interrupt vector using the SysInt (System Interrupt) driver API:
4) The comparator output can be monitored using the Cy_LPComp_GetCompare() function, using the comparator interrupt (if the interrupt is enabled) or using GPIO pin (if routed directly through the HSIOM).
The driver provides the callback functions to facilitate the Low-power mode transition. The callback Cy_LPComp_DeepSleepCallback must be called during the execution of Cy_SysPm_CpuEnterDeepSleep.
To trigger the callback execution, the callback must be registered before calling the mode transition function. Refer to SysPm (System Power Management) driver for more information about low-power mode transitions.
Refer to the appropriate device technical reference manual (TRM) for a detailed description of the registers.
Version | Changes | Reason for Change |
---|---|---|
1.0.1 | Update the paths to the code snippets. | PDL structure update. |
1.0 | Initial version |