1.9.25.7 WDT_CallbackRegister Function

C

void WDT_CallbackRegister( WDT_CALLBACK callback, uintptr_t context )

Summary

Sets the pointer to the function (and it's context) to be called when the Timeout/Early Warning event occurs.

Description

This function sets the pointer to a client function to be called "back" and stores the context pointer to be passed into the callback function when it is called.

  • On devices which have Timeout event support

    • Client function is called back when Timeout event occurs.

    • This function is available only in interrupt mode of operation.

  • On devices which have Early warning event support

    • Client function is called back when the WDT Early Warning event occurs.

    • This function is available only if the Early Warning option (in MHC) is enabled at the time of generating the peripheral library.

    • The time at which the Early warning interrupt occurs is defined by the Early Warning setting in the NVM User row. This is configured by using the compiler provided fuse options.

    • Specifying the Early Warning offset to be larger than the WDT time out value will cause the Early Warning mechanism to be in-active.

Precondition

WDT_Initialize must have been called for the associated WDT instance. Reset mode must be disabled in MCC configuration

Parameters

Param Description
callback A pointer to a function with a calling signature definedby the WDT_CALLBACK data type.
context A value (usually a pointer) passed (unused) into the functionidentified by the callback parameter.

Returns

None.

Example

WDT_CallbackRegister(MyCallback, &myData);

Remarks

The context value may be set to NULL if it is not required. Note that the value of NULL will still be passed to the callback function.

To disable the callback function, pass a NULL for the callback parameter. See the WDT_CALLBACK type definition for additional information.