MTB CAT1 Peripheral driver library

General Description

Functions

void Cy_WDT_Init (void)
 Initializes the Watchdog timer to its default state. More...
 
void Cy_WDT_Lock (void)
 Locks out configuration changes to the Watchdog Timer register. More...
 
void Cy_WDT_Unlock (void)
 Unlocks the Watchdog Timer configuration register. More...
 
bool Cy_WDT_Locked (void)
 Returns the WDT lock state. More...
 
void Cy_WDT_ClearInterrupt (void)
 Clears the WDT match flag which is set every time the WDT counter reaches a WDT match value. More...
 
void Cy_WDT_ClearWatchdog (void)
 Clears ("feeds") the watchdog, to prevent a XRES device reset. More...
 
__STATIC_INLINE void Cy_WDT_Enable (void)
 Enables the Watchdog timer. More...
 
__STATIC_INLINE void Cy_WDT_Disable (void)
 Disables the Watchdog timer. More...
 
__STATIC_INLINE bool Cy_WDT_IsEnabled (void)
 Reports an enable/disable state of the Watchdog timer. More...
 
__STATIC_INLINE uint32_t Cy_WDT_GetCount (void)
 Reads the current WDT counter value. More...
 
__STATIC_INLINE void Cy_WDT_ResetCounter (void)
 Resets the WDT counter value. More...
 
__STATIC_INLINE void Cy_WDT_MaskInterrupt (void)
 After masking interrupts from the WDT, they are not passed to the CPU. More...
 
__STATIC_INLINE void Cy_WDT_UnmaskInterrupt (void)
 After unmasking interrupts from the WDT, they are passed to CPU. More...
 
void Cy_WDT_SetMatch (uint32_t match)
 Configures the WDT counter match comparison value. More...
 
void Cy_WDT_SetIgnoreBits (uint32_t bitsNum)
 Configures the number of the most significant bits of the Watchdog timer that are not checked against the match. More...
 
__STATIC_INLINE uint32_t Cy_WDT_GetMatch (void)
 Reads the WDT counter match comparison value. More...
 
__STATIC_INLINE uint32_t Cy_WDT_GetIgnoreBits (void)
 Reads the number of the most significant bits of the Watchdog timer that are not checked against the match. More...
 
void Cy_WDT_SetMatchBits (uint32_t bitPos)
 Configures the bit position above which the bits will be ignored for match. More...
 
__STATIC_INLINE void Cy_WDT_SetClkSource (cy_en_wdt_clk_sources_t src)
 Configures the WDT clock source. More...
 
__STATIC_INLINE cy_en_wdt_clk_sources_t Cy_WDT_GetClkSource (void)
 Gets the WDT clock source configured. More...
 
__STATIC_INLINE uint32_t Cy_WDT_GetMatchBits (void)
 Gets the bit position above which the bits will be ignored for match. More...
 
void Cy_WDT_SetLowerLimit (uint32_t match)
 Set lower limit for watchdog. More...
 
void Cy_WDT_SetUpperLimit (uint32_t match)
 Set upper limit for watchdog. More...
 
void Cy_WDT_SetWarnLimit (uint32_t match)
 Set warn limit for watchdog. More...
 
void Cy_WDT_SetLowerAction (cy_en_wdt_lower_upper_action_t action)
 Set action taken if this watchdog is serviced before LOWER_LIMIT is reached. More...
 
void Cy_WDT_SetUpperAction (cy_en_wdt_lower_upper_action_t action)
 Set action taken if this watchdog is not serviced before UPPER_LIMIT is reached. More...
 
void Cy_WDT_SetWarnAction (cy_en_wdt_warn_action_t action)
 Set action taken when the count value reaches WARN_LIMIT. More...
 
void Cy_WDT_SetAutoService (cy_en_wdt_enable_t enable)
 Set automatically service when the count value reaches WARN_LIMIT. More...
 
void Cy_WDT_SetDeepSleepPause (cy_en_wdt_enable_t enable)
 Set whether the WDT counter runs/pauses when the system is in DEEPSLEEP. More...
 
void Cy_WDT_SetHibernatePause (cy_en_wdt_enable_t enable)
 Set whether the WDT counter runs/pauses when the system is in HIBERNATE. More...
 
void Cy_WDT_SetDebugRun (cy_en_wdt_enable_t enable)
 Set the debug run value. More...
 
void Cy_WDT_SetService (void)
 Set service of the watchdog. More...
 

Function Documentation

◆ Cy_WDT_Init()

void Cy_WDT_Init ( void  )

Initializes the Watchdog timer to its default state.

The given default setting of the WDT: The WDT is unlocked and disabled. The WDT match value is 4096. None of ignore bits are set: the whole WDT counter bits are checked against the match value.

Side Effects
This function clears the WDT interrupt.

