CAT2 Peripheral Driver Library

Functions

__STATIC_INLINE void Cy_SysClk_DelayCounterInit (uint16_t delayCount)
 Initializes the programmable delay (PGM_DELAY) counter reload value. More...
 
__STATIC_INLINE void Cy_SysClk_DelayCounterEnable (void)
 Enables the PGM_DELAY block. More...
 
__STATIC_INLINE bool Cy_SysClk_DelayCounterIsEnabled (void)
 Checks the PGM_DELAY block enable/disable state. More...
 
__STATIC_INLINE void Cy_SysClk_DelayCounterDisable (void)
 Disables the PGM_DELAY block. More...
 
__STATIC_INLINE void Cy_SysClk_DelayCounterReload (void)
 Reloads the PGM_DELAY counter with the delay count value. More...
 

Detailed Description

Function Documentation

◆ Cy_SysClk_DelayCounterInit()

__STATIC_INLINE void Cy_SysClk_DelayCounterInit ( uint16_t  delayCount)

Initializes the programmable delay (PGM_DELAY) counter reload value.

This API is available on devices with the CSV Feature (i.e. PSoC 4500S and 4100S Max). Refer to the Device Datasheet to check the CSV feature support.

Parameters
delayCountValid range 0-65535, device default value is 256. Sets the # of counts of IMO clock before system reset is asserted.
Function Usage
/* Scenario: Assume the IMO frequency is 32 MHz */
Cy_SysClk_DelayCounterInit(48000); /* 1.5ms */
Cy_SysClk_DelayCounterReload(); /* Load the delay value into the counter */
Cy_SysClk_DelayCounterEnable(); /* Start to count */

◆ Cy_SysClk_DelayCounterEnable()

__STATIC_INLINE void Cy_SysClk_DelayCounterEnable ( void  )

Enables the PGM_DELAY block.

A programmable delay counter starts at delay count value (see Cy_SysClk_DelayCounterInit API) and counts down.

The PGM_DELAY block will assert system reset when the counter reaches zero unless firmware intervenes and reloads the counter using Cy_SysClk_DelayCounterReload() function.

Also for the PGM_DELAY counter proper starting the Cy_SysClk_DelayCounterReload() function should be called before this function.

This API is available on devices with the CSV Feature (i.e. PSoC 4500S and 4100S Max). Refer to the Device Datasheet to check the CSV feature support.

Function Usage
/* Scenario: Assume the IMO frequency is 32 MHz */
Cy_SysClk_DelayCounterInit(48000); /* 1.5ms */
Cy_SysClk_DelayCounterReload(); /* Load the delay value into the counter */
Cy_SysClk_DelayCounterEnable(); /* Start to count */

◆ Cy_SysClk_DelayCounterIsEnabled()

__STATIC_INLINE bool Cy_SysClk_DelayCounterIsEnabled ( void  )

Checks the PGM_DELAY block enable/disable state.

This API is available on devices with the CSV Feature (i.e. PSoC 4500S and 4100S Max). Refer to the Device TRM to check the CSV feature support.

Function Usage
/* Declare the Clock Supervisor Deep Sleep callback */
{
static bool pgmEn = false; /* Static variable to store the Delay Counter state during Deep Sleep cycle */
static bool csvEn = false; /* Static variable to store the CSV state during Deep Sleep cycle */
CY_UNUSED_PARAMETER(callbackParams);
{
pgmEn = Cy_SysClk_DelayCounterIsEnabled(); /* Check the Delay Counter state */
csvEn = Cy_SysClk_CsvIsEnabled(); /* Check the CSV state */
if (pgmEn)
{
Cy_SysClk_DelayCounterDisable(); /* Disable the Delay Counter before falling asleep */
}
if (csvEn)
{
Cy_SysClk_CsvDisable(); /* Disable the CSV before falling asleep */
}
}
{
if (csvEn)
{
Cy_SysClk_CsvEnable(); /* Enable the CSV after wake up */
}
if (pgmEn)
{
Cy_SysClk_DelayCounterReload(); /* Reload the Delay Counter before enabling */
Cy_SysClk_DelayCounterEnable(); /* Enable the Delay Counter after wake up */
}
}
return (retVal);
}

◆ Cy_SysClk_DelayCounterDisable()

__STATIC_INLINE void Cy_SysClk_DelayCounterDisable ( void  )

Disables the PGM_DELAY block.

This API is available on devices with the CSV Feature (i.e. PSoC 4500S and 4100S Max). Refer to the Device Datasheet to check the CSV feature support.

◆ Cy_SysClk_DelayCounterReload()

__STATIC_INLINE void Cy_SysClk_DelayCounterReload ( void  )

Reloads the PGM_DELAY counter with the delay count value.

This API is available on devices with the CSV Feature (i.e. PSoC 4500S and 4100S Max). Refer to the Device Datasheet to check the CSV feature support.

For the PGM_DELAY counter proper functioning, this function should be called before Cy_SysClk_DelayCounterEnable.

Function Usage
/* Scenario: then call reload every ~1ms (less than the delay value), otherwise get a reset */