MTB CAT1 Peripheral driver library

General Description

Functions

cy_rslt_t Cy_HPPASS_Init (const cy_stc_hppass_cfg_t *cfg)
 Configures the entire HPPASS block including AC, STT, CSG and SAR according to the provided settings. More...
 
void Cy_HPPASS_DeInit (void)
 De-initializes the AC, STT, AREF, SAR, CSG, and triggers register values to default. More...
 
cy_en_syspm_status_t Cy_HPPASS_DeepSleepCallback (cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode)
 DeepSleep callback saves the SAR ADC calibration values before switch to deep sleep power mode and restore them after the wakeup. More...
 
__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_TriggerInConfig (uint8_t trigIdx, const cy_stc_hppass_trig_in_t *trig)
 Sets the input trigger type and operation mode. More...
 
__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_TriggerOutLevelConfig (uint8_t trigIdx, const cy_stc_hppass_trig_out_level_t *trig)
 Sets the LEVEL trigger output configuration. More...
 
__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_TriggerOutPulseConfig (uint8_t trigIdx, cy_en_hppass_trig_out_pulse_t trig)
 Sets the PULSE trigger output configuration. More...
 

Function Documentation

◆ Cy_HPPASS_Init()

cy_rslt_t Cy_HPPASS_Init ( const cy_stc_hppass_cfg_t cfg)

Configures the entire HPPASS block including AC, STT, CSG and SAR according to the provided settings.

Note
If AC is running or SAR or CSG is already enabled, the initialization of the overall HPPASS is not allowed (CY_HPPASS_AC_INVALID_STATE will be returned). The only way to reinitialize the entire HPPASS is only after Cy_HPPASS_DeInit call. Despite the 'block ready' status, the particular SAR or SCG subsystem, which is not running at the moment, can be reinitialized using Cy_HPPASS_SAR_Init or Cy_HPPASS_CSG_Init.
Parameters
cfgPointer to structure containing configuration data for the entire High Performance Programmable Analog Sub-System, cy_stc_hppass_cfg_t. The pointer cannot be NULL.
Returns
Combined value of all the subsystem statuses, cy_en_hppass_status_t.
Function Usage
/* Scenario: Configure HPPASS to use SAR GROUP#0 with Chan#0 and FIR#0 to process the result from that conversion output */
const cy_stc_hppass_fir_t firCfg =
{
.chan = CY_HPPASS_FIR_CHAN_0, /* Use FIR channel #0 */
/* Wait for 16 samples before the output is stored into a FIR_RESULT register */
.waitTapInit = true,
/* Test filter coeficients. Need to be updated, if particular filter type is needed. */
.coef = {0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 0x4000},
.limit = CY_HPPASS_SAR_LIMIT_DISABLED, /* Limits are disabled */
.result = true, /* FIR result is exposed to read */
.fifo = CY_HPPASS_FIFO_DISABLED /* FIFO is disabled */
};
{
.dirSampMsk = CY_HPPASS_SAR_DIRECT_SAMP_0, /* Use Direct sampler #0 */
.muxSampMsk = CY_HPPASS_SAR_SAMPLERS_DISABLED, /* Muxed samplers are not used */
.muxChanIdx = {0, 0, 0, 0}, /* Muxed samplers are not used */
.trig = CY_HPPASS_SAR_TRIG_AC, /* Use AC to trigger the Group */
.sampTime = CY_HPPASS_SAR_SAMP_TIME_0, /* Use Sampler Timer #0 */
.priority = false, /* Not used */
.continuous = false /* Not used */
};
/* Using default values for channel configuration */
{
.diff = false,
.sign = false,
.result = false,
};
{
.vref = CY_HPPASS_SAR_VREF_VDDA, /* Use VDDA as reference */
.lowSupply = false, /* Not used */
.offsetCal = false, /* Not used */
.linearCal = false, /* Not used */
.gainCal = false, /* Not used */
.chanId = false, /* Not used */
.dirSampEnMsk = CY_HPPASS_SAR_DIRECT_SAMP_0, /* Use Direct sampler #0 */
.muxSampEnMsk = CY_HPPASS_SAR_SAMPLERS_DISABLED, /* Not used */
.holdCount = 29, /* Optimal value */
.aroute = true, /* Default value */
/* Default gain values */
.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 = {47, 31, 31}, /* Enough time for FIR to complete */
.chan = {&chanCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* Channel configuration structure */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
.grp = {&grpCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, /* Group configuration structure */
.limit = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, /* Not used */
.muxMode = {CY_HPPASS_SAR_MUX_SEQ, CY_HPPASS_SAR_MUX_SEQ, CY_HPPASS_SAR_MUX_SEQ, CY_HPPASS_SAR_MUX_SEQ}, /* Recommended value */
.fir = {&firCfg, NULL}, /* FIR configuration structure */
.fifo = NULL /* Not used */
};
/* HPPASS and AC state transition table configuration, used by Cy_HPPASS_Init API */
{
.ac =
{
.sttEntriesNum = CY_HPPASS_STT_NUM_ENTRIES, /* AC transition table size */
.stt = stateTransitionTable, /* AC transition table */
.gpioOutEnMsk = 0U, /* GPIO contrlolled by AC is not used */
.startupClkDiv = 15U, /* CLK_HF = 160MHz (CLK_INFRA = 80MHz) */
.startup = /* Only one startup configuration is used */
{
{
.count = 199U, /* Calculated value for startupClkDiv = 15 */
.sar = true, /* SAR is used */
.csgChan = false, /* CSG is not used */
.csgSlice = false, /* CSG is not used */
.csgReady = false /* CSG is not used */
},
{0},
{0},
{0}
}
},
.vref = CY_HPPASS_VREF_LOCAL,
.csg = NULL, /* CSG is not used */
.sar = &sarCfg, /* SAR configuration structure */
.trigIn = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}}, /* Triggers are not used */
.trigPulse = {CY_HPPASS_DISABLED, CY_HPPASS_DISABLED, CY_HPPASS_DISABLED, CY_HPPASS_DISABLED, /* Triggers are not used */
CY_HPPASS_DISABLED, CY_HPPASS_DISABLED, CY_HPPASS_DISABLED, CY_HPPASS_DISABLED}, /* Triggers are not used */
.trigLevel = {{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}} /* Triggers are not used */
};
/* Initialize HPPASS */
if (CY_HPPASS_SUCCESS != Cy_HPPASS_Init(&cfg))
{
/* Process the error */
printf("Cy_HPPASS_Init returns error\r\n");
}

