UniversalCanCore/Src/CanProtocol.cpp
2025-12-24 17:18:34 +08:00

47 lines
1.1 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "CanProtocol.h"
#include "System.h"
// 一个任务函数C 风格
void Task1(void* param) {
while (true) {
std::cout << "Task1 running\n";
vTaskDelay(1000); // 延时 1000ms
}
}
// 另一个任务函数
void Task2(void* param) {
while (true) {
std::cout << "Task2 running\n";
vTaskDelay(500); // 延时 500ms
}
}
void CanRecive(void)
{
// 创建“任务”,用 std::thread 代替 FreeRTOS 任务
std::thread t1(Task1, nullptr);
std::thread t2(Task2, nullptr);
// 如果想模拟 FreeRTOS通常任务一直运行主函数也可以阻塞
t1.join();
t2.join();
}
//打开CAN盒子同时如果有初始化这里也会初始化
uint8_t CanOpen(uint8_t Product, int DeviceType, int Chnl, int Baud, int OtherTyp1, int OtherType2)
{
switch (Product)
{
case SC_HHS:
break;
case ZLG:
break;
case GC:
break;
case PEAK_CAN:
break;
default:
break;
}
}