2023-05-3

This commit is contained in:
gitea committed 2023-05-03 18:18:03 +08:00
1 parent 633d9b872b
commit 063c3fcc07
74 files changed
+26281 -13954

No files matched your search

+60 -31
View File
@@ -1,44 +1,73 @@
#include "FreeRTOS.h"
#include "task.h"
#include "main.h"
#include "cmsis_os.h"
#include "os-app.h"
#include <stdio.h>
#include "modbus-m.h"
#include "net-app.h"
#
#include <rtthread.h>
#include <net-app.h>
osThreadId_t NetworkThreadHandle; // Óû§×Ô¶¨ÒåÏß³Ì
const osThreadAttr_t NetworkThread_attributes = {
.name = "networkThread",
.priority = (osPriority_t) osPriorityLow,
.stack_size = 1024 * 4
};
static netWorkInterface_t s_interface;
ALIGN(RT_ALIGN_SIZE)
static char thread_stack[4096];
static struct rt_thread netapp_thread;
enum {
}
static enum {
netDrvInit = 0, // 初始化网络驱动
netDrvJoin = 1, // 等待网络注册成功
netDrvSend = 2, // 发送数据
netDrvRecv = 3, // 读取数据
netDrvIdle = 4, // 读取数据
}eDrvStatus;
static netWorkInterface_t interface;
void NetworkTask(void * argument)
static void thread_entry(void * argument)
{
if (s_interface.Init != NULL)
{
s_interface.Init();
}
while (1)
{
osDelay(5000);
}
eDrvStatus = netDrvInit;
rt_kprintf("%s was start!\r\n",__FILE__);
// 注册网络驱动
// 注册网络驱动
while (1)
{
switch (eDrvStatus)
{
case netDrvInit:
break;
case netDrvJoin:
break;
case netDrvSend:
break;
case netDrvRecv:
break;
case netDrvIdle:
break;
default :
break;
}
rt_thread_delay(10);
}
}
void NET_APPThreadStart(void )
{
/* 创建线程1,名称是thread1,入口是thread1_entry*/
rt_thread_init(&netapp_thread, "netapp_thread",
thread_entry, RT_NULL,
&thread_stack[0],
sizeof(thread_stack),
NET_APP_THREAD_PRIORITY, NET_APP_THREAD_TIMESLICE);
rt_thread_startup(&netapp_thread);
return ;
}