/**
*******************************************************************************************************
* @file fm33le0xxa_fl_atim.h
* @author FMSH Application Team
* @brief Head file of ATIM FL Module
*******************************************************************************************************
* @attention
* Copyright (c) 2022, SHANGHAI FUDAN MICROELECTRONICS GROUP CO., LTD.(FUDAN MICROELECTRONICS./ FUDAN MICRO.)
* All rights reserved.
*
* Processor: FM33LE0xxA
* http: http://www.fmdevelopers.com.cn/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* 4. To provide the most up-to-date information, the revision of our documents
* on the World Wide Web will be the most Current. Your printed copy may be
* an earlier revision. To verify you have the latest information avaliable,
* refer to: http://www.fmdevelopers.com.cn/.
*
* THIS SOFTWARE IS PROVIDED BY FUDAN MICRO "AS IS" AND ANY EXPRESSED
ORIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.IN NO EVENT SHALL FUDAN MICRO OR ITS CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OFTHE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************
*/
/* Define to prevent recursive inclusion---------------------------------------------------------------*/
#ifndef __FM33LE0XXA_FL_ATIM_H
#define __FM33LE0XXA_FL_ATIM_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes -------------------------------------------------------------------------------------------*/
#include "fm33le0xxa_fl_def.h"
/** @addtogroup FM33LE0XXA_FL_Driver
* @{
*/
/** @defgroup ATIM ATIM
* @brief ATIM FL driver
* @{
*/
/* Exported types -------------------------------------------------------------------------------------*/
/** @defgroup ATIM_FL_ES_INIT ATIM Exported Init structures
* @{
*/
/**
* @brief ATIM Init Sturcture Definition
*/
typedef struct
{
/** 时钟源选择 */
uint32_t clockSource;
/** 预分频系数 */
uint32_t prescaler;
/** 计数模式 */
uint32_t counterMode;
/** 自动重装载值 */
uint32_t autoReload;
/** 预装载使能 */
uint32_t autoReloadState;
/** 定时器分频系数与数字滤波器所使用的采样时钟分频比 */
uint32_t clockDivision;
/** 重复计数次数 */
uint32_t repetitionCounter;
} FL_ATIM_InitTypeDef;
/**
* @brief ATIM Slave Init Sturcture Definition
*/
typedef struct
{
/** 外部时钟源模式 */
uint32_t slaveMode;
/** 输入触发信号选择 */
uint32_t triggerSrc;
/** Trigger 延迟*/
uint32_t triggerDelay;
} FL_ATIM_SlaveInitTypeDef;
/**
* @brief ATIM ETR Init Structure Definition
*/
typedef struct
{
/** 外部触发使能 */
uint32_t useExternalTrigger;
/** 外部时钟滤波 */
uint32_t ETRFilter;
/** 外部时钟分频 */
uint32_t ETRClockDivision;
/** 外部时钟触发极性 */
uint32_t ETRPolarity;
} FL_ATIM_ETR_InitTypeDef;
/**
* @brief TIM Output Compare Init Structure Definition
*/
typedef struct
{
/** 比较输出模式 */
uint32_t OCMode;
/** 比较正向通道输出使能 */
uint32_t OCState;
/** 比较互补通道输出使能 */
uint32_t OCNState;
/** 比较输出极性 */
uint32_t OCPolarity;
/** 比较互补输出极性 */
uint32_t OCNPolarity;
/** 比较输出通道快速模式使能 */
uint32_t OCFastMode;
/** 输出比较预装载 */
uint32_t OCPreload;
/** 通道比较值 */
uint32_t compareValue;
/** 输出空闲状态电平 */
uint32_t OCIdleState;
/** ETR清0使能 */
uint32_t OCETRFStatus;
/** 互补输出空闲状态电平 */
uint32_t OCNIdleState;
} FL_ATIM_OC_InitTypeDef;
/**
* @brief TIM Input Capture Init Structure Definition
*/
typedef struct
{
/** 输入捕获使能 */
uint32_t captureState;
/** 输入捕获极性 */
uint32_t ICPolarity;
/** 通道映射激活的输入选择 */
uint32_t ICActiveInput;
/** 输入分频 */
uint32_t ICPrescaler;
/** 输入滤波 */
uint32_t ICFilter;
} FL_ATIM_IC_InitTypeDef;
/**
* @brief BDTR (Break and Dead Time) Init Structure Definition
*/
typedef struct
{
/** 运行状态下的输出关闭状态 */
uint32_t OSSRState;
/** 空闲状态下的输出关闭状态 */
uint32_t OSSIState;
/** 寄存器写保护等级 */
uint32_t lockLevel;
/** 死区时间 */
uint32_t deadTime;
/** 刹车使能 */
uint32_t breakState;
/** 刹车信号滤波 */
uint32_t breakFilter;
/** 刹车信号极性 */
uint32_t breakPolarity;
/** 刹车后计数器重装后自动输出使能*/
uint32_t automaticOutput;
/** 刹车信号1门控 */
uint32_t gatedBrakeSignal_1;
/** 刹车信号2门控 */
uint32_t gatedBrakeSignal_2;
/** 两路刹车信号控制逻辑 */
uint32_t brakeSignalCombined;
} FL_ATIM_BDTR_InitTypeDef;
/**
* @}
*/
/* Exported constants ---------------------------------------------------------------------------------*/
/** @defgroup ATIM_FL_Exported_Constants ATIM Exported Constants
* @{
*/
#define ATIM_CR1_CKD_Pos (8U)
#define ATIM_CR1_CKD_Msk (0x3U << ATIM_CR1_CKD_Pos)
#define ATIM_CR1_CKD ATIM_CR1_CKD_Msk
#define ATIM_CR1_ARPE_Pos (7U)
#define ATIM_CR1_ARPE_Msk (0x1U << ATIM_CR1_ARPE_Pos)
#define ATIM_CR1_ARPE ATIM_CR1_ARPE_Msk
#define ATIM_CR1_CMS_Pos (5U)
#define ATIM_CR1_CMS_Msk (0x3U << ATIM_CR1_CMS_Pos)
#define ATIM_CR1_CMS ATIM_CR1_CMS_Msk
#define ATIM_CR1_DIR_Pos (4U)
#define ATIM_CR1_DIR_Msk (0x1U << ATIM_CR1_DIR_Pos)
#define ATIM_CR1_DIR ATIM_CR1_DIR_Msk
#define ATIM_CR1_OPM_Pos