The given default setting of the WDT: The WDT is unlocked and disabled. The WDT Lower Limit value is set to 0 and Lower action to None. The WDT Warn Limit value is set to 0 and Warn action to None. The WDT Upper Limit value is set to 32000 (1 second) and Upper action to Reset. The WDT is locked again.

◆ Cy_WDT_Lock()

void Cy_WDT_Lock ( void  )

Locks out configuration changes to the Watchdog Timer register.

After this function is called, the WDT configuration cannot be changed until Cy_WDT_Unlock() is called.

Warning
The WDT lock state is not retained during system Deep Sleep. After the wakeup from system Deep Sleep the WDT is locked.

◆ Cy_WDT_Unlock()

void Cy_WDT_Unlock ( void  )

Unlocks the Watchdog Timer configuration register.

Warning
The WDT lock state is not retained during system Deep Sleep. After the wakeup from system Deep Sleep the WDT is locked.

◆ Cy_WDT_Locked()

bool Cy_WDT_Locked ( void  )

Returns the WDT lock state.

Returns
True - if WDT is locked. False - if WDT is unlocked.

◆ Cy_WDT_ClearInterrupt()

void Cy_WDT_ClearInterrupt ( void  )

Clears the WDT match flag which is set every time the WDT counter reaches a WDT match value.

Two unserviced interrupts lead to a system reset (i.e. at the third match).

Clears the WDT match flag which is set every time the WDT counter reaches a WDT match value.

◆ Cy_WDT_ClearWatchdog()

void Cy_WDT_ClearWatchdog ( void  )

Clears ("feeds") the watchdog, to prevent a XRES device reset.

This function simply call Cy_WDT_ClearInterrupt() function.

This function simply call Cy_WDT_SetService() function.

◆ Cy_WDT_Enable()

__STATIC_INLINE void Cy_WDT_Enable ( void  )

Enables the Watchdog timer.

Side Effects
This function clears the WDT interrupt.

◆ Cy_WDT_Disable()

__STATIC_INLINE void Cy_WDT_Disable ( void  )

Disables the Watchdog timer.

The Watchdog timer should be unlocked before being disabled. Call the Cy_WDT_Unlock() API to unlock the WDT.

◆ Cy_WDT_IsEnabled()

__STATIC_INLINE bool Cy_WDT_IsEnabled ( void  )

Reports an enable/disable state of the Watchdog timer.

Returns
  • true - if the timer is enabled
  • false - if the timer is disabled

◆ Cy_WDT_GetCount()

__STATIC_INLINE uint32_t Cy_WDT_GetCount ( void  )

Reads the current WDT counter value.

Returns
A live counter value.

◆ Cy_WDT_ResetCounter()

__STATIC_INLINE void Cy_WDT_ResetCounter ( void  )

Resets the WDT counter value.

Note
This API must be called only after WDT is disabled, else the writes will be ignored if WDT is enabled.

◆ Cy_WDT_MaskInterrupt()

__STATIC_INLINE void Cy_WDT_MaskInterrupt ( void  )

After masking interrupts from the WDT, they are not passed to the CPU.

This function does not disable the WDT-reset generation.

◆ Cy_WDT_UnmaskInterrupt()

__STATIC_INLINE void Cy_WDT_UnmaskInterrupt ( void  )

After unmasking interrupts from the WDT, they are passed to CPU.

This function does not impact the reset generation.

◆ Cy_WDT_SetMatch()

void Cy_WDT_SetMatch ( uint32_t  match)

Configures the WDT counter match comparison value.

The Watchdog timer should be unlocked before changing the match value. Call the Cy_WDT_Unlock() function to unlock the WDT.

Parameters
matchThe valid valid range is [0-65535]. The value to be used to match against the counter.

◆ Cy_WDT_SetIgnoreBits()

void Cy_WDT_SetIgnoreBits ( uint32_t  bitsNum)

Configures the number of the most significant bits of the Watchdog timer that are not checked against the match.

Unlock the Watchdog timer before ignoring the bits setting. Call the Cy_WDT_Unlock() API to unlock the WDT.

Parameters
bitsNumThe valid range is [0-15] for CAT1A devices, The bitsNum over 12 are considered as 12. The valid range is [0-21] for CAT1B/CAT1D devices, The bitsNum over 18 are considered as 18.

The value of bitsNum controls the time-to-reset of the Watchdog timer This happens after 3 successive matches.

Warning
This function changes the WDT interrupt period, therefore the device can go into an infinite WDT reset loop. This may happen if a WDT reset occurs faster that a device start-up.

◆ Cy_WDT_GetMatch()

__STATIC_INLINE uint32_t Cy_WDT_GetMatch ( void  )

Reads the WDT counter match comparison value.

Returns
The counter match value.
Note
This API is available for CAT1A, CAT1B and CAT1D devices.

◆ Cy_WDT_GetIgnoreBits()

__STATIC_INLINE uint32_t Cy_WDT_GetIgnoreBits ( void  )

