diff --git a/.config b/.config
index 140adcf..5efd2ac 100644
--- a/.config
+++ b/.config
@@ -462,7 +462,7 @@ CONFIG_PKG_QMODBUS_PATH="/packages/iot/qmodbus"
CONFIG_MB_USING_PORT_RTT=y
# CONFIG_MB_USING_RAW_PRT is not set
# CONFIG_MB_USING_ADDR_CHK is not set
-CONFIG_MB_USING_MBAP_CHK=y
+# CONFIG_MB_USING_MBAP_CHK is not set
CONFIG_MB_USING_RTU_BACKEND=y
# CONFIG_MB_USING_TCP_BACKEND is not set
# CONFIG_MB_USING_SOCK_BACKEND is not set
@@ -937,6 +937,7 @@ CONFIG_PKG_LITTLEFS_VER="v2.11.2"
#
# CONFIG_PKG_USING_GD32_ARM_CMSIS_DRIVER is not set
# CONFIG_PKG_USING_GD32_ARM_SERIES_DRIVER is not set
+# CONFIG_PKG_USING_GD32_RISCV_SERIES_DRIVER is not set
# end of GD32 Drivers
#
@@ -989,6 +990,7 @@ CONFIG_PKG_LITTLEFS_VER="v2.11.2"
# CONFIG_PKG_USING_RT3020 is not set
# CONFIG_PKG_USING_MLX90632 is not set
# CONFIG_PKG_USING_MLX90382 is not set
+# CONFIG_PKG_USING_MLX90384 is not set
# CONFIG_PKG_USING_MLX90393 is not set
# CONFIG_PKG_USING_MLX90392 is not set
# CONFIG_PKG_USING_MLX90394 is not set
@@ -1141,6 +1143,7 @@ CONFIG_PKG_RS485_VER="v1.06"
# CONFIG_PKG_USING_IC74HC165 is not set
# CONFIG_PKG_USING_IST8310 is not set
# CONFIG_PKG_USING_ST7789_SPI is not set
+# CONFIG_PKG_USING_ISOTP_C is not set
# CONFIG_PKG_USING_SPI_TOOLS is not set
# end of peripheral libraries and drivers
diff --git a/.cproject b/.cproject
index 6a264d8..ee6d579 100644
--- a/.cproject
+++ b/.cproject
@@ -61,7 +61,11 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -410,6 +746,9 @@
-
+
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml
index 7b0d554..7b03ec2 100644
--- a/.settings/language.settings.xml
+++ b/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
diff --git a/applications/PLC_link.c b/applications/PLC_link.c
index 20a4c83..bdbb589 100644
--- a/applications/PLC_link.c
+++ b/applications/PLC_link.c
@@ -1,4 +1,5 @@
/*
+#include
#include
* Copyright (c) 2006-2021, RT-Thread Development Team
*
@@ -12,6 +13,7 @@
*/
#include "rtthread.h"
+#include "modbus.h"
#define DBG_TAG "plc.rtu"
#define DBG_LVL DBG_LOG
diff --git a/exclude_list.json b/exclude_list.json
index 41b4508..839aa7a 100644
--- a/exclude_list.json
+++ b/exclude_list.json
@@ -1 +1 @@
-[{"config_name":"Debug","exclude_files":["packages/sqlite-v3.19.3/dbhelper.c","packages/sqlite-v3.19.3/rtthread_vfs.c","drivers/drv_ltdc.c","packages/sqlite/rtthread_io_methods.c","packages/sqlite/rtthread_mutex.c","packages/sqlite/rtthread_vfs.c","packages/sqlite/shell.c"]}]
\ No newline at end of file
+[{"config_name":"Debug","exclude_files":["packages/sqlite-v3.19.3/dbhelper.c","packages/sqlite-v3.19.3/rtthread_vfs.c","drivers/drv_ltdc.c","packages/sqlite/rtthread_io_methods.c","packages/sqlite/rtthread_mutex.c","packages/sqlite/rtthread_vfs.c","packages/sqlite/shell.c","packages/qmodbus/src/modbus_pdu.c","packages/qmodbus/src/modbus_backend.c","packages/qmodbus/src/modbus_tcp.c","packages/qmodbus/src/modbus_port_linux.c"]}]
\ No newline at end of file
diff --git a/packages/qmodbus/sample/mb_sample_rtu_master.c b/packages/qmodbus/mb_sample_rtu_master.c
similarity index 97%
rename from packages/qmodbus/sample/mb_sample_rtu_master.c
rename to packages/qmodbus/mb_sample_rtu_master.c
index ee0840b..7d91f3e 100644
--- a/packages/qmodbus/sample/mb_sample_rtu_master.c
+++ b/packages/qmodbus/mb_sample_rtu_master.c
@@ -1,5 +1,4 @@
/*
-#include
* mb_sample_rtu_master.c
*
* Change Logs:
@@ -8,6 +7,7 @@
*/
#include "rtthread.h"
+#include "modbus.h"
#ifdef MB_USING_SAMPLE_RTU_MASTER
diff --git a/packages/qmodbus/sample/mb_sample_rtu_slave.c b/packages/qmodbus/mb_sample_rtu_slave.c
similarity index 98%
rename from packages/qmodbus/sample/mb_sample_rtu_slave.c
rename to packages/qmodbus/mb_sample_rtu_slave.c
index de84bc4..fa97ba7 100644
--- a/packages/qmodbus/sample/mb_sample_rtu_slave.c
+++ b/packages/qmodbus/mb_sample_rtu_slave.c
@@ -1,5 +1,4 @@
/*
-#include
* mb_sample_rtu_slave.c
*
* Change Logs:
@@ -8,6 +7,7 @@
*/
#include "rtthread.h"
+#include "modbus.h"
#ifdef MB_USING_SAMPLE_RTU_SLAVE
diff --git a/packages/qmodbus/sample/mb_sample_tcp_master.c b/packages/qmodbus/mb_sample_tcp_master.c
similarity index 97%
rename from packages/qmodbus/sample/mb_sample_tcp_master.c
rename to packages/qmodbus/mb_sample_tcp_master.c
index de9cc24..b840d4e 100644
--- a/packages/qmodbus/sample/mb_sample_tcp_master.c
+++ b/packages/qmodbus/mb_sample_tcp_master.c
@@ -1,5 +1,4 @@
/*
-#include
* mb_sample_tcp_master.c
*
* Change Logs:
@@ -8,6 +7,7 @@
*/
#include "rtthread.h"
+#include "modbus.h"
#ifdef MB_USING_SAMPLE_TCP_MASTER
diff --git a/packages/qmodbus/sample/mb_sample_tcp_slave.c b/packages/qmodbus/mb_sample_tcp_slave.c
similarity index 98%
rename from packages/qmodbus/sample/mb_sample_tcp_slave.c
rename to packages/qmodbus/mb_sample_tcp_slave.c
index c1b9d01..cf86038 100644
--- a/packages/qmodbus/sample/mb_sample_tcp_slave.c
+++ b/packages/qmodbus/mb_sample_tcp_slave.c
@@ -1,5 +1,4 @@
/*
-#include
* mb_sample_tcp_slave.c
*
* Change Logs:
@@ -8,6 +7,7 @@
*/
#include "rtthread.h"
+#include "modbus.h"
#ifdef MB_USING_SAMPLE_TCP_SLAVE
diff --git a/packages/qmodbus/sample/mb_sample_tcp_srv_slave.c b/packages/qmodbus/mb_sample_tcp_srv_slave.c
similarity index 99%
rename from packages/qmodbus/sample/mb_sample_tcp_srv_slave.c
rename to packages/qmodbus/mb_sample_tcp_srv_slave.c
index 7516d10..a868b91 100644
--- a/packages/qmodbus/sample/mb_sample_tcp_srv_slave.c
+++ b/packages/qmodbus/mb_sample_tcp_srv_slave.c
@@ -1,5 +1,4 @@
/*
-#include
* mb_sample_tcp_slave.c
*
* Change Logs:
@@ -10,6 +9,7 @@
#include
#include
#include "rtthread.h"
+#include "modbus.h"
#ifdef MB_USING_SAMPLE_TCP_SRV_SLAVE
diff --git a/packages/qmodbus/src/modbus.c b/packages/qmodbus/modbus.c
similarity index 96%
rename from packages/qmodbus/src/modbus.c
rename to packages/qmodbus/modbus.c
index 3f25bb1..0433e08 100644
--- a/packages/qmodbus/src/modbus.c
+++ b/packages/qmodbus/modbus.c
@@ -1,7 +1,4 @@
/*
-#include
-#include
-#include
* modbus.c
*
* Change Logs:
@@ -11,6 +8,9 @@
#include
#include
+#include "modbus.h"
+#include "modbus_cvt.h"
+#include "modbus_port.h"
#ifdef MB_USING_RAW_PRT
static void mb_raw_prt(bool is_send, const u8 *pdata, int dlen)//原始数据打印
diff --git a/packages/qmodbus/inc/modbus.h b/packages/qmodbus/modbus.h
similarity index 96%
rename from packages/qmodbus/inc/modbus.h
rename to packages/qmodbus/modbus.h
index 1543a49..2923071 100644
--- a/packages/qmodbus/inc/modbus.h
+++ b/packages/qmodbus/modbus.h
@@ -7,14 +7,13 @@
*/
#ifndef __MODBUS_H__
-
#define __MODBUS_H__
-#include
-#include
-#include
-#include
-#include
+#include "modbus_cvt.h"
+#include "modbus_rtu.h"
+#include "modbus_tcp.h"
+#include "modbus_port.h"
+#include "modbus_backend.h"
#ifdef MB_TCP_FRM_MAX
#define MB_BUF_SIZE MB_TCP_FRM_MAX
diff --git a/packages/qmodbus/src/modbus_backend.c b/packages/qmodbus/modbus_backend.c
similarity index 98%
rename from packages/qmodbus/src/modbus_backend.c
rename to packages/qmodbus/modbus_backend.c
index c6f296a..e5c74a1 100644
--- a/packages/qmodbus/src/modbus_backend.c
+++ b/packages/qmodbus/modbus_backend.c
@@ -1,6 +1,4 @@
/*
-#include
-#include
* modbus_backend.c
*
* Change Logs:
@@ -10,6 +8,8 @@
#include
#include
+#include "modbus_backend.h"
+#include "modbus_port.h"
#ifdef MB_USING_RTU_BACKEND
diff --git a/packages/qmodbus/inc/modbus_backend.h b/packages/qmodbus/modbus_backend.h
similarity index 97%
rename from packages/qmodbus/inc/modbus_backend.h
rename to packages/qmodbus/modbus_backend.h
index ac10b7c..b10e0f9 100644
--- a/packages/qmodbus/inc/modbus_backend.h
+++ b/packages/qmodbus/modbus_backend.h
@@ -7,11 +7,10 @@
*/
#ifndef __MODBUS_BACKEND_H__
-
#define __MODBUS_BACKEND_H__
-#include
-#include
+#include "modbus_cfg.h"
+#include "typedef.h"
#define MB_BKD_ACK_TMO_MS_DEF 300
#define MB_BKD_BYTE_TMO_MS_DEF 32
diff --git a/packages/qmodbus/inc/modbus_cfg.h b/packages/qmodbus/modbus_cfg.h
similarity index 100%
rename from packages/qmodbus/inc/modbus_cfg.h
rename to packages/qmodbus/modbus_cfg.h
diff --git a/packages/qmodbus/src/modbus_crc.c b/packages/qmodbus/modbus_crc.c
similarity index 98%
rename from packages/qmodbus/src/modbus_crc.c
rename to packages/qmodbus/modbus_crc.c
index 2a548cb..9b3e1d2 100644
--- a/packages/qmodbus/src/modbus_crc.c
+++ b/packages/qmodbus/modbus_crc.c
@@ -6,7 +6,7 @@
* 2024-04-02 qiyongzhong first version
*/
-#include
+#include "modbus_crc.h"
static const u16 mb_crc_table[] = {
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
diff --git a/packages/qmodbus/inc/modbus_crc.h b/packages/qmodbus/modbus_crc.h
similarity index 88%
rename from packages/qmodbus/inc/modbus_crc.h
rename to packages/qmodbus/modbus_crc.h
index f4542ad..940cce8 100644
--- a/packages/qmodbus/inc/modbus_crc.h
+++ b/packages/qmodbus/modbus_crc.h
@@ -7,10 +7,9 @@
*/
#ifndef __MODBUS_CRC_H__
-
#define __MODBUS_CRC_H__
-#include
+#include "typedef.h"
#define MB_CRC_INIT_VOL 0xFFFF
diff --git a/packages/qmodbus/src/modbus_cvt.c b/packages/qmodbus/modbus_cvt.c
similarity index 97%
rename from packages/qmodbus/src/modbus_cvt.c
rename to packages/qmodbus/modbus_cvt.c
index 2dc27e9..a6356b2 100644
--- a/packages/qmodbus/src/modbus_cvt.c
+++ b/packages/qmodbus/modbus_cvt.c
@@ -6,7 +6,7 @@
* 2024-04-01 qiyongzhong first version
*/
-#include
+#include "modbus_cvt.h"
int mb_cvt_u8_put(u8 *buf, u8 val)
{
diff --git a/packages/qmodbus/inc/modbus_cvt.h b/packages/qmodbus/modbus_cvt.h
similarity index 94%
rename from packages/qmodbus/inc/modbus_cvt.h
rename to packages/qmodbus/modbus_cvt.h
index d2a1ea6..531e629 100644
--- a/packages/qmodbus/inc/modbus_cvt.h
+++ b/packages/qmodbus/modbus_cvt.h
@@ -7,10 +7,9 @@
*/
#ifndef __MODBUS_CVT_H__
-
#define __MODBUS_CVT_H__
-#include
+#include "typedef.h"
int mb_cvt_u8_put(u8 *buf, u8 val);
int mb_cvt_u8_get(const u8 *buf, u8 *pval);
diff --git a/packages/qmodbus/src/modbus_master.c b/packages/qmodbus/modbus_master.c
similarity index 99%
rename from packages/qmodbus/src/modbus_master.c
rename to packages/qmodbus/modbus_master.c
index 6a39fc3..f9c0bf2 100644
--- a/packages/qmodbus/src/modbus_master.c
+++ b/packages/qmodbus/modbus_master.c
@@ -1,7 +1,4 @@
/*
-#include
-#include
-#include
* modbus_master.c
*
* Change Logs:
@@ -10,6 +7,9 @@
*/
#include
+#include "modbus.h"
+#include "modbus_cvt.h"
+#include "modbus_port.h"
#ifdef MB_USING_MASTER
diff --git a/packages/qmodbus/src/modbus_pdu.c b/packages/qmodbus/modbus_pdu.c
similarity index 99%
rename from packages/qmodbus/src/modbus_pdu.c
rename to packages/qmodbus/modbus_pdu.c
index 1cb3bed..e24f290 100644
--- a/packages/qmodbus/src/modbus_pdu.c
+++ b/packages/qmodbus/modbus_pdu.c
@@ -1,6 +1,4 @@
/*
-#include
-#include
* modbus_pdu.c
*
* Change Logs:
@@ -9,6 +7,8 @@
*/
#include
+#include "modbus_pdu.h"
+#include "modbus_cvt.h"
static int mb_pdu_except_make(u8 *buf, const mb_pdu_except_t *exc)
{
diff --git a/packages/qmodbus/inc/modbus_pdu.h b/packages/qmodbus/modbus_pdu.h
similarity index 99%
rename from packages/qmodbus/inc/modbus_pdu.h
rename to packages/qmodbus/modbus_pdu.h
index cb9cd80..f763987 100644
--- a/packages/qmodbus/inc/modbus_pdu.h
+++ b/packages/qmodbus/modbus_pdu.h
@@ -7,10 +7,9 @@
*/
#ifndef __MODBUS_PDU_H__
-
#define __MODBUS_PDU_H__
-#include
+#include "typedef.h"
#define MB_PDU_SIZE_MIN 2 //最小pdu尺寸
#define MB_PDU_SIZE_MAX 253 //最大pdu尺寸
diff --git a/packages/qmodbus/inc/modbus_port.h b/packages/qmodbus/modbus_port.h
similarity index 98%
rename from packages/qmodbus/inc/modbus_port.h
rename to packages/qmodbus/modbus_port.h
index 996b654..cf61231 100644
--- a/packages/qmodbus/inc/modbus_port.h
+++ b/packages/qmodbus/modbus_port.h
@@ -7,10 +7,9 @@
*/
#ifndef __MODBUS_PORT_H__
-
#define __MODBUS_PORT_H__
-#include
+#include "modbus_backend.h"
#define MB_ASSERT(x) //ASSERT(x)
#define MB_WEAK __attribute__((weak))
diff --git a/packages/qmodbus/src/modbus_port_linux.c b/packages/qmodbus/modbus_port_linux.c
similarity index 99%
rename from packages/qmodbus/src/modbus_port_linux.c
rename to packages/qmodbus/modbus_port_linux.c
index 7ccea8b..3b26f98 100644
--- a/packages/qmodbus/src/modbus_port_linux.c
+++ b/packages/qmodbus/modbus_port_linux.c
@@ -6,7 +6,7 @@
* 2024-04-02 qiyongzhong first version
*/
-#include
+#include "modbus_port.h"
#ifdef MB_USING_PORT_LINUX
diff --git a/packages/qmodbus/src/modbus_port_rtt.c b/packages/qmodbus/modbus_port_rtt.c
similarity index 99%
rename from packages/qmodbus/src/modbus_port_rtt.c
rename to packages/qmodbus/modbus_port_rtt.c
index 12af3a1..f32cd21 100644
--- a/packages/qmodbus/src/modbus_port_rtt.c
+++ b/packages/qmodbus/modbus_port_rtt.c
@@ -6,7 +6,7 @@
* 2024-04-02 qiyongzhong first version
*/
-#include
+#include "modbus_port.h"
#ifdef MB_USING_PORT_RTT
diff --git a/packages/qmodbus/src/modbus_port_slave.c b/packages/qmodbus/modbus_port_slave.c
similarity index 95%
rename from packages/qmodbus/src/modbus_port_slave.c
rename to packages/qmodbus/modbus_port_slave.c
index 5529b3a..34b0d3d 100644
--- a/packages/qmodbus/src/modbus_port_slave.c
+++ b/packages/qmodbus/modbus_port_slave.c
@@ -6,7 +6,7 @@
* 2024-04-02 qiyongzhong first version
*/
-#include
+#include "modbus_port.h"
#ifdef MB_USING_SLAVE
MB_WEAK int mb_port_read_disc(u16 addr, u8 *pbit)//读离散量输入, 返回 : 0-成功, -2-地址错误
diff --git a/packages/qmodbus/src/modbus_rtu.c b/packages/qmodbus/modbus_rtu.c
similarity index 89%
rename from packages/qmodbus/src/modbus_rtu.c
rename to packages/qmodbus/modbus_rtu.c
index 794fb76..ca227c0 100644
--- a/packages/qmodbus/src/modbus_rtu.c
+++ b/packages/qmodbus/modbus_rtu.c
@@ -6,9 +6,9 @@
* 2024-04-01 qiyongzhong first version
*/
-#include
-#include
-#include
+#include "modbus_rtu.h"
+#include "modbus_crc.h"
+#include "modbus_cvt.h"
#ifdef MB_USING_RTU_PROTOCOL
diff --git a/packages/qmodbus/inc/modbus_rtu.h b/packages/qmodbus/modbus_rtu.h
similarity index 91%
rename from packages/qmodbus/inc/modbus_rtu.h
rename to packages/qmodbus/modbus_rtu.h
index 33e5bfa..a88c884 100644
--- a/packages/qmodbus/inc/modbus_rtu.h
+++ b/packages/qmodbus/modbus_rtu.h
@@ -7,11 +7,10 @@
*/
#ifndef __MODBUS_RTU_H__
-
#define __MODBUS_RTU_H__
-#include
-#include
+#include "modbus_cfg.h"
+#include "modbus_pdu.h"
#ifdef MB_USING_RTU_PROTOCOL
diff --git a/packages/qmodbus/src/modbus_slave.c b/packages/qmodbus/modbus_slave.c
similarity index 98%
rename from packages/qmodbus/src/modbus_slave.c
rename to packages/qmodbus/modbus_slave.c
index 6fec509..7f4241a 100644
--- a/packages/qmodbus/src/modbus_slave.c
+++ b/packages/qmodbus/modbus_slave.c
@@ -1,7 +1,4 @@
/*
-#include
-#include
-#include
* modbus_slave.c
*
* Change Logs:
@@ -10,6 +7,9 @@
*/
#include
+#include "modbus.h"
+#include "modbus_cvt.h"
+#include "modbus_port.h"
#ifdef MB_USING_SLAVE
diff --git a/packages/qmodbus/src/modbus_tcp.c b/packages/qmodbus/modbus_tcp.c
similarity index 93%
rename from packages/qmodbus/src/modbus_tcp.c
rename to packages/qmodbus/modbus_tcp.c
index 47dd9bf..1d8dc02 100644
--- a/packages/qmodbus/src/modbus_tcp.c
+++ b/packages/qmodbus/modbus_tcp.c
@@ -6,8 +6,8 @@
* 2024-04-01 qiyongzhong first version
*/
-#include
-#include
+#include "modbus_tcp.h"
+#include "modbus_cvt.h"
#ifdef MB_USING_TCP_PROTOCOL
diff --git a/packages/qmodbus/inc/modbus_tcp.h b/packages/qmodbus/modbus_tcp.h
similarity index 92%
rename from packages/qmodbus/inc/modbus_tcp.h
rename to packages/qmodbus/modbus_tcp.h
index 35e8612..4eca95c 100644
--- a/packages/qmodbus/inc/modbus_tcp.h
+++ b/packages/qmodbus/modbus_tcp.h
@@ -7,11 +7,10 @@
*/
#ifndef __MODBUS_TCP_H__
-
#define __MODBUS_TCP_H__
-#include
-#include
+#include "modbus_cfg.h"
+#include "modbus_pdu.h"
#ifdef MB_USING_TCP_PROTOCOL
diff --git a/packages/qmodbus/inc/typedef.h b/packages/qmodbus/typedef.h
similarity index 100%
rename from packages/qmodbus/inc/typedef.h
rename to packages/qmodbus/typedef.h
diff --git a/rtconfig.h b/rtconfig.h
index 07e768b..332761c 100644
--- a/rtconfig.h
+++ b/rtconfig.h
@@ -230,7 +230,6 @@
/* end of IoT Cloud */
#define PKG_USING_QMODBUS
#define MB_USING_PORT_RTT
-#define MB_USING_MBAP_CHK
#define MB_USING_RTU_BACKEND
#define MB_USING_RTU_PROTOCOL
#define MB_USING_MASTER