From d10f581eb749a8338e697a418d630db2cb01843f Mon Sep 17 00:00:00 2001
From: yincheng.zhong <634916154@qq.com>
Date: 星期三, 12 十一月 2025 19:07:58 +0800
Subject: [PATCH] 测试完TCP数据转发,GPS数据解析,UDP数据上传。
---
STM32H743/APL/app.c | 37 ++++++++++++++++++++++++++++---------
1 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/STM32H743/APL/app.c b/STM32H743/APL/app.c
index f4a74fb..bda2343 100644
--- a/STM32H743/APL/app.c
+++ b/STM32H743/APL/app.c
@@ -12,7 +12,7 @@
#include "HIDO_ATLite.h"
#include "UDPClient.h"
#include "bluetooth.h"
-
+#include "TCPClient.h"
static osSemaphoreId_t g_semaphoreHandle = NULL;
extern uint8_t restart_num;
void IdleTask(void)
@@ -27,22 +27,17 @@
{
// printf("%s URTRestart",__debug_info__);
HAL_NVIC_SystemReset();
- // SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader
+ // SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //锟斤拷锟斤拷位锟截碉拷bootloader
}
}
void app_task(void *pvParameters)
{
- g_com_map[IP_0] =103;
- g_com_map[IP_1] =155;
- g_com_map[IP_2] =76;
- g_com_map[IP_3] =198;
- g_com_map[UDP_PORT] =6666;
Shell_Init();
GPS_Init();
Internet_Init();
UDPClient_Init();
-
+ TCPClient_Init();
while (1)
{
//HIDO_UINT32 timeout = HIDO_TimerGetNearestTimeout(1000);
@@ -57,6 +52,7 @@
Internet_Poll();
GPS_Poll();
UDPClient_Poll();
+ TCPClient_Poll();
IdleTask();
HIDO_TimerPoll();
}
@@ -90,6 +86,29 @@
MCUFlash_Init();
parameter_init();
printf("demo run!\r\n");
+
+ /* 寮�鏈轰俊鎭緭鍑猴細鐗堟湰鍙枫�佽澶嘔D銆両P銆佺鍙o紙UDP/TCP锛� */
+ {
+ uint16_t dev_id = g_com_map[DEV_ID];
+ uint16_t udp_port = g_com_map[UDP_PORT];
+ uint16_t tcp_port = g_com_map[TCP_PORT];
+ uint16_t ip0 = g_com_map[IP_0];
+ uint16_t ip1 = g_com_map[IP_1];
+ uint16_t ip2 = g_com_map[IP_2];
+ uint16_t ip3 = g_com_map[IP_3];
+ uint16_t tip0 = g_com_map[TCP_IP_0];
+ uint16_t tip1 = g_com_map[TCP_IP_1];
+ uint16_t tip2 = g_com_map[TCP_IP_2];
+ uint16_t tip3 = g_com_map[TCP_IP_3];
+
+ /* VERSION 绱㈠紩鍦� global_param.h 涓负 0x1锛屽鏋滈渶瑕佹墦鍗扮増鏈彿瀛楃涓诧紝鍙槧灏勫埌鍏跺畠瀛樺偍锛涚洰鍓嶄粎鎵撳嵃鏁存暟 */
+ uint16_t version = g_com_map[VERSION];
+
+ printf("[BOOT] Version: %u\r\n", version);
+ printf("[BOOT] DeviceID: %u\r\n", dev_id);
+ printf("[BOOT] UDP Server: %u.%u.%u.%u:%u\r\n", ip0, ip1, ip2, ip3, udp_port);
+ printf("[BOOT] TCP Server: %u.%u.%u.%u:%u\r\n", tip0, tip1, tip2, tip3, tcp_port);
+ }
TaskHandle_t xTaskHandle = NULL;
osSemaphoreAttr_t semaphore_attr = {
@@ -98,7 +117,7 @@
.cb_mem = NULL,
.cb_size = 0};
- // 创建二进制信号量(初始计数为0,最大计数为1)
+ // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟脚猴拷锟斤拷锟斤拷锟斤拷始锟斤拷锟斤拷为0锟斤拷锟斤拷锟斤拷锟斤拷为1锟斤拷
g_semaphoreHandle = osSemaphoreNew(1, 0, &semaphore_attr);
xTaskCreate(
--
Gitblit v1.9.3