/**
  ******************************************************************************
  * @file    ys32md211_lptim.h
  * @author  YSPRING Application Team
  * @version V1.0.1
  * @date    2023.6.09
  * @brief   This file contains all the functions prototypes for the LPTIM firmware 
  *          library.
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __YS32MD211_LPTIM_H
#define __YS32MD211_LPTIM_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "ys32md211.h"
#include "system_ys32md211.h"

/** @addtogroup YS32MD211_StdPeriph_Driver
  * @{
  */

/** @addtogroup LPTIM
  * @{
  */

/** @defgroup LPTIM_IT
  * @{
  */

#define LPTIM_IT_OVFR          (LPTIM_OVFR_TF)
#define IS_LPTIM_IT(LPTIM_IT)  ((LPTIM_IT) == LPTIM_IT_OVFR)

/**
  * @}
  */

/** @defgroup LPTIM_FLAG
  * @{
  */

#define LPTIM_FLAG_OVFR      (LPTIM_OVFR_TF)
#define IS_LPTIM_FLAG(FLAG)  ((FLAG) == LPTIM_FLAG_OVFR)

/** @defgroup LPTIM_CLEARF
  * @{
  */

#define LPTIM_CLEARF_OVFR      (LPTIM_OCLR_TF)
#define IS_LPTIM_CLEAR_FLAG(LPTIM_CLEARF)  ((LPTIM_CLEARF) == LPTIM_CLEARF_OVFR)

/**
  * @}
  */
  
/** @defgroup LPTIM_CLKConfig
  * @{
  */

#define LPTIM_CLK_SRC_PCLK   (0x00000000)
#define LPTIM_CLK_SRC_LSI    (0x00040000)
#define LPTIM_CLK_SRC_NO     (0x00080000)
#define LPTIM_CLK_SRC_LSE    (0x000C0000)
#define IS_LPTIM_CLK_SRC(CFG)  (((CFG) == LPTIM_CLK_SRC_PCLK) | \
                                ((CFG) == LPTIM_CLK_SRC_LSI)  | \
                                ((CFG) == LPTIM_CLK_SRC_NO)   | \
                                ((CFG) == LPTIM_CLK_SRC_LSE))

/**
  * @}
  */

/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void LPTIM_DeInit(void);
void LPTIM_SetAutoReload(uint16_t Value);
void LPTIM_Cmd(FunctionalState NewState);
void LPTIM_SelectClockSource(uint32_t CLK_SRC);
uint32_t LPTIM_GetCounterValue(void);
uint32_t LPTIM_GetAutoreloadValue(void);
void LPTIM_ITConfig(FunctionalState NewState);
FlagStatus LPTIM_GetFlagStatus(uint32_t LPTIM_FLAG);
ITStatus LPTIM_GetITStatus(uint32_t LPTIM_IT);
void LPTIM_ClearFlag(uint32_t LPTIM_CLEARF);
  
#ifdef __cplusplus
}
#endif

#endif /* __YS32MD211_LPTIM_H */

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

