Functions | |
cy_en_adccomp_status_t | Cy_ADCCOMP_LPCOMP_Init (CyADCCOMP_Type *base, cy_en_adccomp_lpcomp_id_t lpcompId, cy_en_adccomp_lpcomp_mode_t lpcompMode, cy_stc_adccomp_lpcomp_config_t *pCfg) |
Configures Low power comparator for DC mode or noise threshold detect(NTD) mode. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_LPCOMP_Enable (CyADCCOMP_Type *base, cy_en_adccomp_lpcomp_id_t lpcompId) |
Enable comparator for either DC threshold detection or NTD(Noise Threshold mode). More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_LPCOMP_Disable (CyADCCOMP_Type *base, cy_en_adccomp_lpcomp_id_t lpcompId) |
Disables comparator. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_LPCOMP_DeInit (CyADCCOMP_Type *base, cy_en_adccomp_lpcomp_id_t lpcompId) |
Disable comparator and resets configuration to default values, i.e. More... | |
void | Cy_ADCCOMP_LPCOMP_EnableWakeConfig (cy_en_adccomp_lpcomp_id_t lpcompId) |
Configures comparator as wake source. More... | |
void | Cy_ADCCOMP_LPCOMP_DisableWakeConfig (cy_en_adccomp_lpcomp_id_t lpcompId) |
Disables comparator wake source configuration. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_LPCOMP_ClearLatch (CyADCCOMP_Type *base, cy_en_adccomp_lpcomp_id_t lpcompId) |
Clears the comparator latched status. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_ADC_Init (CyADCCOMP_Type *base, cy_en_adccomp_adc_mode_t adcMode, cy_stc_adccomp_adc_config_t *pCfg) |
Configures ADC block for DC conversion or analog MIC mode for audio acquistion. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_ADC_SelectDcChannel (CyADCCOMP_Type *base, cy_en_adccomp_adc_dc_channel_t channel) |
Sets the specified DC measurement channel. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_SetPgaGain (CyADCCOMP_Type *base, cy_en_adccomp_adc_pga_gain_ctrl_t gain) |
Configures the PGA gain (gain factor 1 to 8) for MIC. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_ADC_Enable (CyADCCOMP_Type *base) |
Enable ADC for DC operation or MIC audio capture. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_ADC_Start (CyADCCOMP_Type *base) |
Triggers CIC operation for DC conversion. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_ADC_Stop (CyADCCOMP_Type *base) |
Disables PDM data sync and CIC filter. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_ADC_InitiateDcCalibration (CyADCCOMP_Type *base) |
Configures ADC for DC calibration. More... | |
void | Cy_ADCCOMP_ADC_EndDcCalibration (CyADCCOMP_Type *base) |
Program register to power down the ADC DC calibration mode. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_ADC_Disable (CyADCCOMP_Type *base) |
Program register to power down the ADC block. More... | |
__STATIC_INLINE void | Cy_ADCCOMP_EnableTimer (CyADCCOMP_Type *base) |
Enables the timer. More... | |
__STATIC_INLINE void | Cy_ADCCOMP_DisableTimer (CyADCCOMP_Type *base) |
Disables the timer. More... | |
__STATIC_INLINE void | Cy_ADCCOMP_SetTimerPeriod (CyADCCOMP_Type *base, uint16_t period) |
Sets the timer period. More... | |
__STATIC_INLINE int16_t | Cy_ADCCOMP_GetDcResult (CyADCCOMP_Type const *base) |
Returns the DC conversion result from the CIC status register. More... | |
void | Cy_ADCCOMP_SetDcOffset (CyADCCOMP_Type *base, int16_t offset, cy_stc_adccomp_adc_context_t *context) |
Sets the offset value for DC measurement calibration. More... | |
__STATIC_INLINE int16_t | Cy_ADCCOMP_GetCalibrationResult (CyADCCOMP_Type const *base) |
Get the DC calibration offset API must be called after successful completion of DC calibration procedure. More... | |
void | Cy_ADCCOMP_SetDcGain (int16_t gain, cy_stc_adccomp_adc_context_t *context) |
Sets the gain value for DC measurement calibration. More... | |
__STATIC_INLINE int16_t | Cy_ADCCOMP_CountsTo_mVolts (int16_t adcCounts, cy_stc_adccomp_adc_context_t const *context) |
Convert the ADC output to millivolts as an int16. More... | |
__STATIC_INLINE int32_t | Cy_ADCCOMP_CountsTo_uVolts (int16_t adcCounts, cy_stc_adccomp_adc_context_t const *context) |
Convert the ADC output to microvolts as an int32. More... | |
__STATIC_INLINE UINT32 | Cy_ADCCOMP_GetStatusRegisterVal (CyADCCOMP_Type const *base) |
Reads the ADCCOMP status register. More... | |
void | Cy_ADCCOMP_EnableInterrupt (CyADCCOMP_Type *base, uint32_t intrMask) |
Sets the specified interrupt bit in the interrupt mask register. More... | |
void | Cy_ADCCOMP_DisableInterrupt (CyADCCOMP_Type *base, uint32_t intrMask) |
Clears the specified interrupt bit in the interrupt mask register. More... | |
__STATIC_INLINE UINT32 | Cy_ADCCOMP_GetInterruptStatus (CyADCCOMP_Type const *base) |
Returns the interrupt status. More... | |
__STATIC_INLINE void | Cy_ADCCOMP_ClearInterrupt (CyADCCOMP_Type *base, UINT32 intrMask) |
Clears the specified interrupts status. More... | |
__STATIC_INLINE UINT32 | Cy_ADCCOMP_GetInterruptMask (CyADCCOMP_Type const *base) |
Returns the interrupt mask value. More... | |
__STATIC_INLINE void | Cy_ADCCOMP_SetInterrupt (CyADCCOMP_Type *base, uint32_t intrMask) |
sets the interrupt. More... | |
__STATIC_INLINE void | Cy_ADCCOMP_SetInterruptMask (CyADCCOMP_Type *base, uint32_t intrMask) |
Write interrupt mask value into interrupt mask register. More... | |
__STATIC_INLINE uint32_t | Cy_ADCCOMP_GetInterruptStatusMasked (CyADCCOMP_Type const *base) |
Returns the logical AND of the corresponding INTR and INTR_MASK fields in a single-load operation. More... | |
cy_en_adccomp_status_t | Cy_ADCCOMP_RegisterIntrCallback (CY_ADCCOMP_IRQ_THREAD_CB_t pCb) |
Returns the status of registration of callback for ADCCOMP IRQ cy_en_adccomp_status_t. More... | |
cy_en_adccomp_status_t Cy_ADCCOMP_LPCOMP_Init | ( | CyADCCOMP_Type * | base, |
cy_en_adccomp_lpcomp_id_t | lpcompId, | ||
cy_en_adccomp_lpcomp_mode_t | lpcompMode, | ||
cy_stc_adccomp_lpcomp_config_t * | pCfg | ||
) |
Configures Low power comparator for DC mode or noise threshold detect(NTD) mode.
base | The pointer to the hardware ADCCOMP block. |
lpcompId | Low power comparator Id cy_en_adccomp_lpcomp_id_t. |
lpcompMode | Low power comparator mode of operation cy_en_adccomp_lpcomp_mode_t. |
pCfg | The pointer to the configuration structure cy_stc_adccomp_lpcomp_config_t. |
cy_en_adccomp_status_t Cy_ADCCOMP_LPCOMP_Enable | ( | CyADCCOMP_Type * | base, |
cy_en_adccomp_lpcomp_id_t | lpcompId | ||
) |
Enable comparator for either DC threshold detection or NTD(Noise Threshold mode).
when comparator i/p(i.e. +ve terminal i/p) is above threshold(i.e. -ve terminal value), comparator interrupt group_adccomp_macros_interrupt get generated. In interrupt callback, ADC status register cy_adccomp_status_register_mask_t can be read to check for comparator o/p latched high.
base | The pointer to the hardware ADCCOMP block. |
lpcompId | Low power comparator Id cy_en_adccomp_lpcomp_id_t. |
cy_en_adccomp_status_t Cy_ADCCOMP_LPCOMP_Disable | ( | CyADCCOMP_Type * | base, |
cy_en_adccomp_lpcomp_id_t | lpcompId | ||
) |
Disables comparator.
base | The pointer to the hardware ADCCOMP block. |
lpcompId | Low power comparator Id cy_en_adccomp_lpcomp_id_t. |
cy_en_adccomp_status_t Cy_ADCCOMP_LPCOMP_DeInit | ( | CyADCCOMP_Type * | base, |
cy_en_adccomp_lpcomp_id_t | lpcompId | ||
) |
Disable comparator and resets configuration to default values, i.e.
input to comparator is open, Resets comparator o/p, Clears NTD mode and Set Hysterisis to CY_LPCOMP_HYST_LIMIT_0MV_NONE
base | The pointer to the hardware ADCCOMP block. |
lpcompId | Low power comparator Id cy_en_adccomp_lpcomp_id_t. |
void Cy_ADCCOMP_LPCOMP_EnableWakeConfig | ( | cy_en_adccomp_lpcomp_id_t | lpcompId | ) |
Configures comparator as wake source.
Applicable to use in NTD mode only.
lpcompId | Low power comparator Id cy_en_adccomp_lpcomp_id_t. |
void Cy_ADCCOMP_LPCOMP_DisableWakeConfig | ( | cy_en_adccomp_lpcomp_id_t | lpcompId | ) |
Disables comparator wake source configuration.
Applicable to use in NTD mode only.
lpcompId | Low power comparator Id cy_en_adccomp_lpcomp_id_t. |
cy_en_adccomp_status_t Cy_ADCCOMP_LPCOMP_ClearLatch | ( | CyADCCOMP_Type * | base, |
cy_en_adccomp_lpcomp_id_t | lpcompId | ||
) |
Clears the comparator latched status.
base | The pointer to the hardware ADCCOMP block. |
lpcompId | Low power comparator Id cy_en_adccomp_lpcomp_id_t. |
cy_en_adccomp_status_t Cy_ADCCOMP_ADC_Init | ( | CyADCCOMP_Type * | base, |
cy_en_adccomp_adc_mode_t | adcMode, | ||
cy_stc_adccomp_adc_config_t * | pCfg | ||
) |
Configures ADC block for DC conversion or analog MIC mode for audio acquistion.
base | The pointer to the hardware ADCCOMP block. |
adcMode | ADC mode of operation cy_en_adccomp_adc_mode_t. |
pCfg | The pointer to the configuration structure cy_stc_adccomp_adc_config_t. |
cy_en_adccomp_status_t Cy_ADCCOMP_ADC_SelectDcChannel | ( | CyADCCOMP_Type * | base, |
cy_en_adccomp_adc_dc_channel_t | channel | ||
) |
Sets the specified DC measurement channel.
base | The pointer to the hardware ADCCOMP block. |
channel | The DC measurement channel cy_en_adccomp_adc_dc_channel_t. |
cy_en_adccomp_status_t Cy_ADCCOMP_SetPgaGain | ( | CyADCCOMP_Type * | base, |
cy_en_adccomp_adc_pga_gain_ctrl_t | gain | ||
) |
Configures the PGA gain (gain factor 1 to 8) for MIC.
In DC mode, gain not applicable, i.e gain = 1. This API must be called before ADC enabled
base | The pointer to the hardware ADCCOMP block. |
gain | The gain value cy_en_adccomp_adc_pga_gain_ctrl_t. |
cy_en_adccomp_status_t Cy_ADCCOMP_ADC_Enable | ( | CyADCCOMP_Type * | base | ) |
Enable ADC for DC operation or MIC audio capture.
CY_ADCCOMP_INTR_ADC_READY group_adccomp_macros_interrupt interrupt get generated, on ADC LDO stable(i.e. ADC ready for operation). From interrupt callback, call below APIs for corresponding operation. DC mode: DC conversion: Call Cy_ADCCOMP_ADC_Start for DC conversion DC calibration: Call Cy_ADCCOMP_ADC_InitiateDcCalibration MIC audio capture: call pdmpcm APIs cy_pdm_pcm.h to capture PCM audio samples
base | The pointer to the hardware ADCCOMP block. |
cy_en_adccomp_status_t Cy_ADCCOMP_ADC_Start | ( | CyADCCOMP_Type * | base | ) |
Triggers CIC operation for DC conversion.
CY_ADCCOMP_INTR_CIC group_adccomp_macros_interrupt interrupt get generated on CIC operation completion. From interrupt callback, call corresponding APIs to get DC result. For DC calibration value, call Cy_ADCCOMP_GetDcOffset to get signed DCc alibration result. User has to save this value in memory cy_stc_adccomp_adc_context_t and use it in subsequent DC measures.
base | The pointer to the hardware ADCCOMP block. |
cy_en_adccomp_status_t Cy_ADCCOMP_ADC_Stop | ( | CyADCCOMP_Type * | base | ) |
Disables PDM data sync and CIC filter.
base | The pointer to the hardware ADCCOMP block. |
cy_en_adccomp_status_t Cy_ADCCOMP_ADC_InitiateDcCalibration | ( | CyADCCOMP_Type * | base | ) |
Configures ADC for DC calibration.
CY_ADCCOMP_INTR_ADC_READY group_adccomp_macros_interrupt interrupt get generated From interrupt callback, call Cy_ADCCOMP_ADC_Start to start CIC operation.
base | The pointer to the hardware ADCCOMP block. |
void Cy_ADCCOMP_ADC_EndDcCalibration | ( | CyADCCOMP_Type * | base | ) |
Program register to power down the ADC DC calibration mode.
base | The pointer to the hardware ADCCOMP block. |
cy_en_adccomp_status_t Cy_ADCCOMP_ADC_Disable | ( | CyADCCOMP_Type * | base | ) |
Program register to power down the ADC block.
base | The pointer to the hardware ADCCOMP block. |
__STATIC_INLINE void Cy_ADCCOMP_EnableTimer | ( | CyADCCOMP_Type * | base | ) |
Enables the timer.
Cy_ADCCOMP_SetTimerPeriod for timer requirement.
base | The pointer to the hardware ADCCOMP block. |
__STATIC_INLINE void Cy_ADCCOMP_DisableTimer | ( | CyADCCOMP_Type * | base | ) |
Disables the timer.
base | The pointer to the hardware ADCCOMP block. |
__STATIC_INLINE void Cy_ADCCOMP_SetTimerPeriod | ( | CyADCCOMP_Type * | base, |
uint16_t | period | ||
) |
Sets the timer period.
Timer control APIs allows the user to give extra time to ADC LDO to become stable. By default driver bypass the timer and relay on ADC's GMLDO OK signal to generate CY_ADCCOMP_INTR_ADC_READY group_adccomp_macros_interrupt. For examle, at 2.048Mhz default value(= 0xCD) count will be programmed to generate CY_ADCCOMP_INTR_ADC_READY interrupt based on ADC GM LDO OK signal to indicate that 100us has lapsed and the ADC's LDO is stable. User can adjust this count through external timer using these APIs.
base | The pointer to the hardware ADCCOMP block. |
period | The 16-bit timer period. |
__STATIC_INLINE int16_t Cy_ADCCOMP_GetDcResult | ( | CyADCCOMP_Type const * | base | ) |
Returns the DC conversion result from the CIC status register.
Note:- Driver programs HW to get calibrated DC conversion result, so user must program valid calibration offset value using Cy_ADCCOMP_SetDcOffset before start DC measurement operation.
base | The pointer to the hardware ADCCOMP block. |
void Cy_ADCCOMP_SetDcOffset | ( | CyADCCOMP_Type * | base, |
int16_t | offset, | ||
cy_stc_adccomp_adc_context_t * | context | ||
) |
Sets the offset value for DC measurement calibration.
HW CIC updated with offset value
base | The pointer to the hardware ADCCOMP block. |
offset | The offset value. |
context | The pointer to the context structure cy_stc_adccomp_adc_context_t. |
__STATIC_INLINE int16_t Cy_ADCCOMP_GetCalibrationResult | ( | CyADCCOMP_Type const * | base | ) |
Get the DC calibration offset API must be called after successful completion of DC calibration procedure.
base | The pointer to the hardware ADCCOMP block. |
void Cy_ADCCOMP_SetDcGain | ( | int16_t | gain, |
cy_stc_adccomp_adc_context_t * | context | ||
) |
Sets the gain value for DC measurement calibration.
For H1 ADCCOMP IP, this is 2 ^ 15 = 0x8000, essentially it is an amount of raw counts per 1 volt of input voltage.
gain | The gain value. |
context | The pointer to the context structure cy_stc_adccomp_adc_context_t. |
__STATIC_INLINE int16_t Cy_ADCCOMP_CountsTo_mVolts | ( | int16_t | adcCounts, |
cy_stc_adccomp_adc_context_t const * | context | ||
) |
Convert the ADC output to millivolts as an int16.
For example, if the ADC measured 0.534 volts, the return value would be 534. The calculation of voltage depends on the DC range. The equation used is:
mV = (RawCounts) * 1000 / Gain
where,
adcCounts | Conversion result from Cy_ADCCOMP_GetDcResult |
context | The pointer to the context structure cy_stc_adccomp_adc_context_t. |
__STATIC_INLINE int32_t Cy_ADCCOMP_CountsTo_uVolts | ( | int16_t | adcCounts, |
cy_stc_adccomp_adc_context_t const * | context | ||
) |
Convert the ADC output to microvolts as an int32.
For example, if the ADC measured 0.534 volts, the return value would be 534000. The calculation of voltage depends on the DC range. The equation used is:
uV = (RawCounts) * 1000000 / Gain
where,
adcCounts | Conversion result from Cy_ADCCOMP_GetDcResult |
context | The pointer to the context structure cy_stc_adccomp_adc_context_t. |
__STATIC_INLINE UINT32 Cy_ADCCOMP_GetStatusRegisterVal | ( | CyADCCOMP_Type const * | base | ) |
Reads the ADCCOMP status register.
base | The pointer to the hardware ADCCOMP block. |
void Cy_ADCCOMP_EnableInterrupt | ( | CyADCCOMP_Type * | base, |
uint32_t | intrMask | ||
) |
Sets the specified interrupt bit in the interrupt mask register.
base | The pointer to the hardware ADCCOMP block. |
intrMask | The mask of interrupts. Select one or more values from group_adccomp_macros_interrupt and "OR" them together. |
void Cy_ADCCOMP_DisableInterrupt | ( | CyADCCOMP_Type * | base, |
uint32_t | intrMask | ||
) |
Clears the specified interrupt bit in the interrupt mask register.
base | The pointer to the hardware ADCCOMP block. |
intrMask | The mask of interrupts. Select one or more values from group_adccomp_macros_interrupt and "OR" them together. |
__STATIC_INLINE UINT32 Cy_ADCCOMP_GetInterruptStatus | ( | CyADCCOMP_Type const * | base | ) |
Returns the interrupt status.
base | The pointer to the hardware ADCCOMP block. |
__STATIC_INLINE void Cy_ADCCOMP_ClearInterrupt | ( | CyADCCOMP_Type * | base, |
UINT32 | intrMask | ||
) |
Clears the specified interrupts status.
base | The pointer to the hardware ADCCOMP block. |
intrMask | The mask of interrupts to clear. Typically this will be the value returned from Cy_ADCCOMP_GetInterruptStatus. Alternately, select one or more values from group_adccomp_macros_interrupt and "OR" them together. |
__STATIC_INLINE UINT32 Cy_ADCCOMP_GetInterruptMask | ( | CyADCCOMP_Type const * | base | ) |
Returns the interrupt mask value.
base | The pointer to the hardware ADCCOMP block. |
__STATIC_INLINE void Cy_ADCCOMP_SetInterrupt | ( | CyADCCOMP_Type * | base, |
uint32_t | intrMask | ||
) |
sets the interrupt.
Intended mostly for debugging.
base | The pointer to the hardware ADCCOMP block. |
intrMask | The mask of interrupts. Select one or more values from group_adccomp_macros_interrupt and "OR" them together. |
__STATIC_INLINE void Cy_ADCCOMP_SetInterruptMask | ( | CyADCCOMP_Type * | base, |
uint32_t | intrMask | ||
) |
Write interrupt mask value into interrupt mask register.
base | The pointer to the hardware ADCCOMP block. CyADCCOMP_Type |
intrMask | The mask of interrupts. Select one or more values from group_adccomp_macros_interrupt and "OR" them together. |
__STATIC_INLINE uint32_t Cy_ADCCOMP_GetInterruptStatusMasked | ( | CyADCCOMP_Type const * | base | ) |
Returns the logical AND of the corresponding INTR and INTR_MASK fields in a single-load operation.
base | The pointer to the hardware ADCCOMP block. CyADCCOMP_Type |
cy_en_adccomp_status_t Cy_ADCCOMP_RegisterIntrCallback | ( | CY_ADCCOMP_IRQ_THREAD_CB_t | pCb | ) |
Returns the status of registration of callback for ADCCOMP IRQ cy_en_adccomp_status_t.
pCb | Callback for ADCCOMP IRQ to application CY_ADCCOMP_IRQ_THREAD_CB_t |