MTB CAT1 Peripheral driver library

General Description

API Reference

 Channel functions
 
 FIR functions
 
 FIFO functions
 

Functions

cy_en_hppass_status_t Cy_HPPASS_SAR_Init (const cy_stc_hppass_sar_t *sarCfg)
 Loads the SAR ADC configuration. More...
 
void Cy_HPPASS_SAR_DeInit (void)
 Resets all the SAR registers to their default state.
 
__STATIC_INLINE bool Cy_HPPASS_SAR_IsBusy (void)
 Returns the SAR ADC busy status. More...
 
__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_SAR_Limit_Config (uint8_t limIdx, const cy_stc_hppass_sar_limit_t *limCfg)
 Configures the ADC limit crossing detection block. More...
 
__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_SAR_GroupConfig (uint8_t grpIdx, const cy_stc_hppass_sar_grp_t *grpCfg)
 Configures a single Sequencer Group. More...
 
__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_SAR_DisableGroupContConvert (uint8_t grpIdx)
 Disables continuous conversion for the specified SAR group. More...
 
__STATIC_INLINE uint8_t Cy_HPPASS_SAR_GetTriggerCollisionStatus (void)
 Returns the Sequencer Group Trigger Collision Status for all the Groups. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_ClearTriggerCollisionStatus (uint8_t trigCollision)
 Clears the Sequencer Group Trigger Collision Status for the specified Sequences. More...
 
__STATIC_INLINE uint8_t Cy_HPPASS_SAR_GetHoldViolationStatus (void)
 Returns the Sequencer Group Hold Violation Status for all the Sequences. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_ClearHoldViolationStatus (uint8_t holdViolation)
 Clears the Sequencer Group Hold Violation Status for the specified Sequences. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_SetHoldViolationCnt (uint16_t cnt)
 Sets the common maximum hold count value for all the Sequencer Groups. More...
 
__STATIC_INLINE uint16_t Cy_HPPASS_SAR_GetHoldViolationCnt (void)
 Returns the common maximum hold count value for all the Sequencer Groups. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_SetTempSensorCurrent (cy_en_hppass_sar_temp_sensor_current_t curr)
 Selects low or high current for temperature sensor. More...
 
__STATIC_INLINE int16_t Cy_HPPASS_TEMP_Calc (int16_t tempHi, int16_t tempLo)
 Calculates the temperature based on two ADC reading results of temperature sensor. More...
 
void Cy_HPPASS_SAR_Adjust (int16_t temp, uint16_t vRef)
 Adjusts the offset calibration value according to input temperature value. More...
 
__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Limit_GetInterruptStatus (void)
 Returns the limit crossing interrupt register status. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_Limit_ClearInterrupt (uint32_t interrupt)
 Clears the limit crossing interrupt for SAR. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_Limit_SetInterrupt (uint32_t interrupt)
 Sets a software interrupt request for the specified limit crossing detection block. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_Limit_SetInterruptMask (uint32_t interrupt)
 Enables the interrupt for the specified limit crossing detection block. More...
 
__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Limit_GetInterruptMask (void)
 Returns the interrupt mask for the specified limit crossing detection block. More...
 
__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Limit_GetInterruptStatusMasked (void)
 Gets limit crossing interrupt masked status. More...
 
__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Result_GetInterruptStatus (void)
 Gets the SAR result interrupt status (ENTRY done, FIR done). More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_Result_ClearInterrupt (uint32_t interrupt)
 Clears SAR result interrupt. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_Result_SetInterrupt (uint32_t interrupt)
 Sets a software SAR result interrupt request. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_Result_SetInterruptMask (uint32_t interrupt)
 Enables the SAR result interrupt. More...
 
__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Result_GetInterruptMask (void)
 Gets the SAR result interrupt mask. More...
 
__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Result_GetInterruptStatusMasked (void)
 Gets the SAR result interrupt masked status. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_SetSwitch (uint16_t muxMask)
 Sets selected AROUTE switch closed. More...
 
__STATIC_INLINE void Cy_HPPASS_SAR_ClearSwitch (uint16_t muxMask)
 Clears selected AROUTE switch open. More...
 
