/**
|
******************************************************************************
|
* @file fm33a0xxev_lptim.c
|
* @author FM33A0XXEV Application Team
|
* @version V1.0.0
|
* @date 16-April-2020
|
* @brief This file provides firmware functions to manage the following
|
* functionalities of....:
|
*
|
*/
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "fm33a0xxev_lptim.h"
|
|
/** @addtogroup fm33a0xxev_StdPeriph_Driver
|
* @{
|
*/
|
|
/** @defgroup LPTIM
|
* @brief LPTIM driver modules
|
* @{
|
*/
|
|
/* LPT_ETRÊäÈëÄ£ÄâÂ˲¨Ê¹ÄÜ(External Trigger input Analog Filter Enable)
|
0£º¹Ø±ÕÄ£ÄâÂ˲¨
|
1£ºÊ¹ÄÜÄ£ÄâÂ˲¨£¬Â˲¨¿í¶ÈÔ¼100ns Ïà¹Øº¯Êý */
|
void LPTIM_CFGR_ETR_AFEN_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->CFGR |= (LPTIM_CFGR_ETR_AFEN_Msk);
|
}
|
else
|
{
|
LPTIM->CFGR &= ~(LPTIM_CFGR_ETR_AFEN_Msk);
|
}
|
}
|
|
FunState LPTIM_CFGR_ETR_AFEN_Getable(void)
|
{
|
if (LPTIM->CFGR & (LPTIM_CFGR_ETR_AFEN_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* ʱÖÓÔ¤·ÖƵÊäÈëÑ¡Ôñ(Prescaler input Select)
|
0£ºCLKSELÑ¡ÔñµÄʱÖÓ
|
1£ºLPTETRF Ïà¹Øº¯Êý */
|
void LPTIM_CFGR_PSCSEL_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CFGR;
|
tmpreg &= ~(LPTIM_CFGR_PSCSEL_Msk);
|
tmpreg |= (SetValue & LPTIM_CFGR_PSCSEL_Msk);
|
LPTIM->CFGR = tmpreg;
|
}
|
|
uint32_t LPTIM_CFGR_PSCSEL_Get(void)
|
{
|
return (LPTIM->CFGR & LPTIM_CFGR_PSCSEL_Msk);
|
}
|
|
/* ¼ÆÊýʱÖÓ·ÖÆµÑ¡Ôñ(Counter Clock Divider Select)
|
000£º1·ÖƵ
|
001£º2·ÖƵ
|
010£º4·ÖƵ
|
011£º8·ÖƵ
|
100£º16·ÖƵ
|
101£º32·ÖƵ
|
110£º64·ÖƵ
|
111£º128·ÖƵ Ïà¹Øº¯Êý */
|
void LPTIM_CFGR_DIVSEL_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CFGR;
|
tmpreg &= ~(LPTIM_CFGR_DIVSEL_Msk);
|
tmpreg |= (SetValue & LPTIM_CFGR_DIVSEL_Msk);
|
LPTIM->CFGR = tmpreg;
|
}
|
|
uint32_t LPTIM_CFGR_DIVSEL_Get(void)
|
{
|
return (LPTIM->CFGR & LPTIM_CFGR_DIVSEL_Msk);
|
}
|
|
/* ETRÊäÈë±ßÑØÑ¡Ôñ(ETR Clock Edge Select)
|
0£ºLPT_ETRµÄÉÏÉýÑØ¼ÆÊý
|
1£ºLPT_ETRµÄϽµÑؼÆÊý Ïà¹Øº¯Êý */
|
void LPTIM_CFGR_EDGESEL_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CFGR;
|
tmpreg &= ~(LPTIM_CFGR_EDGESEL_Msk);
|
tmpreg |= (SetValue & LPTIM_CFGR_EDGESEL_Msk);
|
LPTIM->CFGR = tmpreg;
|
}
|
|
uint32_t LPTIM_CFGR_EDGESEL_Get(void)
|
{
|
return (LPTIM->CFGR & LPTIM_CFGR_EDGESEL_Msk);
|
}
|
|
/* Íⲿ´¥·¢±ßÑØÑ¡Ôñ£¨ÐèʹÓÃÄÚ²¿Ê±ÖÓͬ²½²ÉÑùLPT_ETR£©(ETR trigger Configuration)
|
00: LPT_ETRÊäÈëÐźÅÉÏÉýÑØ´¥·¢
|
01: LPT_ETRÊäÈëÐźÅϽµÑØ´¥·¢
|
10/11: ÍⲿÊäÈëÐźÅÉÏÉýϽµÑØ´¥·¢ Ïà¹Øº¯Êý */
|
void LPTIM_CFGR_TRIGCFG_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CFGR;
|
tmpreg &= ~(LPTIM_CFGR_TRIGCFG_Msk);
|
tmpreg |= (SetValue & LPTIM_CFGR_TRIGCFG_Msk);
|
LPTIM->CFGR = tmpreg;
|
}
|
|
uint32_t LPTIM_CFGR_TRIGCFG_Get(void)
|
{
|
return (LPTIM->CFGR & LPTIM_CFGR_TRIGCFG_Msk);
|
}
|
|
/* µ¥´Î¼ÆÊýģʽʹÄÜ(One State Timer)
|
0£ºÁ¬Ðø¼ÆÊýģʽ£º¼ÆÊýÆ÷±»´¥·¢ºó±£³ÖÔËÐУ¬Ö±µ½±»¹Ø±ÕΪֹ¡£¼ÆÊýÆ÷´ïµ½Ä¿±êÖµºó»Øµ½0ÖØÐ¿ªÊ¼¼ÆÊý£¬²¢²úÉúÒç³öÖжϡ£
|
1£ºµ¥´Î¼ÆÊýģʽ£º¼ÆÊýÆ÷±»´¥·¢ºó¼ÆÊýµ½Ä¿±êÖµºó»Øµ½0£¬²¢×Ô¶¯Í£Ö¹£¬²úÉúÒç³öÖжϡ£ Ïà¹Øº¯Êý */
|
void LPTIM_CFGR_ONST_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CFGR;
|
tmpreg &= ~(LPTIM_CFGR_ONST_Msk);
|
tmpreg |= (SetValue & LPTIM_CFGR_ONST_Msk);
|
LPTIM->CFGR = tmpreg;
|
}
|
|
uint32_t LPTIM_CFGR_ONST_Get(void)
|
{
|
return (LPTIM->CFGR & LPTIM_CFGR_ONST_Msk);
|
}
|
|
/* ¹¤×÷ģʽѡÔñ(Timer operation Mode)
|
00£ºÆÕͨ¶¨Ê±Æ÷ģʽ
|
01£ºTriggerÂö³å´¥·¢¼ÆÊýģʽ
|
10£ºÍⲿÒì²½Âö³å¼ÆÊýģʽ
|
11£ºTimeoutģʽ Ïà¹Øº¯Êý */
|
void LPTIM_CFGR_TMODE_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CFGR;
|
tmpreg &= ~(LPTIM_CFGR_TMODE_Msk);
|
tmpreg |= (SetValue & LPTIM_CFGR_TMODE_Msk);
|
LPTIM->CFGR = tmpreg;
|
}
|
|
uint32_t LPTIM_CFGR_TMODE_Get(void)
|
{
|
return (LPTIM->CFGR & LPTIM_CFGR_TMODE_Msk);
|
}
|
|
/* 32bit¼ÆÊýÆ÷µ±Ç°¼ÆÊýÖµ(Counter 32bits-wide) Ïà¹Øº¯Êý */
|
uint32_t LPTIM_CNTR_Read(void)
|
{
|
return (LPTIM->CNTR);
|
}
|
|
/* ͨµÀ1²¶×½Ô´Ñ¡Ôñ(Capture channel 1 source select)£¬½öÔÚCH1ͨµÀÅäÖÃΪÊäÈ벶׽ʱÓÐЧ
|
00£ºLPT_CH1ÊäÈë
|
01£ºXTLF
|
10£ºRCLP
|
11£ºRCMF Ïà¹Øº¯Êý */
|
void LPTIM_CCSR_CAP1SSEL_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CAP1SSEL_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CAP1SSEL_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CAP1SSEL_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CAP1SSEL_Msk);
|
}
|
|
/* ͨµÀ4µ±Ç°±»²¶×½µÄ±ßÑØ£¬ÔÚCC2IFÖÃλʱ¸üÐÂ(Channel 4 Captured Edge)
|
0£ºÉÏÉýÑØ
|
1£ºÏ½µÑØ Ïà¹Øº¯Êý */
|
void LPTIM_CCSR_CAP4EDGE_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CAP4EDGE_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CAP4EDGE_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CAP4EDGE_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CAP4EDGE_Msk);
|
}
|
|
void LPTIM_CCSR_CAP3EDGE_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CAP3EDGE_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CAP3EDGE_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CAP3EDGE_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CAP3EDGE_Msk);
|
}
|
|
void LPTIM_CCSR_CAP2EDGE_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CAP2EDGE_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CAP2EDGE_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CAP2EDGE_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CAP2EDGE_Msk);
|
}
|
|
void LPTIM_CCSR_CAP1EDGE_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CAP1EDGE_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CAP1EDGE_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CAP1EDGE_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CAP1EDGE_Msk);
|
}
|
|
/* ͨµÀ4±È½ÏÊä³ö²¨Ðμ«ÐÔÑ¡Ôñ (Channel 4 compare output Polarity)
|
0£ºÕý¼«ÐÔ²¨ÐΣ¬ÆðʼΪµÍ£¬¼ÆÊýÖµ==±È½ÏֵʱÖøߣ¬¼ÆÊýÖµ==ARRʱ»Ö¸´ÎªµÍ
|
1£º¸º¼«ÐÔ²¨ÐΣ¬Õý¼«ÐÔ²¨ÐÎÈ¡·´ Ïà¹Øº¯Êý */
|
void LPTIM_CCSR_POLAR4_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_POLAR4_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_POLAR4_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_POLAR4_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_POLAR4_Msk);
|
}
|
|
void LPTIM_CCSR_POLAR3_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_POLAR3_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_POLAR3_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_POLAR3_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_POLAR3_Msk);
|
}
|
|
void LPTIM_CCSR_POLAR2_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_POLAR2_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_POLAR2_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_POLAR2_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_POLAR2_Msk);
|
}
|
|
void LPTIM_CCSR_POLAR1_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_POLAR1_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_POLAR1_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_POLAR1_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_POLAR1_Msk);
|
}
|
|
/* ͨµÀ4²¶×½±ßÑØÑ¡Ôñ(Channel 4 Capture edge Config)
|
00£ºÉÏÉýÑØ²¶×½
|
01£ºÏ½µÑز¶×½
|
10£ºÉÏÉýϽµÑز¶×½
|
11£ºRFU Ïà¹Øº¯Êý */
|
void LPTIM_CCSR_CAPCFG4_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CAPCFG4_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CAPCFG4_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CAPCFG4_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CAPCFG4_Msk);
|
}
|
|
void LPTIM_CCSR_CAPCFG3_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CAPCFG3_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CAPCFG3_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CAPCFG3_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CAPCFG3_Msk);
|
}
|
|
void LPTIM_CCSR_CAPCFG2_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CAPCFG2_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CAPCFG2_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CAPCFG2_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CAPCFG2_Msk);
|
}
|
|
void LPTIM_CCSR_CAPCFG1_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CAPCFG1_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CAPCFG1_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CAPCFG1_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CAPCFG1_Msk);
|
}
|
|
/* ͨµÀ4²¶×½/±È½Ï¹¦ÄÜʹÄÜ(Channel 4 Capture/Compare Select)
|
00,11£º½ûֹͨµÀ4²¶×½/±È½Ï¹¦ÄÜ
|
01£ºÊ¹ÄÜͨµÀ4²¶×½¹¦ÄÜ£¨LPT_CH4ΪÊäÈ룩
|
10£ºÊ¹ÄÜͨµÀ4±È½Ï¹¦ÄÜ£¨LPT_CH4ΪÊä³ö£© Ïà¹Øº¯Êý */
|
void LPTIM_CCSR_CC4S_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CC4S_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CC4S_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CC4S_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CC4S_Msk);
|
}
|
|
void LPTIM_CCSR_CC3S_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CC3S_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CC3S_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CC3S_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CC3S_Msk);
|
}
|
|
void LPTIM_CCSR_CC2S_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CC2S_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CC2S_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CC2S_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CC2S_Msk);
|
}
|
|
void LPTIM_CCSR_CC1S_Set(uint32_t SetValue)
|
{
|
uint32_t tmpreg;
|
tmpreg = LPTIM->CCSR;
|
tmpreg &= ~(LPTIM_CCSR_CC1S_Msk);
|
tmpreg |= (SetValue & LPTIM_CCSR_CC1S_Msk);
|
LPTIM->CCSR = tmpreg;
|
}
|
|
uint32_t LPTIM_CCSR_CC1S_Get(void)
|
{
|
return (LPTIM->CCSR & LPTIM_CCSR_CC1S_Msk);
|
}
|
|
/* ×Ô¶¯ÖØÔØÄ¿±ê¼Ä´æÆ÷(Auto-Reload Register)
|
µ±¼ÆÊýÆ÷¼ÆÊýÖµµÈÓÚARRʱ£¬¼ÆÊýÆ÷»Øµ½³õÖµÖØÐ¿ªÊ¼ÏòÉϼÆÊý Ïà¹Øº¯Êý */
|
void LPTIM_ARR_Write(uint32_t SetValue)
|
{
|
LPTIM->ARR = (SetValue);
|
}
|
|
uint32_t LPTIM_ARR_Read(void)
|
{
|
return (LPTIM->ARR);
|
}
|
|
/* ͨµÀ4²¶×½Òç³öÖжÏʹÄÜ(Channel 4 Over-Capture Interrupt Enable)
|
1£ºÔÊÐíÖжÏ
|
0£º½ûÖ¹ÖÐ¶Ï Ïà¹Øº¯Êý */
|
void LPTIM_IER_OVR4IE_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->IER |= (LPTIM_IER_OVR4IE_Msk);
|
}
|
else
|
{
|
LPTIM->IER &= ~(LPTIM_IER_OVR4IE_Msk);
|
}
|
}
|
|
FunState LPTIM_IER_OVR4IE_Getable(void)
|
{
|
if (LPTIM->IER & (LPTIM_IER_OVR4IE_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* ͨµÀ3²¶×½Òç³öÖжÏʹÄÜ(Channel 3 Over-Capture Interrupt Enable)
|
1£ºÔÊÐíÖжÏ
|
0£º½ûÖ¹ÖÐ¶Ï Ïà¹Øº¯Êý */
|
void LPTIM_IER_OVR3IE_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->IER |= (LPTIM_IER_OVR3IE_Msk);
|
}
|
else
|
{
|
LPTIM->IER &= ~(LPTIM_IER_OVR3IE_Msk);
|
}
|
}
|
|
FunState LPTIM_IER_OVR3IE_Getable(void)
|
{
|
if (LPTIM->IER & (LPTIM_IER_OVR3IE_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* ͨµÀ2²¶×½Òç³öÖжÏʹÄÜ(Channel 2 Over-Capture Interrupt Enable)
|
1£ºÔÊÐíÖжÏ
|
0£º½ûÖ¹ÖÐ¶Ï Ïà¹Øº¯Êý */
|
void LPTIM_IER_OVR2IE_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->IER |= (LPTIM_IER_OVR2IE_Msk);
|
}
|
else
|
{
|
LPTIM->IER &= ~(LPTIM_IER_OVR2IE_Msk);
|
}
|
}
|
|
FunState LPTIM_IER_OVR2IE_Getable(void)
|
{
|
if (LPTIM->IER & (LPTIM_IER_OVR2IE_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* ͨµÀ1²¶×½Òç³öÖжÏʹÄÜ(Channel 1 Over-Capture Interrupt Enable)
|
1£ºÔÊÐíÖжÏ
|
0£º½ûÖ¹ÖÐ¶Ï Ïà¹Øº¯Êý */
|
void LPTIM_IER_OVR1IE_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->IER |= (LPTIM_IER_OVR1IE_Msk);
|
}
|
else
|
{
|
LPTIM->IER &= ~(LPTIM_IER_OVR1IE_Msk);
|
}
|
}
|
|
FunState LPTIM_IER_OVR1IE_Getable(void)
|
{
|
if (LPTIM->IER & (LPTIM_IER_OVR1IE_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* Íⲿ´¥·¢µ½À´ÖжÏʹÄÜλ(External Trigger Interrupt Enable)
|
1£ºÍⲿ´¥·¢µ½À´ÖжÏʹÄÜ
|
0£ºÍⲿ´¥·¢µ½À´ÖжϽûÖ¹ Ïà¹Øº¯Êý */
|
void LPTIM_IER_TRIGIE_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->IER |= (LPTIM_IER_TRIGIE_Msk);
|
}
|
else
|
{
|
LPTIM->IER &= ~(LPTIM_IER_TRIGIE_Msk);
|
}
|
}
|
|
FunState LPTIM_IER_TRIGIE_Getable(void)
|
{
|
if (LPTIM->IER & (LPTIM_IER_TRIGIE_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* ¼ÆÊýÆ÷Òç³öÖжÏʹÄÜλ(Counter Over-Flow Interrupt Enable)
|
1£º¼ÆÊýÆ÷Òç³öÖжÏʹÄÜ
|
0£º¼ÆÊýÆ÷Òç³öÖжϽûÖ¹ Ïà¹Øº¯Êý */
|
void LPTIM_IER_OVIE_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->IER |= (LPTIM_IER_OVIE_Msk);
|
}
|
else
|
{
|
LPTIM->IER &= ~(LPTIM_IER_OVIE_Msk);
|
}
|
}
|
|
FunState LPTIM_IER_OVIE_Getable(void)
|
{
|
if (LPTIM->IER & (LPTIM_IER_OVIE_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* ²¶×½/±È½ÏͨµÀ4ÖжÏʹÄÜλ(Capture/Compare channel 4 Interrupt Enable)
|
1£º²¶×½/±È½ÏͨµÀ2ÖжÏʹÄÜ
|
0£º²¶×½/±È½ÏͨµÀ2ÖжϽûÖ¹ Ïà¹Øº¯Êý */
|
void LPTIM_IER_CC4IE_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->IER |= (LPTIM_IER_CC4IE_Msk);
|
}
|
else
|
{
|
LPTIM->IER &= ~(LPTIM_IER_CC4IE_Msk);
|
}
|
}
|
|
FunState LPTIM_IER_CC4IE_Getable(void)
|
{
|
if (LPTIM->IER & (LPTIM_IER_CC4IE_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* ²¶×½/±È½ÏͨµÀ3ÖжÏʹÄÜλ(Capture/Compare channel 3 Interrupt Enable)
|
1£º²¶×½/±È½ÏͨµÀ1ÖжÏʹÄÜ
|
0£º²¶×½/±È½ÏͨµÀ1ÖжϽûÖ¹ Ïà¹Øº¯Êý */
|
void LPTIM_IER_CC3IE_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->IER |= (LPTIM_IER_CC3IE_Msk);
|
}
|
else
|
{
|
LPTIM->IER &= ~(LPTIM_IER_CC3IE_Msk);
|
}
|
}
|
|
FunState LPTIM_IER_CC3IE_Getable(void)
|
{
|
if (LPTIM->IER & (LPTIM_IER_CC3IE_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* ²¶×½/±È½ÏͨµÀ2ÖжÏʹÄÜλ(Capture/Compare channel 2 Interrupt Enable)
|
1£º²¶×½/±È½ÏͨµÀ2ÖжÏʹÄÜ
|
0£º²¶×½/±È½ÏͨµÀ2ÖжϽûÖ¹ Ïà¹Øº¯Êý */
|
void LPTIM_IER_CC2IE_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->IER |= (LPTIM_IER_CC2IE_Msk);
|
}
|
else
|
{
|
LPTIM->IER &= ~(LPTIM_IER_CC2IE_Msk);
|
}
|
}
|
|
FunState LPTIM_IER_CC2IE_Getable(void)
|
{
|
if (LPTIM->IER & (LPTIM_IER_CC2IE_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* ²¶×½/±È½ÏͨµÀ1ÖжÏʹÄÜλ(Capture/Compare channel 1 Interrupt Enable)
|
1£º²¶×½/±È½ÏͨµÀ1ÖжÏʹÄÜ
|
0£º²¶×½/±È½ÏͨµÀ1ÖжϽûÖ¹ Ïà¹Øº¯Êý */
|
void LPTIM_IER_CC1IE_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->IER |= (LPTIM_IER_CC1IE_Msk);
|
}
|
else
|
{
|
LPTIM->IER &= ~(LPTIM_IER_CC1IE_Msk);
|
}
|
}
|
|
FunState LPTIM_IER_CC1IE_Getable(void)
|
{
|
if (LPTIM->IER & (LPTIM_IER_CC1IE_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
void LPTIM_ISR_CAP4OVR_Clr(void)
|
{
|
LPTIM->ISR = LPTIM_ISR_CAP4OVR_Msk;
|
}
|
|
FlagStatus LPTIM_ISR_CAP4OVR_Chk(void)
|
{
|
if (LPTIM->ISR & LPTIM_ISR_CAP4OVR_Msk)
|
{
|
return SET;
|
}
|
else
|
{
|
return RESET;
|
}
|
}
|
|
void LPTIM_ISR_CAP3OVR_Clr(void)
|
{
|
LPTIM->ISR = LPTIM_ISR_CAP3OVR_Msk;
|
}
|
|
FlagStatus LPTIM_ISR_CAP3OVR_Chk(void)
|
{
|
if (LPTIM->ISR & LPTIM_ISR_CAP3OVR_Msk)
|
{
|
return SET;
|
}
|
else
|
{
|
return RESET;
|
}
|
}
|
|
void LPTIM_ISR_CAP2OVR_Clr(void)
|
{
|
LPTIM->ISR = LPTIM_ISR_CAP2OVR_Msk;
|
}
|
|
FlagStatus LPTIM_ISR_CAP2OVR_Chk(void)
|
{
|
if (LPTIM->ISR & LPTIM_ISR_CAP2OVR_Msk)
|
{
|
return SET;
|
}
|
else
|
{
|
return RESET;
|
}
|
}
|
|
void LPTIM_ISR_CAP1OVR_Clr(void)
|
{
|
LPTIM->ISR = LPTIM_ISR_CAP1OVR_Msk;
|
}
|
|
FlagStatus LPTIM_ISR_CAP1OVR_Chk(void)
|
{
|
if (LPTIM->ISR & LPTIM_ISR_CAP1OVR_Msk)
|
{
|
return SET;
|
}
|
else
|
{
|
return RESET;
|
}
|
}
|
|
void LPTIM_ISR_TRIGIF_Clr(void)
|
{
|
LPTIM->ISR = LPTIM_ISR_TRIGIF_Msk;
|
}
|
|
FlagStatus LPTIM_ISR_TRIGIF_Chk(void)
|
{
|
if (LPTIM->ISR & LPTIM_ISR_TRIGIF_Msk)
|
{
|
return SET;
|
}
|
else
|
{
|
return RESET;
|
}
|
}
|
|
void LPTIM_ISR_OVIF_Clr(void)
|
{
|
LPTIM->ISR = LPTIM_ISR_OVIF_Msk;
|
}
|
|
FlagStatus LPTIM_ISR_OVIF_Chk(void)
|
{
|
if (LPTIM->ISR & LPTIM_ISR_OVIF_Msk)
|
{
|
return SET;
|
}
|
else
|
{
|
return RESET;
|
}
|
}
|
|
void LPTIM_ISR_CC4IF_Clr(void)
|
{
|
LPTIM->ISR = LPTIM_ISR_CC4IF_Msk;
|
}
|
|
FlagStatus LPTIM_ISR_CC4IF_Chk(void)
|
{
|
if (LPTIM->ISR & LPTIM_ISR_CC4IF_Msk)
|
{
|
return SET;
|
}
|
else
|
{
|
return RESET;
|
}
|
}
|
|
void LPTIM_ISR_CC3IF_Clr(void)
|
{
|
LPTIM->ISR = LPTIM_ISR_CC3IF_Msk;
|
}
|
|
FlagStatus LPTIM_ISR_CC3IF_Chk(void)
|
{
|
if (LPTIM->ISR & LPTIM_ISR_CC3IF_Msk)
|
{
|
return SET;
|
}
|
else
|
{
|
return RESET;
|
}
|
}
|
|
void LPTIM_ISR_CC2IF_Clr(void)
|
{
|
LPTIM->ISR = LPTIM_ISR_CC2IF_Msk;
|
}
|
|
FlagStatus LPTIM_ISR_CC2IF_Chk(void)
|
{
|
if (LPTIM->ISR & LPTIM_ISR_CC2IF_Msk)
|
{
|
return SET;
|
}
|
else
|
{
|
return RESET;
|
}
|
}
|
|
void LPTIM_ISR_CC1IF_Clr(void)
|
{
|
LPTIM->ISR = LPTIM_ISR_CC1IF_Msk;
|
}
|
|
FlagStatus LPTIM_ISR_CC1IF_Chk(void)
|
{
|
if (LPTIM->ISR & LPTIM_ISR_CC1IF_Msk)
|
{
|
return SET;
|
}
|
else
|
{
|
return RESET;
|
}
|
}
|
|
/* LPTIMʹÄÜλ(LPTIM Enable)
|
1£ºÊ¹ÄܼÆÊýÆ÷¼ÆÊý
|
0£º½ûÖ¹¼ÆÊýÆ÷¼ÆÊý Ïà¹Øº¯Êý */
|
void LPTIM_CR_EN_Setable(FunState NewState)
|
{
|
if (NewState == ENABLE)
|
{
|
LPTIM->CR |= (LPTIM_CR_EN_Msk);
|
}
|
else
|
{
|
LPTIM->CR &= ~(LPTIM_CR_EN_Msk);
|
}
|
}
|
|
FunState LPTIM_CR_EN_Getable(void)
|
{
|
if (LPTIM->CR & (LPTIM_CR_EN_Msk))
|
{
|
return ENABLE;
|
}
|
else
|
{
|
return DISABLE;
|
}
|
}
|
|
/* ²¶×½/±È½ÏÖµ¼Ä´æÆ÷1 (Channel1 Capture/Compare Register) Ïà¹Øº¯Êý */
|
void LPTIM_CCR1_Write(uint32_t SetValue)
|
{
|
LPTIM->CCR1 = (SetValue);
|
}
|
|
uint32_t LPTIM_CCR1_Read(void)
|
{
|
return (LPTIM->CCR1);
|
}
|
|
/* ²¶×½/±È½ÏÖµ¼Ä´æÆ÷2 (Channel2 Capture/Compare Register) Ïà¹Øº¯Êý */
|
void LPTIM_CCR2_Write(uint32_t SetValue)
|
{
|
LPTIM->CCR2 = (SetValue);
|
}
|
|
uint32_t LPTIM_CCR2_Read(void)
|
{
|
return (LPTIM->CCR2);
|
}
|
|
/* ²¶×½/±È½ÏÖµ¼Ä´æÆ÷3 (Channel3 Capture/Compare Register) Ïà¹Øº¯Êý */
|
void LPTIM_CCR3_Write(uint32_t SetValue)
|
{
|
LPTIM->CCR3 = (SetValue);
|
}
|
|
uint32_t LPTIM_CCR3_Read(void)
|
{
|
return (LPTIM->CCR3);
|
}
|
|
/* ²¶×½/±È½ÏÖµ¼Ä´æÆ÷4 (Channel4 Capture/Compare Register) Ïà¹Øº¯Êý */
|
void LPTIM_CCR4_Write(uint32_t SetValue)
|
{
|
LPTIM->CCR4 = (SetValue);
|
}
|
|
uint32_t LPTIM_CCR4_Read(void)
|
{
|
return (LPTIM->CCR4);
|
}
|
|
void LPTIM_Deinit(void)
|
{
|
//LPTIM->CFGR = 0x00000000;
|
//LPTIM->CNTR = 0x00000000;
|
//LPTIM->CCSR = ;
|
//LPTIM->ARR = 0x00000000;
|
//LPTIM->IER = 0x00000000;
|
//LPTIM->ISR = ;
|
//LPTIM->CR = 0x00000000;
|
//LPTIM->CCR1 = 0x00000000;
|
}
|
|
/******END OF FILE****/
|