99 lines
3.2 KiB
C
Raw Normal View History

2025-02-19 13:21:11 +08:00
/*
* 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.
*/
2025-02-18 10:13:34 +08:00
#include "main.h"
#include "uart.h"
#include "lin.h"
#include "user_init.h"
#include "sleep.h"
2025-02-19 13:21:11 +08:00
#include "svd.h"
#include "iwdt.h"
#include "rmu.h"
#include "bstim32.h"
#include "appTask.h"
2025-02-18 10:13:34 +08:00
2025-02-19 13:21:11 +08:00
/**
* @brief HardFault
* @param void
* @retval None
*/
void HardFault_Handler(void)
2025-02-18 10:13:34 +08:00
{
2025-02-19 13:21:11 +08:00
/* 软复位MCU */
FL_RMU_SetSoftReset(RMU);
}
2025-02-18 10:13:34 +08:00
2025-02-19 13:21:11 +08:00
int main(void)
{
/* 使能IWDT */
IWDT_Init(FL_IWDT_PERIOD_1000MS);
2025-02-18 10:13:34 +08:00
2025-02-19 13:21:11 +08:00
/* 延时函数初始化 */
2025-02-18 10:13:34 +08:00
FL_Init();
2025-02-19 13:21:11 +08:00
/* 使能SVD,阈值4.16V(falling)~4.284V(rising) */
SVD_Init(SVD_MONTIOR_VDD,FL_SVD_WARNING_THRESHOLD_GROUP5,FL_SVD_REFERENCE_1P0V);
/* 确认SVD监测结果是否高于阈值如否则持续等待 */
while(false == SVD_Result_Confirmed(SVD_HIGHER_THRESHOLD, 2000U/*us*/));
/* 使能BOR为2.0V */
RMU_BOR_Init(FL_RMU_BOR_THRESHOLD_2P00V);
/* RTC调校初值配置 */
MF_Clock_Init();
2025-02-18 10:13:34 +08:00
/* 用户参数配置 */
UserInit();
/* LIN初始化 */
lin_init();
2025-02-19 13:21:11 +08:00
appTaskInit();
2025-02-18 10:13:34 +08:00
while(1)
{
2025-02-19 13:21:11 +08:00
appTask();
2025-02-18 10:13:34 +08:00
}
}