__STATIC_INLINE uint16_t Cy_HPPASS_SAR_GetSwitchStatus (void)
 Reads the current state of the AROUTE switch. More...
 
float32_t Cy_HPPASS_SAR_CountsTo_Volts (uint8_t chanIdx, uint16_t vRef, int16_t chanCounts)
 Converts the raw ADC result in counts into the analog pin voltage in volts. More...
 
int16_t Cy_HPPASS_SAR_CountsTo_mVolts (uint8_t chanIdx, uint16_t vRef, int16_t chanCounts)
 Converts the raw ADC result in counts into the analog pin voltage in millivolts. More...
 
int32_t Cy_HPPASS_SAR_CountsTo_uVolts (uint8_t chanIdx, uint16_t vRef, int16_t chanCounts)
 Converts the raw ADC result in counts into the analog pin voltage in microvolts. More...
 

Function Documentation

◆ Cy_HPPASS_SAR_Init()

cy_en_hppass_status_t Cy_HPPASS_SAR_Init ( const cy_stc_hppass_sar_t sarCfg)

Loads the SAR ADC configuration.

Can be used after the Cy_HPPASS_Init function to update the SAR settings.

Note
If AC is running the initialization of SAR block is not allowed (CY_HPPASS_AC_INVALID_STATE will be returned).
If the SAR block is currently busy the initialization is not allowed (CY_HPPASS_SAR_INVALID_STATE will be returned).
Since the 'block ready' status is combined SAR and CSG, this particular SAR function cannot be protected from reinitialization during the 'block ready' == true condition, so it is on user's responsibility when and from where to call this function to reinitialize the SAR block.
Parameters
sarCfgPointer to the SAR configuration structure cy_stc_hppass_sar_t. The pointer cannot be NULL.
Returns
Status of initialization, cy_en_hppass_status_t.
Function Usage
{
.lowSupply = false,
.offsetCal = false,
.linearCal = false,
.gainCal = false,
.chanId = false,
.dirSampEnMsk = CY_HPPASS_SAR_DIRECT_SAMP_0,
.holdCount = 29, /* Optimal value */
.aroute = true,
.muxSampGain = {CY_HPPASS_SAR_SAMP_GAIN_1, CY_HPPASS_SAR_SAMP_GAIN_1, CY_HPPASS_SAR_SAMP_GAIN_1, CY_HPPASS_SAR_SAMP_GAIN_1},
.sampTime = {100, 31, 31}, /* Optimal value */
.chan = {&chanCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &chanCfg, NULL,
NULL, NULL, &chanCfg, NULL, NULL, NULL, &chanCfg, NULL, NULL, NULL, &chanCfg, NULL, NULL, NULL},
.grp = {&grpCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
.limit = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
.muxMode = {CY_HPPASS_SAR_MUX_SEQ, CY_HPPASS_SAR_MUX_SEQ, CY_HPPASS_SAR_MUX_SEQ, CY_HPPASS_SAR_MUX_SEQ},
.fir = {NULL, NULL},
.fifo = NULL
};

◆ Cy_HPPASS_SAR_IsBusy()

__STATIC_INLINE bool Cy_HPPASS_SAR_IsBusy ( void  )

Returns the SAR ADC busy status.

Note
Do not use this function with continuous Sequencer Group mode cy_stc_hppass_sar_grp_t::continuous. See the Device Datasheet Errata section for more details.
Returns
Busy status: true - busy, false - idle.
Function Usage
/* Check that SAR is not busy */

◆ Cy_HPPASS_SAR_Limit_Config()

__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_SAR_Limit_Config ( uint8_t  limIdx,
const cy_stc_hppass_sar_limit_t limCfg 
)

Configures the ADC limit crossing detection block.

Note
If AC is running this configuration is not allowed (CY_HPPASS_AC_INVALID_STATE will be returned).
If the SAR block is currently busy the initialization is not allowed (CY_HPPASS_SAR_INVALID_STATE will be returned).
Since the 'block ready' status is combined SAR and CSG, this particular SAR function cannot be protected from reinitialization during the 'block ready' == true condition, so it is on user's responsibility when and from where to call this function to reconfigure this SAR sub-block.
Parameters
limIdxThe index of the limit crossing detection block. Valid range 0..7.
limCfgPointer to the limit crossing detection configuration structure cy_stc_hppass_sar_limit_t. The pointer cannot be NULL.
Returns
Status, cy_en_hppass_status_t.
Function Usage
/* Scenario: The SAR result should be in range between LIMIT_LOW and LIMIT_HIGH */
{
.low = -300,
.high = 500
};
/* Update limit configuration for crossing detection block #0 */
status = Cy_HPPASS_SAR_Limit_Config(0U, &lim0);
/* Process returned status */

◆ Cy_HPPASS_SAR_GroupConfig()

__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_SAR_GroupConfig ( uint8_t  grpIdx,
const cy_stc_hppass_sar_grp_t grpCfg 
)

Configures a single Sequencer Group.

Note
If AC is running this configuration is not allowed (CY_HPPASS_AC_INVALID_STATE will be returned).
If the SAR block is currently busy the initialization is not allowed (CY_HPPASS_SAR_INVALID_STATE will be returned).
Since the 'block ready' status is combined SAR and CSG, this particular SAR function cannot be protected from reinitialization during the 'block ready' == true condition, so it is on user's responsibility when and from where to call this function to reconfigure this SAR sub-block.
Parameters
grpIdxThe index of the Sequencer Group. Valid range 0..7.
grpCfgPointer to the Sequencer Group configuration structure cy_stc_hppass_sar_grp_t. The pointer cannot be NULL.
Returns
Status, cy_en_hppass_status_t.
Function Usage
{
.muxChanIdx = {0, 0, 0, 0},
.priority = false,
.continuous = false
};

◆ Cy_HPPASS_SAR_DisableGroupContConvert()

__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_SAR_DisableGroupContConvert ( uint8_t  grpIdx)

Disables continuous conversion for the specified SAR group.

Note
If AC is running this configuration is not allowed (CY_HPPASS_AC_INVALID_STATE will be returned).
to re-enable the continuous conversion, the restart of entire SAR block using Cy_HPPASS_AC_Start is needed.
Since the 'block ready' status is combined SAR and CSG, this particular SAR function cannot be protected from reinitialization during the 'block ready' == true condition, so it is on user's responsibility when and from where to call this function to reconfigure this SAR sub-block.
Parameters
grpIdxThe index of the Sequencer Group. Valid range 0..7.
Returns
Status, cy_en_hppass_status_t.
Function Usage
#define SAR_GROUP_IDX (5U)
/* Disable continuous conversion for the specified SAR group */
if (CY_HPPASS_SUCCESS != Cy_HPPASS_SAR_DisableGroupContConvert(SAR_GROUP_IDX))
{
/* Something went wrong, insert error handling here */
}

◆ Cy_HPPASS_SAR_GetTriggerCollisionStatus()

__STATIC_INLINE uint8_t Cy_HPPASS_SAR_GetTriggerCollisionStatus ( void  )

Returns the Sequencer Group Trigger Collision Status for all the Groups.

Returns
8-bit Group mask (a bit per each Group). See Sequencer Group Trigger Collision Status Masks.
Function Usage
uint8_t trigCollision = Cy_HPPASS_SAR_GetTriggerCollisionStatus();

◆ Cy_HPPASS_SAR_ClearTriggerCollisionStatus()

__STATIC_INLINE void Cy_HPPASS_SAR_ClearTriggerCollisionStatus ( uint8_t  trigCollision)

Clears the Sequencer Group Trigger Collision Status for the specified Sequences.

Parameters
trigCollisionThe 8-bit Group mask (a bit per each Group). See Sequencer Group Trigger Collision Status Masks.
Function Usage

◆ Cy_HPPASS_SAR_GetHoldViolationStatus()

__STATIC_INLINE uint8_t Cy_HPPASS_SAR_GetHoldViolationStatus ( void  )

Returns the Sequencer Group Hold Violation Status for all the Sequences.

Returns
8-bit Group mask (a bit per each Group).
Function Usage
uint8_t holdViolation = Cy_HPPASS_SAR_GetHoldViolationStatus();

◆ Cy_HPPASS_SAR_ClearHoldViolationStatus()

__STATIC_INLINE void Cy_HPPASS_SAR_ClearHoldViolationStatus ( uint8_t  holdViolation)

Clears the Sequencer Group Hold Violation Status for the specified Sequences.

Parameters
holdViolationThe 8-bit Group mask (a bit per each Group).
Function Usage

◆ Cy_HPPASS_SAR_SetHoldViolationCnt()

__STATIC_INLINE void Cy_HPPASS_SAR_SetHoldViolationCnt ( uint16_t  cnt)

Sets the common maximum hold count value for all the Sequencer Groups.

Parameters
cntThe hold count value.
Function Usage

◆ Cy_HPPASS_SAR_GetHoldViolationCnt()

__STATIC_INLINE uint16_t Cy_HPPASS_SAR_GetHoldViolationCnt ( void  )

Returns the common maximum hold count value for all the Sequencer Groups.

Returns
The hold count value.
Function Usage

◆ Cy_HPPASS_SAR_SetTempSensorCurrent()

__STATIC_INLINE void Cy_HPPASS_SAR_SetTempSensorCurrent ( cy_en_hppass_sar_temp_sensor_current_t  curr)

Selects low or high current for temperature sensor.

Parameters
currCurrent: false - BJT current is 1uA (default), true - Add 8uA to BJT current.
Function Usage
if (flag) /* The flag should be set periodically, e.g., using AC, Timer, or SAR event itself. */
{
flag = false; /* Clear the request */
switch (tempMeasureSequence)
{
case TRIG_TEMP_HI:
Cy_HPPASS_SetFwTrigger(CY_HPPASS_TRIG_0_MSK); /* Triggering the temperature measurement */
tempMeasureSequence = TRIG_TEMP_LO;
break;
case TRIG_TEMP_LO:
tempHi = Cy_HPPASS_SAR_Result_ChannelRead(TEMPSENS_CHAN_IDX);
Cy_HPPASS_SetFwTrigger(CY_HPPASS_TRIG_0_MSK); /* Triggering the temperature measurement */
tempMeasureSequence = CALC_TEMP;
break;
case CALC_TEMP:
tempLo = Cy_HPPASS_SAR_Result_ChannelRead(TEMPSENS_CHAN_IDX);
instTemp = Cy_HPPASS_TEMP_Calc(tempHi, tempLo);
fltTemp = K * fltTemp + (1.f - K) * instTemp; /* One pole Low Pass Filter. K = Tf/(Tf + Ts).
* Tf: filter time constant, Ts: sample time. */
tempMeasureSequence = TRIG_TEMP_HI; /* Go back to the start of the sequence */
break;
default:
break;
}
}

◆ Cy_HPPASS_TEMP_Calc()

__STATIC_INLINE int16_t Cy_HPPASS_TEMP_Calc ( int16_t  tempHi,
int16_t  tempLo 
)

Calculates the temperature based on two ADC reading results of temperature sensor.

See the device Architecture Technical Reference Manual for more detail.

Parameters
tempHiADC reading when the selected temp sensor is biased with a additional 8uA current.
tempLoADC reading when the selected temp sensor is biased with a 1uA current.
Returns
Temperature value.
Function Usage
if (flag) /* The flag should be set periodically, e.g., using AC, Timer, or SAR event itself. */
{
flag = false; /* Clear the request */
switch (tempMeasureSequence)
{
case TRIG_TEMP_HI:
Cy_HPPASS_SetFwTrigger(CY_HPPASS_TRIG_0_MSK); /* Triggering the temperature measurement */
tempMeasureSequence = TRIG_TEMP_LO;
break;
case TRIG_TEMP_LO:
tempHi = Cy_HPPASS_SAR_Result_ChannelRead(TEMPSENS_CHAN_IDX);
Cy_HPPASS_SetFwTrigger(CY_HPPASS_TRIG_0_MSK); /* Triggering the temperature measurement */
tempMeasureSequence = CALC_TEMP;
break;
case CALC_TEMP:
tempLo = Cy_HPPASS_SAR_Result_ChannelRead(TEMPSENS_CHAN_IDX);
instTemp = Cy_HPPASS_TEMP_Calc(tempHi, tempLo);
fltTemp = K * fltTemp + (1.f - K) * instTemp; /* One pole Low Pass Filter. K = Tf/(Tf + Ts).
* Tf: filter time constant, Ts: sample time. */
tempMeasureSequence = TRIG_TEMP_HI; /* Go back to the start of the sequence */
break;
default:
break;
}
}

◆ Cy_HPPASS_SAR_Adjust()

void Cy_HPPASS_SAR_Adjust ( int16_t  temp,
uint16_t  vRef 
)

Adjusts the offset calibration value according to input temperature value.

Parameters
tempThe temperature value.
vRefThe reference voltage in mV used by the system in the field.
Function Usage
/* Scenario: Update offset calibration according to temperature and VREF in the field */
#define TEMPERATURE_IN_CELSIUS (60)
#define VREF_IN_MV (3400U)
Cy_HPPASS_SAR_Adjust(TEMPERATURE_IN_CELSIUS, VREF_IN_MV);

◆ Cy_HPPASS_SAR_Limit_GetInterruptStatus()

__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Limit_GetInterruptStatus ( void  )

Returns the limit crossing interrupt register status.

Returns
The status of combined interrupt requests for the SAR Group_hppass_sar_limit_interrupts.
Function Usage
/* Scenario: Get the limit crossing interrupt register status */
/* Process returned status */

◆ Cy_HPPASS_SAR_Limit_ClearInterrupt()

__STATIC_INLINE void Cy_HPPASS_SAR_Limit_ClearInterrupt ( uint32_t  interrupt)

Clears the limit crossing interrupt for SAR.

Parameters
interruptThe mask of interrupts to clear. Each bit of this mask is responsible for clearing of the particular interrupt in the SAR Group_hppass_sar_limit_interrupts.
Function Usage
/* Scenario: Clear limit interrupt for the SAR Sequencer Group #0 */

◆ Cy_HPPASS_SAR_Limit_SetInterrupt()

__STATIC_INLINE void Cy_HPPASS_SAR_Limit_SetInterrupt ( uint32_t  interrupt)

Sets a software interrupt request for the specified limit crossing detection block.

Parameters
interruptThe mask of interrupts to set. Each bit of this mask is responsible for triggering of the particular interrupt in the SAR Group_hppass_sar_limit_interrupts.
Function Usage
/* Scenario: Set limit interrupt for the SAR Sequencer Group #7 */

◆ Cy_HPPASS_SAR_Limit_SetInterruptMask()

__STATIC_INLINE void Cy_HPPASS_SAR_Limit_SetInterruptMask ( uint32_t  interrupt)

Enables the interrupt for the specified limit crossing detection block.

Parameters
interruptThe mask of interrupts allowable for activation. Each bit of this mask allows triggering of the particular interrupt in the SAR Group_hppass_sar_limit_interrupts.
Function Usage
/* Scenario: Enable the limit interrupt for the SAR Sequencer Group #3 */

◆ Cy_HPPASS_SAR_Limit_GetInterruptMask()

__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Limit_GetInterruptMask ( void  )

Returns the interrupt mask for the specified limit crossing detection block.

Returns
The mask of the interrupts allowable for activation Group_hppass_sar_limit_interrupts.
Function Usage
/* Scenario: Get limit crossing interrupt masked status */
/* Process returned status */

◆ Cy_HPPASS_SAR_Limit_GetInterruptStatusMasked()

__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Limit_GetInterruptStatusMasked ( void  )

Gets limit crossing interrupt masked status.

Returns
The masked status of combined interrupt requests for the SAR Group_hppass_sar_limit_interrupts.
Function Usage
/* Scenario: Get limit crossing interrupt masked status */
/* Process returned status */

◆ Cy_HPPASS_SAR_Result_GetInterruptStatus()

__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Result_GetInterruptStatus ( void  )

Gets the SAR result interrupt status (ENTRY done, FIR done).

Returns
The status of combined interrupt requests for the SAR Result Interrupt Masks.
Function Usage
/* Polling SAR interrupt status register */

◆ Cy_HPPASS_SAR_Result_ClearInterrupt()

__STATIC_INLINE void Cy_HPPASS_SAR_Result_ClearInterrupt ( uint32_t  interrupt)

Clears SAR result interrupt.

Parameters
interruptThe mask of interrupts to clear. Each bit of this mask is responsible for clearing of the particular interrupt in the SAR Result Interrupt Masks.
Function Usage

◆ Cy_HPPASS_SAR_Result_SetInterrupt()

__STATIC_INLINE void Cy_HPPASS_SAR_Result_SetInterrupt ( uint32_t  interrupt)

Sets a software SAR result interrupt request.

Parameters
interruptThe mask of interrupts to set. Each bit of this mask is responsible for triggering of the particular interrupt in the SAR Result Interrupt Masks.
Function Usage

◆ Cy_HPPASS_SAR_Result_SetInterruptMask()

__STATIC_INLINE void Cy_HPPASS_SAR_Result_SetInterruptMask ( uint32_t  interrupt)

Enables the SAR result interrupt.

Parameters
interruptThe mask of interrupts allowable for activation. Each bit of this mask allows triggering of the particular interrupt in the SAR Result Interrupt Masks.
Function Usage

◆ Cy_HPPASS_SAR_Result_GetInterruptMask()

__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Result_GetInterruptMask ( void  )

Gets the SAR result interrupt mask.

Returns
The mask of the interrupts allowable for activation Result Interrupt Masks.
Function Usage

◆ Cy_HPPASS_SAR_Result_GetInterruptStatusMasked()

__STATIC_INLINE uint32_t Cy_HPPASS_SAR_Result_GetInterruptStatusMasked ( void  )

Gets the SAR result interrupt masked status.

Returns
The masked status of combined interrupt requests for the SAR Result Interrupt Masks.
Function Usage

◆ Cy_HPPASS_SAR_SetSwitch()

__STATIC_INLINE void Cy_HPPASS_SAR_SetSwitch ( uint16_t  muxMask)

Sets selected AROUTE switch closed.

Used for FW control input connections of the muxed samplers.

Note
This function works only if cy_stc_hppass_sar_t::muxMode is set to CY_HPPASS_SAR_MUX_FW for selected mux. See TRM for details.
Parameters
muxMaskThe mask of AROUTE switch.
Function Usage

◆ Cy_HPPASS_SAR_ClearSwitch()

__STATIC_INLINE void Cy_HPPASS_SAR_ClearSwitch ( uint16_t  muxMask)

Clears selected AROUTE switch open.

Used for FW control input connections of the muxed samplers.

Note
This function works only if cy_stc_hppass_sar_t::muxMode is set to CY_HPPASS_SAR_MUX_FW for selected mux. See TRM for details.
Parameters
muxMaskThe mask of AROUTE switch.
Function Usage

◆ Cy_HPPASS_SAR_GetSwitchStatus()

__STATIC_INLINE uint16_t Cy_HPPASS_SAR_GetSwitchStatus ( void  )

Reads the current state of the AROUTE switch.

Returns
Read back the current state of the associated switch control.
Function Usage

◆ Cy_HPPASS_SAR_CountsTo_Volts()

float32_t Cy_HPPASS_SAR_CountsTo_Volts ( uint8_t  chanIdx,
uint16_t  vRef,
int16_t  chanCounts 
)

Converts the raw ADC result in counts into the analog pin voltage in volts.

For example, for the 0.534-volt ADC, the return value is 0.534. Voltage calculation depends on ADC channel work modes: Averaging, Signed, Pseudo-Differential, and Sampler Gain.

The equation:

V = ((chanCounts + chanOffset * avgMultiplier) * vRef / 1000) / (4095 * avgMultiplier * samplerGain)

where,

  • chanCounts: the raw counts from the SAR 16-bit CHAN_RESULT register
  • avgMultiplier: the multiplier value based on Averaging mode (cy_stc_hppass_sar_chan_t) and the number of samples averaged (cy_en_hppass_sar_avg_t)
  • chanOffset: the constant value based on Signed and Differential modes cy_stc_hppass_sar_chan_t
    • for Signed mode - true and Differential mode - disabled, chanOffset is 2048
    • for Signed mode - false and Differential mode - enabled, chanOffset is -2048
    • for all other cases, chanOffset is 0
  • vRef: the SAR ADC reference voltage in millivolts (for example, 3300U).
Note
This function is valid only for the right-aligned result.
Parameters
chanIdxThe channel index . Valid range - 0..27.
vRefThe SAR ADC reference voltage in millivolts
chanCountsConversion result from Cy_HPPASS_SAR_Result_ChannelRead
Returns
The result in Volts.
Function Usage

◆ Cy_HPPASS_SAR_CountsTo_mVolts()

int16_t Cy_HPPASS_SAR_CountsTo_mVolts ( uint8_t  chanIdx,
uint16_t  vRef,
int16_t  chanCounts 
)

Converts the raw ADC result in counts into the analog pin voltage in millivolts.

For example, for the 0.534-volts ADC, the return value is 534. Voltage calculation depends on ADC channel work modes: Averaging, Signed, Pseudo-Differential, and Sampler Gain.

The equation:

mV = ((chanCounts + chanOffset * avgMultiplier) * vRef) / (4095 * avgMultiplier * samplerGain)

where,

  • chanCounts: the raw counts from the SAR 16-bit CHAN_RESULT register
  • avgMultiplier: the multiplier value based on Averaging mode (cy_stc_hppass_sar_chan_t) and the number of samples averaged (cy_en_hppass_sar_avg_t)
  • chanOffset: the constant value based on Signed and Differential modes cy_stc_hppass_sar_chan_t
    • for Signed mode - true and Differential mode - disabled, chanOffset is 2048
    • for Signed mode - false and Differential mode - enabled, chanOffset is -2048
    • for all other cases, chanOffset is 0
  • vRef: the SAR ADC reference voltage in millivolts (for example, 3300U).
Note
This function is valid only for the right-aligned result.
Parameters
chanIdxThe channel index . Valid range - 0..27.
vRefThe SAR ADC reference voltage in millivolts
chanCountsConversion result from Cy_HPPASS_SAR_Result_ChannelRead
Returns
The result in millivolts.
Function Usage

◆ Cy_HPPASS_SAR_CountsTo_uVolts()

int32_t Cy_HPPASS_SAR_CountsTo_uVolts ( uint8_t  chanIdx,
uint16_t  vRef,
int16_t  chanCounts 
)

Converts the raw ADC result in counts into the analog pin voltage in microvolts.

For example, for the 0.534-volts ADC, the return value is 534000. Voltage calculation depends on ADC channel work modes: Averaging, Signed, Pseudo-Differential, and Sampler Gain.

The equation:

uV = ((chanCounts + chanOffset * avgMultiplier) * vRef * 1000)/ (4095 * avgMultiplier * samplerGain)

where,

  • chanCounts: the raw counts from the SAR 16-bit CHAN_RESULT register
  • avgMultiplier: the multiplier value based on Averaging mode (cy_stc_hppass_sar_chan_t) and the number of samples averaged (cy_en_hppass_sar_avg_t)
  • chanOffset: the constant value based on Signed and Differential modes cy_stc_hppass_sar_chan_t
    • for Signed mode - true and Differential mode - disabled, chanOffset is 2048
    • for Signed mode - false and Differential mode - enabled, chanOffset is -2048
    • for all other cases, chanOffset is 0
  • vRef: the SAR ADC reference voltage in millivolts (for example, 3300U).
Note
This function is valid only for the right-aligned result.
Parameters
chanIdxThe channel index . Valid range - 0..27.
vRefThe SAR ADC reference voltage in millivolts
chanCountsConversion result from Cy_HPPASS_SAR_Result_ChannelRead
Returns
The result in microvolts.
Function Usage