API Reference | |
| Low Power Callback | |
| The driver supports the SysPm callback for Deep Sleep and Hibernate transition. | |
Functions | |
| cy_en_lpcomp_status_t | Cy_LPComp_Init (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, const cy_stc_lpcomp_config_t *config, cy_stc_lpcomp_context_t *context) |
| This function initializes the low-power comparator and returns the status of the initialization. More... | |
| void | Cy_LPComp_Enable (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_stc_lpcomp_context_t *context) |
| This function enables the low-power comparator and sets interrupt edge-detect and drive power modes. More... | |
| void | Cy_LPComp_Disable (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_stc_lpcomp_context_t *context) |
| This function disables the low-power comparator power and sets interrupt edge-detect mode to the disabled state. More... | |
| __STATIC_INLINE void | Cy_LPComp_GlobalEnable (LPCOMP_Type *base) |
| Activates the IP of the low-power comparator hardware block. More... | |
| __STATIC_INLINE void | Cy_LPComp_GlobalDisable (LPCOMP_Type *base) |
| Deactivates the IP of the low-power comparator hardware block. More... | |
| __STATIC_INLINE void | Cy_LPComp_UlpReferenceEnable (LPCOMP_Type *base) |
| Enables the local reference generator circuit to generate the local Vref and Ibias. More... | |
| __STATIC_INLINE void | Cy_LPComp_UlpReferenceDisable (LPCOMP_Type *base) |
| Disables the local reference-generator circuit. More... | |
| __STATIC_INLINE uint32_t | Cy_LPComp_GetCompare (LPCOMP_Type const *base, cy_en_lpcomp_channel_t channel) |
| This function returns a non-zero value when the voltage connected to the positive input is greater than the negative input voltage. More... | |
| void | Cy_LPComp_SetPower (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_en_lpcomp_pwr_t power, cy_stc_lpcomp_context_t *context) |
| This function sets the drive power and speeds to one of the four settings. More... | |
| void | Cy_LPComp_SetHysteresis (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_en_lpcomp_hyst_t hysteresis) |
| Adds the 30mV hysteresis to the comparator. More... | |
| void | Cy_LPComp_SetInputs (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_en_lpcomp_inputs_t inputP, cy_en_lpcomp_inputs_t inputN) |
| Sets the comparator input sources. More... | |
| void | Cy_LPComp_SetOutputMode (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_en_lpcomp_out_t outType) |
| Sets the type of the comparator DSI output. More... | |
| void | Cy_LPComp_SetInterruptTriggerMode (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_en_lpcomp_int_t intType, cy_stc_lpcomp_context_t *context) |
| This function sets the interrupt edge-detect mode and controls the value provided on the output. More... | |
| __STATIC_INLINE uint32_t | Cy_LPComp_GetInterruptStatus (LPCOMP_Type const *base) |
| Returns the status of two different low-power comparator interrupt requests. More... | |
| __STATIC_INLINE void | Cy_LPComp_ClearInterrupt (LPCOMP_Type *base, uint32_t interrupt) |
| Clears low-power comparator interrupts by setting each bit. More... | |
| __STATIC_INLINE void | Cy_LPComp_SetInterrupt (LPCOMP_Type *base, uint32_t interrupt) |
| Sets a software interrupt request. More... | |
| __STATIC_INLINE uint32_t | Cy_LPComp_GetInterruptMask (LPCOMP_Type const *base) |
| Returns an interrupt mask. More... | |
| __STATIC_INLINE void | Cy_LPComp_SetInterruptMask (LPCOMP_Type *base, uint32_t interrupt) |
| Configures which bits of the interrupt request register will trigger an interrupt event. More... | |
| __STATIC_INLINE uint32_t | Cy_LPComp_GetInterruptStatusMasked (LPCOMP_Type const *base) |
| Returns an interrupt request register masked by an interrupt mask. More... | |
| __STATIC_INLINE void | Cy_LPComp_ConnectULPReference (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel) |
| Connects the local reference generator output to the comparator negative input. More... | |
| void | Cy_LPComp_GetTrim (LPCOMP_Type const *base, cy_en_lpcomp_channel_t channel, cy_en_lpcomp_trim_t *trim) |
| This function returns current trim settings for a particular channel of low-power comparator. More... | |
| void | Cy_LPComp_SetTrim (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, const cy_en_lpcomp_trim_t *trim) |
| This function applies trim settings to the particular channel of low-power comparator. More... | |
| cy_en_lpcomp_status_t Cy_LPComp_Init | ( | LPCOMP_Type * | base, |
| cy_en_lpcomp_channel_t | channel, | ||
| const cy_stc_lpcomp_config_t * | config, | ||
| cy_stc_lpcomp_context_t * | context | ||
| ) |
This function initializes the low-power comparator and returns the status of the initialization.
| *base | The low-power comparator registers structure pointer. |
| channel | The low-power comparator channel index. |
| *config | The pointer to the configuration structure for PDL. |
| *context | The pointer to the context structure cy_stc_lpcomp_context_t allocated by the user. The structure is used during the low-power comparator operation for internal configuration and data retention. The user must not modify anything in this structure. |
| void Cy_LPComp_Enable | ( | LPCOMP_Type * | base, |
| cy_en_lpcomp_channel_t | channel, | ||
| cy_stc_lpcomp_context_t * | context | ||
| ) |
This function enables the low-power comparator and sets interrupt edge-detect and drive power modes.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| *context | The pointer to the context structure cy_stc_lpcomp_context_t allocated by the user. The structure is used during the low-power comparator operation for internal configuration and data retention. The user must not modify anything in this structure. |
| void Cy_LPComp_Disable | ( | LPCOMP_Type * | base, |
| cy_en_lpcomp_channel_t | channel, | ||
| cy_stc_lpcomp_context_t * | context | ||
| ) |
This function disables the low-power comparator power and sets interrupt edge-detect mode to the disabled state.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| *context | The pointer to the context structure cy_stc_lpcomp_context_t allocated by the user. The structure is used during the low-power comparator operation for internal configuration and data retention. The user must not modify anything in this structure. |
| __STATIC_INLINE void Cy_LPComp_GlobalEnable | ( | LPCOMP_Type * | base | ) |
Activates the IP of the low-power comparator hardware block.
Call this function before operating any comparator channel.
| *base | The low-power comparator register structure pointer. |
| __STATIC_INLINE void Cy_LPComp_GlobalDisable | ( | LPCOMP_Type * | base | ) |
Deactivates the IP of the low-power comparator hardware block.
(Analog is in power down, open all switches, all clocks are off).
| *base | The low-power comparator register structure pointer. |
| __STATIC_INLINE void Cy_LPComp_UlpReferenceEnable | ( | LPCOMP_Type * | base | ) |
Enables the local reference generator circuit to generate the local Vref and Ibias.
| *base | The low-power comparator register structure pointer. |
| __STATIC_INLINE void Cy_LPComp_UlpReferenceDisable | ( | LPCOMP_Type * | base | ) |
Disables the local reference-generator circuit.
| *base | The low-power comparator register structure pointer. |
| __STATIC_INLINE uint32_t Cy_LPComp_GetCompare | ( | LPCOMP_Type const * | base, |
| cy_en_lpcomp_channel_t | channel | ||
| ) |
This function returns a non-zero value when the voltage connected to the positive input is greater than the negative input voltage.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| void Cy_LPComp_SetPower | ( | LPCOMP_Type * | base, |
| cy_en_lpcomp_channel_t | channel, | ||
| cy_en_lpcomp_pwr_t | power, | ||
| cy_stc_lpcomp_context_t * | context | ||
| ) |
This function sets the drive power and speeds to one of the four settings.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| power | Defines the component power mode:
|
| *context | The pointer to the context structure cy_stc_lpcomp_context_t allocated by the user. The structure is used during the low-power comparator operation for internal configuration and data retention. The user must not modify anything in this structure. |
| void Cy_LPComp_SetHysteresis | ( | LPCOMP_Type * | base, |
| cy_en_lpcomp_channel_t | channel, | ||
| cy_en_lpcomp_hyst_t | hysteresis | ||
| ) |
Adds the 30mV hysteresis to the comparator.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| hysteresis | Defines the component operation mode:
|
| void Cy_LPComp_SetInputs | ( | LPCOMP_Type * | base, |
| cy_en_lpcomp_channel_t | channel, | ||
| cy_en_lpcomp_inputs_t | inputP, | ||
| cy_en_lpcomp_inputs_t | inputN | ||
| ) |
Sets the comparator input sources.
The comparator inputs can be connected to the dedicated GPIO pins. Additionally, the negative comparator input can be connected to the local VREF. Even one unconnected input causes a comparator undefined output.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| inputP | Positive input selection:
|
| inputN | Negative input selection:
|
| void Cy_LPComp_SetOutputMode | ( | LPCOMP_Type * | base, |
| cy_en_lpcomp_channel_t | channel, | ||
| cy_en_lpcomp_out_t | outType | ||
| ) |
Sets the type of the comparator DSI output.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| outType | Interrupt-edge trigger selection:
|
| void Cy_LPComp_SetInterruptTriggerMode | ( | LPCOMP_Type * | base, |
| cy_en_lpcomp_channel_t | channel, | ||
| cy_en_lpcomp_int_t | intType, | ||
| cy_stc_lpcomp_context_t * | context | ||
| ) |
This function sets the interrupt edge-detect mode and controls the value provided on the output.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| intType | Interrupt edge trigger selection:
|
| *context | The pointer to the context structure cy_stc_lpcomp_context_t allocated by the user. The structure is used during the low-power comparator operation for internal configuration and data retention. The user must not modify anything in this structure. |
| __STATIC_INLINE uint32_t Cy_LPComp_GetInterruptStatus | ( | LPCOMP_Type const * | base | ) |
Returns the status of two different low-power comparator interrupt requests.
| *base | The low-power comparator register structure pointer. |
| __STATIC_INLINE void Cy_LPComp_ClearInterrupt | ( | LPCOMP_Type * | base, |
| uint32_t | interrupt | ||
| ) |
Clears low-power comparator interrupts by setting each bit.
| *base | The low-power comparator register structure pointer. |
| interrupt |
|
| __STATIC_INLINE void Cy_LPComp_SetInterrupt | ( | LPCOMP_Type * | base, |
| uint32_t | interrupt | ||
| ) |
Sets a software interrupt request.
This function is used in the case of combined interrupt signal from the global signal reference. This function from either component instance can be used to trigger either or both software interrupts. The function sets the INTR_SET interrupt mask.
| *base | The low-power comparator register structure pointer. |
| interrupt |
|
| __STATIC_INLINE uint32_t Cy_LPComp_GetInterruptMask | ( | LPCOMP_Type const * | base | ) |
Returns an interrupt mask.
| *base | The low-power comparator register structure pointer. |
| __STATIC_INLINE void Cy_LPComp_SetInterruptMask | ( | LPCOMP_Type * | base, |
| uint32_t | interrupt | ||
| ) |
Configures which bits of the interrupt request register will trigger an interrupt event.
| *base | The low-power comparator register structure pointer. |
| interrupt | uint32_t interruptMask: Bit Mask of interrupts to set.
|
| __STATIC_INLINE uint32_t Cy_LPComp_GetInterruptStatusMasked | ( | LPCOMP_Type const * | base | ) |
Returns an interrupt request register masked by an interrupt mask.
Returns the result of the bitwise AND operation between the corresponding interrupt request and mask bits.
| *base | The low-power comparator register structure pointer. |
| __STATIC_INLINE void Cy_LPComp_ConnectULPReference | ( | LPCOMP_Type * | base, |
| cy_en_lpcomp_channel_t | channel | ||
| ) |
Connects the local reference generator output to the comparator negative input.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| void Cy_LPComp_GetTrim | ( | LPCOMP_Type const * | base, |
| cy_en_lpcomp_channel_t | channel, | ||
| cy_en_lpcomp_trim_t * | trim | ||
| ) |
This function returns current trim settings for a particular channel of low-power comparator.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| *trim | The low-power comparator trim structure pointer, see cy_en_lpcomp_trim_t. |
| void Cy_LPComp_SetTrim | ( | LPCOMP_Type * | base, |
| cy_en_lpcomp_channel_t | channel, | ||
| const cy_en_lpcomp_trim_t * | trim | ||
| ) |
This function applies trim settings to the particular channel of low-power comparator.
| *base | The low-power comparator register structure pointer. |
| channel | The low-power comparator channel index. |
| *trim | The low-power comparator trim structure pointer, see cy_en_lpcomp_trim_t. |