feat: 添加第三方库 AgIsoStack-plus-plus
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "third_party/AgIsoStack-plus-plus"]
|
||||
path = third_party/AgIsoStack-plus-plus
|
||||
url = https://github.com/Open-Agriculture/AgIsoStack-plus-plus.git
|
||||
@@ -1,6 +1,22 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(isobus_demo)
|
||||
project(
|
||||
isobus_demo
|
||||
VERSION 1.0
|
||||
LANGUAGES CXX
|
||||
DESCRIPTION "ISOBUS DEMO Program"
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
add_executable(isobus_demo main.cpp)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/AgIsoStack-plus-plus)
|
||||
|
||||
add_executable(${PROJECT_NAME} src/main.cpp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
isobus::Isobus
|
||||
isobus::HardwareIntegration
|
||||
isobus::Utility
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
16
main.cpp
16
main.cpp
@@ -1,16 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
// TIP 要<b>Run</b>代码,请按 <shortcut actionId="Run"/> 或点击装订区域中的 <icon src="AllIcons.Actions.Execute"/> 图标。
|
||||
int main() {
|
||||
// TIP 当文本光标位于 <b>lang</b> 变量名称处时,按 <shortcut actionId="RenameElement"/> 可以查看 CLion 如何帮助您重命名该变量。
|
||||
auto lang = "C++";
|
||||
std::cout << "Hello and welcome to " << lang << "!\n";
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
// TIP 按 <shortcut actionId="Debug"/> 开始调试代码。我们已为您设置了一个 <icon src="AllIcons.Debugger.Db_set_breakpoint"/> 断点,但您可以随时按 <shortcut actionId="ToggleLineBreakpoint"/> 添加更多断点。
|
||||
std::cout << "i = " << i << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
// TIP 请访问 <a href="https://www.jetbrains.com/help/clion/">jetbrains.com/help/clion/</a> 查看 CLion 帮助。此外,您还可以从主菜单中选择“帮助 | 学习 IDE 功能”,尝试 CLion 的交互式课次。
|
||||
}
|
||||
27
src/main.cpp
Normal file
27
src/main.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "isobus/isobus/can_network_manager.hpp"
|
||||
#include "isobus/hardware_integration/socket_can_interface.hpp"
|
||||
#include "isobus/hardware_integration/can_hardware_interface.hpp"
|
||||
#include "isobus/isobus/can_partnered_control_function.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
int main() {
|
||||
isobus::NAME myNAME(0); // Create an empty NAME
|
||||
std::shared_ptr<isobus::InternalControlFunction> myECU = nullptr; // A pointer to hold our InternalControlFunction
|
||||
|
||||
//! Consider customizing some of these fields, like the function code, to be representative of your device
|
||||
myNAME.set_arbitrary_address_capable(true);
|
||||
myNAME.set_industry_group(1);
|
||||
myNAME.set_device_class(0);
|
||||
myNAME.set_function_code(static_cast<std::uint8_t>(isobus::NAME::Function::SteeringControl));
|
||||
myNAME.set_identity_number(2);
|
||||
myNAME.set_ecu_instance(0);
|
||||
myNAME.set_function_instance(0);
|
||||
myNAME.set_device_class_instance(0);
|
||||
myNAME.set_manufacturer_code(1407);
|
||||
|
||||
// Create our InternalControlFunction
|
||||
myECU = isobus::CANNetworkManager::CANNetwork.create_internal_control_function(myNAME, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
1
third_party/AgIsoStack-plus-plus
vendored
Submodule
1
third_party/AgIsoStack-plus-plus
vendored
Submodule
Submodule third_party/AgIsoStack-plus-plus added at d3fd6df71c
Reference in New Issue
Block a user