2025-02-19 13:21:11 +08:00

97 lines
3.4 KiB
C

/*
* Copyright (c) 2022, SHANGHAI FUDAN MICROELECTRONICS GROUP CO., LTD.(FUDAN MICROELECTRONICS./ FUDAN MICRO.)
* All rights reserved.
*
* Processor: FM33LG0xxA
* 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.
*/
#include "bstim32.h"
#include "main.h"
#include "appTask.h"
/**
* @brief BSTIM中断服务函数
* @param void
* @retval void
*/
//BSTIM_IRQHandler合并至LIN.C
/**
* @brief BSTIM32初始化
* @param void
* @retval void
*/
void BSTIM32_Init(void)
{
FL_BSTIM32_InitTypeDef TimerBase_InitStruct;
TimerBase_InitStruct.prescaler = 8 - 1;
TimerBase_InitStruct.autoReload = 4000 - 1;
TimerBase_InitStruct.autoReloadState = FL_ENABLE;
TimerBase_InitStruct.clockSource = FL_CMU_BSTIM32_CLK_SOURCE_APBCLK;
FL_BSTIM32_Init(BSTIM32, &TimerBase_InitStruct);
FL_BSTIM32_ClearFlag_Update(BSTIM32); /* 清除计数器中断标志位 */
FL_BSTIM32_EnableIT_Update(BSTIM32); /* 开启计数器中断 */
NVIC_DisableIRQ(BSTIM_IRQn);
NVIC_SetPriority(BSTIM_IRQn, 2); /* 中断优先级配置 */
NVIC_EnableIRQ(BSTIM_IRQn);
FL_BSTIM32_Enable(BSTIM32); /* 使能定时器 */
}
/**
* @brief BSTIM32模块复位
* @param void
* @retval void
*/
void BSTIM32_DeInit(void)
{
/* 恢复外设寄存器到复位值 */
FL_BSTIM32_DeInit(BSTIM32);
/* 清除中断挂起 */
NVIC_ClearPendingIRQ(BSTIM_IRQn);
/* 关闭NVIC中断 */
NVIC_DisableIRQ(BSTIM_IRQn);
}