PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
ppg.h File Reference
#include "pdl.h"
Include dependency graph for ppg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  stc_ppg_config
 Structure to config PPG. More...
 
struct  stc_ppg_upcnt0_config
 Up counter0 configuration. More...
 
struct  stc_timer0_gen_ch
 Up counter0 stop channels selection. More...
 
struct  stc_ppg_upcnt1_config
 Up counter1 configuration. More...
 
struct  stc_timer1_gen_ch
 Up counter1 stop channels selection. More...
 
struct  stc_ppg_upcnt2_config
 Up counter2 configuration. More...
 
struct  stc_timer2_gen_ch
 Up counter2 stop channels selection. More...
 
struct  stc_ppg_igbt_config
 structure of PPG IGBT configuration More...
 

Macros

#define PPG_CH0   0
 
#define PPG_CH1   1
 
#define PPG_CH2   2
 
#define PPG_CH3   3
 
#define PPG_CH4   4
 
#define PPG_CH5   5
 
#define PPG_CH6   6
 
#define PPG_CH7   7
 
#define PPG_CH8   8
 
#define PPG_CH9   9
 
#define PPG_CH10   10
 
#define PPG_CH11   11
 
#define PPG_CH12   12
 
#define PPG_CH13   13
 
#define PPG_CH14   14
 
#define PPG_CH15   15
 
#define PPG_CH16   16
 
#define PPG_CH17   17
 
#define PPG_CH18   18
 
#define PPG_CH19   19
 
#define PPG_CH20   20
 
#define PPG_CH21   21
 
#define PPG_CH22   22
 
#define PPG_CH23   23
 
#define PPG_COUPLE_CH01   0
 
#define PPG_COUPLE_CH23   2
 
#define PPG_COUPLE_CH45   4
 
#define PPG_COUPLE_CH67   6
 
#define PPG_COUPLE_CH89   8
 
#define PPG_COUPLE_CH1011   10
 
#define PPG_COUPLE_CH1213   12
 
#define PPG_COUPLE_CH1415   14
 
#define PPG_COUPLE_CH1617   16
 
#define PPG_COUPLE_CH1819   18
 
#define PPG_COUPLE_CH2021   20
 
#define PPG_COUPLE_CH2223   22
 
#define PPG_INT_MAX_CH   9
 
#define PPG_UP_COUNTER_CH0   0
 
#define PPG_UP_COUNTER_CH1   1
 
#define PPG_UP_COUNTER_CH2   2
 

Typedefs

typedef enum en_ppg_opt_mode en_ppg_opt_mode_t
 Enumeration to define PPG operation mode. More...
 
typedef enum en_ppg_clock en_ppg_clock_t
 Enumeration to define PPG count clock prescaler. More...
 
typedef enum en_ppg_trig en_ppg_trig_t
 Enumeration to define PPG trigger. More...
 
typedef enum en_ppg_level en_ppg_level_t
 Enumeration to define PPG output initial level. More...
 
typedef struct stc_ppg_config stc_ppg_config_t
 Structure to config PPG. More...
 
typedef enum en_ppg_gate_level en_ppg_gate_level_t
 Enumeration to define valid level of GATE signal from MFT. More...
 
typedef enum en_ppg_upcnt_clk en_ppg_upcnt_clk_t
 Enumeration to define clock prescaler of up counter in timing generator. More...
 
typedef struct
stc_ppg_upcnt0_config 
stc_ppg_upcnt0_config_t
 Up counter0 configuration. More...
 
typedef struct stc_timer0_gen_ch stc_timer0_gen_ch_t
 Up counter0 stop channels selection. More...
 
typedef struct
stc_ppg_upcnt1_config 
stc_ppg_upcnt1_config_t
 Up counter1 configuration. More...
 
typedef struct stc_timer1_gen_ch stc_timer1_gen_ch_t
 Up counter1 stop channels selection. More...
 
typedef struct
stc_ppg_upcnt2_config 
stc_ppg_upcnt2_config_t
 Up counter2 configuration. More...
 
typedef struct stc_timer2_gen_ch stc_timer2_gen_ch_t
 Up counter2 stop channels selection. More...
 
typedef enum en_ppg_int_mode en_ppg_int_mode_t
 PPG interrupt mode. More...
 
typedef enum
en_igbt_prohibition_mode 
en_igbt_prohibition_mode_t
 Enumeration to define IBGT prohibition mode. More...
 
typedef enum en_igbt_filter_width en_igbt_filter_width_t
 Enumeration to define IBGT noise filter width. More...
 
typedef enum en_igbt_level en_igbt_level_t
 Enumeration to define IBGT input/out level. More...
 
typedef struct stc_ppg_igbt_config stc_ppg_igbt_config_t
 structure of PPG IGBT configuration More...
 
typedef enum en_ppg_irq_ch en_ppg_irq_ch_t
 PPG IRQ channel. More...
 

Enumerations

enum  en_ppg_opt_mode {
  Ppg8Bit8Bit = 0,
  Ppg8Bit8Pres,
  Ppg16Bit,
  Ppg16Bit16Pres
}
 Enumeration to define PPG operation mode. More...
 
enum  en_ppg_clock {
  PpgPclkDiv1 = 0,
  PpgPclkDiv4,
  PpgPclkDiv16,
  PpgPclkDiv64
}
 Enumeration to define PPG count clock prescaler. More...
 
enum  en_ppg_trig {
  PpgSoftwareTrig = 0,
  PpgMftGateTrig,
  PpgTimingGenTrig
}
 Enumeration to define PPG trigger. More...
 
