![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
Provided functions of WC module:
How to use WC module?
Before using WC, WC prescaler must be configured first. Use Wc_Pres_SelClk() to select input clock of prescaler. Following clocks can be selected:
Wc_Pres_EnableDiv() is used to enable watch counter prescaler. Wc_Pres_DisableDiv() is used to disable watch counter prescaler.
Wc_Init() must be used for configuration of watch counter with a structure of the type stc_wc_config_t.
A WC interrupt can be enabled by the function Wc_EnableInt(). This function can set callback function for each channel too.
With Wc_WriteReloadVal() the WC reloader value is set to the value given in the parameter Wc_WriteReloadVal::u8Val.
After above setting, calling Wc_EnableCount() will start WC.
With Wc_ReadCurCnt() the current WC count can be read when WC is counting. with Wc_GetOperationFlag() the current WC operation status can be read.
With interrupt mode, when the interrupt occurs, the interrupt flag will be cleared and run into user interrupt callback function.
With polling mode, user can use Wc_GetIntFlag() to check if the interrupt occurs, and clear the interrupt flag by Wc_ClearIntFlag().
When stopping the WC, use Wc_DisableCount() to disable WC and Wc_DisableInt() to disable WC interrupt.