PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
Programmable Pulse Generator (PPG)

Provided functions of PPG module:

How to use PPG module?

Ppg_Init() must be used for configuration of a PPG couple channel with a structure of the type stc_ppg_config_t. Three ways can trigger the PPG start:

A PPG interrupt can be enabled by the function Ppg_EnableInt(). This function can set callback function for each channel too.

With Ppg_SetLevelWidth() the PPG low/high level width is set to the value given in the parameter Ppg_SetLevelWidth::u8LowWidth and Ppg_SetLevelWidth::u8LowWidth. Ppg_GetUpCntxStatus() can get the operation status of up counter (x=0,1,2)

If use software to start PPG, calling Ppg_StartSoftwareTrig() will start PPG.

If use up counter to start PPG, initialize up counter with Ppg_ConfigUpCntx() with a structure of the type #stc_ppg_upcntx_config_t, start the up counter with Ppg_StartUpCntx() and if count value matchs with compare value, the according PPG channel will start.

If use GATE signal to trigger PPG, set the valid level with Ppg_SelGateLevel(), and if GATE signal from MFT becomes valid level, PPG will start.

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 Ppg_GetIntFlag() to check if the interrupt occurs, and clear the interrupt flag by Ppg_ClrIntFlag().

When stopping the PPG, if PPG is triggered by software, use Ppg_StopSoftwareTrig() to stop PPG output, if PPG is triggered by up counter, use Ppg_DisableTimerGen0StartTrig to stop PPG output, if PPG is triggered by GATE, set the GATE signal to invalid level in the MFT module.

IGBT mode is also supported by PPG. Ppg_InitIgbt() must be used for configuration of IGBT mode with a structure of the type stc_ppg_igbt_config_t.

Ppg_EnableIgbtMode() is used to enable IGBT mode and Ppg_DisableIgbtMode() is used to disable IGBT mode.