PSoC 6 Peripheral Driver Library

General Description

Functions

__STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_WcoEnable (uint32_t timeoutus)
 Enables the WCO. More...
 
__STATIC_INLINE bool Cy_SysClk_WcoOkay (void)
 Reports the status of the WCO_OK bit. More...
 
__STATIC_INLINE void Cy_SysClk_WcoDisable (void)
 Disables the WCO. More...
 
__STATIC_INLINE void Cy_SysClk_WcoBypass (cy_en_wco_bypass_modes_t bypass)
 Sets whether the WCO is bypassed or not. More...
 

Function Documentation

◆ Cy_SysClk_WcoEnable()

__STATIC_INLINE cy_en_sysclk_status_t Cy_SysClk_WcoEnable ( uint32_t  timeoutus)

Enables the WCO.

Parameters
timeoutusamount of time in microseconds to wait for the WCO to be ready. If WCO is not ready, WCO is stopped. To avoid waiting for WCO ready set this to 0, and manually check if WCO is okay using Cy_SysClk_WcoOkay.
Returns
Error / status code:
CY_SYSCLK_SUCCESS - WCO successfully enabled
CY_SYSCLK_TIMEOUT - Timeout waiting for WCO to stabilize CY_SYSCLK_INVALID_STATE - ECO already enabled For the PSoC 64 devices there are possible situations when function returns the PRA error status code. This is because for PSoC 64 devices the function uses the PRA driver to change the protected registers. Refer to cy_en_pra_status_t for more details.
Function Usage
/* Scenario: The WCO needs to source the backup clock for the real-time clock
operation. Timeout of 2ms is tolerable. The WCO pins are configured
using the gpio driver(SRSS_WCO_IN_PIN, SRSS_WCO_OUT_PIN). */
/* Enable the WCO with a timeout of 2000 microseconds */
{
/* Insert error handling */
}
/* Set the backup clock source to WCO */

◆ Cy_SysClk_WcoOkay()

__STATIC_INLINE bool Cy_SysClk_WcoOkay ( void  )

Reports the status of the WCO_OK bit.

Returns
true = okay
false = not okay
Function Usage
/* Scenario: The WCO needs to source the backup clock for the real-time
clock operation. It needs to be enabled in a non-blocking
manner. The WCO pins are configured using the gpio driver
(SRSS_WCO_IN_PIN, SRSS_WCO_OUT_PIN). */
/* Enable the WCO without timeout */
(void)Cy_SysClk_WcoEnable(0UL);
{
/* WCO is not yet ready. Perform some other operation. */
}
/* Set the backup clock source to WCO */

◆ Cy_SysClk_WcoDisable()

__STATIC_INLINE void Cy_SysClk_WcoDisable ( void  )

Disables the WCO.

Function Usage
/* Scenario: LFCLK needs to be sourced by the PILO instead of the WCO. All
peripherals clocked by the LFCLK are disabled and the Watchdog
timer (WDT) is unlocked. */
/* Disable the WCO */
/* Enable the PILO */
/* Set the LFCLK source to the PILO */

◆ Cy_SysClk_WcoBypass()

__STATIC_INLINE void Cy_SysClk_WcoBypass ( cy_en_wco_bypass_modes_t  bypass)

Sets whether the WCO is bypassed or not.

If it is bypassed, then a 32-kHz clock must be provided on the wco_out pin.

Parameters
bypasscy_en_wco_bypass_modes_t
Function Usage
/* Scenario: An external watch crystal oscillator needs to be connected to
the WCO pins instead of a watch crystal. This signal needs
to source the backup clock for the real-time clock operation.
The WCO pins are configured using the gpio driver
(SRSS_WCO_IN_PIN, SRSS_WCO_OUT_PIN). */
/* WCO bypassed mode - 32768 kHz square-wave supplied through SRSS_WCO_OUT_PIN pin */
/* Enable the WCO with a timeout of 2000 microsecond */
{
/* Insert error handling */
}
/* Set the backup clock source to WCO */