Modules | |
Low Power Callback | |
The driver supports SysPm callback for Deep Sleep 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) |
Initializes the low-power comparator. More... | |
void | Cy_LPComp_Enable (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_stc_lpcomp_context_t *context) |
Enables the low-power comparator and sets the interrupt mode. More... | |
void | Cy_LPComp_Disable (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_stc_lpcomp_context_t *context) |
Disables the low-power comparator and sets the interrupt mode to disabled. More... | |
__STATIC_INLINE uint32_t | Cy_LPComp_GetCompare (LPCOMP_Type const *base, cy_en_lpcomp_channel_t channel) |
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) |
Sets Drive power mode and speed configuration. More... | |
void | Cy_LPComp_SetHysteresis (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_en_lpcomp_hyst_t hysteresis) |
Configures the 10 mV hysteresis level. More... | |
void | Cy_LPComp_SetOutputMode (LPCOMP_Type *base, cy_en_lpcomp_channel_t channel, cy_en_lpcomp_out_t outType) |
Sets the comparator Output mode. 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) |
Sets the interrupt Edge-detect mode. More... | |
uint32_t | Cy_LPComp_ZeroCal (LPCOMP_Type const *base, cy_en_lpcomp_channel_t channel) |
Performs custom calibration of the input offset to minimize the error for a specific set of conditions: the comparator reference voltage, supply voltage, and operating temperature. More... | |
void | Cy_LPComp_LoadTrim (LPCOMP_Type const *base, cy_en_lpcomp_channel_t channel, uint32_t trimVal) |
Writes a value into the comparator offset trim register. More... | |
__STATIC_INLINE uint32_t | Cy_LPComp_GetInterruptStatus (LPCOMP_Type const *base) |
Returns the status of 2 different LPCOMP interrupt requests. More... | |
__STATIC_INLINE void | Cy_LPComp_ClearInterrupt (LPCOMP_Type *base, uint32_t interrupt) |
Clears LPCOMP 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 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... | |
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 | ||
) |
Initializes the low-power comparator.
*base | The low-power comparator registers structure-pointer. |
channel | The low-power comparator channel number. |
*config | The pointer to the configuration structure. |
*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 | ||
) |
Enables the low-power comparator and sets the interrupt mode.
*base | The low-power comparator registers structure-pointer. |
channel | The low-power comparator channel number. |
*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 | ||
) |
Disables the low-power comparator and sets the interrupt mode to disabled.
*base | The low-power comparator registers structure-pointer. |
channel | The low-power comparator channel number. |
*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_GetCompare | ( | LPCOMP_Type const * | base, |
cy_en_lpcomp_channel_t | channel | ||
) |
Returns a non-zero value when the voltage connected to the positive input is greater than the negative input voltage.
*base | The LPComp register structure-pointer. |
channel | The LPComp channel index. |
void Cy_LPComp_SetPower | ( | LPCOMP_Type * | base, |
cy_en_lpcomp_channel_t | channel, | ||
cy_en_lpcomp_pwr_t | power | ||
) |
Sets Drive power mode and speed configuration.
The power consumption and response time vary depending on the selected power mode; power consumption is the highest in Fast mode and the lowest in Ultra-low-power mode, response time is fastest in fast mode and slowest in ultra-low-power mode. Refer to the device datasheet for specifications for the response time and power consumption for various power settings.
*base | The low-power comparator registers structure pointer. |
channel | The low-power comparator channel number. |
power | cy_en_lpcomp_pwr_t |
void Cy_LPComp_SetHysteresis | ( | LPCOMP_Type * | base, |
cy_en_lpcomp_channel_t | channel, | ||
cy_en_lpcomp_hyst_t | hysteresis | ||
) |
Configures the 10 mV hysteresis level.
Enabling the hysteresis helps ensure that slowly moving voltages or slightly noisy voltages will not cause the output of the comparator to oscillate when the two input voltages are nearly equal.
*base | The low-power comparator registers structure-pointer. |
channel | The low-power comparator channel number. |
hysteresis | cy_en_lpcomp_hyst_t |
void Cy_LPComp_SetOutputMode | ( | LPCOMP_Type * | base, |
cy_en_lpcomp_channel_t | channel, | ||
cy_en_lpcomp_out_t | outType | ||
) |
Sets the comparator Output mode.
*base | The low-power comparator registers structure-pointer. |
channel | The low-power comparator channel number. |
outType | Comparator output mode cy_en_lpcomp_out_t |
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 | ||
) |
Sets the interrupt Edge-detect mode.
*base | The low-power comparator registers structure-pointer. |
channel | The low-power comparator channel number. |
intType | Interrupt edge trigger selection cy_en_lpcomp_int_t |
*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. |
uint32_t Cy_LPComp_ZeroCal | ( | LPCOMP_Type const * | base, |
cy_en_lpcomp_channel_t | channel | ||
) |
Performs custom calibration of the input offset to minimize the error for a specific set of conditions: the comparator reference voltage, supply voltage, and operating temperature.
Refer to technical reference manual (TRM) and the device datasheet for more details.
*base | The low-power comparator registers structure-pointer. |
channel | The low-power comparator channel number. |
void Cy_LPComp_LoadTrim | ( | LPCOMP_Type const * | base, |
cy_en_lpcomp_channel_t | channel, | ||
uint32_t | trimVal | ||
) |
Writes a value into the comparator offset trim register.
See Cy_LPComp_ZeroCal() description for the procedure of getting trim.
*base | The low-power comparator registers structure-pointer. |
channel | The low-power comparator channel number. |
trimVal | The value to store into the comparator offset trim-register. This value has the same format as the parameter returned by the Cy_LPComp_ZeroCal() API routine. |
__STATIC_INLINE uint32_t Cy_LPComp_GetInterruptStatus | ( | LPCOMP_Type const * | base | ) |
Returns the status of 2 different LPCOMP interrupt requests.
*base | The LPCOMP register structure-pointer. |
__STATIC_INLINE void Cy_LPComp_ClearInterrupt | ( | LPCOMP_Type * | base, |
uint32_t | interrupt | ||
) |
Clears LPCOMP interrupts by setting each bit.
*base | The LPCOMP register structure-pointer. |
interrupt | status: CY_LPCOMP_CHANNEL0_INTR and CY_LPCOMP_CHANNEL1_INTR. |
__STATIC_INLINE void Cy_LPComp_SetInterrupt | ( | LPCOMP_Type * | base, |
uint32_t | interrupt | ||
) |
Sets a software interrupt request.
Used for a combined interrupt signal from the global signal reference. Also, can be used from either component instance to trigger either or both software interrupts. It sets the INTR_SET interrupt mask.
*base | The LPCOMP register structure-pointer. |
interrupt | Interrupt status: CY_LPCOMP_CHANNEL0_INTR and CY_LPCOMP_CHANNEL1_INTR. |
__STATIC_INLINE uint32_t Cy_LPComp_GetInterruptMask | ( | LPCOMP_Type const * | base | ) |
Returns an interrupt mask.
*base | The LPCOMP register structure-pointer. |
__STATIC_INLINE void Cy_LPComp_SetInterruptMask | ( | LPCOMP_Type * | base, |
uint32_t | interrupt | ||
) |
Configures which bits of the interrupt request register trigger an interrupt event.
*base | The LPCOMP register structure-pointer. |
interrupt | Interrupt mask: CY_LPCOMP_CHANNEL0_INTR and CY_LPCOMP_CHANNEL1_INTR. |
__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 LPCOMP register structure-pointer. |