High level interface for interacting with the Cypress Watchdog Timer (WDT).
The watchdog timer is initialized with a timeout interval. Once the WDT is started, if cyhal_wdt_kick is not called at least once every timeout interval, the device will be reset.
Macros | |
| #define | CY_RSLT_WDT_INVALID_TIMEOUT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_WDT, 0)) |
| #define | CY_RSLT_WDT_ALREADY_INITIALIZED (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_WDT, 1)) |
Functions | |
| cy_rslt_t | cyhal_wdt_init (cyhal_wdt_t *obj, uint32_t timeout_ms) |
| void | cyhal_wdt_free (cyhal_wdt_t *obj) |
| void | cyhal_wdt_kick (cyhal_wdt_t *obj) |
| void | cyhal_wdt_start (cyhal_wdt_t *obj) |
| void | cyhal_wdt_stop (cyhal_wdt_t *obj) |
| uint32_t | cyhal_wdt_get_timeout_ms (cyhal_wdt_t *obj) |
| uint32_t | cyhal_wdt_get_max_timeout_ms (void) |
| #define CY_RSLT_WDT_INVALID_TIMEOUT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_WDT, 0)) |
WDT timeout out of range
| #define CY_RSLT_WDT_ALREADY_INITIALIZED (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_WDT, 1)) |
WDT already initialized
| cy_rslt_t cyhal_wdt_init | ( | cyhal_wdt_t * | obj, |
| uint32_t | timeout_ms | ||
| ) |
Initialize and start the WDT
Initialize or re-initialize the WDT.
| [out] | obj | The WDT object |
| [in] | timeout_ms | The time in milliseconds before the WDT times out (1ms - max) (see cyhal_wdt_get_max_timeout_ms()) |
| void cyhal_wdt_free | ( | cyhal_wdt_t * | obj | ) |
Deinitialize the WDT
Powers down the WDT. After calling this function no other WDT functions should be called except cyhal_wdt_init(). Calling any function other than init after freeing is undefined.
| [in,out] | obj | The WDT object |
| void cyhal_wdt_kick | ( | cyhal_wdt_t * | obj | ) |
Refresh the WDT
Refreshes the WDT. This function should be called periodically to prevent the WDT from timing out. In the event of a timeout, the WDT resets the system.
| [in,out] | obj | The WDT object |
| void cyhal_wdt_start | ( | cyhal_wdt_t * | obj | ) |
Start the WDT
Enables the WDT.
| [in,out] | obj | The WDT object |
| void cyhal_wdt_stop | ( | cyhal_wdt_t * | obj | ) |
Stop the WDT
Disables the WDT.
| [in,out] | obj | The WDT object |
| uint32_t cyhal_wdt_get_timeout_ms | ( | cyhal_wdt_t * | obj | ) |
Get the WDT timeout
Gets the time in milliseconds before the WDT times out.
| [in,out] | obj | The WDT object |
| uint32_t cyhal_wdt_get_max_timeout_ms | ( | void | ) |
Gets the maximum WDT timeout
Gets the maximum timeout for the WDT.