PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
C:/pdl_v10/library/driver/mft/mft_wfg.h File Reference
#include "mcu.h"
#include "pdl_user.h"
Include dependency graph for mft_wfg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  stc_wfg_ctrl_bits
struct  stc_mft_wfg_intern_data
struct  stc_wfg_nzcl_config
struct  stc_dtif_int_sel
struct  stc_dtif_int_cb
struct  stc_mft_wfg_instance_data

Defines

#define stc_mftn_wfg_t   FM0P_MFT_WFG_TypeDef
#define MFT0_WFG   (*((volatile stc_mftn_wfg_t *) FM0P_MFT0_WFG_BASE))
#define MFT1_WFG   (*((volatile stc_mftn_wfg_t *) FM0P_MFT1_WFG_BASE))
#define MFT2_WFG   (*((volatile stc_mftn_wfg_t *) FM0P_MFT2_WFG_BASE))
#define MFT_WFG_CH0   0
#define MFT_WFG_CH1   1
#define MFT_WFG_CH2   2
#define MFT_WFG_CH3   3
#define MFT_WFG_CH4   4
#define MFT_WFG_CH5   5
#define MFT_WFG_CH10   0
#define MFT_WFG_CH32   1
#define MFT_WFG_CH54   2
#define MFT_WFG_MAXCH   3
#define WFG_INSTANCE_COUNT

Typedefs

typedef enum en_wfg_instance_index en_wfg_instance_index_t
 Enumeration to define an index for each WFG instance.
typedef enum en_mft_wfg_mode en_mft_wfg_mode_t
typedef enum en_gten_bits en_gten_bits_t
typedef enum en_psel_bits en_psel_bits_t
typedef enum en_pgen_bits en_pgen_bits_t
typedef enum en_dmod_bit en_dmod_bit_t
typedef struct stc_wfg_ctrl_bits stc_wfg_ctrl_bits_t
typedef enum en_wfg_timer_clock en_wfg_timer_clock_t
typedef struct
stc_mft_wfg_intern_data 
stc_mft_wfg_intern_data_t
typedef enum en_nzcl_filter_width en_nzcl_filter_width_t
typedef struct stc_wfg_nzcl_config stc_wfg_nzcl_config_t
typedef struct stc_dtif_int_sel stc_dtif_int_sel_t
typedef struct stc_dtif_int_cb stc_dtif_int_cb_t
typedef struct
stc_mft_wfg_instance_data 
stc_mft_wfg_instance_data_t

Enumerations

enum  en_wfg_instance_index { WfgInstanceIndexWfg0 = 0, WfgInstanceIndexWfg1, WfgInstanceIndexWfg2 }
 Enumeration to define an index for each WFG instance. More...
enum  en_mft_wfg_mode {
  WfgThroughMode = 0, WfgRtPpgMode = 1, WfgTimerPpgMode = 2, WfgRtDeadTimerMode = 4,
  WfgRtDeadTimerFilterMode = 5, WfgPpgDeadTimerFilterMode = 6, WfgPpgDeadTimerMode = 7
}
enum  en_gten_bits { GtenBits00B = 0, GtenBits01B, GtenBits10B, GtenBits11B }
enum  en_psel_bits { PselBits00B = 0, PselBits01B, PselBits10B, PselBits11B }
enum  en_pgen_bits { PgenBits00B = 0, PgenBits01B, PgenBits10B, PgenBits11B }
enum  en_dmod_bit { DmodBit0B = 0, DmodBit1B }
enum  en_wfg_timer_clock {
  WfgPlckDiv1 = 0, WfgPlckDiv2, WfgPlckDiv4, WfgPlckDiv8,
  WfgPlckDiv16, WfgPlckDiv32, WfgPlckDiv64, WfgPlckDiv128
}
enum  en_nzcl_filter_width {
  NzlcNoFilter, NzlcWidth4Cycle, NzlcWidth8Cycle, NzlcWidth16Cycle,
  NzlcWidth32Cycle, NzlcWidth64Cycle, NzlcWidth128Cycle
}

Functions

en_result_t Mft_Wfg_ConfigMode (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, en_mft_wfg_mode_t enMode)
 configure WFG mode
en_result_t Mft_Wfg_ConfigCtrlBits (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, stc_wfg_ctrl_bits_t *pstcCtrlBits)
 configure WFG control bit
en_result_t Mft_Wfg_InitTimerClock (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, en_wfg_timer_clock_t enClk)
 init timer clock
en_result_t Mft_Wfg_EnableTimerInt (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, func_ptr_t pfnCallback)
 enable WFG timer interrupt
en_result_t Mft_Wfg_DisableTimerInt (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh)
 disable WFG timer interrupt
en_result_t Mft_Wfg_StartTimer (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh)
 Start WFG timer.
en_result_t Mft_Wfg_StopTimer (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh)
 Stop WFG timer.
en_int_flag_t Mft_Wfg_GetTimerIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh)
 get WFG timer interrupt flag
en_result_t Mft_Wfg_ClrTimerIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh)
 clear WFG timer interrupt flag
en_result_t Mft_Wfg_WriteTimerCountCycle (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, uint16_t u16CycleA, uint16_t u16CycleB)
 write timer count cycle
en_result_t Mft_Wfg_SetTimerCycle (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, uint16_t u16Count)
 set cycle of WFG timer
uint16_t Mft_Wfg_GetTimerCurCycle (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh)
 get cycle of WFG timer
en_result_t Mft_Wfg_ConfigNzcl (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, stc_wfg_nzcl_config_t *pstcNzclConfig)
 configure NZCL
en_result_t Mft_Wfg_EnableDtifInt (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, stc_dtif_int_sel_t *pstcIntSel, stc_dtif_int_cb_t *pstcCallback)
 Enable DTIF interrupt.
en_result_t Mft_Wfg_DisableDtifInt (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, stc_dtif_int_sel_t *pstcIntSel)
 Disable DTIF interrupt.
en_result_t Mft_Wfg_SwTiggerDtif (volatile FM0P_MFT_WFG_TypeDef *pstcWfg)
 set software trigger DTIF
en_int_flag_t Mft_Wfg_GetDigitalFilterIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg)
 get Digital filter interrupt flag
en_result_t Mft_Wfg_ClrDigitalFilterIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg)
 clear Digital filter interrupt flag
en_int_flag_t Mft_Wfg_GetAnalogFilterIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg)
 get Analog Filter interrupt flag
en_result_t Mft_Wfg_ClrAnalogFilterIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg)
 clear Analog Filter interrupt flag
void Mft_Wfg_IrqHandler (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, stc_mft_wfg_intern_data_t *pstcMftWfgInternData)
 WFG interrupt handler sub function.

Variables

stc_mft_wfg_instance_data_t m_astcMftWfgInstanceDataLut [(PDL_PERIPHERAL_ENABLE_MFT0_WFG==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT1_WFG==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT2_WFG==PDL_ON?1:0)]
 Look-up table for all enabled WFG instances and their internal data.

Detailed Description

Headerfile for MFT's Waveform Generator functions

History:

  • 2013-03-21 0.1 Edison Zhang First version.
  • 2013-07-16 0.2 Edison Zhang Add comments about how to use WFG with APIs

Definition in file mft_wfg.h.