rt-thread/bsp/essemi/es8p508x/libraries/Library/Include/lib_timer.h

311 lines
11 KiB
C
Raw Normal View History

2019-11-07 10:00:14 +08:00
/******************************************************************************************
* Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd.
* <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>: lib_timer.h
* <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: Liut
* <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: V1.00
* <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: 2017/07/14
* <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: 16λ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>32λ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
* <EFBFBD><EFBFBD> ע: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ES8P508xϵ<EFBFBD><EFBFBD>оƬ
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧϰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾʹ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>κη<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ρ<EFBFBD>
*******************************************************************************************/
#ifndef __LIBTIMER_H__
#define __LIBTIMER_H__
#include "ES8P508x.h"
#include "type.h"
/* ʱ<><CAB1>Դѡ<D4B4><D1A1> */
typedef enum
{
TIM_ClkS_PCLK = 0x0 , //ʱ<><CAB1>Դѡ<D4B4><D1A1>:<3A>ڲ<EFBFBD>PCLK
TIM_ClkS_CK0 = 0x1 , //ʱ<><CAB1>Դѡ<D4B4><D1A1>:<3A>ⲿCK0ʱ<30><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TIM_ClkS_CK1 = 0x2 , //ʱ<><CAB1>Դѡ<D4B4><D1A1>:<3A>ⲿCK1ʱ<31><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}TIM_TYPE_CLKS;
/* <20>ⲿʱ<E2B2BF>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1> */
typedef enum
{
TIM_EDGE_Rise = 0x0 , //<2F>ⲿʱ<E2B2BF>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TIM_EDGE_Fall = 0x1 , //<2F>ⲿʱ<E2B2BF>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>:<3A>½<EFBFBD><C2BD><EFBFBD>
TIM_EDGE_All = 0x2 , //<2F>ⲿʱ<E2B2BF>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>:<3A><><EFBFBD><EFBFBD>
}TIM_TYPE_EDGE;
/* <20><><EFBFBD><EFBFBD>ģʽѡ<CABD><D1A1> */
typedef enum
{
TIM_Mode_TC0 = 0x0 , //<2F><><EFBFBD><EF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BD><EFBFBD><EFBFBD>˿ڵĹ<DAB5><C4B9><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TIM_Out_Low = 0x1 , //ƥ<><C6A5><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>ֵƥ<D6B5><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ڵĹ<DAB5><C4B9><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>0
TIM_Out_High = 0x2 , //ƥ<><C6A5><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>ֵƥ<D6B5><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ڵĹ<DAB5><C4B9><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>1
TIM_Out_Switch = 0x3 , //ƥ<><C6A5><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>ֵƥ<D6B5><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ڵĹ<DAB5><C4B9><EFBFBD>ģʽ<C4A3><CABD>ȡ<EFBFBD><C8A1>
}TIM_TYPE_MATOUT;
/* <20><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
typedef enum
{
TIM_CapTime_1 = 0x0 , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:1
TIM_CapTime_2 = 0x1 , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:2
TIM_CapTime_3 = 0x2 , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:3
TIM_CapTime_4 = 0x3 , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:4
TIM_CapTime_5 = 0x4 , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:5
TIM_CapTime_6 = 0x5 , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:6
TIM_CapTime_7 = 0x6 , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:7
TIM_CapTime_8 = 0x7 , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:8
TIM_CapTime_9 = 0x8 , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:9
TIM_CapTime_10 = 0x9 , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:10
TIM_CapTime_11 = 0xA , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:11
TIM_CapTime_12 = 0xB , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:12
TIM_CapTime_13 = 0xC , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:13
TIM_CapTime_14 = 0xD , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:14
TIM_CapTime_15 = 0xE , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:15
TIM_CapTime_16 = 0xF , //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:16
}TIM_TYPE_CAPT;
/* PWM<57><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
typedef enum
{
POSITIVE = 0X00, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
NEGATIVE = 0X01, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}T16Nx_PWMOUT_POLAR_Type;
/* <20><><EFBFBD>ƹ<EFBFBD><C6B9>ܳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><E5B6A8> */
typedef struct
{
TYPE_FUNCEN T16Nx_MOE0; //<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>0ʹ<30><CAB9>
TYPE_FUNCEN T16Nx_MOE1; //<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>1ʹ<31><CAB9>
T16Nx_PWMOUT_POLAR_Type T16Nx_POL0; //T16NxOUT0<54><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>λ
T16Nx_PWMOUT_POLAR_Type T16Nx_POL1; //T16NxOUT1<54><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>λ
}T16Nx_PWMInitStruType;
/* <20><>׽<EFBFBD><D7BD><EFBFBD>ܳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><E5B6A8> */
typedef struct
{
TYPE_FUNCEN TIM_CapRise; //<2F><><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>׽ʹ<D7BD><CAB9>
TYPE_FUNCEN TIM_CapFall; //<2F>½<EFBFBD><C2BD>ز<EFBFBD>׽ʹ<D7BD><CAB9>
TYPE_FUNCEN TIM_CapIS0; //<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>0ʹ<30><CAB9>
TYPE_FUNCEN TIM_CapIS1; //<2F><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>1ʹ<31><CAB9>
TIM_TYPE_CAPT TIM_CapTime; //<2F><>׽<EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}TIM_CapInitStruType;
/* PWMɲ<4D><C9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ */
typedef enum
{
PWMBKOUT_Low = 0,
PWMBKOUT_High = 1,
}T16Nx_PWMBKOUT_LEVEl;
/* PWMɲ<4D><C9B2><EFBFBD>źż<C5BA><C5BC><EFBFBD>ѡ<EFBFBD><D1A1> */
typedef enum
{
PWMBKP_High = 0,
PWMBKP_Low = 1,
}T16Nx_PWMBKP_LEVEl;
/*PWMɲ<4D><C9B2><EFBFBD>ź<EFBFBD>Դѡ<D4B4><D1A1>*/
typedef enum
{
PWMBKPS_PINT0 = 0,
PWMBKPS_PINT1 = 1,
PWMBKPS_PINT2 = 2,
PWMBKPS_PINT3 = 3,
PWMBKPS_PINT4 = 4,
PWMBKPS_PINT5 = 5,
PWMBKPS_PINT6 = 6,
PWMBKPS_PINT7 = 7,
}T16Nx_PWMBKP_S;
/*PWM<57><4D><EFBFBD><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
typedef struct
{
T16Nx_PWMBKOUT_LEVEl T16Nx_PWMBKL0; //PWMͨ<4D><CDA8><30><C9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽѡ<C6BD><D1A1>
T16Nx_PWMBKOUT_LEVEl T16Nx_PWMBKL1; //PWMͨ<4D><CDA8><31><C9B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽѡ<C6BD><D1A1>
T16Nx_PWMBKP_S T16Nx_PWMBKS; //PWMͨ<4D><CDA8><EFBFBD>ź<EFBFBD>Դѡ<D4B4><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>2<EFBFBD><32><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
T16Nx_MAT3 = 0x40, //PWMͨ<4D><CDA8><31><C6A5>3<EFBFBD><33><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
}T16Nx_PWMTRG_type;
/*************TIMģ<4D><C4A3><EFBFBD><EFBFBD><EAB6A8>************/
/* TIMģ<4D><C4A3>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
#define T16N0_Enable() (T16N0->CON0.EN = 1)
#define T16N1_Enable() (T16N1->CON0.EN = 1)
#define T16N2_Enable() (T16N2->CON0.EN = 1)
#define T16N3_Enable() (T16N3->CON0.EN = 1)
#define T32N0_Enable() (T32N0->CON0.EN = 1)
#define T16N0_Disable() (T16N0->CON0.EN = 0)
#define T16N1_Disable() (T16N1->CON0.EN = 0)
#define T16N2_Disable() (T16N2->CON0.EN = 0)
#define T16N3_Disable() (T16N3->CON0.EN = 0)
#define T32N0_Disable() (T32N0->CON0.EN = 0)
/* <20>첽дʹ<D0B4>ܿ<EFBFBD><DCBF><EFBFBD> */
#define T16N0_ASYNCWR_Enable() (T16N0->CON0.ASYWEN = 1)
#define T16N1_ASYNCWR_Enable() (T16N1->CON0.ASYWEN = 1)
#define T16N2_ASYNCWR_Enable() (T16N2->CON0.ASYWEN = 1)
#define T16N3_ASYNCWR_Enable() (T16N3->CON0.ASYWEN = 1)
#define T32N0_ASYNCWR_Enable() (T32N0->CON0.ASYNCWREN = 1)
#define T16N0_ASYNCWR_Disable() (T16N0->CON0.ASYWEN= 0)
#define T16N1_ASYNCWR_Disable() (T16N1->CON0.ASYWEN = 0)
#define T16N2_ASYNCWR_Disable() (T16N2->CON0.ASYWEN = 0)
#define T16N3_ASYNCWR_Disable() (T16N3->CON0.ASYWEN = 0)
#define T32N0_ASYNCWR_Disable() (T32N0->CON0.ASYNCWREN = 0)
/* PWM<57><4D><EFBFBD><EFBFBD>ʹ<EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD> */
#define T16N0_PwmOut0_Enable() (T16N0->CON2.MOE0 = 1)
#define T16N1_PwmOut0_Enable() (T16N1->CON2.MOE0 = 1)
#define T16N2_PwmOut0_Enable() (T16N2->CON2.MOE0 = 1)
#define T16N3_PwmOut0_Enable() (T16N3->CON2.MOE0 = 1)
#define T32N0_PwmOut0_Enable() (T32N0->CON2.MOE0 = 1)
#define T16N0_PwmOut1_Enable() (T16N0->CON2.MOE1 = 1)
#define T16N1_PwmOut1_Enable() (T16N1->CON2.MOE1 = 1)
#define T16N2_PwmOut1_Enable() (T16N2->CON2.MOE1 = 1)
#define T16N3_PwmOut1_Enable() (T16N3->CON2.MOE1 = 1)
#define T32N0_PwmOut1_Enable() (T32N0->CON2.MOE1 = 1)
#define T16N0_PwmOut0_Disable() (T16N0->CON2.MOE0 = 0)
#define T16N1_PwmOut0_Disable() (T16N1->CON2.MOE0 = 0)
#define T16N2_PwmOut0_Disable() (T16N2->CON2.MOE0 = 0)
#define T16N3_PwmOut0_Disable() (T16N3->CON2.MOE0 = 0)
#define T32N0_PwmOut0_Disable() (T32N0->CON2.MOE0 = 0)
#define T16N0_PwmOut1_Disable() (T16N0->CON2.MOE1 = 0)
#define T16N1_PwmOut1_Disable() (T16N1->CON2.MOE1 = 0)
#define T16N2_PwmOut1_Disable() (T16N2->CON2.MOE1 = 0)
#define T16N3_PwmOut1_Disable() (T16N3->CON2.MOE1 = 0)
#define T32N0_PwmOut1_Disable() (T32N0->CON2.MOE1 = 0)
/************T16ģ<36><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>***********/
void T16Nx_BaseInit(T16N_TypeDef* T16Nx,TIM_BaseInitStruType* TIM_BaseInitStruct);
void T16Nx_CapInit(T16N_TypeDef* T16Nx,TIM_CapInitStruType* TIM_CapInitStruct);
void T16Nx_MAT0ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type);
void T16Nx_MAT1ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type);
void T16Nx_MAT2ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type);
void T16Nx_MAT3ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type);
void T16Nx_MAT0Out0Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type);
void T16Nx_MAT1Out0Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type);
void T16Nx_MAT2Out1Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type);
void T16Nx_MAT3Out1Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type);
void T16Nx_ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_IT Type,TYPE_FUNCEN NewState);
void T16Nx_PWMOutConfig(T16N_TypeDef* T16Nx,T16Nx_PWMInitStruType* T16Nx_PWMInitStruct);
void T16Nx_PWMBK_Config(T16N_TypeDef* T16Nx,T16Nx_PWMBK_Type* type);
void T16Nx_TRG_Config(T16N_TypeDef* T16Nx,T16Nx_PWMTRG_type Type,TYPE_FUNCEN NewState);
FlagStatus T16Nx_GetPWMBKF(T16N_TypeDef* T16Nx);
void T16Nx_ResetPWMBKF(T16N_TypeDef* T16Nx);
void T16Nx_SetCNT(T16N_TypeDef* T16Nx,uint16_t Value);
void T16Nx_SetPRECNT(T16N_TypeDef* T16Nx,uint8_t Value);
void T16Nx_SetPREMAT(T16N_TypeDef* T16Nx,uint8_t Value);
void T16Nx_SetMAT0(T16N_TypeDef* T16Nx,uint16_t Value);
void T16Nx_SetMAT1(T16N_TypeDef* T16Nx,uint16_t Value);
void T16Nx_SetMAT2(T16N_TypeDef* T16Nx,uint16_t Value);
void T16Nx_SetMAT3(T16N_TypeDef* T16Nx,uint16_t Value);
uint16_t T16Nx_GetMAT0(T16N_TypeDef* T16Nx);
uint16_t T16Nx_GetMAT1(T16N_TypeDef* T16Nx);
uint16_t T16Nx_GetMAT2(T16N_TypeDef* T16Nx);
uint16_t T16Nx_GetMAT3(T16N_TypeDef* T16Nx);
uint16_t T16Nx_GetCNT(T16N_TypeDef* T16Nx);
uint8_t T16Nx_GetPRECNT(T16N_TypeDef* T16Nx);
FlagStatus T16Nx_GetFlagStatus(T16N_TypeDef* T16Nx,TIM_TYPE_IF TIM_Flag);
ITStatus T16Nx_GetITStatus(T16N_TypeDef* T16Nx,TIM_TYPE_IT TIM_Flag);
void T16Nx_ClearIFPendingBit(T16N_TypeDef* T16Nx,TIM_TYPE_IF TIM_Flag);
/************************************T32ģ<32><EFBFBD><E9BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>********************************************************/
void T32Nx_BaseInit(T32N_TypeDef* T32Nx,TIM_BaseInitStruType* TIM_BaseInitStruct);
void T32Nx_CapInit(T32N_TypeDef* T32Nx,TIM_CapInitStruType* TIM_CapInitStruct);
void T32Nx_MAT0ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type);
void T32Nx_MAT1ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type);
void T32Nx_MAT2ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type);
void T32Nx_MAT3ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type);
void T32Nx_MAT0Out0Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type);
void T32Nx_MAT1Out0Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type);
void T32Nx_MAT2Out1Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type);
void T32Nx_MAT3Out1Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type);
void T32Nx_ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_IT Type,TYPE_FUNCEN NewState);
void T32Nx_SetCNT(T32N_TypeDef* T16Nx,uint32_t Value);
void T32Nx_SetPRECNT(T32N_TypeDef* T32Nx,uint8_t Value);
void T32Nx_SetPREMAT(T32N_TypeDef* T32Nx,uint8_t Value);
void T32Nx_SetMAT0(T32N_TypeDef* T32Nx,uint32_t Value);
void T32Nx_SetMAT1(T32N_TypeDef* T32Nx,uint32_t Value);
void T32Nx_SetMAT2(T32N_TypeDef* T32Nx,uint32_t Value);
void T32Nx_SetMAT3(T32N_TypeDef* T32Nx,uint32_t Value);
uint32_t T32Nx_GetMAT0(T32N_TypeDef* T32Nx);
uint32_t T32Nx_GetMAT1(T32N_TypeDef* T32Nx);
uint32_t T32Nx_GetMAT2(T32N_TypeDef* T32Nx);
uint32_t T32Nx_GetMAT3(T32N_TypeDef* T32Nx);
uint32_t T32Nx_GetCNT(T32N_TypeDef* T32Nx);
uint8_t T32Nx_GetPRECNT(T32N_TypeDef* T32Nx);
FlagStatus T32Nx_GetFlagStatus(T32N_TypeDef* T32Nx,TIM_TYPE_IF TIM_Flag);
ITStatus T32Nx_GetITStatus(T32N_TypeDef* T32Nx,TIM_TYPE_IT TIM_Flag);
void T32Nx_ClearIFPendingBit(T32N_TypeDef* T32Nx,TIM_TYPE_IF TIM_Flag);
#endif
/*************************END OF FILE**********************/