mirror of
https://github.com/Jacajack/liblightmodbus-esp.git
synced 2025-12-15 08:45:36 +00:00
Add ESP-IDF component files
This commit is contained in:
parent
b0ff68613e
commit
ddb70139f1
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
liblightmodbus
|
||||||
27
CMakeLists.txt
Normal file
27
CMakeLists.txt
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
# This CMakeLists.txt is only a ESP-IDF component declaration
|
||||||
|
include(FetchContent)
|
||||||
|
set(LIBLIGHTMODBUS_REPO_DIR "${CMAKE_CURRENT_LIST_DIR}/liblightmodbus")
|
||||||
|
|
||||||
|
# Fetch liblightmodbus source code from GitHub
|
||||||
|
FetchContent_Populate(liblightmodbus-src
|
||||||
|
GIT_REPOSITORY "https://github.com/jacajack/liblightmodbus.git"
|
||||||
|
GIT_TAG "dev-v3.0"
|
||||||
|
SOURCE_DIR "${LIBLIGHTMODBUS_REPO_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Copy config file to liblightmodbus include directory
|
||||||
|
configure_file(
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/src/esp.config.h"
|
||||||
|
"${LIBLIGHTMODBUS_REPO_DIR}/include/lightmodbus/esp.config.h"
|
||||||
|
COPYONLY
|
||||||
|
)
|
||||||
|
|
||||||
|
# Register component
|
||||||
|
idf_component_register(
|
||||||
|
SRCS "src/impl.c"
|
||||||
|
INCLUDE_DIRS "${LIBLIGHTMODBUS_REPO_DIR}/include"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Inform liblightmodbus to use ESP config header
|
||||||
|
idf_build_set_property(COMPILE_DEFINITIONS "-DLIGHTMODBUS_USE_CONFIG_FILE" APPEND)
|
||||||
|
idf_build_set_property(COMPILE_DEFINITIONS "-DLIGHTMODBUS_CONFIG_FILE=\"esp.config.h\"" APPEND)
|
||||||
98
src/esp.config.h
Normal file
98
src/esp.config.h
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
#ifndef LIGHTMODBUS_ESP_CONFIG_H
|
||||||
|
#define LIGHTMODBUS_ESP_CONFIG_H
|
||||||
|
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_DEBUG
|
||||||
|
#define LIGHTMODBUS_DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_FULL
|
||||||
|
#define LIGHTMODBUS_FULL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_SLAVE
|
||||||
|
#define LIGHTMODBUS_SLAVE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F01S
|
||||||
|
#define LIGHTMODBUS_F01S
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F02S
|
||||||
|
#define LIGHTMODBUS_F02S
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F03S
|
||||||
|
#define LIGHTMODBUS_F03S
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F04S
|
||||||
|
#define LIGHTMODBUS_F04S
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F05S
|
||||||
|
#define LIGHTMODBUS_F05S
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F06S
|
||||||
|
#define LIGHTMODBUS_F06S
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F15S
|
||||||
|
#define LIGHTMODBUS_F15S
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F16S
|
||||||
|
#define LIGHTMODBUS_F16S
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F22S
|
||||||
|
#define LIGHTMODBUS_F22S
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_MASTER
|
||||||
|
#define LIGHTMODBUS_MASTER
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_MASTER_OMIT_REQUEST_CRC
|
||||||
|
#define LIGHTMODBUS_MASTER_OMIT_REQUEST_CRC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F01M
|
||||||
|
#define LIGHTMODBUS_F01M
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F02M
|
||||||
|
#define LIGHTMODBUS_F02M
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F03M
|
||||||
|
#define LIGHTMODBUS_F03M
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F04M
|
||||||
|
#define LIGHTMODBUS_F04M
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F05M
|
||||||
|
#define LIGHTMODBUS_F05M
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F06M
|
||||||
|
#define LIGHTMODBUS_F06M
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F15M
|
||||||
|
#define LIGHTMODBUS_F15M
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F16M
|
||||||
|
#define LIGHTMODBUS_F16M
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIGHTMODBUS_F22M
|
||||||
|
#define LIGHTMODBUS_F22M
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
2
src/impl.c
Normal file
2
src/impl.c
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
#define LIGHTMODBUS_IMPL
|
||||||
|
#include <lightmodbus/lightmodbus.h>
|
||||||
Loading…
Reference in New Issue
Block a user