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

Go to the source code of this file.

Data Structures

struct  stc_mft_icu_config
 Structure of Mft icu configuration. More...
struct  stc_mft_icu_intern_data
 Icu instance internal data, storing internal information for each enabled Icu instance. More...
struct  stc_mft_icu_instance_data
 Mft_icu instance data type. More...

Defines

#define stc_mftn_icu_t   FM0P_MFT_ICU_TypeDef
#define MFT0_ICU   (*((volatile stc_mftn_icu_t *) FM0P_MFT0_ICU_BASE))
#define MFT1_ICU   (*((volatile stc_mftn_icu_t *) FM0P_MFT1_ICU_BASE))
#define MFT2_ICU   (*((volatile stc_mftn_icu_t *) FM0P_MFT2_ICU_BASE))
#define MFT_ICU_CH0   0u
#define MFT_ICU_CH1   1u
#define MFT_ICU_CH2   2u
#define MFT_ICU_CH3   3u
#define MFT_ICU_CHx_MAX   3u
#define MFT_ICU_INSTANCE_COUNT

Typedefs

typedef enum en_icu_instance_index en_icu_instance_index_t
 Enumeration to define an index for each ICU instance.
typedef enum en_mft_icu_frt en_mft_icu_frt_t
 Frt channel.
typedef enum en_mft_icu_mode en_mft_icu_mode_t
 Icu mode.
typedef enum en_icu_edge en_mft_icu_edge_t
 Icu edge.
typedef struct stc_mft_icu_config stc_mft_icu_config_t
 Structure of Mft icu configuration.
typedef struct
stc_mft_icu_intern_data 
stc_mft_icu_intern_data_t
 Icu instance internal data, storing internal information for each enabled Icu instance.
typedef struct
stc_mft_icu_instance_data 
stc_mft_icu_instance_data_t
 Mft_icu instance data type.

Enumerations

enum  en_icu_instance_index { IcuInstanceIndexIcu0, IcuInstanceIndexIcu1, IcuInstanceIndexIcu2 }
 Enumeration to define an index for each ICU instance. More...
enum  en_mft_icu_frt {
  Frt0ToIcu = 0u, Frt1ToIcu = 1u, Frt2ToIcu = 2u, IcuFrtToExt0 = 3u,
  IcuFrtToExt1 = 4u
}
 Frt channel. More...
enum  en_mft_icu_mode { IcuDisable = 0u, IcuRisingDetect = 1u, IcuFallingDetect = 2u, IcuBothDetect = 3u }
 Icu mode. More...
enum  en_icu_edge { IcuFallingEdge = 0u, IcuRisingEdge = 1u }
 Icu edge. More...

Functions

en_result_t Mft_Icu_SelFrt (volatile FM0P_MFT_ICU_TypeDef *pstcMftIcu, uint8_t u8Ch, en_mft_icu_frt_t enFrt)
 Select FRTx channel to connect to ICUx.
en_result_t Mft_Icu_ConfigDetectMode (volatile FM0P_MFT_ICU_TypeDef *pstcMftIcu, uint8_t u8Ch, en_mft_icu_mode_t enMode)
 Configure ICU module detection mode(different edge)
en_result_t Mft_Icu_EnableInt (volatile FM0P_MFT_ICU_TypeDef *pstcMftIcu, uint8_t u8Ch, func_ptr_t pfnCallback)
 Enable Mft Icu interrupt.
en_result_t Mft_Icu_DisableInt (volatile FM0P_MFT_ICU_TypeDef *pstcMftIcu, uint8_t u8Ch)
 Disable Mft Icu interrupt and release callback function.
en_int_flag_t Mft_Icu_GetIntFlag (volatile FM0P_MFT_ICU_TypeDef *pstcMftIcu, uint8_t u8Ch)
 Get interrupt flag.
en_result_t Mft_Icu_ClrIntFlag (volatile FM0P_MFT_ICU_TypeDef *pstcMftIcu, uint8_t u8Ch)
 Clear interrupt flag.
en_mft_icu_edge_t Mft_Icu_GetLastEdge (volatile FM0P_MFT_ICU_TypeDef *pstcMftIcu, uint8_t u8Ch)
 Get the latest captured edge type.
uint16_t Mft_Icu_GetCaptureData (volatile FM0P_MFT_ICU_TypeDef *pstcMftIcu, uint8_t u8Ch)
 Readout captured data value.
void Mft_Icu_IrqHandler (volatile FM0P_MFT_ICU_TypeDef *pstcMftIcu, stc_mft_icu_intern_data_t *pstcMftIcuInternData)
 Device Interrupt handler.

Variables

stc_mft_icu_instance_data_t m_astcMftIcuInstanceDataLut [(uint8_t)(PDL_PERIPHERAL_ENABLE_MFT0_ICU==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFT1_ICU==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFT2_ICU==PDL_ON)]

Detailed Description

Header file for MFT's Input Capture Unit functions

History:

  • 2013-12-21 0.1 Edison Zhang First version.
  • 2014-01-12 0.2 Edison Zhang Add comments about how to use ICU with APIs

Definition in file mft_icu.h.