enum  en_ppg_level {
  PpgNormalLevel = 0,
  PpgReverseLevel
}
 Enumeration to define PPG output initial level. More...
 
enum  en_ppg_gate_level {
  PpgGateHighActive = 0,
  PpgGateLowActive
}
 Enumeration to define valid level of GATE signal from MFT. More...
 
enum  en_ppg_upcnt_clk {
  PpgUpCntPclkDiv2 = 0,
  PpgUpCntPclkDiv8,
  PpgUpCntPclkDiv32,
  PpgUpCntPclkDiv64
}
 Enumeration to define clock prescaler of up counter in timing generator. More...
 
enum  en_ppg_int_mode {
  PpgHighUnderflow,
  PpgHighAndLowUnderflow
}
 PPG interrupt mode. More...
 
enum  en_igbt_prohibition_mode {
  IgbtNormalMode = 0,
  IgbtStopProhibitionMode
}
 Enumeration to define IBGT prohibition mode. More...
 
enum  en_igbt_filter_width {
  IgbtNoFilter = 0,
  IgbtFilter4Pclk,
  IgbtFilter8Pclk,
  IgbtFilter16Pclk,
  IgbtFilter32Pclk
}
 Enumeration to define IBGT noise filter width. More...
 
enum  en_igbt_level {
  IgbtLevelNormal = 0,
  IgbtLevelInvert
}
 Enumeration to define IBGT input/out level. More...
 
enum  en_ppg_irq_ch {
  PpgCh024,
  PpgCh81012,
  PpgCh161820
}
 PPG IRQ channel. More...
 

Functions

en_result_t Ppg_Init (uint8_t u8CoupleCh, stc_ppg_config_t *pstcConfig)
 Initialize PPG. More...
 
en_result_t Ppg_StartSoftwareTrig (uint8_t u8Ch)
 Start PPG by software trigger. More...
 
en_result_t Ppg_StopSoftwareTrig (uint8_t u8Ch)
 Stop PPG software trigger. More...
 
en_result_t Ppg_SelGateLevel (uint8_t u8EvenCh, en_ppg_gate_level_t enLevel)
 Set the valid level of GATE signal. More...
 
en_result_t Ppg_ConfigUpCnt0 (stc_ppg_upcnt0_config_t *pstcConfig)
 Configure the up counter of Timing Generator 0. More...
 
void Ppg_StartUpCnt0 (void)
 Start the up counter of Timing Generator 0. More...
 
en_stat_flag_t Ppg_GetUpCnt0Status (void)
 Get the work status of up counter of Timing Generator 0. More...
 
en_result_t Ppg_DisableTimerGen0StartTrig (stc_timer0_gen_ch_t *pstcTimer0GenCh)
 Disable start trigger of Timing Generator 0. More...
 
en_result_t Ppg_ConfigUpCnt1 (stc_ppg_upcnt1_config_t *pstcConfig)
 Configure the up counter of Timing Generator 1. More...
 
void Ppg_StartUpCnt1 (void)
 Start the up counter of Timing Generator 1. More...
 
en_stat_flag_t Ppg_GetUpCnt1Status (void)
 Get the work status of up counter of Timing Generator 1. More...
 
en_result_t Ppg_DisableTimerGen1StartTrig (stc_timer1_gen_ch_t *pstcTimer1GenCh)
 Disable start trigger of Timing Generator 1. More...
 
en_result_t Ppg_ConfigUpCnt2 (stc_ppg_upcnt2_config_t *pstcConfig)
 Configure the up counter of Timing Generator 2. More...
 
void Ppg_StartUpCnt2 (void)
 Start the up counter of Timing Generator 2. More...
 
en_stat_flag_t Ppg_GetUpCnt2Status (void)
 Get the work status of up counter of Timing Generator 2. More...
 
en_result_t Ppg_DisableTimerGen2StartTrig (stc_timer2_gen_ch_t *pstcTimer2GenCh)
 Disable start trigger of Timing Generator 2. More...
 
en_result_t Ppg_EnableInt (uint8_t u8Ch, en_ppg_int_mode_t enIntMode, func_ptr_t pfnCallback)
 Enable PPG interrupt. More...
 
en_result_t Ppg_DisableInt (uint8_t u8Ch)
 Disable PPG interrupt. More...
 
en_int_flag_t Ppg_GetIntFlag (uint8_t u8Ch)
 Get the interrupt flag of PPG. More...
 
en_result_t Ppg_ClrIntFlag (uint8_t u8Ch)
 Clear PPG interrupt flag. More...
 
en_result_t Ppg_SetLevelWidth (uint8_t u8Ch, uint8_t u8LowWidth, uint8_t u8HighWidth)
 Set the pulse width of PPG. More...
 
en_result_t Ppg_InitIgbt (stc_ppg_igbt_config_t *pstcPpgIgbt)
 Initialize IGBT mode. More...
 
void Ppg_EnableIgbtMode (void)
 Enable IGBT mode. More...
 
void Ppg_DisableIgbtMode (void)
 Disable IGBT mode. More...
 
void Ppg_IrqHandler (en_ppg_irq_ch_t u8Ch)
 PPG interrupt service routine. More...
 

Detailed Description

Headerfile for PPG functions

History:

  • 2013-05-15 0.1 Edison Zhang First version.
  • 2014-05-28 1.0 MWi Doxygen comments corrected.

Definition in file ppg.h.