/********************************************************************************************************************* * TC264 Opensourec Library 即(TC264 开源库)是一个基于官方 SDK 接口的第三方开源库 * Copyright (c) 2022 SEEKFREE 逐飞科技 * * 本文件是 TC264 开源库的一部分 * * TC264 开源库 是免费软件 * 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款 * 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它 * * 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证 * 甚至没有隐含的适销性或适合特定用途的保证 * 更多细节请参见 GPL * * 您应该在收到本开源库的同时收到一份 GPL 的副本 * 如果没有,请参阅 * * 额外注明: * 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本 * 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中 * 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件 * 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明) * * 文件名称 cpu0_main * 公司名称 成都逐飞科技有限公司 * 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明 * 开发环境 ADS v1.10.2 * 适用平台 TC264D * 店铺链接 https://seekfree.taobao.com/ * * 修改记录 * 日期 作者 备注 * 2022-09-15 pudding first version ********************************************************************************************************************/ #include "zf_common_headfile.h" #include "power_out.h" #include "status_led.h" #include "vofa_client.h" #pragma section all "cpu0_dsram" // **************************** 代码区域 **************************** int core0_main(void) { clock_init(); // 获取时钟频率<务必保留> debug_init(); // 初始化默认调试串口 Power_Out_Init(); Status_LED_Init(); VOFA_Client_Init(); ON_LED(STATUS_LED_7); ON_LED(STATUS_LED_8); uint32 t = 0; uint8 dir = 0; Power_Out_Enable(&power_outs[0], 1); Power_Out_Enable(&power_outs[1], 1); Power_Out_Enable(&power_outs[2], 1); Power_Out_Enable(&power_outs[3], 1); Power_Out_Enable(&power_outs[4], 1); Power_Out_Enable(&power_outs[5], 1); Power_Out_Enable(&power_outs[6], 1); Power_Out_Enable(&power_outs[7], 1); // Power_Out_Set_PWM(&power_outs[4], 3000); // Power_Out_Set_PWM(&power_outs[5], 4000); // Power_Out_Set_PWM(&power_outs[6], 5000); // Power_Out_Set_PWM(&power_outs[7], 6000); pit_ms_init(CCU60_CH0, POWER_OUT_READ_TIME_MS); // 初始化PIT0 用于读取电源模块状态 cpu_wait_event_ready(); while (TRUE) { Flash_LED(STATUS_LED_6); VOFA_Set_JustFloat_Data(0, power_outs[0].status.voltage_V); VOFA_Set_JustFloat_Data(1, power_outs[0].status.current_A); VOFA_Set_JustFloat_Data(2, power_outs[1].status.voltage_V); VOFA_Set_JustFloat_Data(3, power_outs[1].status.current_A); VOFA_Set_JustFloat_Data(4, power_outs[2].status.voltage_V); VOFA_Set_JustFloat_Data(5, power_outs[2].status.current_A); VOFA_Set_JustFloat_Data(6, power_outs[3].status.voltage_V); VOFA_Set_JustFloat_Data(7, power_outs[3].status.current_A); VOFA_Set_JustFloat_Data(8, power_outs[4].status.voltage_V); VOFA_Set_JustFloat_Data(9, power_outs[4].status.current_A); VOFA_Set_JustFloat_Data(10, power_outs[5].status.voltage_V); VOFA_Set_JustFloat_Data(11, power_outs[5].status.current_A); VOFA_Set_JustFloat_Data(12, power_outs[6].status.voltage_V); VOFA_Set_JustFloat_Data(13, power_outs[6].status.current_A); VOFA_Set_JustFloat_Data(14, power_outs[7].status.voltage_V); VOFA_Set_JustFloat_Data(15, power_outs[7].status.current_A); VOFA_Send_Datas(16); system_delay_ms(1); // if(dir == 0) // { // t += 10; // if(t >= 10000) // { // dir = 1; // t = 10000; // } // } // else // { // t -= 10; // if(t <= 0) // { // dir = 0; // t = 0; // } // } // Power_Out_Set_PWM(&power_outs[7], t); // system_delay_ms(1); } } #pragma section all restore // **************************** 代码区域 ****************************