/** ****************************************************************************** * @file main.c * @author Motor Control SDK Team, Yuwell Software XiangenWang * @brief Voice Recognition Module Initialization Section, including peripheral initialization and message node insertion, etc. * @version 1.0 * @changelog version 1.0 初始版本 2025.12.18 - 新增:新建第一个版本的软件,待完善解析命令后的程序执行部分 ****************************************************************************** * @attention * *

© Copyright (c) 2025 Yuwell Software Danyang.Jiangsu.China. * All rights reserved.

* * Redistribution and use in source and binary forms, with or without * modification, are permitted, provided that the following conditions are met: * * 1. Redistribution 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 Yuwell Software nor the names of other * contributors to this software may be used to endorse or promote products * derived from this software without specific written permission. * 4. This software, including modifications and/or derivative works of this * software, must execute solely and exclusively on microcontroller or * microprocessor devices manufactured by or for Yuwell Software. * 5. Redistribution and use of this software other than as permitted under * this license is void and will automatically terminate your rights under * this license. * * THIS SOFTWARE IS PROVIDED BY Yuwell Software AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT * SHALL Yuwell Software OR 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) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* USER CODE END Header */ #include "main.h" #include "fm33_assert.h" #include "8f_5aw_powerMeter.h" #include "8f_5aw_display.h" #define FREQ_CHECK_ENABLE (1) // 选择是否使能频率检查 仅在debug阶段使用 #define WATCHDOG_ENABLE (0) #if FREQ_CHECK_ENABLE uint32_t apb_clk[3]; #endif int main(void) { FL_Init(); // 初始化Delay函数 MF_Clock_Init(); // 初始化时钟为RCHF SelXTHFToPLL(FL_CMU_PLL_PSC_DIV8, FL_MAIN_FREQ_Mhz - 1); // 设置芯片工作主频 FL_GPIO_InitTypeDef GPIO_InitStruct; // 开启LED闪烁 GPIO_InitStruct.pin = FL_GPIO_PIN_5; GPIO_InitStruct.mode = FL_GPIO_MODE_OUTPUT; GPIO_InitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL; GPIO_InitStruct.pull = FL_ENABLE; GPIO_InitStruct.remapPin = FL_DISABLE; GPIO_InitStruct.analogSwitch = FL_DISABLE; FL_GPIO_Init(GPIOD, &GPIO_InitStruct); // 开启压缩机继电器 GPIO_InitStruct.pin = FL_GPIO_PIN_12; FL_GPIO_Init(GPIOC, &GPIO_InitStruct); FL_GPIO_SetOutputPin(GPIOC, FL_GPIO_PIN_12); user_display_init(); // 初始化定时器任务 #if FREQ_CHECK /* 系统始终频率检测 */ apb_clk[0] = FL_CMU_GetAPBClockFreq(); apb_clk[1] = FL_CMU_GetAHBClockFreq(); apb_clk[2] = FL_CMU_GetSystemClockFreq(); #endif User_PowerMeter_Init(); // 初始化电量计芯片 panel_display_info.error.is_light = LIGHT_OFF; while(1) { FL_DelayMs(500); User_Power_refresh(); // LED灯闪烁 FL_GPIO_ToggleOutputPin(GPIOD, FL_GPIO_PIN_5); panel_display_info.oxg.value = elec_v_data.bus_rms_voltage_V; panel_display_info.total_time.hours = elec_v_data.bus_rms_current_mA; panel_display_info.timer.hours = elec_v_data.bus_active_power_watt / 100; panel_display_info.timer.minutes = elec_v_data.bus_active_power_watt % 100; user_display_refresh(); } }