Reads the number of the most significant bits of the Watchdog timer that are not checked against the match.

Returns
The number of the most significant bits.
Note
This API is available for CAT1A, CAT1B and CAT1D devices.

◆ Cy_WDT_SetMatchBits()

void Cy_WDT_SetMatchBits ( uint32_t  bitPos)

Configures the bit position above which the bits will be ignored for match.

Parameters
bitPosThe bit position above which the match should be ignored.

The value of bitPos controls the time-to-reset of the Watchdog timer This happens after 3 successive matches.

Warning
This function changes the WDT interrupt period, therefore the device can go into an infinite WDT reset loop. This may happen if a WDT reset occurs faster that a device start-up.
Note
This API is available for CAT1B devices.

◆ Cy_WDT_SetClkSource()

__STATIC_INLINE void Cy_WDT_SetClkSource ( cy_en_wdt_clk_sources_t  src)

Configures the WDT clock source.

Parameters
srccy_en_wdt_clk_sources_t
Note
This API is available for CAT1B and CAT1D devices.
It takes four cycles of the originally selected clock to switch away from it. Do not disable the original clock during this time.

Adding 4 cycle delay

◆ Cy_WDT_GetClkSource()

__STATIC_INLINE cy_en_wdt_clk_sources_t Cy_WDT_GetClkSource ( void  )

Gets the WDT clock source configured.

Returns
The Clock source enum cy_en_wdt_clk_sources_t
Note
This API is available for CAT1B and CAT1D devices.

◆ Cy_WDT_GetMatchBits()

__STATIC_INLINE uint32_t Cy_WDT_GetMatchBits ( void  )

Gets the bit position above which the bits will be ignored for match.

Returns
The bit position above which the bits will be ignored for match.
Note
This API is available for CAT1B and CAT1D devices.

◆ Cy_WDT_SetLowerLimit()

void Cy_WDT_SetLowerLimit ( uint32_t  match)

Set lower limit for watchdog.

Parameters
match- Value to be matched
Note
This API is available for CAT1C devices.

◆ Cy_WDT_SetUpperLimit()

void Cy_WDT_SetUpperLimit ( uint32_t  match)

Set upper limit for watchdog.

Parameters
match- Value to be matched
Note
This API is available for CAT1C devices.

◆ Cy_WDT_SetWarnLimit()

void Cy_WDT_SetWarnLimit ( uint32_t  match)

Set warn limit for watchdog.

Parameters
match- Value to be matched
Note
This API is available for CAT1C devices.

◆ Cy_WDT_SetLowerAction()

void Cy_WDT_SetLowerAction ( cy_en_wdt_lower_upper_action_t  action)

Set action taken if this watchdog is serviced before LOWER_LIMIT is reached.

Parameters
actioncy_en_wdt_lower_upper_action_t
Note
This API is available for CAT1C devices.

◆ Cy_WDT_SetUpperAction()

void Cy_WDT_SetUpperAction ( cy_en_wdt_lower_upper_action_t  action)

Set action taken if this watchdog is not serviced before UPPER_LIMIT is reached.

Parameters
actioncy_en_wdt_lower_upper_action_t
Note
This API is available for CAT1C devices.

◆ Cy_WDT_SetWarnAction()

void Cy_WDT_SetWarnAction ( cy_en_wdt_warn_action_t  action)

Set action taken when the count value reaches WARN_LIMIT.

Parameters
actioncy_en_wdt_warn_action_t
Note
This API is available for CAT1C devices.

◆ Cy_WDT_SetAutoService()

void Cy_WDT_SetAutoService ( cy_en_wdt_enable_t  enable)

Set automatically service when the count value reaches WARN_LIMIT.

This function is used for WARN_LIMIT.

Parameters
enablecy_en_wdt_enable_t
Note
This API is available for CAT1C devices.

◆ Cy_WDT_SetDeepSleepPause()

void Cy_WDT_SetDeepSleepPause ( cy_en_wdt_enable_t  enable)

Set whether the WDT counter runs/pauses when the system is in DEEPSLEEP.

Parameters
enablecy_en_wdt_enable_t
Note
This API is available for CAT1C devices.

◆ Cy_WDT_SetHibernatePause()

void Cy_WDT_SetHibernatePause ( cy_en_wdt_enable_t  enable)

Set whether the WDT counter runs/pauses when the system is in HIBERNATE.

Parameters
enablecy_en_wdt_enable_t
Note
This API is available for CAT1C devices.

◆ Cy_WDT_SetDebugRun()

void Cy_WDT_SetDebugRun ( cy_en_wdt_enable_t  enable)

Set the debug run value.

It needs when using debugger.

Parameters
enablecy_en_wdt_enable_t
Note
This API is available for CAT1C devices.

◆ Cy_WDT_SetService()

void Cy_WDT_SetService ( void  )

Set service of the watchdog.

This resets the count value to zero.

Note
This API is available for CAT1C devices.