You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
2.5 KiB
115 lines
2.5 KiB
/**********************************************
|
|
Copyright @Avic 2024 All Rights Reserved
|
|
File Name: main.c
|
|
File Description:提供主程序入口main
|
|
Author:tanjiaxin
|
|
Creation Date:2024-10-9
|
|
History:
|
|
1.Date:2024-11-7
|
|
Author:xuming
|
|
Modification: 增加文件序言
|
|
************************************************/
|
|
|
|
/*****************FILE INCLUSION**********************/
|
|
#include "MPC5646C.h"
|
|
#include "common.h"
|
|
#include "nvram.h"
|
|
#include "spi.h"
|
|
#include "wdg.h"
|
|
#include "lquart.h"
|
|
#include "pubit.h"
|
|
#include "ibit.h"
|
|
#include "pll.h"
|
|
#include "atp.h"
|
|
#include "spi_driver.h"
|
|
|
|
#include "test.h"
|
|
#include "WindModeltestfinal.h"
|
|
|
|
|
|
|
|
/*****************MACRO DEFINITIONS**********************/
|
|
|
|
#define WM_BUFFER_SIZE 200
|
|
|
|
|
|
/*****************TYPE DECLARATIONS**********************/
|
|
|
|
|
|
|
|
/*****************VARIABLE DEFINITIONS**********************/
|
|
char WM_data_pg[WM_BUFFER_SIZE];
|
|
uint8_t fix_step = 1;
|
|
|
|
extern ExtY_WindModeltestfinal_T WindModeltestfinal_Y;
|
|
|
|
/*****************FUNCTION DECLARATIONS**********************/
|
|
|
|
void WM_data_pakeage(ExtY_WindModeltestfinal_T* final,char* out_data)
|
|
{
|
|
uint32_t temp32 = 0;
|
|
float temp_f = 0.0;
|
|
int temp_L=0,size_d = 0;
|
|
|
|
temp32 = final->WindVisible;
|
|
snprintf(out_data, WM_BUFFER_SIZE, "WindVisible: %s,", temp32);
|
|
temp_L = strlen(out_data);
|
|
size_d = WM_BUFFER_SIZE;
|
|
|
|
temp32 = final->WindDirectionColor;
|
|
snprintf(out_data+temp_L, WM_BUFFER_SIZE-temp_L, "WindDirectionColor: %s,", temp32);
|
|
temp_L = strlen(out_data);
|
|
|
|
temp_f = final->WindSpeed;
|
|
snprintf(out_data+temp_L, WM_BUFFER_SIZE-temp_L, "WindSpeed: %s,", temp_f);
|
|
temp_L = strlen(out_data);
|
|
|
|
temp32 = final->WindSpeedColor;
|
|
snprintf(out_data+temp_L, WM_BUFFER_SIZE-temp_L, "WindSpeedColor: %s,", temp32);
|
|
temp_L = strlen(out_data);
|
|
|
|
temp_f = final->WindDirection;
|
|
snprintf(out_data+temp_L, WM_BUFFER_SIZE-temp_L, "WindSpeedColor: %s/r/n", temp_f);
|
|
temp_L = strlen(out_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
int main(void) {
|
|
pll_120M();
|
|
|
|
lq_serial_init(120000000, 0, 115200); // 串口初始化
|
|
|
|
pu_BIT(); // 上电自检
|
|
|
|
initDSPI_gpio(); // SPI初始化
|
|
delay_spi(10); // 延迟
|
|
|
|
ATP_menu(); // 调用ATP菜单
|
|
|
|
WindModeltestfinal_initialize();
|
|
|
|
fix_step = 1;
|
|
|
|
//test_menu();
|
|
|
|
/* Loop forever */
|
|
while(1){
|
|
delay_spi(30000);
|
|
if(fix_step == 1){
|
|
fix_step = 0;
|
|
memset(WM_data_pg,0,sizeof(WM_data_pg));//clear buff
|
|
WindModeltestfinal_step();//out:WindModeltestfinal_Y
|
|
WM_data_pakeage(&WindModeltestfinal_Y,WM_data_pg);//data package
|
|
lq_serial_putstr(0,WM_data_pg);
|
|
fix_step = 1;
|
|
}
|
|
else
|
|
{
|
|
}
|
|
|
|
|
|
}
|
|
}
|