◆ Cy_HPPASS_DeInit()

void Cy_HPPASS_DeInit ( void  )

De-initializes the AC, STT, AREF, SAR, CSG, and triggers register values to default.

Note
This function stops and shuts down entire HPPASS including all the trims, calibrations, resets AC and STT flow and subsystems.
Function Usage
/* Scenario: The HPPASS is initialized/working and then no longer used or needs to be deinit */

◆ Cy_HPPASS_DeepSleepCallback()

cy_en_syspm_status_t Cy_HPPASS_DeepSleepCallback ( cy_stc_syspm_callback_params_t callbackParams,
cy_en_syspm_callback_mode_t  mode 
)

DeepSleep callback saves the SAR ADC calibration values before switch to deep sleep power mode and restore them after the wakeup.

Parameters
callbackParamsCallback parameters, see cy_stc_syspm_callback_params_t
modeCallback mode, see cy_en_syspm_callback_mode_t
Returns
cy_en_syspm_status_t
Function Usage
/* Scenario: The hardware must be suitably prepared to enter device Deep Sleep Mode */
cy_stc_syspm_callback_t hppass_Callback = {Cy_HPPASS_DeepSleepCallback, CY_SYSPM_DEEPSLEEP, 0u, &hppass_Params, NULL, NULL, 0};
cy_en_syspm_status_t syspmStatus = Cy_SysPm_RegisterCallback(&hppass_Callback);
/* Process returned syspmStatus */

◆ Cy_HPPASS_TriggerInConfig()

__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_TriggerInConfig ( uint8_t  trigIdx,
const cy_stc_hppass_trig_in_t trig 
)

Sets the input trigger type and operation mode.

Parameters
trigIdxTrigger index. See Trigger Indexes.
trigPointer to the input trigger structure. See cy_stc_hppass_trig_in_t. The pointer cannot be NULL.
Returns
Status of operation, cy_en_hppass_status_t.
Function Usage
/* Scenario: Select External HW Trigger#1 from A trigger inputs. Trigger is assumed to be asynchronous and used as a level trigger */
const cy_stc_hppass_trig_in_t trigInOne =
{
};
status = Cy_HPPASS_TriggerInConfig(1U, &trigInOne);
/* Process returned status */

◆ Cy_HPPASS_TriggerOutLevelConfig()

__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_TriggerOutLevelConfig ( uint8_t  trigIdx,
const cy_stc_hppass_trig_out_level_t trig 
)

Sets the LEVEL trigger output configuration.

Parameters
trigIdxTrigger index. See Trigger Indexes.
trigPointer to the output LEVEL trigger structure. See cy_stc_hppass_trig_out_level_t. The pointer cannot be NULL.
Function Usage
/* Scenario: Configure CMP#1 and SAR Limit detector #1 outputs to associated trigger, trigger is considered as asynchronous */
const cy_stc_hppass_trig_out_level_t outLevelOne =
{
.syncBypass = true,
};
status = Cy_HPPASS_TriggerOutLevelConfig(4U, &outLevelOne);
/* Process returned status */

◆ Cy_HPPASS_TriggerOutPulseConfig()

__STATIC_INLINE cy_en_hppass_status_t Cy_HPPASS_TriggerOutPulseConfig ( uint8_t  trigIdx,
cy_en_hppass_trig_out_pulse_t  trig 
)

Sets the PULSE trigger output configuration.

Parameters
trigIdxTrigger index. See Trigger Indexes.
trigThe PULSE trigger out select. See cy_en_hppass_trig_out_pulse_t.
Function Usage
/* Scenario: Initiate Trigger#3 when FIR#0 results are ready for reading */
/* Process returned status */