Przeglądaj źródła

更新和功能

liwenbin 8 miesięcy temu
rodzic
commit
5059448103
100 zmienionych plików z 7953 dodań i 4002 usunięć
  1. 5 0
      .idea/codeStyles/codeStyleConfig.xml
  2. 8 0
      .idea/modules.xml
  3. 156 26
      .idea/workspace.xml
  4. 1 0
      .mxproject
  5. 8 6
      CMakeLists.txt
  6. 7 0
      Core/Inc/ffx_master.h
  7. 10 0
      Core/Inc/mini_gateway_master.h
  8. 49 0
      Core/Inc/modbus_slave.h
  9. 1 0
      Core/Inc/stm32f1xx_it.h
  10. 87 29
      Core/Src/ffx_master.c
  11. 10 3
      Core/Src/main.c
  12. 105 8
      Core/Src/mini_gateway_master.c
  13. 130 0
      Core/Src/modbus_slave.c
  14. 26 0
      Core/Src/stm32f1xx_it.c
  15. 26 0
      Middlewares/Third_Party/FreeModbus/bsd.txt
  16. 340 0
      Middlewares/Third_Party/FreeModbus/gpl.txt
  17. 504 0
      Middlewares/Third_Party/FreeModbus/lgpl.txt
  18. 486 0
      Middlewares/Third_Party/FreeModbus/modbus/ascii/mbascii.c
  19. 56 0
      Middlewares/Third_Party/FreeModbus/modbus/ascii/mbascii.h
  20. 269 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfunccoils.c
  21. 390 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfunccoils_m.c
  22. 29 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdiag.c
  23. 133 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdisc.c
  24. 162 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdisc_m.c
  25. 32 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncfile.c
  26. 308 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncholding.c
  27. 455 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncholding_m.c
  28. 122 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncinput.c
  29. 148 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncinput_m.c
  30. 88 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncother.c
  31. 142 0
      Middlewares/Third_Party/FreeModbus/modbus/functions/mbutils.c
  32. 424 0
      Middlewares/Third_Party/FreeModbus/modbus/include/mb.h
  33. 417 0
      Middlewares/Third_Party/FreeModbus/modbus/include/mb_m.h
  34. 126 0
      Middlewares/Third_Party/FreeModbus/modbus/include/mbconfig.h
  35. 87 0
      Middlewares/Third_Party/FreeModbus/modbus/include/mbframe.h
  36. 84 0
      Middlewares/Third_Party/FreeModbus/modbus/include/mbfunc.h
  37. 214 0
      Middlewares/Third_Party/FreeModbus/modbus/include/mbport.h
  38. 84 0
      Middlewares/Third_Party/FreeModbus/modbus/include/mbproto.h
  39. 108 0
      Middlewares/Third_Party/FreeModbus/modbus/include/mbutils.h
  40. 415 0
      Middlewares/Third_Party/FreeModbus/modbus/mb.c
  41. 98 0
      Middlewares/Third_Party/FreeModbus/modbus/rtu/mbcrc.c
  42. 36 0
      Middlewares/Third_Party/FreeModbus/modbus/rtu/mbcrc.h
  43. 361 0
      Middlewares/Third_Party/FreeModbus/modbus/rtu/mbrtu.c
  44. 64 0
      Middlewares/Third_Party/FreeModbus/modbus/rtu/mbrtu.h
  45. 158 0
      Middlewares/Third_Party/FreeModbus/modbus/tcp/mbtcp.c
  46. 53 0
      Middlewares/Third_Party/FreeModbus/modbus/tcp/mbtcp.h
  47. 30 0
      Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portcritical.c
  48. 82 0
      Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portevent.c
  49. 178 0
      Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portserial.c
  50. 79 0
      Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/porttimer.c
  51. 69 0
      Middlewares/Third_Party/FreeModbus/port/port.h
  52. 285 0
      Middlewares/Third_Party/FreeModbus/port/user_mb_app.c
  53. 48 0
      Middlewares/Third_Party/FreeModbus/port/user_mb_app.h
  54. 0 1207
      cmake-build-debug-mingw/.cmake/api/v1/reply/cache-v2-c2d184a70121e4b5cc51.json
  55. 0 1238
      cmake-build-debug-mingw/.cmake/api/v1/reply/cmakeFiles-v1-27eb94a99a8aa9ca0fc1.json
  56. 0 60
      cmake-build-debug-mingw/.cmake/api/v1/reply/codemodel-v2-6b33da970254852e2625.json
  57. 0 108
      cmake-build-debug-mingw/.cmake/api/v1/reply/index-2024-10-17T10-08-27-0165.json
  58. 0 1211
      cmake-build-debug-mingw/.cmake/api/v1/reply/target-gmv-gateway-board.elf-Debug-326a890ddc764dc957b2.json
  59. BIN
      cmake-build-debug-mingw/.ninja_deps
  60. 106 38
      cmake-build-debug-mingw/.ninja_log
  61. 6 6
      cmake-build-debug-mingw/CMakeCache.txt
  62. BIN
      cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeDetermineCompilerABI_C.bin
  63. BIN
      cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeDetermineCompilerABI_CXX.bin
  64. 42 42
      cmake-build-debug-mingw/CMakeFiles/CMakeConfigureLog.yaml
  65. 3 3
      cmake-build-debug-mingw/CMakeFiles/TargetDirectories.txt
  66. 3 17
      cmake-build-debug-mingw/CMakeFiles/clion-Debug-MinGW-log.txt
  67. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj
  68. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/freertos.c.obj
  69. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/gpio.c.obj
  70. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/main.c.obj
  71. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj
  72. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/modbus.c.obj
  73. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_msp.c.obj
  74. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_timebase_tim.c.obj
  75. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_it.c.obj
  76. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/syscalls.c.obj
  77. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/sysmem.c.obj
  78. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/system_stm32f1xx.c.obj
  79. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/usart.c.obj
  80. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Startup/startup_stm32f103rctx.s.obj
  81. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c.obj
  82. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c.obj
  83. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c.obj
  84. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c.obj
  85. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c.obj
  86. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c.obj
  87. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c.obj
  88. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c.obj
  89. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c.obj
  90. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c.obj
  91. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c.obj
  92. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c.obj
  93. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c.obj
  94. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c.obj
  95. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c.obj
  96. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/croutine.c.obj
  97. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c.obj
  98. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/list.c.obj
  99. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c.obj
  100. BIN
      cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c.obj

+ 5 - 0
.idea/codeStyles/codeStyleConfig.xml

@@ -0,0 +1,5 @@
+<component name="ProjectCodeStyleConfiguration">
+  <state>
+    <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
+  </state>
+</component>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/gmv-gateway-board.iml" filepath="$PROJECT_DIR$/.idea/gmv-gateway-board.iml" />
+    </modules>
+  </component>
+</project>

+ 156 - 26
.idea/workspace.xml

@@ -21,15 +21,115 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="01ce1271-fbf8-4e14-b10b-a2875bdb8cd4" name="更改" comment="">
-      <change afterPath="$PROJECT_DIR$/Core/Inc/ffx_master.h" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Core/Inc/mini_gateway_master.h" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Core/Inc/modbus.h" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Core/Src/ffx_master.c" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Core/Src/mini_gateway_master.c" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Core/Src/modbus.c" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Core/Inc/modbus_slave.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Core/Src/modbus_slave.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/bsd.txt" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/gpl.txt" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/lgpl.txt" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/ascii/mbascii.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/ascii/mbascii.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfunccoils.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfunccoils_m.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdiag.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdisc.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdisc_m.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncfile.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncholding.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncholding_m.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncinput.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncinput_m.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncother.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/functions/mbutils.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/include/mb.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/include/mb_m.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/include/mbconfig.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/include/mbframe.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/include/mbfunc.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/include/mbport.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/include/mbproto.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/include/mbutils.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/mb.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/rtu/mbcrc.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/rtu/mbcrc.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/rtu/mbrtu.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/rtu/mbrtu.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/tcp/mbtcp.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/modbus/tcp/mbtcp.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portcritical.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portevent.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portserial.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/porttimer.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/port/port.h" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/port/user_mb_app.c" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Middlewares/Third_Party/FreeModbus/port/user_mb_app.h" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.mxproject" beforeDir="false" afterPath="$PROJECT_DIR$/.mxproject" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Inc/ffx_master.h" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Inc/ffx_master.h" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Inc/mini_gateway_master.h" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Inc/mini_gateway_master.h" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Inc/stm32f1xx_it.h" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Inc/stm32f1xx_it.h" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Src/ffx_master.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/ffx_master.c" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Src/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/main.c" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Src/mini_gateway_master.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/mini_gateway_master.c" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Src/stm32f1xx_it.c" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Src/stm32f1xx_it.c" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/.cmake/api/v1/reply/cache-v2-c2d184a70121e4b5cc51.json" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/.cmake/api/v1/reply/cmakeFiles-v1-27eb94a99a8aa9ca0fc1.json" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/.cmake/api/v1/reply/codemodel-v2-6b33da970254852e2625.json" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/.cmake/api/v1/reply/index-2024-10-17T10-08-27-0165.json" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/.cmake/api/v1/reply/target-gmv-gateway-board.elf-Debug-326a890ddc764dc957b2.json" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/.ninja_deps" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/.ninja_deps" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/.ninja_log" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/.ninja_log" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeCache.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeCache.txt" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeDetermineCompilerABI_C.bin" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeDetermineCompilerABI_C.bin" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeDetermineCompilerABI_CXX.bin" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeDetermineCompilerABI_CXX.bin" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/CMakeConfigureLog.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/CMakeConfigureLog.yaml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/TargetDirectories.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/TargetDirectories.txt" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/clion-Debug-MinGW-log.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/clion-Debug-MinGW-log.txt" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/freertos.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/freertos.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/gpio.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/gpio.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/main.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/main.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/modbus.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/modbus.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_msp.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_msp.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_timebase_tim.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_timebase_tim.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_it.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_it.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/syscalls.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/syscalls.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/sysmem.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/sysmem.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/system_stm32f1xx.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/system_stm32f1xx.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/usart.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/usart.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Startup/startup_stm32f103rctx.s.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Startup/startup_stm32f103rctx.s.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/croutine.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/croutine.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/list.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/list.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/queue.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/queue.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/tasks.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/tasks.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/timers.c.obj" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/timers.c.obj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/rules.ninja" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/CMakeFiles/rules.ninja" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/Testing/Temporary/LastTest.log" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/Testing/Temporary/LastTest.log" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/build.ninja" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/build.ninja" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/cmake-build-debug-mingw/cmake_install.cmake" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug-mingw/cmake_install.cmake" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/gmv-gateway-board.ioc" beforeDir="false" afterPath="$PROJECT_DIR$/gmv-gateway-board.ioc" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -57,35 +157,48 @@
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
-  <component name="PropertiesComponent">{
-  &quot;keyToString&quot;: {
-    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
-    &quot;RunOnceActivity.cidr.known.project.marker&quot;: &quot;true&quot;,
-    &quot;RunOnceActivity.readMode.enableVisualFormatting&quot;: &quot;true&quot;,
-    &quot;cf.first.check.clang-format&quot;: &quot;false&quot;,
-    &quot;cidr.known.project.marker&quot;: &quot;true&quot;,
-    &quot;git-widget-placeholder&quot;: &quot;master&quot;,
-    &quot;last_opened_file_path&quot;: &quot;C:/Users/DELL/CLionProjects/gmv-gateway-board/Core/Src&quot;,
-    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
-    &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
-    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
-    &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
-    &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
-    &quot;settings.editor.selected.configurable&quot;: &quot;CMakeSettings&quot;,
-    &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
+  <component name="PropertiesComponent"><![CDATA[{
+  "keyToString": {
+    "CMake 应用程序.gmv-gateway-board.elf.executor": "Run",
+    "OpenOCD 下载并运行.OCD gmv-gateway-board.executor": "Debug",
+    "RunOnceActivity.ShowReadmeOnStart": "true",
+    "RunOnceActivity.cidr.known.project.marker": "true",
+    "RunOnceActivity.readMode.enableVisualFormatting": "true",
+    "SHARE_PROJECT_CONFIGURATION_FILES": "true",
+    "cf.first.check.clang-format": "false",
+    "cidr.known.project.marker": "true",
+    "git-widget-placeholder": "master",
+    "last_opened_file_path": "C:/Users/DELL/Desktop/1729591886844.jpg",
+    "node.js.detected.package.eslint": "true",
+    "node.js.detected.package.tslint": "true",
+    "node.js.selected.package.eslint": "(autodetect)",
+    "node.js.selected.package.tslint": "(autodetect)",
+    "nodejs_package_manager_path": "npm",
+    "settings.editor.selected.configurable": "fileTemplates",
+    "structure.view.defaults.are.configured": "true",
+    "vue.rearranger.settings.migration": "true"
   }
-}</component>
+}]]></component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
+      <recent name="C:\Users\DELL\Desktop\gmv-gateway-board\Middlewares\Third_Party" />
+      <recent name="C:\Users\DELL\Desktop\gmv-gateway-board\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2" />
+      <recent name="C:\Users\DELL\CLionProjects\gmv-gateway-board\Core\Inc" />
       <recent name="C:\Users\DELL\CLionProjects\gmv-gateway-board\Core\Src" />
       <recent name="C:\Users\DELL\CLionProjects\gmv-gateway-board\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2" />
     </key>
     <key name="MoveFile.RECENT_KEYS">
+      <recent name="C:\Users\DELL\Desktop\gmv-gateway-board\Core\Src" />
       <recent name="C:\Users\DELL\CLionProjects\gmv-gateway-board\Core\Src" />
       <recent name="C:\Users\DELL\CLionProjects\gmv-gateway-board\Core\Inc" />
     </key>
   </component>
   <component name="RunManager" selected="OpenOCD 下载并运行.OCD gmv-gateway-board">
+    <configuration default="true" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true">
+      <method v="2">
+        <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
+      </method>
+    </configuration>
     <configuration name="gmv-gateway-board.elf" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="gmv-gateway-board" TARGET_NAME="gmv-gateway-board.elf" CONFIG_NAME="Debug-MinGW" RUN_TARGET_PROJECT_NAME="gmv-gateway-board" RUN_TARGET_NAME="gmv-gateway-board.elf">
       <method v="2">
         <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
@@ -109,6 +222,19 @@
       <workItem from="1729071882365" duration="9000" />
       <workItem from="1729127338448" duration="7204000" />
       <workItem from="1729158876001" duration="66000" />
+      <workItem from="1729159641169" duration="1429000" />
+      <workItem from="1729161296926" duration="1810000" />
+      <workItem from="1729214288847" duration="1091000" />
+      <workItem from="1729217522360" duration="20756000" />
+      <workItem from="1729247460332" duration="162000" />
+      <workItem from="1729300053740" duration="14782000" />
+      <workItem from="1729316096216" duration="1860000" />
+      <workItem from="1729473635361" duration="6228000" />
+      <workItem from="1729480226857" duration="19657000" />
+      <workItem from="1729559621578" duration="4148000" />
+      <workItem from="1729577088491" duration="602000" />
+      <workItem from="1729580056881" duration="10586000" />
+      <workItem from="1729651575018" duration="8708000" />
     </task>
     <servers />
   </component>
@@ -120,4 +246,8 @@
     <isAutomaticFoundErrors value="true" />
     <isAutomaticReloadCMake value="true" />
   </component>
+  <component name="XSLT-Support.FileAssociations.UIState">
+    <expand />
+    <select />
+  </component>
 </project>

Plik diff jest za duży
+ 1 - 0
.mxproject


+ 8 - 6
CMakeLists.txt

@@ -49,17 +49,19 @@ else ()
     add_compile_options(-Og -g)
 endif ()
 
-include_directories(Core/Inc Drivers/STM32F1xx_HAL_Driver/Inc/Legacy Drivers/STM32F1xx_HAL_Driver/Inc Middlewares/Third_Party/FreeRTOS/Source/include Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 Drivers/CMSIS/Device/ST/STM32F1xx/Include Drivers/CMSIS/Include)
+include_directories(Core/Inc Drivers/STM32F1xx_HAL_Driver/Inc/Legacy
+        Drivers/STM32F1xx_HAL_Driver/Inc Middlewares/Third_Party/FreeRTOS/Source/include
+        Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 Drivers/CMSIS/Device/ST/STM32F1xx/Include Drivers/CMSIS/Include
+        Middlewares/Third_Party/FreeModbus/modbus/include
+        Middlewares/Third_Party/FreeModbus/port
+        Middlewares/Third_Party/FreeModbus/modbus/rtu
+)
 
 add_definitions(-DDEBUG -DUSE_HAL_DRIVER -DSTM32F103xE)
 
 file(GLOB_RECURSE SOURCES "Core/*.*" "Middlewares/*.*" "Drivers/*.*")
 
-set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/STM32F103RCTX_FLASH.ld
-        Core/Src/ffx_master.c
-        Core/Inc/ffx_master.h
-        Core/Src/mini_gateway_master.c
-        Core/Inc/mini_gateway_master.h)
+set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/STM32F103RCTX_FLASH.ld)
 
 add_link_options(-Wl,-gc-sections,--print-memory-usage,-Map=${PROJECT_BINARY_DIR}/${PROJECT_NAME}.map)
 add_link_options(-mcpu=cortex-m3 -mthumb -mthumb-interwork)

+ 7 - 0
Core/Inc/ffx_master.h

@@ -10,6 +10,13 @@
 #define SLAVE_ADDRESS_START 1
 #define SLAVE_ADDRESS_END 5
 
+#define POWER_FFX_ADDRESS 0
+#define SET_TEMP_FFX_ADDRESS 0x0E
+#define FAN_SPEED_FFX_ADDRESS 0x4
+#define TEMP_ON_FFX_ADDRESS 0x11
+#define TEMP_OFF_FFX_ADDRESS 0x12
+#define INNER_NUM_FFX_ADDRESS 0x59
+
 #define POWER_REG_ADDRESS 0
 #define WORK_MODE_REG_ADDRESS 1
 #define FAN_SPEED_REG_ADDRESS 4

+ 10 - 0
Core/Inc/mini_gateway_master.h

@@ -5,4 +5,14 @@
 #ifndef GMV_GATEWAY_BOARD_MINI_GATEWAY_MASTER_H
 #define GMV_GATEWAY_BOARD_MINI_GATEWAY_MASTER_H
 
+#include "ffx_master.h"
+
+#define MINI_GATEWAY_SLAVE_ADDRESS 0x01
+#define INNER_GROUP1_REG_ADDRESS 10
+#define INNER_GROUP2_REG_ADDRESS 11
+
+void mini_gateway_master_init(void);
+
+void sync_ac_status(ffx_status_t *status);
+
 #endif //GMV_GATEWAY_BOARD_MINI_GATEWAY_MASTER_H

+ 49 - 0
Core/Inc/modbus_slave.h

@@ -0,0 +1,49 @@
+//
+// Created by DELL on 2024/10/18.
+//
+
+#ifndef GMV_GATEWAY_BOARD_MODBUS_SLAVE_H
+#define GMV_GATEWAY_BOARD_MODBUS_SLAVE_H
+#include "main.h"
+// 定义从机寄存器开始地址和长度
+#define S_REG_HOLDING_START           0
+#define S_REG_HOLDING_NREGS           20
+
+#define COMMUNICATION_REG_ADDRESS 0 // 当前从机通讯地址
+#define POWER_REG_ADDRESS 1 // 电源地址
+#define WORK_MODE_REG_ADDRESS 2
+#define FAN_SPEED_REG_ADDRESS 3
+#define SET_TEMP_REG_ADDRESS 4
+
+
+/**
+ * 开启485从机
+ * @param address 从机地址
+ */
+void start_485_slave(uint8_t address);
+
+/**
+ * 设置故障位
+ * @param offset 位偏移量
+ */
+void set_err_code(uint8_t offset);
+
+/**
+ * 清除故障位
+ * @param offset 位偏移量
+ */
+void clear_err_code(uint8_t offset);
+
+/**
+ * 设置一个寄存器的值
+ * @param regAddress
+ */
+void set_reg_value(uint16_t regAddress, uint16_t value);
+
+/**
+ * 读取一个寄存器的值
+ * @param regAddress
+ * @return
+ */
+uint16_t get_reg_value(uint16_t regAddress);
+#endif //GMV_GATEWAY_BOARD_MODBUS_SLAVE_H

+ 1 - 0
Core/Inc/stm32f1xx_it.h

@@ -53,6 +53,7 @@ void BusFault_Handler(void);
 void UsageFault_Handler(void);
 void DebugMon_Handler(void);
 void TIM1_UP_IRQHandler(void);
+void TIM2_IRQHandler(void);
 void USART2_IRQHandler(void);
 void USART3_IRQHandler(void);
 void UART4_IRQHandler(void);

+ 87 - 29
Core/Src/ffx_master.c

@@ -6,80 +6,138 @@
 #include "modbus.h"
 #include "usart.h"
 #include "cmsis_os2.h"
+#include "mini_gateway_master.h"
+#include "modbus_slave.h"
 
 static nmbs_t nmbs;
-static uint8_t slaves[] = {0}; // 保存已经存在的从站号
+static uint8_t slaves[5] = {0}; // 保存已经存在的从站号
 static uint8_t index = 0;
+void search_ffx_slave();
 
 
 static int32_t uart_read(uint8_t *buf, uint16_t count, int32_t byte_timeout_ms,
-                         void *arg) {
+                         void *arg)
+{
     HAL_StatusTypeDef status = HAL_UART_Receive(&huart2, buf, count, byte_timeout_ms);
-    if (status == HAL_OK) {
+    if (status == HAL_OK)
+    {
         return count;
-    } else {
+    } else
+    {
         return 0;
     }
 }
 
 static int32_t uart_write(const uint8_t *buf, uint16_t count, int32_t byte_timeout_ms,
-                          void *arg) {
+                          void *arg)
+{
     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_SET);
     HAL_UART_Transmit(&huart2, buf, count, byte_timeout_ms);
     HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET);
     return count;
 }
 
-_Noreturn void ffx_mater_task(void *pv) {
-    for (;;) {
-        for (int i = 0; i < sizeof(slaves); i++) {
-            nmbs_set_destination_rtu_address(&nmbs, slaves[i]);
-            uint16_t data[2];
-            ffx_status_t ffxStatus;
-            nmbs_error err = nmbs_read_holding_registers(&nmbs, POWER_REG_ADDRESS, 2, data);
-            if(err == NMBS_ERROR_NONE) {
-                // TODO:
-                ffxStatus.power = data[0];
-                ffxStatus.mode = data[1];
+_Noreturn void ffx_poll_task(void *pv){
+    for (;;)
+    {
+        search_ffx_slave();
+        HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
+        osDelay(1000 * 60);
+    }
+}
+_Noreturn void ffx_mater_task(void *pv)
+{
+    for (;;)
+    {
+        ffx_status_t ffxStatus;
+        bool is_power_on = false;
+        for (int i = 0; i < sizeof(slaves); i++)
+        {
+            if (slaves[i] != 0)
+            {
+                nmbs_set_destination_rtu_address(&nmbs, slaves[i]);
+                uint16_t data[10];
+                uint16_t inner_data[1];
+                nmbs_error err = nmbs_read_holding_registers(&nmbs, POWER_FFX_ADDRESS, 2, data);
+                osDelay(200);
+                nmbs_read_holding_registers(&nmbs, INNER_NUM_FFX_ADDRESS, 1, &inner_data[0]);
+                osDelay(200);
+                nmbs_read_holding_registers(&nmbs, SET_TEMP_FFX_ADDRESS, 1, &data[2]);
+                osDelay(200);
+                nmbs_read_holding_registers(&nmbs, FAN_SPEED_FFX_ADDRESS, 1, &data[3]);
+                osDelay(200);
+                nmbs_read_holding_registers(&nmbs, TEMP_ON_FFX_ADDRESS, 1, &data[4]);
+                osDelay(200);
+                nmbs_read_holding_registers(&nmbs, TEMP_OFF_FFX_ADDRESS, 1, &data[5]);
+                if (err == NMBS_ERROR_NONE)
+                {
+                    ffxStatus.power = data[0];
+                    ffxStatus.mode = data[1];
+                    ffxStatus.set_temp = data[2];
+                    ffxStatus.fan_speed = data[3];
+                    ffxStatus.inner_num = inner_data[0];
+                    if (ffxStatus.power && !(is_power_on))
+                    {
+                        is_power_on = true;
+                        set_reg_value(POWER_REG_ADDRESS, ffxStatus.power);
+                        set_reg_value(WORK_MODE_REG_ADDRESS, ffxStatus.mode);
+                        set_reg_value(INNER_REG_ADDRESS, ffxStatus.inner_num);
+                        set_reg_value(FAN_SPEED_REG_ADDRESS, ffxStatus.fan_speed);
+                        set_reg_value(SET_TEMP_REG_ADDRESS, ffxStatus.set_temp);
+                        set_reg_value(TEMP_ON_FFX_ADDRESS, data[4]);
+                        set_reg_value(TEMP_OFF_FFX_ADDRESS, data[5]);
+                    }
+                    sync_ac_status(&ffxStatus);
+                }
+                osDelay(500);
             }
-            // 发送到消息队列
-
-
         }
-        osDelay(3000);
+        HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_12);// LED闪烁
+        if ((ffxStatus.power == 0) && (is_power_on == false))
+        {
+            set_reg_value(POWER_REG_ADDRESS, ffxStatus.power);
+        }
     }
 }
+
 // 检测从机是否存在
-bool check_slave_exist(uint8_t slave_addr) {
+bool check_slave_exist(uint8_t slave_addr)
+{
     nmbs_set_destination_rtu_address(&nmbs, slave_addr);
     uint16_t result;
+    HAL_Delay(300);
     nmbs_error err = nmbs_read_holding_registers(&nmbs, 0x01, 1, &result);
     return err == NMBS_ERROR_NONE;
 }
 
 // 轮询从站
-void search_ffx_slave() {
-    for (int i = SLAVE_ADDRESS_START; i <= SLAVE_ADDRESS_END; i++) {
+void search_ffx_slave()
+{
+    for (int i = SLAVE_ADDRESS_START; i <= SLAVE_ADDRESS_END; i++)
+    {
         bool exist = check_slave_exist(i);
-        if (exist) {
+        if (exist)
+        {
             slaves[index] = i;
             index++;
         }
+//        HAL_Delay(500);
     }
     index = 0;
 }
 
-
-void ffx_master_init() {
+void ffx_master_init()
+{
     nmbs_platform_conf platformConf;// 配置uart
     platformConf.transport = NMBS_TRANSPORT_RTU;// RTU
     platformConf.read = &uart_read;     // 读写函数
     platformConf.write = &uart_write;   // 读写函数
     nmbs_client_create(&nmbs, &platformConf);// 创建客户端
-    nmbs_set_read_timeout(&nmbs, 1000);//
-    nmbs_set_byte_timeout(&nmbs, 1000);
-    search_ffx_slave();
+    nmbs_set_read_timeout(&nmbs, 100);
+    nmbs_set_byte_timeout(&nmbs, 100);
+//    search_ffx_slave();
     // 开启轮询任务
+    osThreadNew(ffx_poll_task, NULL, NULL);
     osThreadNew(ffx_mater_task, NULL, NULL);
 }
 

+ 10 - 3
Core/Src/main.c

@@ -19,12 +19,14 @@
 /* Includes ------------------------------------------------------------------*/
 #include "main.h"
 #include "cmsis_os.h"
+#include "tim.h"
 #include "usart.h"
 #include "gpio.h"
-#include "ffx_master.h"
 
 /* Private includes ----------------------------------------------------------*/
 /* USER CODE BEGIN Includes */
+#include "mini_gateway_master.h"
+#include "modbus_slave.h"
 
 /* USER CODE END Includes */
 
@@ -35,7 +37,7 @@
 
 /* Private define ------------------------------------------------------------*/
 /* USER CODE BEGIN PD */
-
+extern void prvvTIMERExpiredISR();
 /* USER CODE END PD */
 
 /* Private macro -------------------------------------------------------------*/
@@ -93,8 +95,11 @@ int main(void)
   MX_UART4_Init();
   MX_USART2_UART_Init();
   MX_USART3_UART_Init();
+  MX_TIM2_Init();
   /* USER CODE BEGIN 2 */
     ffx_master_init();
+    mini_gateway_master_init();
+    start_485_slave(0x10);
   /* USER CODE END 2 */
 
   /* Init scheduler */
@@ -179,7 +184,9 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
     HAL_IncTick();
   }
   /* USER CODE BEGIN Callback 1 */
-
+    if (htim->Instance == TIM2) {
+        prvvTIMERExpiredISR();
+    }
   /* USER CODE END Callback 1 */
 }
 

+ 105 - 8
Core/Src/mini_gateway_master.c

@@ -5,21 +5,118 @@
 #include <stdint.h>
 #include "mini_gateway_master.h"
 #include "usart.h"
+#include "modbus.h"
+#include "cmsis_os2.h"
+#include "modbus_slave.h"
+
+static nmbs_t nmbs;
 
 static int32_t uart_read(uint8_t *buf, uint16_t count, int32_t byte_timeout_ms,
-                         void *arg) {
-    HAL_StatusTypeDef status = HAL_UART_Receive(&huart2, buf, count, byte_timeout_ms);
-    if (status == HAL_OK) {
+                         void *arg)
+{
+    HAL_StatusTypeDef status = HAL_UART_Receive(&huart4, buf, count, byte_timeout_ms);
+    if (status == HAL_OK)
+    {
         return count;
-    } else {
+    } else
+    {
         return 0;
     }
 }
 
 static int32_t uart_write(const uint8_t *buf, uint16_t count, int32_t byte_timeout_ms,
-                          void *arg) {
-    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_SET);
-    HAL_UART_Transmit(&huart2, buf, count, byte_timeout_ms);
-    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET);
+                          void *arg)
+{
+    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, GPIO_PIN_SET);
+    HAL_UART_Transmit(&huart4, buf, count, byte_timeout_ms);
+    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, GPIO_PIN_RESET);
     return count;
 }
+
+void sync_ac_status(ffx_status_t *status)
+{
+    uint16_t power;
+    uint16_t mode;
+    uint16_t fan_speed;
+    uint16_t set_temp;
+    if (status->power == 0x01)
+    {
+        power = 0xAA;
+        fan_speed = status->fan_speed + 1;
+        set_temp = status->set_temp;
+    } else
+        power = 0x55;
+    mode = status->mode + 1;
+    switch (status->mode)
+    {
+        case 0://制冷模式
+            mode = status->mode + 1;
+            break;
+        case 1://制热模式
+            mode = status->mode + 3;
+            break;
+        case 2://除湿模式
+            mode = status->mode;
+            break;
+        case 3://送风模式
+            mode = status->mode;
+            break;
+        case 4://加湿模式、送风
+            mode = 3;
+            break;
+        default:
+            break;
+    }
+    uint16_t regs[5] = {power, mode, set_temp, fan_speed, 0};
+//    nmbs_write_multiple_registers(&nmbs, 102 + 25 * (status->inner_num - 1), 5, regs);
+}
+
+_Noreturn void mini_mater_task(void *pv)
+{
+    for (;;)
+    {
+//        for (uint8_t i = 0; i < 10; i++)
+//        {
+//            bool regs[1] = {0};
+//            nmbs_error err = nmbs_read_coils(&nmbs, 120 + i, 1, &regs[0]);
+//            osDelay(300);
+//            if (err == NMBS_ERROR_NONE)
+//            {
+//                set_reg_value(INNER_POWER_REG_ADDRESS + i -1, regs[0]);
+//            }
+//        }
+        osDelay(300);
+        HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
+        osDelay(1);
+    }
+}
+
+void mini_gateway_master_init(void)
+{
+    nmbs_platform_conf platformConf;// 配置uart
+    platformConf.transport = NMBS_TRANSPORT_RTU;// RTU
+    platformConf.read = &uart_read;     // 读写函数
+    platformConf.write = &uart_write;   // 读写函数
+    nmbs_client_create(&nmbs, &platformConf);// 创建客户端
+    nmbs_set_read_timeout(&nmbs, 1000);//
+    nmbs_set_byte_timeout(&nmbs, 1000);
+    nmbs_set_destination_rtu_address(&nmbs, MINI_GATEWAY_SLAVE_ADDRESS);
+    for (uint8_t i = 0; i < 2; i++)
+    {
+        bool regs[2] = {0};
+        nmbs_error err = nmbs_read_coils(&nmbs, 120, 8, &regs[0]);
+        osDelay(300);
+        nmbs_error err_2 = nmbs_read_coils(&nmbs, 120, 8, &regs[0]);
+        osDelay(300);
+        if ((err_2 == NMBS_ERROR_NONE) && (err == NMBS_ERROR_NONE))
+        {
+            set_reg_value(INNER_GROUP1_REG_ADDRESS, regs[0]);
+            set_reg_value(INNER_GROUP2_REG_ADDRESS, regs[1]);
+        } else
+        {
+            i = 0;
+        }
+    }
+
+    osThreadNew(mini_mater_task, NULL, NULL);
+}

+ 130 - 0
Core/Src/modbus_slave.c

@@ -0,0 +1,130 @@
+//
+// Created by DELL on 2024/10/18.
+//
+
+#include "modbus_slave.h"
+#include "port.h"
+#include "mb.h"
+#include "cmsis_os2.h"
+
+USHORT usSRegHoldStart = S_REG_HOLDING_START;
+static USHORT usSRegHoldBuf[S_REG_HOLDING_NREGS];
+const static osThreadAttr_t task_attributes = {
+        .name = "slave_485_task",
+        .stack_size = 128 * 4,
+        .priority = (osPriority_t) osPriorityHigh,
+};
+
+/**
+ * 输入型寄存器读写回调函数
+ * @param pucRegBuffer
+ * @param usAddress
+ * @param usNRegs
+ * @return
+ */
+eMBErrorCode eMBRegInputCB(UCHAR *pucRegBuffer, USHORT usAddress, USHORT usNRegs)
+{
+    return MB_ENOERR;
+}
+
+/**
+ * 保持型寄存器读写回调函数
+ * @param pucRegBuffer
+ * @param usAddress
+ * @param usNRegs
+ * @param eMode
+ * @return
+ */
+eMBErrorCode eMBRegHoldingCB(UCHAR *pucRegBuffer, USHORT usAddress, USHORT usNRegs, eMBRegisterMode eMode)
+{
+    eMBErrorCode eStatus = MB_ENOERR;
+    USHORT iRegIndex;
+    USHORT *pusRegHoldingBuf;
+    USHORT REG_HOLDING_START;
+    USHORT REG_HOLDING_NREGS;
+    USHORT usRegHoldStart;
+    pusRegHoldingBuf = usSRegHoldBuf;
+    REG_HOLDING_START = S_REG_HOLDING_START;
+    REG_HOLDING_NREGS = S_REG_HOLDING_NREGS;
+    usRegHoldStart = usSRegHoldStart;
+
+    /* it already plus one in modbus function method. */
+    usAddress--;
+
+    if ((usAddress >= REG_HOLDING_START)
+        && (usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS))
+    {
+        iRegIndex = usAddress - usRegHoldStart;
+        switch (eMode)
+        {
+            /* read current register values from the protocol stack. */
+            case MB_REG_READ:
+                while (usNRegs > 0)
+                {
+                    *pucRegBuffer++ = (UCHAR) (pusRegHoldingBuf[iRegIndex] >> 8);
+                    *pucRegBuffer++ = (UCHAR) (pusRegHoldingBuf[iRegIndex] & 0xFF);
+                    iRegIndex++;
+                    usNRegs--;
+                }
+                break;
+
+                /* write current register values with new values from the protocol stack. */
+            case MB_REG_WRITE:
+                while (usNRegs > 0)
+                {
+
+                    pusRegHoldingBuf[iRegIndex] = *pucRegBuffer++ << 8;
+                    pusRegHoldingBuf[iRegIndex] |= *pucRegBuffer++;
+                    iRegIndex++;
+                    usNRegs--;
+                }
+                break;
+        }
+    } else
+    {
+        eStatus = MB_ENOREG;
+    }
+    return eStatus;
+}
+
+uint16_t get_reg_value(uint16_t addr)
+{
+    if (addr >= S_REG_HOLDING_NREGS)
+    {
+        return 0;
+    }
+    return usSRegHoldBuf[addr];
+}
+
+void set_reg_value(uint16_t addr, uint16_t value)
+{
+    if (addr >= S_REG_HOLDING_NREGS)
+    {
+        return;
+    }
+    usSRegHoldBuf[addr] = value;
+}
+
+/**
+ * 从机任务
+ * @param pv
+ */
+_Noreturn static void slave_485_task(void *pv)
+{
+    eMBErrorCode code;
+    uint8_t slave_addr = (uint8_t) pv;
+    eMBInit(MB_RTU, slave_addr, 3, 9600, MB_PAR_NONE);
+    eMBEnable();
+    for (;;)
+    {
+        eMBPoll();
+        osDelay(5);
+    }
+}
+
+void start_485_slave(uint8_t address)//启动485从机
+{
+    usSRegHoldBuf[0] = address; // init current communication address
+    osThreadNew(slave_485_task, (void *) address, &task_attributes);
+}
+

+ 26 - 0
Core/Src/stm32f1xx_it.c

@@ -20,6 +20,7 @@
 /* Includes ------------------------------------------------------------------*/
 #include "main.h"
 #include "stm32f1xx_it.h"
+#include "port.h"
 /* Private includes ----------------------------------------------------------*/
 /* USER CODE BEGIN Includes */
 /* USER CODE END Includes */
@@ -55,6 +56,7 @@
 /* USER CODE END 0 */
 
 /* External variables --------------------------------------------------------*/
+extern TIM_HandleTypeDef htim2;
 extern UART_HandleTypeDef huart4;
 extern UART_HandleTypeDef huart2;
 extern UART_HandleTypeDef huart3;
@@ -176,6 +178,20 @@ void TIM1_UP_IRQHandler(void)
   /* USER CODE END TIM1_UP_IRQn 1 */
 }
 
+/**
+  * @brief This function handles TIM2 global interrupt.
+  */
+void TIM2_IRQHandler(void)
+{
+  /* USER CODE BEGIN TIM2_IRQn 0 */
+
+  /* USER CODE END TIM2_IRQn 0 */
+  HAL_TIM_IRQHandler(&htim2);
+  /* USER CODE BEGIN TIM2_IRQn 1 */
+
+  /* USER CODE END TIM2_IRQn 1 */
+}
+
 /**
   * @brief This function handles USART2 global interrupt.
   */
@@ -196,7 +212,17 @@ void USART2_IRQHandler(void)
 void USART3_IRQHandler(void)
 {
   /* USER CODE BEGIN USART3_IRQn 0 */
+    if(__HAL_UART_GET_IT_SOURCE(&huart3, UART_IT_RXNE)!= RESET)
+    {
+        prvvUARTRxISR();
+    }
+
+    if(__HAL_UART_GET_IT_SOURCE(&huart3, UART_IT_TXE)!= RESET)
+    {
+        prvvUARTTxReadyISR();
+    }
 
+    HAL_NVIC_ClearPendingIRQ(USART3_IRQn);
   /* USER CODE END USART3_IRQn 0 */
   HAL_UART_IRQHandler(&huart3);
   /* USER CODE BEGIN USART3_IRQn 1 */

+ 26 - 0
Middlewares/Third_Party/FreeModbus/bsd.txt

@@ -0,0 +1,26 @@
+Copyright (c) 2006 Christian Walter <wolti@sil.at>
+Copyright (c) 2013-2019 Armink <armink.ztl@gmail.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+

+ 340 - 0
Middlewares/Third_Party/FreeModbus/gpl.txt

@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

+ 504 - 0
Middlewares/Third_Party/FreeModbus/lgpl.txt

@@ -0,0 +1,504 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+

+ 486 - 0
Middlewares/Third_Party/FreeModbus/modbus/ascii/mbascii.c

@@ -0,0 +1,486 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbascii.c,v 1.15 2007/02/18 23:46:48 wolti Exp $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbconfig.h"
+#include "mbascii.h"
+#include "mbframe.h"
+
+#include "mbcrc.h"
+#include "mbport.h"
+
+#if MB_SLAVE_ASCII_ENABLED > 0
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_ASCII_DEFAULT_CR     '\r'    /*!< Default CR character for Modbus ASCII. */
+#define MB_ASCII_DEFAULT_LF     '\n'    /*!< Default LF character for Modbus ASCII. */
+#define MB_SER_PDU_SIZE_MIN     3       /*!< Minimum size of a Modbus ASCII frame. */
+#define MB_SER_PDU_SIZE_MAX     256     /*!< Maximum size of a Modbus ASCII frame. */
+#define MB_SER_PDU_SIZE_LRC     1       /*!< Size of LRC field in PDU. */
+#define MB_SER_PDU_ADDR_OFF     0       /*!< Offset of slave address in Ser-PDU. */
+#define MB_SER_PDU_PDU_OFF      1       /*!< Offset of Modbus-PDU in Ser-PDU. */
+
+/* ----------------------- Type definitions ---------------------------------*/
+typedef enum
+{
+    STATE_RX_IDLE,              /*!< Receiver is in idle state. */
+    STATE_RX_RCV,               /*!< Frame is beeing received. */
+    STATE_RX_WAIT_EOF           /*!< Wait for End of Frame. */
+} eMBRcvState;
+
+typedef enum
+{
+    STATE_TX_IDLE,              /*!< Transmitter is in idle state. */
+    STATE_TX_START,             /*!< Starting transmission (':' sent). */
+    STATE_TX_DATA,              /*!< Sending of data (Address, Data, LRC). */
+    STATE_TX_END,               /*!< End of transmission. */
+    STATE_TX_NOTIFY             /*!< Notify sender that the frame has been sent. */
+} eMBSndState;
+
+typedef enum
+{
+    BYTE_HIGH_NIBBLE,           /*!< Character for high nibble of byte. */
+    BYTE_LOW_NIBBLE             /*!< Character for low nibble of byte. */
+} eMBBytePos;
+
+/* ----------------------- Static functions ---------------------------------*/
+static UCHAR    prvucMBCHAR2BIN( UCHAR ucCharacter );
+
+static UCHAR    prvucMBBIN2CHAR( UCHAR ucByte );
+
+static UCHAR    prvucMBLRC( UCHAR * pucFrame, USHORT usLen );
+
+/* ----------------------- Static variables ---------------------------------*/
+static volatile eMBSndState eSndState;
+static volatile eMBRcvState eRcvState;
+
+/* We reuse the Modbus RTU buffer because only one buffer is needed and the
+ * RTU buffer is bigger. */
+extern volatile UCHAR ucRTUBuf[];
+static volatile UCHAR *ucASCIIBuf = ucRTUBuf;
+
+static volatile USHORT usRcvBufferPos;
+static volatile eMBBytePos eBytePos;
+
+static volatile UCHAR *pucSndBufferCur;
+static volatile USHORT usSndBufferCount;
+
+static volatile UCHAR ucLRC;
+static volatile UCHAR ucMBLFCharacter;
+
+/* ----------------------- Start implementation -----------------------------*/
+eMBErrorCode
+eMBASCIIInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+    ( void )ucSlaveAddress;
+
+    ENTER_CRITICAL_SECTION(  );
+    ucMBLFCharacter = MB_ASCII_DEFAULT_LF;
+
+    if( xMBPortSerialInit( ucPort, ulBaudRate, 7, eParity ) != TRUE )
+    {
+        eStatus = MB_EPORTERR;
+    }
+    else if( xMBPortTimersInit( MB_ASCII_TIMEOUT_SEC * 20000UL ) != TRUE )
+    {
+        eStatus = MB_EPORTERR;
+    }
+
+    EXIT_CRITICAL_SECTION(  );
+
+    return eStatus;
+}
+
+void
+eMBASCIIStart( void )
+{
+    ENTER_CRITICAL_SECTION(  );
+    vMBPortSerialEnable( TRUE, FALSE );
+    eRcvState = STATE_RX_IDLE;
+    EXIT_CRITICAL_SECTION(  );
+
+    /* No special startup required for ASCII. */
+    ( void )xMBPortEventPost( EV_READY );
+}
+
+void
+eMBASCIIStop( void )
+{
+    ENTER_CRITICAL_SECTION(  );
+    vMBPortSerialEnable( FALSE, FALSE );
+    vMBPortTimersDisable(  );
+    EXIT_CRITICAL_SECTION(  );
+}
+
+eMBErrorCode
+eMBASCIIReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+
+    ENTER_CRITICAL_SECTION(  );
+    assert( usRcvBufferPos < MB_SER_PDU_SIZE_MAX );
+
+    /* Length and CRC check */
+    if( ( usRcvBufferPos >= MB_SER_PDU_SIZE_MIN )
+        && ( prvucMBLRC( ( UCHAR * ) ucASCIIBuf, usRcvBufferPos ) == 0 ) )
+    {
+        /* Save the address field. All frames are passed to the upper layed
+         * and the decision if a frame is used is done there.
+         */
+        *pucRcvAddress = ucASCIIBuf[MB_SER_PDU_ADDR_OFF];
+
+        /* Total length of Modbus-PDU is Modbus-Serial-Line-PDU minus
+         * size of address field and CRC checksum.
+         */
+        *pusLength = ( USHORT )( usRcvBufferPos - MB_SER_PDU_PDU_OFF - MB_SER_PDU_SIZE_LRC );
+
+        /* Return the start of the Modbus PDU to the caller. */
+        *pucFrame = ( UCHAR * ) & ucASCIIBuf[MB_SER_PDU_PDU_OFF];
+    }
+    else
+    {
+        eStatus = MB_EIO;
+    }
+    EXIT_CRITICAL_SECTION(  );
+    return eStatus;
+}
+
+eMBErrorCode
+eMBASCIISend( UCHAR ucSlaveAddress, const UCHAR * pucFrame, USHORT usLength )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+    UCHAR           usLRC;
+
+    ENTER_CRITICAL_SECTION(  );
+    /* Check if the receiver is still in idle state. If not we where too
+     * slow with processing the received frame and the master sent another
+     * frame on the network. We have to abort sending the frame.
+     */
+    if( eRcvState == STATE_RX_IDLE )
+    {
+        /* First byte before the Modbus-PDU is the slave address. */
+        pucSndBufferCur = ( UCHAR * ) pucFrame - 1;
+        usSndBufferCount = 1;
+
+        /* Now copy the Modbus-PDU into the Modbus-Serial-Line-PDU. */
+        pucSndBufferCur[MB_SER_PDU_ADDR_OFF] = ucSlaveAddress;
+        usSndBufferCount += usLength;
+
+        /* Calculate LRC checksum for Modbus-Serial-Line-PDU. */
+        usLRC = prvucMBLRC( ( UCHAR * ) pucSndBufferCur, usSndBufferCount );
+        ucASCIIBuf[usSndBufferCount++] = usLRC;
+
+        /* Activate the transmitter. */
+        eSndState = STATE_TX_START;
+        vMBPortSerialEnable( FALSE, TRUE );
+    }
+    else
+    {
+        eStatus = MB_EIO;
+    }
+    EXIT_CRITICAL_SECTION(  );
+    return eStatus;
+}
+
+BOOL
+xMBASCIIReceiveFSM( void )
+{
+    BOOL            xNeedPoll = FALSE;
+    UCHAR           ucByte;
+    UCHAR           ucResult;
+
+    assert( eSndState == STATE_TX_IDLE );
+
+    ( void )xMBPortSerialGetByte( ( CHAR * ) & ucByte );
+    switch ( eRcvState )
+    {
+        /* A new character is received. If the character is a ':' the input
+         * buffer is cleared. A CR-character signals the end of the data
+         * block. Other characters are part of the data block and their
+         * ASCII value is converted back to a binary representation.
+         */
+    case STATE_RX_RCV:
+        /* Enable timer for character timeout. */
+        vMBPortTimersEnable(  );
+        if( ucByte == ':' )
+        {
+            /* Empty receive buffer. */
+            eBytePos = BYTE_HIGH_NIBBLE;
+            usRcvBufferPos = 0;
+        }
+        else if( ucByte == MB_ASCII_DEFAULT_CR )
+        {
+            eRcvState = STATE_RX_WAIT_EOF;
+        }
+        else
+        {
+            ucResult = prvucMBCHAR2BIN( ucByte );
+            switch ( eBytePos )
+            {
+                /* High nibble of the byte comes first. We check for
+                 * a buffer overflow here. */
+            case BYTE_HIGH_NIBBLE:
+                if( usRcvBufferPos < MB_SER_PDU_SIZE_MAX )
+                {
+                    ucASCIIBuf[usRcvBufferPos] = ( UCHAR )( ucResult << 4 );
+                    eBytePos = BYTE_LOW_NIBBLE;
+                    break;
+                }
+                else
+                {
+                    /* not handled in Modbus specification but seems
+                     * a resonable implementation. */
+                    eRcvState = STATE_RX_IDLE;
+                    /* Disable previously activated timer because of error state. */
+                    vMBPortTimersDisable(  );
+                }
+                break;
+
+            case BYTE_LOW_NIBBLE:
+                ucASCIIBuf[usRcvBufferPos] |= ucResult;
+                usRcvBufferPos++;
+                eBytePos = BYTE_HIGH_NIBBLE;
+                break;
+            }
+        }
+        break;
+
+    case STATE_RX_WAIT_EOF:
+        if( ucByte == ucMBLFCharacter )
+        {
+            /* Disable character timeout timer because all characters are
+             * received. */
+            vMBPortTimersDisable(  );
+            /* Receiver is again in idle state. */
+            eRcvState = STATE_RX_IDLE;
+
+            /* Notify the caller of eMBASCIIReceive that a new frame
+             * was received. */
+            xNeedPoll = xMBPortEventPost( EV_FRAME_RECEIVED );
+        }
+        else if( ucByte == ':' )
+        {
+            /* Empty receive buffer and back to receive state. */
+            eBytePos = BYTE_HIGH_NIBBLE;
+            usRcvBufferPos = 0;
+            eRcvState = STATE_RX_RCV;
+
+            /* Enable timer for character timeout. */
+            vMBPortTimersEnable(  );
+        }
+        else
+        {
+            /* Frame is not okay. Delete entire frame. */
+            eRcvState = STATE_RX_IDLE;
+        }
+        break;
+
+    case STATE_RX_IDLE:
+        if( ucByte == ':' )
+        {
+            /* Enable timer for character timeout. */
+            vMBPortTimersEnable(  );
+            /* Reset the input buffers to store the frame. */
+            usRcvBufferPos = 0;;
+            eBytePos = BYTE_HIGH_NIBBLE;
+            eRcvState = STATE_RX_RCV;
+        }
+        break;
+    }
+
+    return xNeedPoll;
+}
+
+BOOL
+xMBASCIITransmitFSM( void )
+{
+    BOOL            xNeedPoll = FALSE;
+    UCHAR           ucByte;
+
+    assert( eRcvState == STATE_RX_IDLE );
+    switch ( eSndState )
+    {
+        /* Start of transmission. The start of a frame is defined by sending
+         * the character ':'. */
+    case STATE_TX_START:
+        ucByte = ':';
+        xMBPortSerialPutByte( ( CHAR )ucByte );
+        eSndState = STATE_TX_DATA;
+        eBytePos = BYTE_HIGH_NIBBLE;
+        break;
+
+        /* Send the data block. Each data byte is encoded as a character hex
+         * stream with the high nibble sent first and the low nibble sent
+         * last. If all data bytes are exhausted we send a '\r' character
+         * to end the transmission. */
+    case STATE_TX_DATA:
+        if( usSndBufferCount > 0 )
+        {
+            switch ( eBytePos )
+            {
+            case BYTE_HIGH_NIBBLE:
+                ucByte = prvucMBBIN2CHAR( ( UCHAR )( *pucSndBufferCur >> 4 ) );
+                xMBPortSerialPutByte( ( CHAR ) ucByte );
+                eBytePos = BYTE_LOW_NIBBLE;
+                break;
+
+            case BYTE_LOW_NIBBLE:
+                ucByte = prvucMBBIN2CHAR( ( UCHAR )( *pucSndBufferCur & 0x0F ) );
+                xMBPortSerialPutByte( ( CHAR )ucByte );
+                pucSndBufferCur++;
+                eBytePos = BYTE_HIGH_NIBBLE;
+                usSndBufferCount--;
+                break;
+            }
+        }
+        else
+        {
+            xMBPortSerialPutByte( MB_ASCII_DEFAULT_CR );
+            eSndState = STATE_TX_END;
+        }
+        break;
+
+        /* Finish the frame by sending a LF character. */
+    case STATE_TX_END:
+        xMBPortSerialPutByte( ( CHAR )ucMBLFCharacter );
+        /* We need another state to make sure that the CR character has
+         * been sent. */
+        eSndState = STATE_TX_NOTIFY;
+        break;
+
+        /* Notify the task which called eMBASCIISend that the frame has
+         * been sent. */
+    case STATE_TX_NOTIFY:
+        eSndState = STATE_TX_IDLE;
+        xNeedPoll = xMBPortEventPost( EV_FRAME_SENT );
+
+        /* Disable transmitter. This prevents another transmit buffer
+         * empty interrupt. */
+        vMBPortSerialEnable( TRUE, FALSE );
+        eSndState = STATE_TX_IDLE;
+        break;
+
+        /* We should not get a transmitter event if the transmitter is in
+         * idle state.  */
+    case STATE_TX_IDLE:
+        /* enable receiver/disable transmitter. */
+        vMBPortSerialEnable( TRUE, FALSE );
+        break;
+    }
+
+    return xNeedPoll;
+}
+
+BOOL
+xMBASCIITimerT1SExpired( void )
+{
+    switch ( eRcvState )
+    {
+        /* If we have a timeout we go back to the idle state and wait for
+         * the next frame.
+         */
+    case STATE_RX_RCV:
+    case STATE_RX_WAIT_EOF:
+        eRcvState = STATE_RX_IDLE;
+        break;
+
+    default:
+        assert( ( eRcvState == STATE_RX_RCV ) || ( eRcvState == STATE_RX_WAIT_EOF ) );
+        break;
+    }
+    vMBPortTimersDisable(  );
+
+    /* no context switch required. */
+    return FALSE;
+}
+
+
+static          UCHAR
+prvucMBCHAR2BIN( UCHAR ucCharacter )
+{
+    if( ( ucCharacter >= '0' ) && ( ucCharacter <= '9' ) )
+    {
+        return ( UCHAR )( ucCharacter - '0' );
+    }
+    else if( ( ucCharacter >= 'A' ) && ( ucCharacter <= 'F' ) )
+    {
+        return ( UCHAR )( ucCharacter - 'A' + 0x0A );
+    }
+    else
+    {
+        return 0xFF;
+    }
+}
+
+static          UCHAR
+prvucMBBIN2CHAR( UCHAR ucByte )
+{
+    if( ucByte <= 0x09 )
+    {
+        return ( UCHAR )( '0' + ucByte );
+    }
+    else if( ( ucByte >= 0x0A ) && ( ucByte <= 0x0F ) )
+    {
+        return ( UCHAR )( ucByte - 0x0A + 'A' );
+    }
+    else
+    {
+        /* Programming error. */
+        assert( 0 );
+    }
+    return '0';
+}
+
+
+static          UCHAR
+prvucMBLRC( UCHAR * pucFrame, USHORT usLen )
+{
+    UCHAR           ucLRC = 0;  /* LRC char initialized */
+
+    while( usLen-- )
+    {
+        ucLRC += *pucFrame++;   /* Add buffer byte without carry */
+    }
+
+    /* Return twos complement */
+    ucLRC = ( UCHAR ) ( -( ( CHAR ) ucLRC ) );
+    return ucLRC;
+}
+
+#endif

+ 56 - 0
Middlewares/Third_Party/FreeModbus/modbus/ascii/mbascii.h

@@ -0,0 +1,56 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbascii.h,v 1.8 2006/12/07 22:10:34 wolti Exp $
+ */
+
+#ifndef _MB_ASCII_H
+#define _MB_ASCII_H
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+
+#if MB_SLAVE_ASCII_ENABLED > 0
+eMBErrorCode    eMBASCIIInit( UCHAR slaveAddress, UCHAR ucPort,
+                              ULONG ulBaudRate, eMBParity eParity );
+void            eMBASCIIStart( void );
+void            eMBASCIIStop( void );
+
+eMBErrorCode    eMBASCIIReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame,
+                                 USHORT * pusLength );
+eMBErrorCode    eMBASCIISend( UCHAR slaveAddress, const UCHAR * pucFrame,
+                              USHORT usLength );
+BOOL            xMBASCIIReceiveFSM( void );
+BOOL            xMBASCIITransmitFSM( void );
+BOOL            xMBASCIITimerT1SExpired( void );
+#endif
+
+#ifdef __cplusplus
+PR_END_EXTERN_C
+#endif
+#endif

+ 269 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfunccoils.c

@@ -0,0 +1,269 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbfunccoils.c,v 1.8 2007/02/18 23:47:16 wolti Exp $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbframe.h"
+#include "mbproto.h"
+#include "mbconfig.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_PDU_FUNC_READ_ADDR_OFF           ( MB_PDU_DATA_OFF )
+#define MB_PDU_FUNC_READ_COILCNT_OFF        ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_READ_SIZE               ( 4 )
+#define MB_PDU_FUNC_READ_COILCNT_MAX        ( 0x07D0 )
+
+#define MB_PDU_FUNC_WRITE_ADDR_OFF          ( MB_PDU_DATA_OFF )
+#define MB_PDU_FUNC_WRITE_VALUE_OFF         ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_WRITE_SIZE              ( 4 )
+
+#define MB_PDU_FUNC_WRITE_MUL_ADDR_OFF      ( MB_PDU_DATA_OFF )
+#define MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF   ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF   ( MB_PDU_DATA_OFF + 4 )
+#define MB_PDU_FUNC_WRITE_MUL_VALUES_OFF    ( MB_PDU_DATA_OFF + 5 )
+#define MB_PDU_FUNC_WRITE_MUL_SIZE_MIN      ( 5 )
+#define MB_PDU_FUNC_WRITE_MUL_COILCNT_MAX   ( 0x07B0 )
+
+/* ----------------------- Static functions ---------------------------------*/
+eMBException    prveMBError2Exception( eMBErrorCode eErrorCode );
+
+/* ----------------------- Start implementation -----------------------------*/
+
+#if MB_FUNC_READ_COILS_ENABLED > 0
+
+eMBException
+eMBFuncReadCoils( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    USHORT          usCoilCount;
+    UCHAR           ucNBytes;
+    UCHAR          *pucFrameCur;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) )
+    {
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usCoilCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_COILCNT_OFF] << 8 );
+        usCoilCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_COILCNT_OFF + 1] );
+
+        /* Check if the number of registers to read is valid. If not
+         * return Modbus illegal data value exception.
+         */
+        if( ( usCoilCount >= 1 ) &&
+            ( usCoilCount < MB_PDU_FUNC_READ_COILCNT_MAX ) )
+        {
+            /* Set the current PDU data pointer to the beginning. */
+            pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF];
+            *usLen = MB_PDU_FUNC_OFF;
+
+            /* First byte contains the function code. */
+            *pucFrameCur++ = MB_FUNC_READ_COILS;
+            *usLen += 1;
+
+            /* Test if the quantity of coils is a multiple of 8. If not last
+             * byte is only partially field with unused coils set to zero. */
+            if( ( usCoilCount & 0x0007 ) != 0 )
+            {
+                ucNBytes = ( UCHAR )( usCoilCount / 8 + 1 );
+            }
+            else
+            {
+                ucNBytes = ( UCHAR )( usCoilCount / 8 );
+            }
+            *pucFrameCur++ = ucNBytes;
+            *usLen += 1;
+
+            eRegStatus =
+                eMBRegCoilsCB( pucFrameCur, usRegAddress, usCoilCount,
+                               MB_REG_READ );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+            else
+            {
+                /* The response contains the function code, the starting address
+                 * and the quantity of registers. We reuse the old values in the
+                 * buffer because they are still valid. */
+                *usLen += ucNBytes;;
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid read coil register request because the length
+         * is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+#endif
+
+#if MB_FUNC_WRITE_COIL_ENABLED > 0
+eMBException
+eMBFuncWriteCoil( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    UCHAR           ucBuf[2];
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen == ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) )
+    {
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        if( ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF + 1] == 0x00 ) &&
+            ( ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0xFF ) ||
+              ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0x00 ) ) )
+        {
+            ucBuf[1] = 0;
+            if( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0xFF )
+            {
+                ucBuf[0] = 1;
+            }
+            else
+            {
+                ucBuf[0] = 0;
+            }
+            eRegStatus =
+                eMBRegCoilsCB( &ucBuf[0], usRegAddress, 1, MB_REG_WRITE );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid write coil register request because the length
+         * is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+
+#endif
+
+#if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0
+eMBException
+eMBFuncWriteMultipleCoils( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    USHORT          usCoilCnt;
+    UCHAR           ucByteCount;
+    UCHAR           ucByteCountVerify;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen > ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) )
+    {
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usCoilCnt = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF] << 8 );
+        usCoilCnt |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF + 1] );
+
+        ucByteCount = pucFrame[MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF];
+
+        /* Compute the number of expected bytes in the request. */
+        if( ( usCoilCnt & 0x0007 ) != 0 )
+        {
+            ucByteCountVerify = ( UCHAR )( usCoilCnt / 8 + 1 );
+        }
+        else
+        {
+            ucByteCountVerify = ( UCHAR )( usCoilCnt / 8 );
+        }
+
+        if( ( usCoilCnt >= 1 ) &&
+            ( usCoilCnt <= MB_PDU_FUNC_WRITE_MUL_COILCNT_MAX ) &&
+            ( ucByteCountVerify == ucByteCount ) )
+        {
+            eRegStatus =
+                eMBRegCoilsCB( &pucFrame[MB_PDU_FUNC_WRITE_MUL_VALUES_OFF],
+                               usRegAddress, usCoilCnt, MB_REG_WRITE );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+            else
+            {
+                /* The response contains the function code, the starting address
+                 * and the quantity of registers. We reuse the old values in the
+                 * buffer because they are still valid. */
+                *usLen = MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF;
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid write coil register request because the length
+         * is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+
+#endif

+ 390 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfunccoils_m.c

@@ -0,0 +1,390 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (C) 2013 Armink <armink.ztl@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbfunccoils_m.c,v 1.60 2013/10/12 15:10:12 Armink Add Master Functions
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mb_m.h"
+#include "mbframe.h"
+#include "mbproto.h"
+#include "mbconfig.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_PDU_REQ_READ_ADDR_OFF            ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_REQ_READ_COILCNT_OFF         ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_REQ_READ_SIZE                ( 4 )
+#define MB_PDU_FUNC_READ_COILCNT_OFF        ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_FUNC_READ_VALUES_OFF         ( MB_PDU_DATA_OFF + 1 )
+#define MB_PDU_FUNC_READ_SIZE_MIN           ( 1 )
+
+#define MB_PDU_REQ_WRITE_ADDR_OFF           ( MB_PDU_DATA_OFF )
+#define MB_PDU_REQ_WRITE_VALUE_OFF          ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_REQ_WRITE_SIZE               ( 4 )
+#define MB_PDU_FUNC_WRITE_ADDR_OFF          ( MB_PDU_DATA_OFF )
+#define MB_PDU_FUNC_WRITE_VALUE_OFF         ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_WRITE_SIZE              ( 4 )
+
+#define MB_PDU_REQ_WRITE_MUL_ADDR_OFF       ( MB_PDU_DATA_OFF )
+#define MB_PDU_REQ_WRITE_MUL_COILCNT_OFF    ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_REQ_WRITE_MUL_BYTECNT_OFF    ( MB_PDU_DATA_OFF + 4 )
+#define MB_PDU_REQ_WRITE_MUL_VALUES_OFF     ( MB_PDU_DATA_OFF + 5 )
+#define MB_PDU_REQ_WRITE_MUL_SIZE_MIN       ( 5 )
+#define MB_PDU_REQ_WRITE_MUL_COILCNT_MAX    ( 0x07B0 )
+#define MB_PDU_FUNC_WRITE_MUL_ADDR_OFF      ( MB_PDU_DATA_OFF )
+#define MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF   ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_WRITE_MUL_SIZE          ( 5 )
+
+/* ----------------------- Static functions ---------------------------------*/
+eMBException    prveMBError2Exception( eMBErrorCode eErrorCode );
+
+/* ----------------------- Start implementation -----------------------------*/
+#if MB_MASTER_RTU_ENABLED > 0 || MB_MASTER_ASCII_ENABLED > 0
+#if MB_FUNC_READ_COILS_ENABLED > 0
+
+/**
+ * This function will request read coil.
+ *
+ * @param ucSndAddr salve address
+ * @param usCoilAddr coil start address
+ * @param usNCoils coil total number
+ * @param lTimeOut timeout (-1 will waiting forever)
+ *
+ * @return error code
+ */
+eMBMasterReqErrCode
+eMBMasterReqReadCoils( UCHAR ucSndAddr, USHORT usCoilAddr, USHORT usNCoils ,LONG lTimeOut )
+{
+    UCHAR                 *ucMBFrame;
+    eMBMasterReqErrCode    eErrStatus = MB_MRE_NO_ERR;
+
+    if ( ucSndAddr > MB_MASTER_TOTAL_SLAVE_NUM ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( xMBMasterRunResTake( lTimeOut ) == FALSE ) eErrStatus = MB_MRE_MASTER_BUSY;
+    else
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        vMBMasterSetDestAddress(ucSndAddr);
+        ucMBFrame[MB_PDU_FUNC_OFF]                 = MB_FUNC_READ_COILS;
+        ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF]        = usCoilAddr >> 8;
+        ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF + 1]    = usCoilAddr;
+        ucMBFrame[MB_PDU_REQ_READ_COILCNT_OFF ]    = usNCoils >> 8;
+        ucMBFrame[MB_PDU_REQ_READ_COILCNT_OFF + 1] = usNCoils;
+        vMBMasterSetPDUSndLength( MB_PDU_SIZE_MIN + MB_PDU_REQ_READ_SIZE );
+        ( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT );
+        eErrStatus = eMBMasterWaitRequestFinish( );
+
+    }
+    return eErrStatus;
+}
+
+eMBException
+eMBMasterFuncReadCoils( UCHAR * pucFrame, USHORT * usLen )
+{
+    UCHAR          *ucMBFrame;
+    USHORT          usRegAddress;
+    USHORT          usCoilCount;
+    UCHAR           ucByteCount;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    /* If this request is broadcast, and it's read mode. This request don't need execute. */
+    if ( xMBMasterRequestIsBroadcast() )
+    {
+        eStatus = MB_EX_NONE;
+    }
+    else if ( *usLen >= MB_PDU_SIZE_MIN + MB_PDU_FUNC_READ_SIZE_MIN )
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        usRegAddress = ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usCoilCount = ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_COILCNT_OFF] << 8 );
+        usCoilCount |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_COILCNT_OFF + 1] );
+
+        /* Test if the quantity of coils is a multiple of 8. If not last
+         * byte is only partially field with unused coils set to zero. */
+        if( ( usCoilCount & 0x0007 ) != 0 )
+        {
+            ucByteCount = ( UCHAR )( usCoilCount / 8 + 1 );
+        }
+        else
+        {
+            ucByteCount = ( UCHAR )( usCoilCount / 8 );
+        }
+
+        /* Check if the number of registers to read is valid. If not
+         * return Modbus illegal data value exception.
+         */
+        if( ( usCoilCount >= 1 ) &&
+            ( ucByteCount == pucFrame[MB_PDU_FUNC_READ_COILCNT_OFF] ) )
+        {
+            /* Make callback to fill the buffer. */
+            eRegStatus = eMBMasterRegCoilsCB( &pucFrame[MB_PDU_FUNC_READ_VALUES_OFF], usRegAddress, usCoilCount, MB_REG_READ );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid read coil register request because the length
+         * is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+#endif
+
+#if MB_FUNC_WRITE_COIL_ENABLED > 0
+
+/**
+ * This function will request write one coil.
+ *
+ * @param ucSndAddr salve address
+ * @param usCoilAddr coil start address
+ * @param usCoilData data to be written
+ * @param lTimeOut timeout (-1 will waiting forever)
+ *
+ * @return error code
+ *
+ * @see eMBMasterReqWriteMultipleCoils
+ */
+eMBMasterReqErrCode
+eMBMasterReqWriteCoil( UCHAR ucSndAddr, USHORT usCoilAddr, USHORT usCoilData, LONG lTimeOut )
+{
+    UCHAR                 *ucMBFrame;
+    eMBMasterReqErrCode    eErrStatus = MB_MRE_NO_ERR;
+
+    if ( ucSndAddr > MB_MASTER_TOTAL_SLAVE_NUM ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( ( usCoilData != 0xFF00 ) && ( usCoilData != 0x0000 ) ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( xMBMasterRunResTake( lTimeOut ) == FALSE ) eErrStatus = MB_MRE_MASTER_BUSY;
+    else
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        vMBMasterSetDestAddress(ucSndAddr);
+        ucMBFrame[MB_PDU_FUNC_OFF]                = MB_FUNC_WRITE_SINGLE_COIL;
+        ucMBFrame[MB_PDU_REQ_WRITE_ADDR_OFF]      = usCoilAddr >> 8;
+        ucMBFrame[MB_PDU_REQ_WRITE_ADDR_OFF + 1]  = usCoilAddr;
+        ucMBFrame[MB_PDU_REQ_WRITE_VALUE_OFF ]    = usCoilData >> 8;
+        ucMBFrame[MB_PDU_REQ_WRITE_VALUE_OFF + 1] = usCoilData;
+        vMBMasterSetPDUSndLength( MB_PDU_SIZE_MIN + MB_PDU_REQ_WRITE_SIZE );
+        ( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT );
+        eErrStatus = eMBMasterWaitRequestFinish( );
+    }
+    return eErrStatus;
+}
+
+eMBException
+eMBMasterFuncWriteCoil( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    UCHAR           ucBuf[2];
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen == ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) )
+    {
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        if( ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF + 1] == 0x00 ) &&
+            ( ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0xFF ) ||
+              ( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0x00 ) ) )
+        {
+            ucBuf[1] = 0;
+            if( pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF] == 0xFF )
+            {
+                ucBuf[0] = 1;
+            }
+            else
+            {
+                ucBuf[0] = 0;
+            }
+            eRegStatus =
+                eMBMasterRegCoilsCB( &ucBuf[0], usRegAddress, 1, MB_REG_WRITE );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid write coil register request because the length
+         * is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+
+#endif
+
+#if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0
+
+/**
+ * This function will request write multiple coils.
+ *
+ * @param ucSndAddr salve address
+ * @param usCoilAddr coil start address
+ * @param usNCoils coil total number
+ * @param usCoilData data to be written
+ * @param lTimeOut timeout (-1 will waiting forever)
+ *
+ * @return error code
+ *
+ * @see eMBMasterReqWriteCoil
+ */
+eMBMasterReqErrCode
+eMBMasterReqWriteMultipleCoils( UCHAR ucSndAddr,
+        USHORT usCoilAddr, USHORT usNCoils, UCHAR * pucDataBuffer, LONG lTimeOut)
+{
+    UCHAR                 *ucMBFrame;
+    USHORT                 usRegIndex = 0;
+    UCHAR                  ucByteCount;
+    eMBMasterReqErrCode    eErrStatus = MB_MRE_NO_ERR;
+
+    if ( ucSndAddr > MB_MASTER_TOTAL_SLAVE_NUM ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( usNCoils > MB_PDU_REQ_WRITE_MUL_COILCNT_MAX ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( xMBMasterRunResTake( lTimeOut ) == FALSE ) eErrStatus = MB_MRE_MASTER_BUSY;
+    else
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        vMBMasterSetDestAddress(ucSndAddr);
+        ucMBFrame[MB_PDU_FUNC_OFF]                      = MB_FUNC_WRITE_MULTIPLE_COILS;
+        ucMBFrame[MB_PDU_REQ_WRITE_MUL_ADDR_OFF]        = usCoilAddr >> 8;
+        ucMBFrame[MB_PDU_REQ_WRITE_MUL_ADDR_OFF + 1]    = usCoilAddr;
+        ucMBFrame[MB_PDU_REQ_WRITE_MUL_COILCNT_OFF]     = usNCoils >> 8;
+        ucMBFrame[MB_PDU_REQ_WRITE_MUL_COILCNT_OFF + 1] = usNCoils ;
+        if( ( usNCoils & 0x0007 ) != 0 )
+        {
+            ucByteCount = ( UCHAR )( usNCoils / 8 + 1 );
+        }
+        else
+        {
+            ucByteCount = ( UCHAR )( usNCoils / 8 );
+        }
+        ucMBFrame[MB_PDU_REQ_WRITE_MUL_BYTECNT_OFF]     = ucByteCount;
+        ucMBFrame += MB_PDU_REQ_WRITE_MUL_VALUES_OFF;
+        while( ucByteCount > usRegIndex)
+        {
+            *ucMBFrame++ = pucDataBuffer[usRegIndex++];
+        }
+        vMBMasterSetPDUSndLength( MB_PDU_SIZE_MIN + MB_PDU_REQ_WRITE_MUL_SIZE_MIN + ucByteCount );
+        ( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT );
+        eErrStatus = eMBMasterWaitRequestFinish( );
+    }
+    return eErrStatus;
+}
+
+eMBException
+eMBMasterFuncWriteMultipleCoils( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    USHORT          usCoilCnt;
+    UCHAR           ucByteCount;
+    UCHAR           ucByteCountVerify;
+    UCHAR          *ucMBFrame;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    /* If this request is broadcast, the *usLen is not need check. */
+    if( ( *usLen == MB_PDU_FUNC_WRITE_MUL_SIZE ) || xMBMasterRequestIsBroadcast() )
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usCoilCnt = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF] << 8 );
+        usCoilCnt |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_COILCNT_OFF + 1] );
+
+        ucByteCount = ucMBFrame[MB_PDU_REQ_WRITE_MUL_BYTECNT_OFF];
+
+        /* Compute the number of expected bytes in the request. */
+        if( ( usCoilCnt & 0x0007 ) != 0 )
+        {
+            ucByteCountVerify = ( UCHAR )( usCoilCnt / 8 + 1 );
+        }
+        else
+        {
+            ucByteCountVerify = ( UCHAR )( usCoilCnt / 8 );
+        }
+
+        if( ( usCoilCnt >= 1 ) && ( ucByteCountVerify == ucByteCount ) )
+        {
+            eRegStatus =
+                eMBMasterRegCoilsCB( &ucMBFrame[MB_PDU_REQ_WRITE_MUL_VALUES_OFF],
+                               usRegAddress, usCoilCnt, MB_REG_WRITE );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid write coil register request because the length
+         * is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+
+#endif
+#endif

+ 29 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdiag.c

@@ -0,0 +1,29 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbfuncdiag.c,v 1.3 2006/12/07 22:10:34 wolti Exp $
+ */

+ 133 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdisc.c

@@ -0,0 +1,133 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbframe.h"
+#include "mbproto.h"
+#include "mbconfig.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_PDU_FUNC_READ_ADDR_OFF           ( MB_PDU_DATA_OFF )
+#define MB_PDU_FUNC_READ_DISCCNT_OFF        ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_READ_SIZE               ( 4 )
+#define MB_PDU_FUNC_READ_DISCCNT_MAX        ( 0x07D0 )
+
+/* ----------------------- Static functions ---------------------------------*/
+eMBException    prveMBError2Exception( eMBErrorCode eErrorCode );
+
+/* ----------------------- Start implementation -----------------------------*/
+
+#if MB_FUNC_READ_DISCRETE_INPUTS_ENABLED > 0
+
+eMBException
+eMBFuncReadDiscreteInputs( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    USHORT          usDiscreteCnt;
+    UCHAR           ucNBytes;
+    UCHAR          *pucFrameCur;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) )
+    {
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usDiscreteCnt = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_DISCCNT_OFF] << 8 );
+        usDiscreteCnt |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_DISCCNT_OFF + 1] );
+
+        /* Check if the number of registers to read is valid. If not
+         * return Modbus illegal data value exception.
+         */
+        if( ( usDiscreteCnt >= 1 ) &&
+            ( usDiscreteCnt < MB_PDU_FUNC_READ_DISCCNT_MAX ) )
+        {
+            /* Set the current PDU data pointer to the beginning. */
+            pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF];
+            *usLen = MB_PDU_FUNC_OFF;
+
+            /* First byte contains the function code. */
+            *pucFrameCur++ = MB_FUNC_READ_DISCRETE_INPUTS;
+            *usLen += 1;
+
+            /* Test if the quantity of coils is a multiple of 8. If not last
+             * byte is only partially field with unused coils set to zero. */
+            if( ( usDiscreteCnt & 0x0007 ) != 0 )
+            {
+                ucNBytes = ( UCHAR ) ( usDiscreteCnt / 8 + 1 );
+            }
+            else
+            {
+                ucNBytes = ( UCHAR ) ( usDiscreteCnt / 8 );
+            }
+            *pucFrameCur++ = ucNBytes;
+            *usLen += 1;
+
+            eRegStatus =
+                eMBRegDiscreteCB( pucFrameCur, usRegAddress, usDiscreteCnt );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+            else
+            {
+                /* The response contains the function code, the starting address
+                 * and the quantity of registers. We reuse the old values in the
+                 * buffer because they are still valid. */
+                *usLen += ucNBytes;;
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid read coil register request because the length
+         * is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+
+#endif

+ 162 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdisc_m.c

@@ -0,0 +1,162 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (C) 2013 Armink <armink.ztl@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbfuncdisc_m.c,v 1.60 2013/10/15 8:48:20 Armink Add Master Functions  Exp $
+ */
+
+
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mb_m.h"
+#include "mbframe.h"
+#include "mbproto.h"
+#include "mbconfig.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_PDU_REQ_READ_ADDR_OFF            ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_REQ_READ_DISCCNT_OFF         ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_REQ_READ_SIZE                ( 4 )
+#define MB_PDU_FUNC_READ_DISCCNT_OFF        ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_FUNC_READ_VALUES_OFF         ( MB_PDU_DATA_OFF + 1 )
+#define MB_PDU_FUNC_READ_SIZE_MIN           ( 1 )
+
+/* ----------------------- Static functions ---------------------------------*/
+eMBException    prveMBError2Exception( eMBErrorCode eErrorCode );
+
+/* ----------------------- Start implementation -----------------------------*/
+#if MB_MASTER_RTU_ENABLED > 0 || MB_MASTER_ASCII_ENABLED > 0
+#if MB_FUNC_READ_DISCRETE_INPUTS_ENABLED > 0
+
+/**
+ * This function will request read discrete inputs.
+ *
+ * @param ucSndAddr salve address
+ * @param usDiscreteAddr discrete start address
+ * @param usNDiscreteIn discrete total number
+ * @param lTimeOut timeout (-1 will waiting forever)
+ *
+ * @return error code
+ */
+eMBMasterReqErrCode
+eMBMasterReqReadDiscreteInputs( UCHAR ucSndAddr, USHORT usDiscreteAddr, USHORT usNDiscreteIn, LONG lTimeOut )
+{
+    UCHAR                 *ucMBFrame;
+    eMBMasterReqErrCode    eErrStatus = MB_MRE_NO_ERR;
+
+    if ( ucSndAddr > MB_MASTER_TOTAL_SLAVE_NUM ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( xMBMasterRunResTake( lTimeOut ) == FALSE ) eErrStatus = MB_MRE_MASTER_BUSY;
+    else
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        vMBMasterSetDestAddress(ucSndAddr);
+        ucMBFrame[MB_PDU_FUNC_OFF]                 = MB_FUNC_READ_DISCRETE_INPUTS;
+        ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF]        = usDiscreteAddr >> 8;
+        ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF + 1]    = usDiscreteAddr;
+        ucMBFrame[MB_PDU_REQ_READ_DISCCNT_OFF ]    = usNDiscreteIn >> 8;
+        ucMBFrame[MB_PDU_REQ_READ_DISCCNT_OFF + 1] = usNDiscreteIn;
+        vMBMasterSetPDUSndLength( MB_PDU_SIZE_MIN + MB_PDU_REQ_READ_SIZE );
+        ( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT );
+        eErrStatus = eMBMasterWaitRequestFinish( );
+    }
+    return eErrStatus;
+}
+
+eMBException
+eMBMasterFuncReadDiscreteInputs( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    USHORT          usDiscreteCnt;
+    UCHAR           ucNBytes;
+    UCHAR          *ucMBFrame;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    /* If this request is broadcast, and it's read mode. This request don't need execute. */
+    if ( xMBMasterRequestIsBroadcast() )
+    {
+        eStatus = MB_EX_NONE;
+    }
+    else if( *usLen >= MB_PDU_SIZE_MIN + MB_PDU_FUNC_READ_SIZE_MIN )
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        usRegAddress = ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usDiscreteCnt = ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_DISCCNT_OFF] << 8 );
+        usDiscreteCnt |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_DISCCNT_OFF + 1] );
+
+        /* Test if the quantity of coils is a multiple of 8. If not last
+         * byte is only partially field with unused coils set to zero. */
+        if( ( usDiscreteCnt & 0x0007 ) != 0 )
+        {
+            ucNBytes = ( UCHAR )( usDiscreteCnt / 8 + 1 );
+        }
+        else
+        {
+            ucNBytes = ( UCHAR )( usDiscreteCnt / 8 );
+        }
+
+        /* Check if the number of registers to read is valid. If not
+         * return Modbus illegal data value exception.
+         */
+        if ((usDiscreteCnt >= 1) && ucNBytes == pucFrame[MB_PDU_FUNC_READ_DISCCNT_OFF])
+        {
+            /* Make callback to fill the buffer. */
+            eRegStatus = eMBMasterRegDiscreteCB( &pucFrame[MB_PDU_FUNC_READ_VALUES_OFF], usRegAddress, usDiscreteCnt );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid read coil register request because the length
+         * is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+
+#endif
+#endif

+ 32 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncfile.c

@@ -0,0 +1,32 @@
+/**
+ * @Author: 李建
+ * @Date: 2024/9/7 10:46
+ * Description: modbus rtu实现写文件功能码0x15
+ * Copyright: Copyright (©) 2024 永续绿建. All rights reserved.
+ */
+#include "mb.h"
+#include "mbframe.h"
+// 定义ymodem协议包的起始始偏移地址
+#define MB_PDU_YMODEM_PACK_OFFSET       ( 0 )
+// 定义帧头的偏移地址
+#define MB_PDU_YMODEL_PACK_HEADER_OFFSET ( MB_PDU_YMODEM_PACK_OFFSET + 1 )
+
+/* ----------------------- Static functions ---------------------------------*/
+eMBException prveMBError2Exception(eMBErrorCode eErrorCode);
+
+#if MB_FUNC_WRITE_FILE_ENABLE
+
+eMBException eMBFuncWriteFile(UCHAR *pucFrame, USHORT *usLen) {
+    eMBErrorCode    eRegStatus;
+    eMBException    eStatus = MB_EX_NONE;
+    eRegStatus = eMBWriteFileCB( &pucFrame[MB_PDU_YMODEL_PACK_HEADER_OFFSET],
+                                 &pucFrame[MB_PDU_YMODEL_PACK_HEADER_OFFSET], usLen );
+
+    /* If an error occured convert it into a Modbus exception. */
+    if( eRegStatus != MB_ENOERR )
+    {
+        eStatus = prveMBError2Exception( eRegStatus );
+    }
+}
+
+#endif

+ 308 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncholding.c

@@ -0,0 +1,308 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbfuncholding.c,v 1.12 2007/02/18 23:48:22 wolti Exp $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbframe.h"
+#include "mbproto.h"
+#include "mbconfig.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_PDU_FUNC_READ_ADDR_OFF               ( MB_PDU_DATA_OFF + 0)
+#define MB_PDU_FUNC_READ_REGCNT_OFF             ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_READ_SIZE                   ( 4 )
+#define MB_PDU_FUNC_READ_REGCNT_MAX             ( 0x007D )
+
+#define MB_PDU_FUNC_WRITE_ADDR_OFF              ( MB_PDU_DATA_OFF + 0)
+#define MB_PDU_FUNC_WRITE_VALUE_OFF             ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_WRITE_SIZE                  ( 4 )
+
+#define MB_PDU_FUNC_WRITE_MUL_ADDR_OFF          ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF        ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF       ( MB_PDU_DATA_OFF + 4 )
+#define MB_PDU_FUNC_WRITE_MUL_VALUES_OFF        ( MB_PDU_DATA_OFF + 5 )
+#define MB_PDU_FUNC_WRITE_MUL_SIZE_MIN          ( 5 )
+#define MB_PDU_FUNC_WRITE_MUL_REGCNT_MAX        ( 0x0078 )
+
+#define MB_PDU_FUNC_READWRITE_READ_ADDR_OFF     ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF   ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF    ( MB_PDU_DATA_OFF + 4 )
+#define MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF  ( MB_PDU_DATA_OFF + 6 )
+#define MB_PDU_FUNC_READWRITE_BYTECNT_OFF       ( MB_PDU_DATA_OFF + 8 )
+#define MB_PDU_FUNC_READWRITE_WRITE_VALUES_OFF  ( MB_PDU_DATA_OFF + 9 )
+#define MB_PDU_FUNC_READWRITE_SIZE_MIN          ( 9 )
+
+/* ----------------------- Static functions ---------------------------------*/
+eMBException    prveMBError2Exception( eMBErrorCode eErrorCode );
+
+/* ----------------------- Start implementation -----------------------------*/
+
+#if MB_FUNC_WRITE_HOLDING_ENABLED > 0
+
+eMBException
+eMBFuncWriteHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen == ( MB_PDU_FUNC_WRITE_SIZE + MB_PDU_SIZE_MIN ) )
+    {
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        /* Make callback to update the value. */
+        eRegStatus = eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF],
+                                      usRegAddress, 1, MB_REG_WRITE );
+
+        /* If an error occured convert it into a Modbus exception. */
+        if( eRegStatus != MB_ENOERR )
+        {
+            eStatus = prveMBError2Exception( eRegStatus );
+        }
+    }
+    else
+    {
+        /* Can't be a valid request because the length is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+#endif
+
+#if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0
+eMBException
+eMBFuncWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    USHORT          usRegCount;
+    UCHAR           ucRegByteCount;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen >= ( MB_PDU_FUNC_WRITE_MUL_SIZE_MIN + MB_PDU_SIZE_MIN ) )
+    {
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF] << 8 );
+        usRegCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF + 1] );
+
+        ucRegByteCount = pucFrame[MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF];
+
+        if( ( usRegCount >= 1 ) &&
+            ( usRegCount <= MB_PDU_FUNC_WRITE_MUL_REGCNT_MAX ) &&
+            ( ucRegByteCount == ( UCHAR ) ( 2 * usRegCount ) ) )
+        {
+            /* Make callback to update the register values. */
+            eRegStatus =
+                eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_WRITE_MUL_VALUES_OFF],
+                                 usRegAddress, usRegCount, MB_REG_WRITE );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+            else
+            {
+                /* The response contains the function code, the starting
+                 * address and the quantity of registers. We reuse the
+                 * old values in the buffer because they are still valid.
+                 */
+                *usLen = MB_PDU_FUNC_WRITE_MUL_BYTECNT_OFF;
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid request because the length is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+#endif
+
+#if MB_FUNC_READ_HOLDING_ENABLED > 0
+
+eMBException
+eMBFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    USHORT          usRegCount;
+    UCHAR          *pucFrameCur;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) )
+    {
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF] << 8 );
+        usRegCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF + 1] );
+
+        /* Check if the number of registers to read is valid. If not
+         * return Modbus illegal data value exception.
+         */
+        if( ( usRegCount >= 1 ) && ( usRegCount <= MB_PDU_FUNC_READ_REGCNT_MAX ) )
+        {
+            /* Set the current PDU data pointer to the beginning. */
+            pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF];
+            *usLen = MB_PDU_FUNC_OFF;
+
+            /* First byte contains the function code. */
+            *pucFrameCur++ = MB_FUNC_READ_HOLDING_REGISTER;
+            *usLen += 1;
+
+            /* Second byte in the response contain the number of bytes. */
+            *pucFrameCur++ = ( UCHAR ) ( usRegCount * 2 );
+            *usLen += 1;
+
+            /* Make callback to fill the buffer. */
+            eRegStatus = eMBRegHoldingCB( pucFrameCur, usRegAddress, usRegCount, MB_REG_READ );
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+            else
+            {
+                *usLen += usRegCount * 2;
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid request because the length is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+
+#endif
+
+#if MB_FUNC_READWRITE_HOLDING_ENABLED > 0
+
+eMBException
+eMBFuncReadWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegReadAddress;
+    USHORT          usRegReadCount;
+    USHORT          usRegWriteAddress;
+    USHORT          usRegWriteCount;
+    UCHAR           ucRegWriteByteCount;
+    UCHAR          *pucFrameCur;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen >= ( MB_PDU_FUNC_READWRITE_SIZE_MIN + MB_PDU_SIZE_MIN ) )
+    {
+        usRegReadAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_ADDR_OFF] << 8U );
+        usRegReadAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_ADDR_OFF + 1] );
+        usRegReadAddress++;
+
+        usRegReadCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF] << 8U );
+        usRegReadCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_READ_REGCNT_OFF + 1] );
+
+        usRegWriteAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF] << 8U );
+        usRegWriteAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_ADDR_OFF + 1] );
+        usRegWriteAddress++;
+
+        usRegWriteCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF] << 8U );
+        usRegWriteCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READWRITE_WRITE_REGCNT_OFF + 1] );
+
+        ucRegWriteByteCount = pucFrame[MB_PDU_FUNC_READWRITE_BYTECNT_OFF];
+
+        if( ( usRegReadCount >= 1 ) && ( usRegReadCount <= 0x7D ) &&
+            ( usRegWriteCount >= 1 ) && ( usRegWriteCount <= 0x79 ) &&
+            ( ( 2 * usRegWriteCount ) == ucRegWriteByteCount ) )
+        {
+            /* Make callback to update the register values. */
+            eRegStatus = eMBRegHoldingCB( &pucFrame[MB_PDU_FUNC_READWRITE_WRITE_VALUES_OFF],
+                                          usRegWriteAddress, usRegWriteCount, MB_REG_WRITE );
+
+            if( eRegStatus == MB_ENOERR )
+            {
+                /* Set the current PDU data pointer to the beginning. */
+                pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF];
+                *usLen = MB_PDU_FUNC_OFF;
+
+                /* First byte contains the function code. */
+                *pucFrameCur++ = MB_FUNC_READWRITE_MULTIPLE_REGISTERS;
+                *usLen += 1;
+
+                /* Second byte in the response contain the number of bytes. */
+                *pucFrameCur++ = ( UCHAR ) ( usRegReadCount * 2 );
+                *usLen += 1;
+
+                /* Make the read callback. */
+                eRegStatus =
+                    eMBRegHoldingCB( pucFrameCur, usRegReadAddress, usRegReadCount, MB_REG_READ );
+                if( eRegStatus == MB_ENOERR )
+                {
+                    *usLen += 2 * usRegReadCount;
+                }
+            }
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    return eStatus;
+}
+
+#endif

+ 455 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncholding_m.c

@@ -0,0 +1,455 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (C) 2013 Armink <armink.ztl@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbfuncholding_m.c,v 1.60 2013/09/02 14:13:40 Armink Add Master Functions  Exp $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mb_m.h"
+#include "mbframe.h"
+#include "mbproto.h"
+#include "mbconfig.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_PDU_REQ_READ_ADDR_OFF                ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_REQ_READ_REGCNT_OFF              ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_REQ_READ_SIZE                    ( 4 )
+#define MB_PDU_FUNC_READ_REGCNT_MAX             ( 0x007D )
+#define MB_PDU_FUNC_READ_BYTECNT_OFF            ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_FUNC_READ_VALUES_OFF             ( MB_PDU_DATA_OFF + 1 )
+#define MB_PDU_FUNC_READ_SIZE_MIN               ( 1 )
+
+#define MB_PDU_REQ_WRITE_ADDR_OFF               ( MB_PDU_DATA_OFF + 0)
+#define MB_PDU_REQ_WRITE_VALUE_OFF              ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_REQ_WRITE_SIZE                   ( 4 )
+#define MB_PDU_FUNC_WRITE_ADDR_OFF              ( MB_PDU_DATA_OFF + 0)
+#define MB_PDU_FUNC_WRITE_VALUE_OFF             ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_WRITE_SIZE                  ( 4 )
+
+#define MB_PDU_REQ_WRITE_MUL_ADDR_OFF           ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_REQ_WRITE_MUL_REGCNT_OFF         ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_REQ_WRITE_MUL_BYTECNT_OFF        ( MB_PDU_DATA_OFF + 4 )
+#define MB_PDU_REQ_WRITE_MUL_VALUES_OFF         ( MB_PDU_DATA_OFF + 5 )
+#define MB_PDU_REQ_WRITE_MUL_SIZE_MIN           ( 5 )
+#define MB_PDU_REQ_WRITE_MUL_REGCNT_MAX         ( 0x0078 )
+#define MB_PDU_FUNC_WRITE_MUL_ADDR_OFF          ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_FUNC_WRITE_MUL_REGCNT_OFF        ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_WRITE_MUL_SIZE              ( 4 )
+
+#define MB_PDU_REQ_READWRITE_READ_ADDR_OFF      ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_REQ_READWRITE_READ_REGCNT_OFF    ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_REQ_READWRITE_WRITE_ADDR_OFF     ( MB_PDU_DATA_OFF + 4 )
+#define MB_PDU_REQ_READWRITE_WRITE_REGCNT_OFF   ( MB_PDU_DATA_OFF + 6 )
+#define MB_PDU_REQ_READWRITE_WRITE_BYTECNT_OFF  ( MB_PDU_DATA_OFF + 8 )
+#define MB_PDU_REQ_READWRITE_WRITE_VALUES_OFF   ( MB_PDU_DATA_OFF + 9 )
+#define MB_PDU_REQ_READWRITE_SIZE_MIN           ( 9 )
+#define MB_PDU_FUNC_READWRITE_READ_BYTECNT_OFF  ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_FUNC_READWRITE_READ_VALUES_OFF   ( MB_PDU_DATA_OFF + 1 )
+#define MB_PDU_FUNC_READWRITE_SIZE_MIN          ( 1 )
+
+/* ----------------------- Static functions ---------------------------------*/
+eMBException    prveMBError2Exception( eMBErrorCode eErrorCode );
+
+/* ----------------------- Start implementation -----------------------------*/
+#if MB_MASTER_RTU_ENABLED > 0 || MB_MASTER_ASCII_ENABLED > 0
+#if MB_FUNC_WRITE_HOLDING_ENABLED > 0
+
+/**
+ * This function will request write holding register.
+ *
+ * @param ucSndAddr salve address
+ * @param usRegAddr register start address
+ * @param usRegData register data to be written
+ * @param lTimeOut timeout (-1 will waiting forever)
+ *
+ * @return error code
+ */
+eMBMasterReqErrCode
+eMBMasterReqWriteHoldingRegister( UCHAR ucSndAddr, USHORT usRegAddr, USHORT usRegData, LONG lTimeOut )
+{
+    UCHAR                 *ucMBFrame;
+    eMBMasterReqErrCode    eErrStatus = MB_MRE_NO_ERR;
+
+    if ( ucSndAddr > MB_MASTER_TOTAL_SLAVE_NUM ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( xMBMasterRunResTake( lTimeOut ) == FALSE ) eErrStatus = MB_MRE_MASTER_BUSY;
+    else
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        vMBMasterSetDestAddress(ucSndAddr);
+        ucMBFrame[MB_PDU_FUNC_OFF]                = MB_FUNC_WRITE_REGISTER;
+        ucMBFrame[MB_PDU_REQ_WRITE_ADDR_OFF]      = usRegAddr >> 8;
+        ucMBFrame[MB_PDU_REQ_WRITE_ADDR_OFF + 1]  = usRegAddr;
+        ucMBFrame[MB_PDU_REQ_WRITE_VALUE_OFF]     = usRegData >> 8;
+        ucMBFrame[MB_PDU_REQ_WRITE_VALUE_OFF + 1] = usRegData ;
+        vMBMasterSetPDUSndLength( MB_PDU_SIZE_MIN + MB_PDU_REQ_WRITE_SIZE );
+        ( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT );
+        eErrStatus = eMBMasterWaitRequestFinish( );
+    }
+    return eErrStatus;
+}
+
+eMBException
+eMBMasterFuncWriteHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen == ( MB_PDU_SIZE_MIN + MB_PDU_FUNC_WRITE_SIZE ) )
+    {
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_WRITE_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        /* Make callback to update the value. */
+        eRegStatus = eMBMasterRegHoldingCB( &pucFrame[MB_PDU_FUNC_WRITE_VALUE_OFF],
+                                      usRegAddress, 1, MB_REG_WRITE );
+
+        /* If an error occured convert it into a Modbus exception. */
+        if( eRegStatus != MB_ENOERR )
+        {
+            eStatus = prveMBError2Exception( eRegStatus );
+        }
+    }
+    else
+    {
+        /* Can't be a valid request because the length is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+#endif
+
+#if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0
+
+/**
+ * This function will request write multiple holding register.
+ *
+ * @param ucSndAddr salve address
+ * @param usRegAddr register start address
+ * @param usNRegs register total number
+ * @param pusDataBuffer data to be written
+ * @param lTimeOut timeout (-1 will waiting forever)
+ *
+ * @return error code
+ */
+eMBMasterReqErrCode
+eMBMasterReqWriteMultipleHoldingRegister( UCHAR ucSndAddr,
+        USHORT usRegAddr, USHORT usNRegs, USHORT * pusDataBuffer, LONG lTimeOut )
+{
+    UCHAR                 *ucMBFrame;
+    USHORT                 usRegIndex = 0;
+    eMBMasterReqErrCode    eErrStatus = MB_MRE_NO_ERR;
+
+    if ( ucSndAddr > MB_MASTER_TOTAL_SLAVE_NUM ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( xMBMasterRunResTake( lTimeOut ) == FALSE ) eErrStatus = MB_MRE_MASTER_BUSY;
+    else
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        vMBMasterSetDestAddress(ucSndAddr);
+        ucMBFrame[MB_PDU_FUNC_OFF]                     = MB_FUNC_WRITE_MULTIPLE_REGISTERS;
+        ucMBFrame[MB_PDU_REQ_WRITE_MUL_ADDR_OFF]       = usRegAddr >> 8;
+        ucMBFrame[MB_PDU_REQ_WRITE_MUL_ADDR_OFF + 1]   = usRegAddr;
+        ucMBFrame[MB_PDU_REQ_WRITE_MUL_REGCNT_OFF]     = usNRegs >> 8;
+        ucMBFrame[MB_PDU_REQ_WRITE_MUL_REGCNT_OFF + 1] = usNRegs ;
+        ucMBFrame[MB_PDU_REQ_WRITE_MUL_BYTECNT_OFF]    = usNRegs * 2;
+        ucMBFrame += MB_PDU_REQ_WRITE_MUL_VALUES_OFF;
+        while( usNRegs > usRegIndex)
+        {
+            *ucMBFrame++ = pusDataBuffer[usRegIndex] >> 8;
+            *ucMBFrame++ = pusDataBuffer[usRegIndex++] ;
+        }
+        vMBMasterSetPDUSndLength( MB_PDU_SIZE_MIN + MB_PDU_REQ_WRITE_MUL_SIZE_MIN + 2*usNRegs );
+        ( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT );
+        eErrStatus = eMBMasterWaitRequestFinish( );
+    }
+    return eErrStatus;
+}
+
+eMBException
+eMBMasterFuncWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
+{
+    UCHAR          *ucMBFrame;
+    USHORT          usRegAddress;
+    USHORT          usRegCount;
+    UCHAR           ucRegByteCount;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    /* If this request is broadcast, the *usLen is not need check. */
+    if( ( *usLen == MB_PDU_SIZE_MIN + MB_PDU_FUNC_WRITE_MUL_SIZE ) || xMBMasterRequestIsBroadcast() )
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        usRegAddress = ( USHORT )( ucMBFrame[MB_PDU_REQ_WRITE_MUL_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( ucMBFrame[MB_PDU_REQ_WRITE_MUL_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usRegCount = ( USHORT )( ucMBFrame[MB_PDU_REQ_WRITE_MUL_REGCNT_OFF] << 8 );
+        usRegCount |= ( USHORT )( ucMBFrame[MB_PDU_REQ_WRITE_MUL_REGCNT_OFF + 1] );
+
+        ucRegByteCount = ucMBFrame[MB_PDU_REQ_WRITE_MUL_BYTECNT_OFF];
+
+        if( ucRegByteCount == 2 * usRegCount )
+        {
+            /* Make callback to update the register values. */
+            eRegStatus =
+                eMBMasterRegHoldingCB( &ucMBFrame[MB_PDU_REQ_WRITE_MUL_VALUES_OFF],
+                                 usRegAddress, usRegCount, MB_REG_WRITE );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid request because the length is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+#endif
+
+#if MB_FUNC_READ_HOLDING_ENABLED > 0
+
+/**
+ * This function will request read holding register.
+ *
+ * @param ucSndAddr salve address
+ * @param usRegAddr register start address
+ * @param usNRegs register total number
+ * @param lTimeOut timeout (-1 will waiting forever)
+ *
+ * @return error code
+ */
+eMBMasterReqErrCode
+eMBMasterReqReadHoldingRegister( UCHAR ucSndAddr, USHORT usRegAddr, USHORT usNRegs, LONG lTimeOut )
+{
+    UCHAR                 *ucMBFrame;
+    eMBMasterReqErrCode    eErrStatus = MB_MRE_NO_ERR;
+
+    if ( ucSndAddr > MB_MASTER_TOTAL_SLAVE_NUM ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( xMBMasterRunResTake( lTimeOut ) == FALSE ) eErrStatus = MB_MRE_MASTER_BUSY;
+    else
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        vMBMasterSetDestAddress(ucSndAddr);
+        ucMBFrame[MB_PDU_FUNC_OFF]                = MB_FUNC_READ_HOLDING_REGISTER;
+        ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF]       = usRegAddr >> 8;
+        ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF + 1]   = usRegAddr;
+        ucMBFrame[MB_PDU_REQ_READ_REGCNT_OFF]     = usNRegs >> 8;
+        ucMBFrame[MB_PDU_REQ_READ_REGCNT_OFF + 1] = usNRegs;
+        vMBMasterSetPDUSndLength( MB_PDU_SIZE_MIN + MB_PDU_REQ_READ_SIZE );
+        ( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT );
+        eErrStatus = eMBMasterWaitRequestFinish( );
+    }
+    return eErrStatus;
+}
+
+eMBException
+eMBMasterFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
+{
+    UCHAR          *ucMBFrame;
+    USHORT          usRegAddress;
+    USHORT          usRegCount;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    /* If this request is broadcast, and it's read mode. This request don't need execute. */
+    if ( xMBMasterRequestIsBroadcast() )
+    {
+        eStatus = MB_EX_NONE;
+    }
+    else if( *usLen >= MB_PDU_SIZE_MIN + MB_PDU_FUNC_READ_SIZE_MIN )
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        usRegAddress = ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usRegCount = ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_REGCNT_OFF] << 8 );
+        usRegCount |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_REGCNT_OFF + 1] );
+
+        /* Check if the number of registers to read is valid. If not
+         * return Modbus illegal data value exception.
+         */
+        if( ( usRegCount >= 1 ) && ( 2 * usRegCount == pucFrame[MB_PDU_FUNC_READ_BYTECNT_OFF] ) )
+        {
+            /* Make callback to fill the buffer. */
+            eRegStatus = eMBMasterRegHoldingCB( &pucFrame[MB_PDU_FUNC_READ_VALUES_OFF], usRegAddress, usRegCount, MB_REG_READ );
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid request because the length is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+
+#endif
+
+#if MB_FUNC_READWRITE_HOLDING_ENABLED > 0
+
+/**
+ * This function will request read and write holding register.
+ *
+ * @param ucSndAddr salve address
+ * @param usReadRegAddr read register start address
+ * @param usNReadRegs read register total number
+ * @param pusDataBuffer data to be written
+ * @param usWriteRegAddr write register start address
+ * @param usNWriteRegs write register total number
+ * @param lTimeOut timeout (-1 will waiting forever)
+ *
+ * @return error code
+ */
+eMBMasterReqErrCode
+eMBMasterReqReadWriteMultipleHoldingRegister( UCHAR ucSndAddr,
+        USHORT usReadRegAddr, USHORT usNReadRegs, USHORT * pusDataBuffer,
+        USHORT usWriteRegAddr, USHORT usNWriteRegs, LONG lTimeOut )
+{
+    UCHAR                 *ucMBFrame;
+    USHORT                 usRegIndex = 0;
+    eMBMasterReqErrCode    eErrStatus = MB_MRE_NO_ERR;
+
+    if ( ucSndAddr > MB_MASTER_TOTAL_SLAVE_NUM ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( xMBMasterRunResTake( lTimeOut ) == FALSE ) eErrStatus = MB_MRE_MASTER_BUSY;
+    else
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        vMBMasterSetDestAddress(ucSndAddr);
+        ucMBFrame[MB_PDU_FUNC_OFF]                           = MB_FUNC_READWRITE_MULTIPLE_REGISTERS;
+        ucMBFrame[MB_PDU_REQ_READWRITE_READ_ADDR_OFF]        = usReadRegAddr >> 8;
+        ucMBFrame[MB_PDU_REQ_READWRITE_READ_ADDR_OFF + 1]    = usReadRegAddr;
+        ucMBFrame[MB_PDU_REQ_READWRITE_READ_REGCNT_OFF]      = usNReadRegs >> 8;
+        ucMBFrame[MB_PDU_REQ_READWRITE_READ_REGCNT_OFF + 1]  = usNReadRegs ;
+        ucMBFrame[MB_PDU_REQ_READWRITE_WRITE_ADDR_OFF]       = usWriteRegAddr >> 8;
+        ucMBFrame[MB_PDU_REQ_READWRITE_WRITE_ADDR_OFF + 1]   = usWriteRegAddr;
+        ucMBFrame[MB_PDU_REQ_READWRITE_WRITE_REGCNT_OFF]     = usNWriteRegs >> 8;
+        ucMBFrame[MB_PDU_REQ_READWRITE_WRITE_REGCNT_OFF + 1] = usNWriteRegs ;
+        ucMBFrame[MB_PDU_REQ_READWRITE_WRITE_BYTECNT_OFF]    = usNWriteRegs * 2;
+        ucMBFrame += MB_PDU_REQ_READWRITE_WRITE_VALUES_OFF;
+        while( usNWriteRegs > usRegIndex)
+        {
+            *ucMBFrame++ = pusDataBuffer[usRegIndex] >> 8;
+            *ucMBFrame++ = pusDataBuffer[usRegIndex++] ;
+        }
+        vMBMasterSetPDUSndLength( MB_PDU_SIZE_MIN + MB_PDU_REQ_READWRITE_SIZE_MIN + 2*usNWriteRegs );
+        ( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT );
+        eErrStatus = eMBMasterWaitRequestFinish( );
+    }
+    return eErrStatus;
+}
+
+eMBException
+eMBMasterFuncReadWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegReadAddress;
+    USHORT          usRegReadCount;
+    USHORT          usRegWriteAddress;
+    USHORT          usRegWriteCount;
+    UCHAR          *ucMBFrame;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    /* If this request is broadcast, and it's read mode. This request don't need execute. */
+    if ( xMBMasterRequestIsBroadcast() )
+    {
+        eStatus = MB_EX_NONE;
+    }
+    else if( *usLen >= MB_PDU_SIZE_MIN + MB_PDU_FUNC_READWRITE_SIZE_MIN )
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        usRegReadAddress = ( USHORT )( ucMBFrame[MB_PDU_REQ_READWRITE_READ_ADDR_OFF] << 8U );
+        usRegReadAddress |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READWRITE_READ_ADDR_OFF + 1] );
+        usRegReadAddress++;
+
+        usRegReadCount = ( USHORT )( ucMBFrame[MB_PDU_REQ_READWRITE_READ_REGCNT_OFF] << 8U );
+        usRegReadCount |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READWRITE_READ_REGCNT_OFF + 1] );
+
+        usRegWriteAddress = ( USHORT )( ucMBFrame[MB_PDU_REQ_READWRITE_WRITE_ADDR_OFF] << 8U );
+        usRegWriteAddress |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READWRITE_WRITE_ADDR_OFF + 1] );
+        usRegWriteAddress++;
+
+        usRegWriteCount = ( USHORT )( ucMBFrame[MB_PDU_REQ_READWRITE_WRITE_REGCNT_OFF] << 8U );
+        usRegWriteCount |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READWRITE_WRITE_REGCNT_OFF + 1] );
+
+        if( ( 2 * usRegReadCount ) == pucFrame[MB_PDU_FUNC_READWRITE_READ_BYTECNT_OFF] )
+        {
+            /* Make callback to update the register values. */
+            eRegStatus = eMBMasterRegHoldingCB( &ucMBFrame[MB_PDU_REQ_READWRITE_WRITE_VALUES_OFF],
+                                           usRegWriteAddress, usRegWriteCount, MB_REG_WRITE );
+
+            if( eRegStatus == MB_ENOERR )
+            {
+                /* Make the read callback. */
+                eRegStatus = eMBMasterRegHoldingCB(&pucFrame[MB_PDU_FUNC_READWRITE_READ_VALUES_OFF],
+                                              usRegReadAddress, usRegReadCount, MB_REG_READ);
+            }
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    return eStatus;
+}
+
+#endif
+#endif
+

+ 122 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncinput.c

@@ -0,0 +1,122 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbfuncinput.c,v 1.10 2007/09/12 10:15:56 wolti Exp $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbframe.h"
+#include "mbproto.h"
+#include "mbconfig.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_PDU_FUNC_READ_ADDR_OFF           ( MB_PDU_DATA_OFF )
+#define MB_PDU_FUNC_READ_REGCNT_OFF         ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_FUNC_READ_SIZE               ( 4 )
+#define MB_PDU_FUNC_READ_REGCNT_MAX         ( 0x007D )
+
+#define MB_PDU_FUNC_READ_RSP_BYTECNT_OFF    ( MB_PDU_DATA_OFF )
+
+/* ----------------------- Static functions ---------------------------------*/
+eMBException    prveMBError2Exception( eMBErrorCode eErrorCode );
+
+/* ----------------------- Start implementation -----------------------------*/
+#if MB_FUNC_READ_INPUT_ENABLED > 0
+
+eMBException
+eMBFuncReadInputRegister( UCHAR * pucFrame, USHORT * usLen )
+{
+    USHORT          usRegAddress;
+    USHORT          usRegCount;
+    UCHAR          *pucFrameCur;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    if( *usLen == ( MB_PDU_FUNC_READ_SIZE + MB_PDU_SIZE_MIN ) )
+    {
+        usRegAddress = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usRegCount = ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF] << 8 );
+        usRegCount |= ( USHORT )( pucFrame[MB_PDU_FUNC_READ_REGCNT_OFF + 1] );
+
+        /* Check if the number of registers to read is valid. If not
+         * return Modbus illegal data value exception.
+         */
+        if( ( usRegCount >= 1 )
+            && ( usRegCount < MB_PDU_FUNC_READ_REGCNT_MAX ) )
+        {
+            /* Set the current PDU data pointer to the beginning. */
+            pucFrameCur = &pucFrame[MB_PDU_FUNC_OFF];
+            *usLen = MB_PDU_FUNC_OFF;
+
+            /* First byte contains the function code. */
+            *pucFrameCur++ = MB_FUNC_READ_INPUT_REGISTER;
+            *usLen += 1;
+
+            /* Second byte in the response contain the number of bytes. */
+            *pucFrameCur++ = ( UCHAR )( usRegCount * 2 );
+            *usLen += 1;
+
+            eRegStatus =
+                eMBRegInputCB( pucFrameCur, usRegAddress, usRegCount );
+
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+            else
+            {
+                *usLen += usRegCount * 2;
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid read input register request because the length
+         * is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+
+#endif

+ 148 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncinput_m.c

@@ -0,0 +1,148 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (C) 2013 Armink <armink.ztl@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbfuncinput_m.c,v 1.60 2013/10/12 14:23:40 Armink Add Master Functions  Exp $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mb_m.h"
+#include "mbframe.h"
+#include "mbproto.h"
+#include "mbconfig.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_PDU_REQ_READ_ADDR_OFF            ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_REQ_READ_REGCNT_OFF          ( MB_PDU_DATA_OFF + 2 )
+#define MB_PDU_REQ_READ_SIZE                ( 4 )
+#define MB_PDU_FUNC_READ_BYTECNT_OFF        ( MB_PDU_DATA_OFF + 0 )
+#define MB_PDU_FUNC_READ_VALUES_OFF         ( MB_PDU_DATA_OFF + 1 )
+#define MB_PDU_FUNC_READ_SIZE_MIN           ( 1 )
+
+#define MB_PDU_FUNC_READ_RSP_BYTECNT_OFF    ( MB_PDU_DATA_OFF )
+
+/* ----------------------- Static functions ---------------------------------*/
+eMBException    prveMBError2Exception( eMBErrorCode eErrorCode );
+
+/* ----------------------- Start implementation -----------------------------*/
+#if MB_MASTER_RTU_ENABLED > 0 || MB_MASTER_ASCII_ENABLED > 0
+#if MB_FUNC_READ_INPUT_ENABLED > 0
+
+/**
+ * This function will request read input register.
+ *
+ * @param ucSndAddr salve address
+ * @param usRegAddr register start address
+ * @param usNRegs register total number
+ * @param lTimeOut timeout (-1 will waiting forever)
+ *
+ * @return error code
+ */
+eMBMasterReqErrCode
+eMBMasterReqReadInputRegister( UCHAR ucSndAddr, USHORT usRegAddr, USHORT usNRegs, LONG lTimeOut )
+{
+    UCHAR                 *ucMBFrame;
+    eMBMasterReqErrCode    eErrStatus = MB_MRE_NO_ERR;
+
+    if ( ucSndAddr > MB_MASTER_TOTAL_SLAVE_NUM ) eErrStatus = MB_MRE_ILL_ARG;
+    else if ( xMBMasterRunResTake( lTimeOut ) == FALSE ) eErrStatus = MB_MRE_MASTER_BUSY;
+    else
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        vMBMasterSetDestAddress(ucSndAddr);
+        ucMBFrame[MB_PDU_FUNC_OFF]                = MB_FUNC_READ_INPUT_REGISTER;
+        ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF]       = usRegAddr >> 8;
+        ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF + 1]   = usRegAddr;
+        ucMBFrame[MB_PDU_REQ_READ_REGCNT_OFF]     = usNRegs >> 8;
+        ucMBFrame[MB_PDU_REQ_READ_REGCNT_OFF + 1] = usNRegs;
+        vMBMasterSetPDUSndLength( MB_PDU_SIZE_MIN + MB_PDU_REQ_READ_SIZE );
+        ( void ) xMBMasterPortEventPost( EV_MASTER_FRAME_SENT );
+        eErrStatus = eMBMasterWaitRequestFinish( );
+    }
+    return eErrStatus;
+}
+
+eMBException
+eMBMasterFuncReadInputRegister( UCHAR * pucFrame, USHORT * usLen )
+{
+    UCHAR          *ucMBFrame;
+    USHORT          usRegAddress;
+    USHORT          usRegCount;
+
+    eMBException    eStatus = MB_EX_NONE;
+    eMBErrorCode    eRegStatus;
+
+    /* If this request is broadcast, and it's read mode. This request don't need execute. */
+    if ( xMBMasterRequestIsBroadcast() )
+    {
+        eStatus = MB_EX_NONE;
+    }
+    else if( *usLen >= MB_PDU_SIZE_MIN + MB_PDU_FUNC_READ_SIZE_MIN )
+    {
+        vMBMasterGetPDUSndBuf(&ucMBFrame);
+        usRegAddress = ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF] << 8 );
+        usRegAddress |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_ADDR_OFF + 1] );
+        usRegAddress++;
+
+        usRegCount = ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_REGCNT_OFF] << 8 );
+        usRegCount |= ( USHORT )( ucMBFrame[MB_PDU_REQ_READ_REGCNT_OFF + 1] );
+
+        /* Check if the number of registers to read is valid. If not
+         * return Modbus illegal data value exception.
+         */
+        if( ( usRegCount >= 1 ) && ( 2 * usRegCount == pucFrame[MB_PDU_FUNC_READ_BYTECNT_OFF] ) )
+        {
+            /* Make callback to fill the buffer. */
+            eRegStatus = eMBMasterRegInputCB( &pucFrame[MB_PDU_FUNC_READ_VALUES_OFF], usRegAddress, usRegCount );
+            /* If an error occured convert it into a Modbus exception. */
+            if( eRegStatus != MB_ENOERR )
+            {
+                eStatus = prveMBError2Exception( eRegStatus );
+            }
+        }
+        else
+        {
+            eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+        }
+    }
+    else
+    {
+        /* Can't be a valid request because the length is incorrect. */
+        eStatus = MB_EX_ILLEGAL_DATA_VALUE;
+    }
+    return eStatus;
+}
+
+#endif
+#endif

+ 88 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncother.c

@@ -0,0 +1,88 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbfuncother.c,v 1.8 2006/12/07 22:10:34 wolti Exp $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbframe.h"
+#include "mbproto.h"
+#include "mbconfig.h"
+
+#if MB_FUNC_OTHER_REP_SLAVEID_ENABLED > 0
+
+/* ----------------------- Static variables ---------------------------------*/
+static UCHAR    ucMBSlaveID[MB_FUNC_OTHER_REP_SLAVEID_BUF];
+static USHORT   usMBSlaveIDLen;
+
+/* ----------------------- Start implementation -----------------------------*/
+
+eMBErrorCode
+eMBSetSlaveID( UCHAR ucSlaveID, BOOL xIsRunning,
+               UCHAR const *pucAdditional, USHORT usAdditionalLen )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+
+    /* the first byte and second byte in the buffer is reserved for
+     * the parameter ucSlaveID and the running flag. The rest of
+     * the buffer is available for additional data. */
+    if( usAdditionalLen + 2 < MB_FUNC_OTHER_REP_SLAVEID_BUF )
+    {
+        usMBSlaveIDLen = 0;
+        ucMBSlaveID[usMBSlaveIDLen++] = ucSlaveID;
+        ucMBSlaveID[usMBSlaveIDLen++] = ( UCHAR )( xIsRunning ? 0xFF : 0x00 );
+        if( usAdditionalLen > 0 )
+        {
+            memcpy( &ucMBSlaveID[usMBSlaveIDLen], pucAdditional,
+                    ( size_t )usAdditionalLen );
+            usMBSlaveIDLen += usAdditionalLen;
+        }
+    }
+    else
+    {
+        eStatus = MB_ENORES;
+    }
+    return eStatus;
+}
+
+eMBException
+eMBFuncReportSlaveID( UCHAR * pucFrame, USHORT * usLen )
+{
+    memcpy( &pucFrame[MB_PDU_DATA_OFF], &ucMBSlaveID[0], ( size_t )usMBSlaveIDLen );
+    *usLen = ( USHORT )( MB_PDU_DATA_OFF + usMBSlaveIDLen );
+    return MB_EX_NONE;
+}
+
+#endif

+ 142 - 0
Middlewares/Third_Party/FreeModbus/modbus/functions/mbutils.c

@@ -0,0 +1,142 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbutils.c,v 1.6 2007/02/18 23:49:07 wolti Exp $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+#include "main.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbproto.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+#define BITS_UCHAR      8U
+
+/* ----------------------- Start implementation -----------------------------*/
+void
+xMBUtilSetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits,
+                UCHAR ucValue )
+{
+    USHORT          usWordBuf;
+    USHORT          usMask;
+    USHORT          usByteOffset;
+    USHORT          usNPreBits;
+    USHORT          usValue = ucValue;
+
+    assert_param( ucNBits <= 8 );
+    assert_param( ( size_t )BITS_UCHAR == sizeof( UCHAR ) * 8 );
+
+    /* Calculate byte offset for first byte containing the bit values starting
+     * at usBitOffset. */
+    usByteOffset = ( USHORT )( ( usBitOffset ) / BITS_UCHAR );
+
+    /* How many bits precede our bits to set. */
+    usNPreBits = ( USHORT )( usBitOffset - usByteOffset * BITS_UCHAR );
+
+    /* Move bit field into position over bits to set */
+    usValue <<= usNPreBits;
+
+    /* Prepare a mask for setting the new bits. */
+    usMask = ( USHORT )( ( 1 << ( USHORT ) ucNBits ) - 1 );
+    usMask <<= usBitOffset - usByteOffset * BITS_UCHAR;
+
+    /* copy bits into temporary storage. */
+    usWordBuf = ucByteBuf[usByteOffset];
+    usWordBuf |= ucByteBuf[usByteOffset + 1] << BITS_UCHAR;
+
+    /* Zero out bit field bits and then or value bits into them. */
+    usWordBuf = ( USHORT )( ( usWordBuf & ( ~usMask ) ) | usValue );
+
+    /* move bits back into storage */
+    ucByteBuf[usByteOffset] = ( UCHAR )( usWordBuf & 0xFF );
+    ucByteBuf[usByteOffset + 1] = ( UCHAR )( usWordBuf >> BITS_UCHAR );
+}
+
+UCHAR
+xMBUtilGetBits( UCHAR * ucByteBuf, USHORT usBitOffset, UCHAR ucNBits )
+{
+    USHORT          usWordBuf;
+    USHORT          usMask;
+    USHORT          usByteOffset;
+    USHORT          usNPreBits;
+
+    /* Calculate byte offset for first byte containing the bit values starting
+     * at usBitOffset. */
+    usByteOffset = ( USHORT )( ( usBitOffset ) / BITS_UCHAR );
+
+    /* How many bits precede our bits to set. */
+    usNPreBits = ( USHORT )( usBitOffset - usByteOffset * BITS_UCHAR );
+
+    /* Prepare a mask for setting the new bits. */
+    usMask = ( USHORT )( ( 1 << ( USHORT ) ucNBits ) - 1 );
+
+    /* copy bits into temporary storage. */
+    usWordBuf = ucByteBuf[usByteOffset];
+    usWordBuf |= ucByteBuf[usByteOffset + 1] << BITS_UCHAR;
+
+    /* throw away unneeded bits. */
+    usWordBuf >>= usNPreBits;
+
+    /* mask away bits above the requested bitfield. */
+    usWordBuf &= usMask;
+
+    return ( UCHAR ) usWordBuf;
+}
+
+eMBException
+prveMBError2Exception( eMBErrorCode eErrorCode )
+{
+    eMBException    eStatus;
+
+    switch ( eErrorCode )
+    {
+        case MB_ENOERR:
+            eStatus = MB_EX_NONE;
+            break;
+
+        case MB_ENOREG:
+            eStatus = MB_EX_ILLEGAL_DATA_ADDRESS;
+            break;
+
+        case MB_ETIMEDOUT:
+            eStatus = MB_EX_SLAVE_BUSY;
+            break;
+
+        default:
+            eStatus = MB_EX_SLAVE_DEVICE_FAILURE;
+            break;
+    }
+
+    return eStatus;
+}

+ 424 - 0
Middlewares/Third_Party/FreeModbus/modbus/include/mb.h

@@ -0,0 +1,424 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mb.h,v 1.17 2006/12/07 22:10:34 wolti Exp $
+ */
+
+#ifndef _MB_H
+#define _MB_H
+
+#include "port.h"
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+
+#include "mbport.h"
+#include "mbproto.h"
+
+/*! \defgroup modbus Modbus
+ * \code #include "mb.h" \endcode
+ *
+ * This module defines the interface for the application. It contains
+ * the basic functions and types required to use the Modbus protocol stack.
+ * A typical application will want to call eMBInit() first. If the device
+ * is ready to answer network requests it must then call eMBEnable() to activate
+ * the protocol stack. In the main loop the function eMBPoll() must be called
+ * periodically. The time interval between pooling depends on the configured
+ * Modbus timeout. If an RTOS is available a separate task should be created
+ * and the task should always call the function eMBPoll().
+ *
+ * \code
+ * // Initialize protocol stack in RTU mode for a slave with address 10 = 0x0A
+ * eMBInit( MB_RTU, 0x0A, 38400, MB_PAR_EVEN );
+ * // Enable the Modbus Protocol Stack.
+ * eMBEnable(  );
+ * for( ;; )
+ * {
+ *     // Call the main polling loop of the Modbus protocol stack.
+ *     eMBPoll(  );
+ *     ...
+ * }
+ * \endcode
+ */
+
+/* ----------------------- Defines ------------------------------------------*/
+
+/*! \ingroup modbus
+ * \brief Use the default Modbus TCP port (502)
+ */
+#define MB_TCP_PORT_USE_DEFAULT 0
+
+/* ----------------------- Type definitions ---------------------------------*/
+
+/*! \ingroup modbus
+ * \brief Modbus serial transmission modes (RTU/ASCII).
+ *
+ * Modbus serial supports two transmission modes. Either ASCII or RTU. RTU
+ * is faster but has more hardware requirements and requires a network with
+ * a low jitter. ASCII is slower and more reliable on slower links (E.g. modems)
+ */
+    typedef enum
+{
+    MB_RTU,                     /*!< RTU transmission mode. */
+    MB_ASCII,                   /*!< ASCII transmission mode. */
+    MB_TCP                      /*!< TCP mode. */
+} eMBMode;
+
+/*! \ingroup modbus
+ * \brief If register should be written or read.
+ *
+ * This value is passed to the callback functions which support either
+ * reading or writing register values. Writing means that the application
+ * registers should be updated and reading means that the modbus protocol
+ * stack needs to know the current register values.
+ *
+ * \see eMBRegHoldingCB( ), eMBRegCoilsCB( ), eMBRegDiscreteCB( ) and
+ *   eMBRegInputCB( ).
+ */
+typedef enum
+{
+    MB_REG_READ,                /*!< Read register values and pass to protocol stack. */
+    MB_REG_WRITE                /*!< Update register values. */
+} eMBRegisterMode;
+
+/*! \ingroup modbus
+ * \brief Errorcodes used by all function in the protocol stack.
+ */
+typedef enum
+{
+    MB_ENOERR,                  /*!< no error. */
+    MB_ENOREG,                  /*!< illegal register address. */
+    MB_EINVAL,                  /*!< illegal argument. */
+    MB_EPORTERR,                /*!< porting layer error. */
+    MB_ENORES,                  /*!< insufficient resources. */
+    MB_EIO,                     /*!< I/O error. */
+    MB_EILLSTATE,               /*!< protocol stack in illegal state. */
+    MB_ETIMEDOUT                /*!< timeout error occurred. */
+} eMBErrorCode;
+
+
+/* ----------------------- Function prototypes ------------------------------*/
+/*! \ingroup modbus
+ * \brief Initialize the Modbus protocol stack.
+ *
+ * This functions initializes the ASCII or RTU module and calls the
+ * init functions of the porting layer to prepare the hardware. Please
+ * note that the receiver is still disabled and no Modbus frames are
+ * processed until eMBEnable( ) has been called.
+ *
+ * \param eMode If ASCII or RTU mode should be used.
+ * \param ucSlaveAddress The slave address. Only frames sent to this
+ *   address or to the broadcast address are processed.
+ * \param ucPort The port to use. E.g. 1 for COM1 on windows. This value
+ *   is platform dependent and some ports simply choose to ignore it.
+ * \param ulBaudRate The baudrate. E.g. 19200. Supported baudrates depend
+ *   on the porting layer.
+ * \param eParity Parity used for serial transmission.
+ *
+ * \return If no error occurs the function returns eMBErrorCode::MB_ENOERR.
+ *   The protocol is then in the disabled state and ready for activation
+ *   by calling eMBEnable( ). Otherwise one of the following error codes
+ *   is returned:
+ *    - eMBErrorCode::MB_EINVAL If the slave address was not valid. Valid
+ *        slave addresses are in the range 1 - 247.
+ *    - eMBErrorCode::MB_EPORTERR IF the porting layer returned an error.
+ */
+eMBErrorCode    eMBInit( eMBMode eMode, UCHAR ucSlaveAddress,
+                         UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity );
+
+/*! \ingroup modbus
+ * \brief Initialize the Modbus protocol stack for Modbus TCP.
+ *
+ * This function initializes the Modbus TCP Module. Please note that
+ * frame processing is still disabled until eMBEnable( ) is called.
+ *
+ * \param usTCPPort The TCP port to listen on.
+ * \return If the protocol stack has been initialized correctly the function
+ *   returns eMBErrorCode::MB_ENOERR. Otherwise one of the following error
+ *   codes is returned:
+ *    - eMBErrorCode::MB_EINVAL If the slave address was not valid. Valid
+ *        slave addresses are in the range 1 - 247.
+ *    - eMBErrorCode::MB_EPORTERR IF the porting layer returned an error.
+ */
+eMBErrorCode    eMBTCPInit( USHORT usTCPPort );
+
+/*! \ingroup modbus
+ * \brief Release resources used by the protocol stack.
+ *
+ * This function disables the Modbus protocol stack and release all
+ * hardware resources. It must only be called when the protocol stack
+ * is disabled.
+ *
+ * \note Note all ports implement this function. A port which wants to
+ *   get an callback must define the macro MB_PORT_HAS_CLOSE to 1.
+ *
+ * \return If the resources where released it return eMBErrorCode::MB_ENOERR.
+ *   If the protocol stack is not in the disabled state it returns
+ *   eMBErrorCode::MB_EILLSTATE.
+ */
+eMBErrorCode    eMBClose( void );
+
+/*! \ingroup modbus
+ * \brief Enable the Modbus protocol stack.
+ *
+ * This function enables processing of Modbus frames. Enabling the protocol
+ * stack is only possible if it is in the disabled state.
+ *
+ * \return If the protocol stack is now in the state enabled it returns
+ *   eMBErrorCode::MB_ENOERR. If it was not in the disabled state it
+ *   return eMBErrorCode::MB_EILLSTATE.
+ */
+eMBErrorCode    eMBEnable( void );
+
+/*! \ingroup modbus
+ * \brief Disable the Modbus protocol stack.
+ *
+ * This function disables processing of Modbus frames.
+ *
+ * \return If the protocol stack has been disabled it returns
+ *  eMBErrorCode::MB_ENOERR. If it was not in the enabled state it returns
+ *  eMBErrorCode::MB_EILLSTATE.
+ */
+eMBErrorCode    eMBDisable( void );
+
+/*! \ingroup modbus
+ * \brief The main pooling loop of the Modbus protocol stack.
+ *
+ * This function must be called periodically. The timer interval required
+ * is given by the application dependent Modbus slave timeout. Internally the
+ * function calls xMBPortEventGet() and waits for an event from the receiver or
+ * transmitter state machines.
+ *
+ * \return If the protocol stack is not in the enabled state the function
+ *   returns eMBErrorCode::MB_EILLSTATE. Otherwise it returns
+ *   eMBErrorCode::MB_ENOERR.
+ */
+eMBErrorCode    eMBPoll( void );
+
+/*! \ingroup modbus
+ * \brief Configure the slave id of the device.
+ *
+ * This function should be called when the Modbus function <em>Report Slave ID</em>
+ * is enabled ( By defining MB_FUNC_OTHER_REP_SLAVEID_ENABLED in mbconfig.h ).
+ *
+ * \param ucSlaveID Values is returned in the <em>Slave ID</em> byte of the
+ *   <em>Report Slave ID</em> response.
+ * \param xIsRunning If TRUE the <em>Run Indicator Status</em> byte is set to 0xFF.
+ *   otherwise the <em>Run Indicator Status</em> is 0x00.
+ * \param pucAdditional Values which should be returned in the <em>Additional</em>
+ *   bytes of the <em> Report Slave ID</em> response.
+ * \param usAdditionalLen Length of the buffer <code>pucAdditonal</code>.
+ *
+ * \return If the static buffer defined by MB_FUNC_OTHER_REP_SLAVEID_BUF in
+ *   mbconfig.h is to small it returns eMBErrorCode::MB_ENORES. Otherwise
+ *   it returns eMBErrorCode::MB_ENOERR.
+ */
+eMBErrorCode    eMBSetSlaveID( UCHAR ucSlaveID, BOOL xIsRunning,
+                               UCHAR const *pucAdditional,
+                               USHORT usAdditionalLen );
+
+/*! \ingroup modbus
+ * \brief Registers a callback handler for a given function code.
+ *
+ * This function registers a new callback handler for a given function code.
+ * The callback handler supplied is responsible for interpreting the Modbus PDU and
+ * the creation of an appropriate response. In case of an error it should return
+ * one of the possible Modbus exceptions which results in a Modbus exception frame
+ * sent by the protocol stack.
+ *
+ * \param ucFunctionCode The Modbus function code for which this handler should
+ *   be registers. Valid function codes are in the range 1 to 127.
+ * \param pxHandler The function handler which should be called in case
+ *   such a frame is received. If \c NULL a previously registered function handler
+ *   for this function code is removed.
+ *
+ * \return eMBErrorCode::MB_ENOERR if the handler has been installed. If no
+ *   more resources are available it returns eMBErrorCode::MB_ENORES. In this
+ *   case the values in mbconfig.h should be adjusted. If the argument was not
+ *   valid it returns eMBErrorCode::MB_EINVAL.
+ */
+eMBErrorCode    eMBRegisterCB( UCHAR ucFunctionCode,
+                               pxMBFunctionHandler pxHandler );
+
+/* ----------------------- Callback -----------------------------------------*/
+
+/*! \defgroup modbus_registers Modbus Registers
+ * \code #include "mb.h" \endcode
+ * The protocol stack does not internally allocate any memory for the
+ * registers. This makes the protocol stack very small and also usable on
+ * low end targets. In addition the values don't have to be in the memory
+ * and could for example be stored in a flash.<br>
+ * Whenever the protocol stack requires a value it calls one of the callback
+ * function with the register address and the number of registers to read
+ * as an argument. The application should then read the actual register values
+ * (for example the ADC voltage) and should store the result in the supplied
+ * buffer.<br>
+ * If the protocol stack wants to update a register value because a write
+ * register function was received a buffer with the new register values is
+ * passed to the callback function. The function should then use these values
+ * to update the application register values.
+ */
+
+/*! \ingroup modbus_registers
+ * \brief Callback function used if the value of a <em>Input Register</em>
+ *   is required by the protocol stack. The starting register address is given
+ *   by \c usAddress and the last register is given by <tt>usAddress +
+ *   usNRegs - 1</tt>.
+ *
+ * \param pucRegBuffer A buffer where the callback function should write
+ *   the current value of the modbus registers to.
+ * \param usAddress The starting address of the register. Input registers
+ *   are in the range 1 - 65535.
+ * \param usNRegs Number of registers the callback function must supply.
+ *
+ * \return The function must return one of the following error codes:
+ *   - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal
+ *       Modbus response is sent.
+ *   - eMBErrorCode::MB_ENOREG If the application can not supply values
+ *       for registers within this range. In this case a
+ *       <b>ILLEGAL DATA ADDRESS</b> exception frame is sent as a response.
+ *   - eMBErrorCode::MB_ETIMEDOUT If the requested register block is
+ *       currently not available and the application dependent response
+ *       timeout would be violated. In this case a <b>SLAVE DEVICE BUSY</b>
+ *       exception is sent as a response.
+ *   - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case
+ *       a <b>SLAVE DEVICE FAILURE</b> exception is sent as a response.
+ */
+eMBErrorCode    eMBRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress,
+                               USHORT usNRegs );
+
+/*! \ingroup modbus_registers
+ * \brief Callback function used if a <em>Holding Register</em> value is
+ *   read or written by the protocol stack. The starting register address
+ *   is given by \c usAddress and the last register is given by
+ *   <tt>usAddress + usNRegs - 1</tt>.
+ *
+ * \param pucRegBuffer If the application registers values should be updated the
+ *   buffer points to the new registers values. If the protocol stack needs
+ *   to now the current values the callback function should write them into
+ *   this buffer.
+ * \param usAddress The starting address of the register.
+ * \param usNRegs Number of registers to read or write.
+ * \param eMode If eMBRegisterMode::MB_REG_WRITE the application register
+ *   values should be updated from the values in the buffer. For example
+ *   this would be the case when the Modbus master has issued an
+ *   <b>WRITE SINGLE REGISTER</b> command.
+ *   If the value eMBRegisterMode::MB_REG_READ the application should copy
+ *   the current values into the buffer \c pucRegBuffer.
+ *
+ * \return The function must return one of the following error codes:
+ *   - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal
+ *       Modbus response is sent.
+ *   - eMBErrorCode::MB_ENOREG If the application can not supply values
+ *       for registers within this range. In this case a
+ *       <b>ILLEGAL DATA ADDRESS</b> exception frame is sent as a response.
+ *   - eMBErrorCode::MB_ETIMEDOUT If the requested register block is
+ *       currently not available and the application dependent response
+ *       timeout would be violated. In this case a <b>SLAVE DEVICE BUSY</b>
+ *       exception is sent as a response.
+ *   - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case
+ *       a <b>SLAVE DEVICE FAILURE</b> exception is sent as a response.
+ */
+eMBErrorCode    eMBRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress,
+                                 USHORT usNRegs, eMBRegisterMode eMode );
+
+/*! \ingroup modbus_registers
+ * \brief Callback function used if a <em>Coil Register</em> value is
+ *   read or written by the protocol stack. If you are going to use
+ *   this function you might use the functions xMBUtilSetBits(  ) and
+ *   xMBUtilGetBits(  ) for working with bitfields.
+ *
+ * \param pucRegBuffer The bits are packed in bytes where the first coil
+ *   starting at address \c usAddress is stored in the LSB of the
+ *   first byte in the buffer <code>pucRegBuffer</code>.
+ *   If the buffer should be written by the callback function unused
+ *   coil values (I.e. if not a multiple of eight coils is used) should be set
+ *   to zero.
+ * \param usAddress The first coil number.
+ * \param usNCoils Number of coil values requested.
+ * \param eMode If eMBRegisterMode::MB_REG_WRITE the application values should
+ *   be updated from the values supplied in the buffer \c pucRegBuffer.
+ *   If eMBRegisterMode::MB_REG_READ the application should store the current
+ *   values in the buffer \c pucRegBuffer.
+ *
+ * \return The function must return one of the following error codes:
+ *   - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal
+ *       Modbus response is sent.
+ *   - eMBErrorCode::MB_ENOREG If the application does not map an coils
+ *       within the requested address range. In this case a
+ *       <b>ILLEGAL DATA ADDRESS</b> is sent as a response.
+ *   - eMBErrorCode::MB_ETIMEDOUT If the requested register block is
+ *       currently not available and the application dependent response
+ *       timeout would be violated. In this case a <b>SLAVE DEVICE BUSY</b>
+ *       exception is sent as a response.
+ *   - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case
+ *       a <b>SLAVE DEVICE FAILURE</b> exception is sent as a response.
+ */
+eMBErrorCode    eMBRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress,
+                               USHORT usNCoils, eMBRegisterMode eMode );
+
+/*! \ingroup modbus_registers
+ * \brief Callback function used if a <em>Input Discrete Register</em> value is
+ *   read by the protocol stack.
+ *
+ * If you are going to use his function you might use the functions
+ * xMBUtilSetBits(  ) and xMBUtilGetBits(  ) for working with bitfields.
+ *
+ * \param pucRegBuffer The buffer should be updated with the current
+ *   coil values. The first discrete input starting at \c usAddress must be
+ *   stored at the LSB of the first byte in the buffer. If the requested number
+ *   is not a multiple of eight the remaining bits should be set to zero.
+ * \param usAddress The starting address of the first discrete input.
+ * \param usNDiscrete Number of discrete input values.
+ * \return The function must return one of the following error codes:
+ *   - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal
+ *       Modbus response is sent.
+ *   - eMBErrorCode::MB_ENOREG If no such discrete inputs exists.
+ *       In this case a <b>ILLEGAL DATA ADDRESS</b> exception frame is sent
+ *       as a response.
+ *   - eMBErrorCode::MB_ETIMEDOUT If the requested register block is
+ *       currently not available and the application dependent response
+ *       timeout would be violated. In this case a <b>SLAVE DEVICE BUSY</b>
+ *       exception is sent as a response.
+ *   - eMBErrorCode::MB_EIO If an unrecoverable error occurred. In this case
+ *       a <b>SLAVE DEVICE FAILURE</b> exception is sent as a response.
+ */
+eMBErrorCode    eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress,
+                                  USHORT usNDiscrete );
+/**
+ * modbus写文件回调
+ * @param header yModem协议头
+ * @param pucRegBuffer yModem消息体
+ * @return
+ */
+eMBErrorCode eMBWriteFileCB(UCHAR *header, UCHAR * pucRegBuffer, USHORT * usLen);
+
+#ifdef __cplusplus
+PR_END_EXTERN_C
+#endif
+#endif

+ 417 - 0
Middlewares/Third_Party/FreeModbus/modbus/include/mb_m.h

@@ -0,0 +1,417 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (C) 2013 Armink <armink.ztl@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mb_m.h,v 1.60 2013/09/03 10:20:05 Armink Add Master Functions $
+ */
+
+#ifndef _MB_M_H
+#define _MB_M_H
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+
+/*! \defgroup modbus Modbus
+ * \code #include "mb_m.h" \endcode
+ *
+ * This module defines the interface for the application. It contains
+ * the basic functions and types required to use the Modbus Master protocol stack.
+ * A typical application will want to call eMBMasterInit() first. If the device
+ * is ready to answer network requests it must then call eMBEnable() to activate
+ * the protocol stack. In the main loop the function eMBMasterPoll() must be called
+ * periodically. The time interval between pooling depends on the configured
+ * Modbus timeout. If an RTOS is available a separate task should be created
+ * and the task should always call the function eMBMasterPoll().
+ *
+ * \code
+ * // Initialize protocol stack in RTU mode for a Master
+ * eMBMasterInit( MB_RTU, 38400, MB_PAR_EVEN );
+ * // Enable the Modbus Protocol Stack.
+ * eMBMasterEnable(  );
+ * for( ;; )
+ * {
+ *     // Call the main polling loop of the Modbus Master protocol stack.
+ *     eMBMasterPoll(  );
+ *     ...
+ * }
+ * \endcode
+ */
+
+#include "port.h"
+#include "mb.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+
+/*! \ingroup modbus
+ * \brief Use the default Modbus Master TCP port (502)
+ */
+#define MB_MASTER_TCP_PORT_USE_DEFAULT 0
+
+/* ----------------------- Type definitions ---------------------------------*/
+/*! \ingroup modbus
+ * \brief Errorcodes used by all function in the Master request.
+ */
+typedef enum
+{
+    MB_MRE_NO_ERR,                  /*!< no error. */
+    MB_MRE_NO_REG,                  /*!< illegal register address. */
+    MB_MRE_ILL_ARG,                 /*!< illegal argument. */
+    MB_MRE_REV_DATA,                /*!< receive data error. */
+    MB_MRE_TIMEDOUT,                /*!< timeout error occurred. */
+    MB_MRE_MASTER_BUSY,             /*!< master is busy now. */
+    MB_MRE_EXE_FUN                  /*!< execute function error. */
+} eMBMasterReqErrCode;
+/*! \ingroup modbus
+ *  \brief TimerMode is Master 3 kind of Timer modes.
+ */
+typedef enum
+{
+    MB_TMODE_T35,                   /*!< Master receive frame T3.5 timeout. */
+    MB_TMODE_RESPOND_TIMEOUT,       /*!< Master wait respond for slave. */
+    MB_TMODE_CONVERT_DELAY          /*!< Master sent broadcast ,then delay sometime.*/
+}eMBMasterTimerMode;
+
+/* ----------------------- Function prototypes ------------------------------*/
+/*! \ingroup modbus
+ * \brief Initialize the Modbus Master protocol stack.
+ *
+ * This functions initializes the ASCII or RTU module and calls the
+ * init functions of the porting layer to prepare the hardware. Please
+ * note that the receiver is still disabled and no Modbus frames are
+ * processed until eMBMasterEnable( ) has been called.
+ *
+ * \param eMode If ASCII or RTU mode should be used.
+ * \param ucPort The port to use. E.g. 1 for COM1 on windows. This value
+ *   is platform dependent and some ports simply choose to ignore it.
+ * \param ulBaudRate The baudrate. E.g. 19200. Supported baudrates depend
+ *   on the porting layer.
+ * \param eParity Parity used for serial transmission.
+ *
+ * \return If no error occurs the function returns eMBErrorCode::MB_ENOERR.
+ *   The protocol is then in the disabled state and ready for activation
+ *   by calling eMBMasterEnable( ). Otherwise one of the following error codes
+ *   is returned:
+ *    - eMBErrorCode::MB_EPORTERR IF the porting layer returned an error.
+ */
+eMBErrorCode    eMBMasterInit( eMBMode eMode, UCHAR ucPort,
+                         ULONG ulBaudRate, eMBParity eParity );
+
+/*! \ingroup modbus
+ * \brief Initialize the Modbus Master protocol stack for Modbus TCP.
+ *
+ * This function initializes the Modbus TCP Module. Please note that
+ * frame processing is still disabled until eMBEnable( ) is called.
+ *
+ * \param usTCPPort The TCP port to listen on.
+ * \return If the protocol stack has been initialized correctly the function
+ *   returns eMBErrorCode::MB_ENOERR. Otherwise one of the following error
+ *   codes is returned:
+ *    - eMBErrorCode::MB_EINVAL If the slave address was not valid. Valid
+ *        slave addresses are in the range 1 - 247.
+ *    - eMBErrorCode::MB_EPORTERR IF the porting layer returned an error.
+ */
+eMBErrorCode    eMBMasterTCPInit( USHORT usTCPPort );
+
+/*! \ingroup modbus
+ * \brief Release resources used by the protocol stack.
+ *
+ * This function disables the Modbus Master protocol stack and release all
+ * hardware resources. It must only be called when the protocol stack
+ * is disabled.
+ *
+ * \note Note all ports implement this function. A port which wants to
+ *   get an callback must define the macro MB_PORT_HAS_CLOSE to 1.
+ *
+ * \return If the resources where released it return eMBErrorCode::MB_ENOERR.
+ *   If the protocol stack is not in the disabled state it returns
+ *   eMBErrorCode::MB_EILLSTATE.
+ */
+eMBErrorCode    eMBMasterClose( void );
+
+/*! \ingroup modbus
+ * \brief Enable the Modbus Master protocol stack.
+ *
+ * This function enables processing of Modbus Master frames. Enabling the protocol
+ * stack is only possible if it is in the disabled state.
+ *
+ * \return If the protocol stack is now in the state enabled it returns
+ *   eMBErrorCode::MB_ENOERR. If it was not in the disabled state it
+ *   return eMBErrorCode::MB_EILLSTATE.
+ */
+eMBErrorCode    eMBMasterEnable( void );
+
+/*! \ingroup modbus
+ * \brief Disable the Modbus Master protocol stack.
+ *
+ * This function disables processing of Modbus frames.
+ *
+ * \return If the protocol stack has been disabled it returns
+ *  eMBErrorCode::MB_ENOERR. If it was not in the enabled state it returns
+ *  eMBErrorCode::MB_EILLSTATE.
+ */
+eMBErrorCode    eMBMasterDisable( void );
+
+/*! \ingroup modbus
+ * \brief Check the Modbus Master protocol stack has established or not.
+ *
+ * This function must be called and check the return value before calling
+ * any other functions.
+ *
+ * \return If the protocol stack has been established or not
+ *  TRUE.  the protocol stack has established
+ *  FALSE. the protocol stack hasn't established
+ */
+BOOL            eMBMasterIsEstablished( void );
+
+/*! \ingroup modbus
+ * \brief The main pooling loop of the Modbus Master protocol stack.
+ *
+ * This function must be called periodically. The timer interval required
+ * is given by the application dependent Modbus slave timeout. Internally the
+ * function calls xMBMasterPortEventGet() and waits for an event from the receiver or
+ * transmitter state machines.
+ *
+ * \return If the protocol stack is not in the enabled state the function
+ *   returns eMBErrorCode::MB_EILLSTATE. Otherwise it returns
+ *   eMBErrorCode::MB_ENOERR.
+ */
+eMBErrorCode    eMBMasterPoll( void );
+
+/*! \ingroup modbus
+ * \brief Registers a callback handler for a given function code.
+ *
+ * This function registers a new callback handler for a given function code.
+ * The callback handler supplied is responsible for interpreting the Modbus PDU and
+ * the creation of an appropriate response. In case of an error it should return
+ * one of the possible Modbus exceptions which results in a Modbus exception frame
+ * sent by the protocol stack.
+ *
+ * \param ucFunctionCode The Modbus function code for which this handler should
+ *   be registers. Valid function codes are in the range 1 to 127.
+ * \param pxHandler The function handler which should be called in case
+ *   such a frame is received. If \c NULL a previously registered function handler
+ *   for this function code is removed.
+ *
+ * \return eMBErrorCode::MB_ENOERR if the handler has been installed. If no
+ *   more resources are available it returns eMBErrorCode::MB_ENORES. In this
+ *   case the values in mbconfig.h should be adjusted. If the argument was not
+ *   valid it returns eMBErrorCode::MB_EINVAL.
+ */
+eMBErrorCode    eMBMasterRegisterCB( UCHAR ucFunctionCode,
+                               pxMBFunctionHandler pxHandler );
+
+/* ----------------------- Callback -----------------------------------------*/
+
+/*! \defgroup modbus_master registers Modbus Registers
+ * \code #include "mb_m.h" \endcode
+ * The protocol stack does not internally allocate any memory for the
+ * registers. This makes the protocol stack very small and also usable on
+ * low end targets. In addition the values don't have to be in the memory
+ * and could for example be stored in a flash.<br>
+ * Whenever the protocol stack requires a value it calls one of the callback
+ * function with the register address and the number of registers to read
+ * as an argument. The application should then read the actual register values
+ * (for example the ADC voltage) and should store the result in the supplied
+ * buffer.<br>
+ * If the protocol stack wants to update a register value because a write
+ * register function was received a buffer with the new register values is
+ * passed to the callback function. The function should then use these values
+ * to update the application register values.
+ */
+
+/*! \ingroup modbus_registers
+ * \brief Callback function used if the value of a <em>Input Register</em>
+ *   is required by the protocol stack. The starting register address is given
+ *   by \c usAddress and the last register is given by <tt>usAddress +
+ *   usNRegs - 1</tt>.
+ *
+ * \param pucRegBuffer A buffer where the callback function should write
+ *   the current value of the modbus registers to.
+ * \param usAddress The starting address of the register. Input registers
+ *   are in the range 1 - 65535.
+ * \param usNRegs Number of registers the callback function must supply.
+ *
+ * \return The function must return one of the following error codes:
+ *   - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal
+ *       Modbus response is sent.
+ *   - eMBErrorCode::MB_ENOREG If the application does not map an coils
+ *       within the requested address range. In this case a
+ *       <b>ILLEGAL DATA ADDRESS</b> is sent as a response.
+ */
+eMBErrorCode eMBMasterRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress,
+        USHORT usNRegs );
+
+/*! \ingroup modbus_registers
+ * \brief Callback function used if a <em>Holding Register</em> value is
+ *   read or written by the protocol stack. The starting register address
+ *   is given by \c usAddress and the last register is given by
+ *   <tt>usAddress + usNRegs - 1</tt>.
+ *
+ * \param pucRegBuffer If the application registers values should be updated the
+ *   buffer points to the new registers values. If the protocol stack needs
+ *   to now the current values the callback function should write them into
+ *   this buffer.
+ * \param usAddress The starting address of the register.
+ * \param usNRegs Number of registers to read or write.
+ * \param eMode If eMBRegisterMode::MB_REG_WRITE the application register
+ *   values should be updated from the values in the buffer. For example
+ *   this would be the case when the Modbus master has issued an
+ *   <b>WRITE SINGLE REGISTER</b> command.
+ *   If the value eMBRegisterMode::MB_REG_READ the application should copy
+ *   the current values into the buffer \c pucRegBuffer.
+ *
+ * \return The function must return one of the following error codes:
+ *   - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal
+ *       Modbus response is sent.
+ *   - eMBErrorCode::MB_ENOREG If the application does not map an coils
+ *       within the requested address range. In this case a
+ *       <b>ILLEGAL DATA ADDRESS</b> is sent as a response.
+ */
+eMBErrorCode eMBMasterRegHoldingCB( UCHAR * pucRegBuffer, USHORT usAddress,
+        USHORT usNRegs, eMBRegisterMode eMode );
+
+/*! \ingroup modbus_registers
+ * \brief Callback function used if a <em>Coil Register</em> value is
+ *   read or written by the protocol stack. If you are going to use
+ *   this function you might use the functions xMBUtilSetBits(  ) and
+ *   xMBUtilGetBits(  ) for working with bitfields.
+ *
+ * \param pucRegBuffer The bits are packed in bytes where the first coil
+ *   starting at address \c usAddress is stored in the LSB of the
+ *   first byte in the buffer <code>pucRegBuffer</code>.
+ *   If the buffer should be written by the callback function unused
+ *   coil values (I.e. if not a multiple of eight coils is used) should be set
+ *   to zero.
+ * \param usAddress The first coil number.
+ * \param usNCoils Number of coil values requested.
+ * \param eMode If eMBRegisterMode::MB_REG_WRITE the application values should
+ *   be updated from the values supplied in the buffer \c pucRegBuffer.
+ *   If eMBRegisterMode::MB_REG_READ the application should store the current
+ *   values in the buffer \c pucRegBuffer.
+ *
+ * \return The function must return one of the following error codes:
+ *   - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal
+ *       Modbus response is sent.
+ *   - eMBErrorCode::MB_ENOREG If the application does not map an coils
+ *       within the requested address range. In this case a
+ *       <b>ILLEGAL DATA ADDRESS</b> is sent as a response.
+ */
+eMBErrorCode eMBMasterRegCoilsCB( UCHAR * pucRegBuffer, USHORT usAddress,
+        USHORT usNCoils, eMBRegisterMode eMode );
+
+/*! \ingroup modbus_registers
+ * \brief Callback function used if a <em>Input Discrete Register</em> value is
+ *   read by the protocol stack.
+ *
+ * If you are going to use his function you might use the functions
+ * xMBUtilSetBits(  ) and xMBUtilGetBits(  ) for working with bitfields.
+ *
+ * \param pucRegBuffer The buffer should be updated with the current
+ *   coil values. The first discrete input starting at \c usAddress must be
+ *   stored at the LSB of the first byte in the buffer. If the requested number
+ *   is not a multiple of eight the remaining bits should be set to zero.
+ * \param usAddress The starting address of the first discrete input.
+ * \param usNDiscrete Number of discrete input values.
+ * \return The function must return one of the following error codes:
+ *   - eMBErrorCode::MB_ENOERR If no error occurred. In this case a normal
+ *       Modbus response is sent.
+ *   - eMBErrorCode::MB_ENOREG If the application does not map an coils
+ *       within the requested address range. In this case a
+ *       <b>ILLEGAL DATA ADDRESS</b> is sent as a response.
+ */
+eMBErrorCode eMBMasterRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress,
+        USHORT usNDiscrete );
+
+/*! \ingroup modbus
+ *\brief These Modbus functions are called for user when Modbus run in Master Mode.
+ */
+eMBMasterReqErrCode
+eMBMasterReqReadInputRegister( UCHAR ucSndAddr, USHORT usRegAddr, USHORT usNRegs, LONG lTimeOut );
+eMBMasterReqErrCode
+eMBMasterReqWriteHoldingRegister( UCHAR ucSndAddr, USHORT usRegAddr, USHORT usRegData, LONG lTimeOut );
+eMBMasterReqErrCode
+eMBMasterReqWriteMultipleHoldingRegister( UCHAR ucSndAddr, USHORT usRegAddr,
+        USHORT usNRegs, USHORT * pusDataBuffer, LONG lTimeOut );
+eMBMasterReqErrCode
+eMBMasterReqReadHoldingRegister( UCHAR ucSndAddr, USHORT usRegAddr, USHORT usNRegs, LONG lTimeOut );
+eMBMasterReqErrCode
+eMBMasterReqReadWriteMultipleHoldingRegister( UCHAR ucSndAddr,
+        USHORT usReadRegAddr, USHORT usNReadRegs, USHORT * pusDataBuffer,
+        USHORT usWriteRegAddr, USHORT usNWriteRegs, LONG lTimeOut );
+eMBMasterReqErrCode
+eMBMasterReqReadCoils( UCHAR ucSndAddr, USHORT usCoilAddr, USHORT usNCoils, LONG lTimeOut );
+eMBMasterReqErrCode
+eMBMasterReqWriteCoil( UCHAR ucSndAddr, USHORT usCoilAddr, USHORT usCoilData, LONG lTimeOut );
+eMBMasterReqErrCode
+eMBMasterReqWriteMultipleCoils( UCHAR ucSndAddr,
+        USHORT usCoilAddr, USHORT usNCoils, UCHAR * pucDataBuffer, LONG lTimeOut );
+eMBMasterReqErrCode
+eMBMasterReqReadDiscreteInputs( UCHAR ucSndAddr, USHORT usDiscreteAddr, USHORT usNDiscreteIn, LONG lTimeOut );
+
+eMBException
+eMBMasterFuncReportSlaveID( UCHAR * pucFrame, USHORT * usLen );
+eMBException
+eMBMasterFuncReadInputRegister( UCHAR * pucFrame, USHORT * usLen );
+eMBException
+eMBMasterFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen );
+eMBException
+eMBMasterFuncWriteHoldingRegister( UCHAR * pucFrame, USHORT * usLen );
+eMBException
+eMBMasterFuncWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen );
+eMBException
+eMBMasterFuncReadCoils( UCHAR * pucFrame, USHORT * usLen );
+eMBException
+eMBMasterFuncWriteCoil( UCHAR * pucFrame, USHORT * usLen );
+eMBException
+eMBMasterFuncWriteMultipleCoils( UCHAR * pucFrame, USHORT * usLen );
+eMBException
+eMBMasterFuncReadDiscreteInputs( UCHAR * pucFrame, USHORT * usLen );
+eMBException
+eMBMasterFuncReadWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen );
+
+/*! \ingroup modbus
+ *\brief These functions are interface for Modbus Master
+ */
+void vMBMasterGetPDUSndBuf( UCHAR ** pucFrame );
+UCHAR ucMBMasterGetDestAddress( void );
+void vMBMasterSetDestAddress( UCHAR Address );
+BOOL xMBMasterGetCBRunInMasterMode( void );
+void vMBMasterSetCBRunInMasterMode( BOOL IsMasterMode );
+USHORT usMBMasterGetPDUSndLength( void );
+void vMBMasterSetPDUSndLength( USHORT SendPDULength );
+void vMBMasterSetCurTimerMode( eMBMasterTimerMode eMBTimerMode );
+BOOL xMBMasterRequestIsBroadcast( void );
+eMBMasterErrorEventType eMBMasterGetErrorType( void );
+void vMBMasterSetErrorType( eMBMasterErrorEventType errorType );
+eMBMasterReqErrCode eMBMasterWaitRequestFinish( void );
+
+/* ----------------------- Callback -----------------------------------------*/
+
+#ifdef __cplusplus
+PR_END_EXTERN_C
+#endif
+#endif

+ 126 - 0
Middlewares/Third_Party/FreeModbus/modbus/include/mbconfig.h

@@ -0,0 +1,126 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbconfig.h,v 1.14 2006/12/07 22:10:34 wolti Exp $
+ *       $Id: mbconfig.h,v 1.60 2013/08/13 21:19:55 Armink Add Master Functions $
+ */
+
+#ifndef _MB_CONFIG_H
+#define _MB_CONFIG_H
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+/* ----------------------- Defines ------------------------------------------*/
+/*! \defgroup modbus_cfg Modbus Configuration
+ *
+ * Most modules in the protocol stack are completly optional and can be
+ * excluded. This is specially important if target resources are very small
+ * and program memory space should be saved.<br>
+ *
+ * All of these settings are available in the file <code>mbconfig.h</code>
+ */
+/*! \addtogroup modbus_cfg
+ *  @{
+ */
+/*! \brief If Modbus Master ASCII support is enabled. */
+#define MB_MASTER_ASCII_ENABLED                 (  0 )
+/*! \brief If Modbus Master RTU support is enabled. */
+#define MB_MASTER_RTU_ENABLED                   (  0 )
+/*! \brief If Modbus Master TCP support is enabled. */
+#define MB_MASTER_TCP_ENABLED                   (  0 )
+/*! \brief If Modbus Slave ASCII support is enabled. */
+#define MB_SLAVE_ASCII_ENABLED                  (  0 )
+/*! \brief If Modbus Slave RTU support is enabled. */
+#define MB_SLAVE_RTU_ENABLED                    (  1 )
+/*! \brief If Modbus Slave TCP support is enabled. */
+#define MB_SLAVE_TCP_ENABLED                    (  0 )
+/*! \brief The character timeout value for Modbus ASCII.
+ *
+ * The character timeout value is not fixed for Modbus ASCII and is therefore
+ * a configuration option. It should be set to the maximum expected delay
+ * time of the network.
+ */
+#define MB_ASCII_TIMEOUT_SEC                    (  1 )
+/*! \brief Maximum number of Modbus functions codes the protocol stack
+ *    should support.
+ *
+ * The maximum number of supported Modbus functions must be greater than
+ * the sum of all enabled functions in this file and custom function
+ * handlers. If set to small adding more functions will fail.
+ */
+#define MB_FUNC_HANDLERS_MAX                    ( 16 )
+/*! \brief Number of bytes which should be allocated for the <em>Report Slave ID
+ *    </em>command.
+ *
+ * This number limits the maximum size of the additional segment in the
+ * report slave id function. See eMBSetSlaveID(  ) for more information on
+ * how to set this value. It is only used if MB_FUNC_OTHER_REP_SLAVEID_ENABLED
+ * is set to <code>1</code>.
+ */
+#define MB_FUNC_OTHER_REP_SLAVEID_BUF           ( 32 )
+/*! \brief If the <em>Report Slave ID</em> function should be enabled. */
+#define MB_FUNC_OTHER_REP_SLAVEID_ENABLED       (  1 )
+/*! \brief If the <em>Read Input Registers</em> function should be enabled. */
+#define MB_FUNC_READ_INPUT_ENABLED              (  0 )
+/*! \brief If the <em>Read Holding Registers</em> function should be enabled. */
+#define MB_FUNC_READ_HOLDING_ENABLED            (  1 )
+/*! \brief If the <em>Write Single Register</em> function should be enabled. */
+#define MB_FUNC_WRITE_HOLDING_ENABLED           (  1 )
+/*! \brief If the <em>Write Multiple registers</em> function should be enabled. */
+#define MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED  (  1 )
+/*! \brief If the <em>Read Coils</em> function should be enabled. */
+#define MB_FUNC_READ_COILS_ENABLED              (  0 )
+/*! \brief If the <em>Write Coils</em> function should be enabled. */
+#define MB_FUNC_WRITE_COIL_ENABLED              (  0 )
+/*! \brief If the <em>Write Multiple Coils</em> function should be enabled. */
+#define MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED    (  0 )
+/*! \brief If the <em>Read Discrete Inputs</em> function should be enabled. */
+#define MB_FUNC_READ_DISCRETE_INPUTS_ENABLED    (  0 )
+/*! \brief If the <em>Read/Write Multiple Registers</em> function should be enabled. */
+#define MB_FUNC_READWRITE_HOLDING_ENABLED       (  1 )
+
+#define MB_FUNC_WRITE_FILE_ENABLE               (0)
+/*! @} */
+#ifdef __cplusplus
+    PR_END_EXTERN_C
+#endif
+
+#if MB_MASTER_RTU_ENABLED > 0 || MB_MASTER_ASCII_ENABLED > 0
+/*! \brief If master send a broadcast frame,the master will wait time of convert to delay,
+ * then master can send other frame */
+#define MB_MASTER_DELAY_MS_CONVERT              (200 )
+/*! \brief If master send a frame which is not broadcast,the master will wait sometime for slave.
+ * And if slave is not respond in this time,the master will process this timeout error.
+ * Then master can send other frame */
+#define MB_MASTER_TIMEOUT_MS_RESPOND            (100 )
+/*! \brief The total slaves in Modbus Master system. Default 16.
+ * \note : The slave ID must be continuous from 1.*/
+#define MB_MASTER_TOTAL_SLAVE_NUM               ( 16 )
+#endif
+
+#endif

+ 87 - 0
Middlewares/Third_Party/FreeModbus/modbus/include/mbframe.h

@@ -0,0 +1,87 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbframe.h,v 1.9 2006/12/07 22:10:34 wolti Exp $
+ */
+
+#ifndef _MB_FRAME_H
+#define _MB_FRAME_H
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+
+/*!
+ * Constants which defines the format of a modbus frame. The example is
+ * shown for a Modbus RTU/ASCII frame. Note that the Modbus PDU is not
+ * dependent on the underlying transport.
+ *
+ * <code>
+ * <------------------------ MODBUS SERIAL LINE PDU (1) ------------------->
+ *              <----------- MODBUS PDU (1') ---------------->
+ *  +-----------+---------------+----------------------------+-------------+
+ *  | Address   | Function Code | Data                       | CRC/LRC     |
+ *  +-----------+---------------+----------------------------+-------------+
+ *  |           |               |                                   |
+ * (2)        (3/2')           (3')                                (4)
+ *
+ * (1)  ... MB_SER_PDU_SIZE_MAX = 256
+ * (2)  ... MB_SER_PDU_ADDR_OFF = 0
+ * (3)  ... MB_SER_PDU_PDU_OFF  = 1
+ * (4)  ... MB_SER_PDU_SIZE_CRC = 2
+ *
+ * (1') ... MB_PDU_SIZE_MAX     = 253
+ * (2') ... MB_PDU_FUNC_OFF     = 0
+ * (3') ... MB_PDU_DATA_OFF     = 1
+ * </code>
+ */
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_PDU_SIZE_MAX     253 /*!< Maximum size of a PDU. */
+#define MB_PDU_SIZE_MIN     1   /*!< Function Code */
+#define MB_PDU_FUNC_OFF     0   /*!< Offset of function code in PDU. */
+#define MB_PDU_DATA_OFF     1   /*!< Offset for response data in PDU. */
+
+/* ----------------------- Prototypes  0-------------------------------------*/
+typedef void    ( *pvMBFrameStart ) ( void );
+
+typedef void    ( *pvMBFrameStop ) ( void );
+
+typedef eMBErrorCode( *peMBFrameReceive ) ( UCHAR * pucRcvAddress,
+                                            UCHAR ** pucFrame,
+                                            USHORT * pusLength );
+
+typedef eMBErrorCode( *peMBFrameSend ) ( UCHAR slaveAddress,
+                                         const UCHAR * pucFrame,
+                                         USHORT usLength );
+
+typedef void( *pvMBFrameClose ) ( void );
+
+#ifdef __cplusplus
+PR_END_EXTERN_C
+#endif
+#endif

+ 84 - 0
Middlewares/Third_Party/FreeModbus/modbus/include/mbfunc.h

@@ -0,0 +1,84 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbfunc.h,v 1.12 2006/12/07 22:10:34 wolti Exp $
+ */
+
+#ifndef _MB_FUNC_H
+#define _MB_FUNC_H
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+#if MB_FUNC_OTHER_REP_SLAVEID_BUF > 0
+eMBException    eMBFuncReportSlaveID( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#if MB_FUNC_READ_INPUT_ENABLED > 0
+eMBException    eMBFuncReadInputRegister( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#if MB_FUNC_READ_HOLDING_ENABLED > 0
+eMBException    eMBFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#if MB_FUNC_WRITE_HOLDING_ENABLED > 0
+eMBException    eMBFuncWriteHoldingRegister( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0
+eMBException    eMBFuncWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#if MB_FUNC_WRITE_FILE_ENABLE > 0
+eMBException    eMBFuncWriteFile( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#if MB_FUNC_READ_COILS_ENABLED > 0
+eMBException    eMBFuncReadCoils( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#if MB_FUNC_WRITE_COIL_ENABLED > 0
+eMBException    eMBFuncWriteCoil( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0
+eMBException    eMBFuncWriteMultipleCoils( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#if MB_FUNC_READ_DISCRETE_INPUTS_ENABLED > 0
+eMBException    eMBFuncReadDiscreteInputs( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#if MB_FUNC_READWRITE_HOLDING_ENABLED > 0
+eMBException    eMBFuncReadWriteMultipleHoldingRegister( UCHAR * pucFrame, USHORT * usLen );
+#endif
+
+#ifdef __cplusplus
+PR_END_EXTERN_C
+#endif
+#endif

+ 214 - 0
Middlewares/Third_Party/FreeModbus/modbus/include/mbport.h

@@ -0,0 +1,214 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbport.h,v 1.17 2006/12/07 22:10:34 wolti Exp $
+ *            mbport.h,v 1.60 2013/08/17 11:42:56 Armink Add Master Functions  $
+ *            mbport.h,v 1.60 2022/07/17          quanghona <lyhonquang@gmail.com> Add send multiple bytes in one call  $
+ */
+
+#ifndef _MB_PORT_H
+#define _MB_PORT_H
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+
+/* ----------------------- Defines ------------------------------------------*/
+#include "port.h"
+
+#define MASTER_SEND_ALL_BYTES_IN_ONE_CALL		(1)
+#define SLAVE_SEND_ALL_BYTES_IN_ONE_CALL		(0)
+
+/* ----------------------- Type definitions ---------------------------------*/
+
+typedef enum
+{
+    EV_READY            = 1<<0,         /*!< Startup finished. */
+    EV_FRAME_RECEIVED   = 1<<1,         /*!< Frame received. */
+    EV_EXECUTE          = 1<<2,         /*!< Execute function. */
+    EV_FRAME_SENT       = 1<<3          /*!< Frame sent. */
+} eMBEventType;
+
+typedef enum
+{
+    EV_MASTER_READY                    = 1<<0,  /*!< Startup finished. */
+    EV_MASTER_FRAME_RECEIVED           = 1<<1,  /*!< Frame received. */
+    EV_MASTER_EXECUTE                  = 1<<2,  /*!< Execute function. */
+    EV_MASTER_FRAME_SENT               = 1<<3,  /*!< Frame sent. */
+    EV_MASTER_ERROR_PROCESS            = 1<<4,  /*!< Frame error process. */
+    EV_MASTER_PROCESS_SUCESS           = 1<<5,  /*!< Request process success. */
+    EV_MASTER_ERROR_RESPOND_TIMEOUT    = 1<<6,  /*!< Request respond timeout. */
+    EV_MASTER_ERROR_RECEIVE_DATA       = 1<<7,  /*!< Request receive data error. */
+    EV_MASTER_ERROR_EXECUTE_FUNCTION   = 1<<8,  /*!< Request execute function error. */
+} eMBMasterEventType;
+
+typedef enum
+{
+    EV_ERROR_RESPOND_TIMEOUT,         /*!< Slave respond timeout. */
+    EV_ERROR_RECEIVE_DATA,            /*!< Receive frame data erroe. */
+    EV_ERROR_EXECUTE_FUNCTION,        /*!< Execute function error. */
+} eMBMasterErrorEventType;
+
+/*! \ingroup modbus
+ * \brief Parity used for characters in serial mode.
+ *
+ * The parity which should be applied to the characters sent over the serial
+ * link. Please note that this values are actually passed to the porting
+ * layer and therefore not all parity modes might be available.
+ */
+typedef enum
+{
+    MB_PAR_NONE,                /*!< No parity. */
+    MB_PAR_ODD,                 /*!< Odd parity. */
+    MB_PAR_EVEN                 /*!< Even parity. */
+} eMBParity;
+
+/* ----------------------- Supporting functions -----------------------------*/
+BOOL            xMBPortEventInit( void );
+
+BOOL            xMBPortEventPost( eMBEventType eEvent );
+
+BOOL            xMBPortEventGet(  /*@out@ */ eMBEventType * eEvent );
+
+BOOL            xMBMasterPortEventInit( void );
+
+BOOL            xMBMasterPortEventPost( eMBMasterEventType eEvent );
+
+BOOL            xMBMasterPortEventGet(  /*@out@ */ eMBMasterEventType * eEvent );
+
+void            vMBMasterOsResInit( void );
+
+BOOL            xMBMasterRunResTake( int32_t time );
+
+void            vMBMasterRunResRelease( void );
+
+/* ----------------------- Serial port functions ----------------------------*/
+
+BOOL            xMBPortSerialInit( UCHAR ucPort, ULONG ulBaudRate,
+                                   UCHAR ucDataBits, eMBParity eParity );
+
+void            vMBPortClose( void );
+
+void            xMBPortSerialClose( void );
+
+void            vMBPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable );
+
+INLINE BOOL     xMBPortSerialGetByte( CHAR * pucByte );
+
+INLINE BOOL     xMBPortSerialPutByte( CHAR ucByte );
+
+INLINE BOOL     xMBPortSerialPutBytes( volatile UCHAR *ucByte, USHORT usSize );
+
+BOOL            xMBMasterPortSerialInit( UCHAR ucPort, ULONG ulBaudRate,
+                                   UCHAR ucDataBits, eMBParity eParity );
+
+void            vMBMasterPortClose( void );
+
+void            xMBMasterPortSerialClose( void );
+
+void            vMBMasterPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable );
+
+INLINE BOOL     xMBMasterPortSerialGetByte( CHAR * pucByte );
+
+INLINE BOOL     xMBMasterPortSerialPutByte( CHAR ucByte );
+
+INLINE BOOL     xMBMasterPortSerialPutBytes( volatile UCHAR *ucByte, USHORT usSize );
+
+/* ----------------------- Timers functions ---------------------------------*/
+BOOL            xMBPortTimersInit( USHORT usTimeOut50us );
+
+void            xMBPortTimersClose( void );
+
+INLINE void     vMBPortTimersEnable( void );
+
+INLINE void     vMBPortTimersDisable( void );
+
+BOOL            xMBMasterPortTimersInit( USHORT usTimeOut50us );
+
+void            xMBMasterPortTimersClose( void );
+
+INLINE void     vMBMasterPortTimersT35Enable( void );
+
+INLINE void     vMBMasterPortTimersConvertDelayEnable( void );
+
+INLINE void     vMBMasterPortTimersRespondTimeoutEnable( void );
+
+INLINE void     vMBMasterPortTimersDisable( void );
+
+/* ----------------- Callback for the master error process ------------------*/
+void            vMBMasterErrorCBRespondTimeout( UCHAR ucDestAddress, const UCHAR* pucPDUData,
+                                                USHORT ucPDULength );
+
+void            vMBMasterErrorCBReceiveData( UCHAR ucDestAddress, const UCHAR* pucPDUData,
+                                             USHORT ucPDULength );
+
+void            vMBMasterErrorCBExecuteFunction( UCHAR ucDestAddress, const UCHAR* pucPDUData,
+                                                 USHORT ucPDULength );
+
+void            vMBMasterCBRequestSuccess( void );
+
+/* ----------------------- Callback for the protocol stack ------------------*/
+
+/*!
+ * \brief Callback function for the porting layer when a new byte is
+ *   available.
+ *
+ * Depending upon the mode this callback function is used by the RTU or
+ * ASCII transmission layers. In any case a call to xMBPortSerialGetByte()
+ * must immediately return a new character.
+ *
+ * \return <code>TRUE</code> if a event was posted to the queue because
+ *   a new byte was received. The port implementation should wake up the
+ *   tasks which are currently blocked on the eventqueue.
+ */
+extern          BOOL( *pxMBFrameCBByteReceived ) ( void );
+
+extern          BOOL( *pxMBFrameCBTransmitterEmpty ) ( void );
+
+extern          BOOL( *pxMBPortCBTimerExpired ) ( void );
+
+extern          BOOL( *pxMBMasterFrameCBByteReceived ) ( void );
+
+extern          BOOL( *pxMBMasterFrameCBTransmitterEmpty ) ( void );
+
+extern          BOOL( *pxMBMasterPortCBTimerExpired ) ( void );
+
+/* ----------------------- TCP port functions -------------------------------*/
+BOOL            xMBTCPPortInit( USHORT usTCPPort );
+
+void            vMBTCPPortClose( void );
+
+void            vMBTCPPortDisable( void );
+
+BOOL            xMBTCPPortGetRequest( UCHAR **ppucMBTCPFrame, USHORT * usTCPLength );
+
+BOOL            xMBTCPPortSendResponse( const UCHAR *pucMBTCPFrame, USHORT usTCPLength );
+
+#ifdef __cplusplus
+PR_END_EXTERN_C
+#endif
+#endif

+ 84 - 0
Middlewares/Third_Party/FreeModbus/modbus/include/mbproto.h

@@ -0,0 +1,84 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbproto.h,v 1.14 2006/12/07 22:10:34 wolti Exp $
+ */
+
+#ifndef _MB_PROTO_H
+#define _MB_PROTO_H
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_ADDRESS_BROADCAST    ( 0 )   /*! Modbus broadcast address. */
+#define MB_ADDRESS_MIN          ( 1 )   /*! Smallest possible slave address. */
+#define MB_ADDRESS_MAX          ( 247 ) /*! Biggest possible slave address. */
+#define MB_FUNC_NONE                          (  0 )
+#define MB_FUNC_READ_COILS                    (  1 )
+#define MB_FUNC_READ_DISCRETE_INPUTS          (  2 )
+#define MB_FUNC_WRITE_SINGLE_COIL             (  5 )
+#define MB_FUNC_WRITE_MULTIPLE_COILS          ( 15 )
+#define MB_FUNC_READ_HOLDING_REGISTER         (  3 )
+#define MB_FUNC_READ_INPUT_REGISTER           (  4 )
+#define MB_FUNC_WRITE_REGISTER                (  6 )
+#define MB_FUNC_WRITE_MULTIPLE_REGISTERS      ( 16 )
+#define MB_FUNC_READWRITE_MULTIPLE_REGISTERS  ( 23 )
+#define MB_FUNC_DIAG_READ_EXCEPTION           (  7 )
+#define MB_FUNC_DIAG_DIAGNOSTIC               (  8 )
+#define MB_FUNC_DIAG_GET_COM_EVENT_CNT        ( 11 )
+#define MB_FUNC_DIAG_GET_COM_EVENT_LOG        ( 12 )
+#define MB_FUNC_OTHER_REPORT_SLAVEID          ( 17 )
+#define MB_FUNC_WRITE_FILE                    ( 21 )
+#define MB_FUNC_ERROR                         ( 128 )
+/* ----------------------- Type definitions ---------------------------------*/
+    typedef enum
+{
+    MB_EX_NONE = 0x00,
+    MB_EX_ILLEGAL_FUNCTION = 0x01,
+    MB_EX_ILLEGAL_DATA_ADDRESS = 0x02,
+    MB_EX_ILLEGAL_DATA_VALUE = 0x03,
+    MB_EX_SLAVE_DEVICE_FAILURE = 0x04,
+    MB_EX_ACKNOWLEDGE = 0x05,
+    MB_EX_SLAVE_BUSY = 0x06,
+    MB_EX_MEMORY_PARITY_ERROR = 0x08,
+    MB_EX_GATEWAY_PATH_FAILED = 0x0A,
+    MB_EX_GATEWAY_TGT_FAILED = 0x0B
+} eMBException;
+
+typedef         eMBException( *pxMBFunctionHandler ) ( UCHAR * pucFrame, USHORT * pusLength );
+
+typedef struct
+{
+    UCHAR           ucFunctionCode;
+    pxMBFunctionHandler pxHandler;
+} xMBFunctionHandler;
+
+#ifdef __cplusplus
+PR_END_EXTERN_C
+#endif
+#endif

+ 108 - 0
Middlewares/Third_Party/FreeModbus/modbus/include/mbutils.h

@@ -0,0 +1,108 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbutils.h,v 1.5 2006/12/07 22:10:34 wolti Exp $
+ */
+
+#ifndef _MB_UTILS_H
+#define _MB_UTILS_H
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+/*! \defgroup modbus_utils Utilities
+ *
+ * This module contains some utility functions which can be used by
+ * the application. It includes some special functions for working with
+ * bitfields backed by a character array buffer.
+ *
+ */
+/*! \addtogroup modbus_utils
+ *  @{
+ */
+/*! \brief Function to set bits in a byte buffer.
+ *
+ * This function allows the efficient use of an array to implement bitfields.
+ * The array used for storing the bits must always be a multiple of two
+ * bytes. Up to eight bits can be set or cleared in one operation.
+ *
+ * \param ucByteBuf A buffer where the bit values are stored. Must be a
+ *   multiple of 2 bytes. No length checking is performed and if
+ *   usBitOffset / 8 is greater than the size of the buffer memory contents
+ *   is overwritten.
+ * \param usBitOffset The starting address of the bits to set. The first
+ *   bit has the offset 0.
+ * \param ucNBits Number of bits to modify. The value must always be smaller
+ *   than 8.
+ * \param ucValues Thew new values for the bits. The value for the first bit
+ *   starting at <code>usBitOffset</code> is the LSB of the value
+ *   <code>ucValues</code>
+ *
+ * \code
+ * ucBits[2] = {0, 0};
+ *
+ * // Set bit 4 to 1 (read: set 1 bit starting at bit offset 4 to value 1)
+ * xMBUtilSetBits( ucBits, 4, 1, 1 );
+ *
+ * // Set bit 7 to 1 and bit 8 to 0.
+ * xMBUtilSetBits( ucBits, 7, 2, 0x01 );
+ *
+ * // Set bits 8 - 11 to 0x05 and bits 12 - 15 to 0x0A;
+ * xMBUtilSetBits( ucBits, 8, 8, 0x5A);
+ * \endcode
+ */
+void            xMBUtilSetBits( UCHAR * ucByteBuf, USHORT usBitOffset,
+                                UCHAR ucNBits, UCHAR ucValues );
+
+/*! \brief Function to read bits in a byte buffer.
+ *
+ * This function is used to extract up bit values from an array. Up to eight
+ * bit values can be extracted in one step.
+ *
+ * \param ucByteBuf A buffer where the bit values are stored.
+ * \param usBitOffset The starting address of the bits to set. The first
+ *   bit has the offset 0.
+ * \param ucNBits Number of bits to modify. The value must always be smaller
+ *   than 8.
+ *
+ * \code
+ * UCHAR ucBits[2] = {0, 0};
+ * UCHAR ucResult;
+ *
+ * // Extract the bits 3 - 10.
+ * ucResult = xMBUtilGetBits( ucBits, 3, 8 );
+ * \endcode
+ */
+UCHAR           xMBUtilGetBits( UCHAR * ucByteBuf, USHORT usBitOffset,
+                                UCHAR ucNBits );
+
+/*! @} */
+
+#ifdef __cplusplus
+PR_END_EXTERN_C
+#endif
+#endif

+ 415 - 0
Middlewares/Third_Party/FreeModbus/modbus/mb.c

@@ -0,0 +1,415 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mb.c,v 1.27 2007/02/18 23:45:41 wolti Exp $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+
+#include "mb.h"
+#include "mbconfig.h"
+#include "mbframe.h"
+#include "mbproto.h"
+#include "mbfunc.h"
+
+#include "mbport.h"
+#if MB_SLAVE_RTU_ENABLED == 1
+#include "mbrtu.h"
+#endif
+#if MB_SLAVE_ASCII_ENABLED == 1
+#include "mbascii.h"
+#endif
+#if MB_SLAVE_TCP_ENABLED == 1
+#include "mbtcp.h"
+#endif
+
+#ifndef MB_PORT_HAS_CLOSE
+#define MB_PORT_HAS_CLOSE 0
+#endif
+
+/* ----------------------- Static variables ---------------------------------*/
+
+static UCHAR    ucMBAddress;
+static eMBMode  eMBCurrentMode;
+
+static enum
+{
+    STATE_ENABLED,
+    STATE_DISABLED,
+    STATE_NOT_INITIALIZED
+} eMBState = STATE_NOT_INITIALIZED;
+
+/* Functions pointer which are initialized in eMBInit( ). Depending on the
+ * mode (RTU or ASCII) the are set to the correct implementations.
+ * Using for Modbus Slave
+ */
+static peMBFrameSend peMBFrameSendCur;
+static pvMBFrameStart pvMBFrameStartCur;
+static pvMBFrameStop pvMBFrameStopCur;
+static peMBFrameReceive peMBFrameReceiveCur;
+static pvMBFrameClose pvMBFrameCloseCur;
+
+/* Callback functions required by the porting layer. They are called when
+ * an external event has happend which includes a timeout or the reception
+ * or transmission of a character.
+ * Using for Modbus Slave
+ */
+BOOL( *pxMBFrameCBByteReceived ) ( void );
+BOOL( *pxMBFrameCBTransmitterEmpty ) ( void );
+BOOL( *pxMBPortCBTimerExpired ) ( void );
+
+BOOL( *pxMBFrameCBReceiveFSMCur ) ( void );
+BOOL( *pxMBFrameCBTransmitFSMCur ) ( void );
+
+/* An array of Modbus functions handlers which associates Modbus function
+ * codes with implementing functions.
+ */
+static xMBFunctionHandler xFuncHandlers[MB_FUNC_HANDLERS_MAX] = {
+#if MB_FUNC_OTHER_REP_SLAVEID_ENABLED > 0
+    {MB_FUNC_OTHER_REPORT_SLAVEID, eMBFuncReportSlaveID},
+#endif
+#if MB_FUNC_READ_INPUT_ENABLED > 0
+    {MB_FUNC_READ_INPUT_REGISTER, eMBFuncReadInputRegister},
+#endif
+#if MB_FUNC_READ_HOLDING_ENABLED > 0
+    {MB_FUNC_READ_HOLDING_REGISTER, eMBFuncReadHoldingRegister},
+#endif
+#if MB_FUNC_WRITE_MULTIPLE_HOLDING_ENABLED > 0
+    {MB_FUNC_WRITE_MULTIPLE_REGISTERS, eMBFuncWriteMultipleHoldingRegister},
+#endif
+#if MB_FUNC_WRITE_HOLDING_ENABLED > 0
+    {MB_FUNC_WRITE_REGISTER, eMBFuncWriteHoldingRegister},
+#endif
+#if MB_FUNC_READWRITE_HOLDING_ENABLED > 0
+    {MB_FUNC_READWRITE_MULTIPLE_REGISTERS, eMBFuncReadWriteMultipleHoldingRegister},
+#endif
+#if MB_FUNC_READ_COILS_ENABLED > 0
+    {MB_FUNC_READ_COILS, eMBFuncReadCoils},
+#endif
+#if MB_FUNC_WRITE_COIL_ENABLED > 0
+    {MB_FUNC_WRITE_SINGLE_COIL, eMBFuncWriteCoil},
+#endif
+#if MB_FUNC_WRITE_MULTIPLE_COILS_ENABLED > 0
+    {MB_FUNC_WRITE_MULTIPLE_COILS, eMBFuncWriteMultipleCoils},
+#endif
+#if MB_FUNC_READ_DISCRETE_INPUTS_ENABLED > 0
+    {MB_FUNC_READ_DISCRETE_INPUTS, eMBFuncReadDiscreteInputs},
+#endif
+#if MB_FUNC_WRITE_FILE_ENABLE > 0
+    {MB_FUNC_WRITE_FILE, eMBFuncWriteFile}
+#endif
+};
+
+/* ----------------------- Start implementation -----------------------------*/
+eMBErrorCode
+eMBInit( eMBMode eMode, UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+
+    /* check preconditions */
+    if( ( ucSlaveAddress == MB_ADDRESS_BROADCAST ) ||
+        ( ucSlaveAddress < MB_ADDRESS_MIN ) || ( ucSlaveAddress > MB_ADDRESS_MAX ) )
+    {
+        eStatus = MB_EINVAL;
+    }
+    else
+    {
+        ucMBAddress = ucSlaveAddress;
+
+        switch ( eMode )
+        {
+#if MB_SLAVE_RTU_ENABLED > 0
+        case MB_RTU:
+            pvMBFrameStartCur = eMBRTUStart;
+            pvMBFrameStopCur = eMBRTUStop;
+            peMBFrameSendCur = eMBRTUSend;
+            peMBFrameReceiveCur = eMBRTUReceive;
+            pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBPortClose : NULL;
+            pxMBFrameCBByteReceived = xMBRTUReceiveFSM;
+            pxMBFrameCBTransmitterEmpty = xMBRTUTransmitFSM;
+            pxMBPortCBTimerExpired = xMBRTUTimerT35Expired;
+
+            eStatus = eMBRTUInit( ucMBAddress, ucPort, ulBaudRate, eParity );
+            break;
+#endif
+#if MB_SLAVE_ASCII_ENABLED > 0
+        case MB_ASCII:
+            pvMBFrameStartCur = eMBASCIIStart;
+            pvMBFrameStopCur = eMBASCIIStop;
+            peMBFrameSendCur = eMBASCIISend;
+            peMBFrameReceiveCur = eMBASCIIReceive;
+            pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBPortClose : NULL;
+            pxMBFrameCBByteReceived = xMBASCIIReceiveFSM;
+            pxMBFrameCBTransmitterEmpty = xMBASCIITransmitFSM;
+            pxMBPortCBTimerExpired = xMBASCIITimerT1SExpired;
+
+            eStatus = eMBASCIIInit( ucMBAddress, ucPort, ulBaudRate, eParity );
+            break;
+#endif
+        default:
+            eStatus = MB_EINVAL;
+            break;
+        }
+
+        if( eStatus == MB_ENOERR )
+        {
+            if( !xMBPortEventInit(  ) )
+            {
+                /* port dependent event module initalization failed. */
+                eStatus = MB_EPORTERR;
+            }
+            else
+            {
+                eMBCurrentMode = eMode;
+                eMBState = STATE_DISABLED;
+            }
+        }
+    }
+    return eStatus;
+}
+
+#if MB_SLAVE_TCP_ENABLED > 0
+eMBErrorCode
+eMBTCPInit( USHORT ucTCPPort )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+
+    if( ( eStatus = eMBTCPDoInit( ucTCPPort ) ) != MB_ENOERR )
+    {
+        eMBState = STATE_DISABLED;
+    }
+    else if( !xMBPortEventInit(  ) )
+    {
+        /* Port dependent event module initalization failed. */
+        eStatus = MB_EPORTERR;
+    }
+    else
+    {
+        pvMBFrameStartCur = eMBTCPStart;
+        pvMBFrameStopCur = eMBTCPStop;
+        peMBFrameReceiveCur = eMBTCPReceive;
+        peMBFrameSendCur = eMBTCPSend;
+        pvMBFrameCloseCur = MB_PORT_HAS_CLOSE ? vMBTCPPortClose : NULL;
+        ucMBAddress = MB_TCP_PSEUDO_ADDRESS;
+        eMBCurrentMode = MB_TCP;
+        eMBState = STATE_DISABLED;
+    }
+    return eStatus;
+}
+#endif
+
+eMBErrorCode
+eMBRegisterCB( UCHAR ucFunctionCode, pxMBFunctionHandler pxHandler )
+{
+    int             i;
+    eMBErrorCode    eStatus;
+
+    if( ( 0 < ucFunctionCode ) && ( ucFunctionCode <= 127 ) )
+    {
+        ENTER_CRITICAL_SECTION(  );
+        if( pxHandler != NULL )
+        {
+            for( i = 0; i < MB_FUNC_HANDLERS_MAX; i++ )
+            {
+                if( ( xFuncHandlers[i].pxHandler == NULL ) ||
+                    ( xFuncHandlers[i].pxHandler == pxHandler ) )
+                {
+                    xFuncHandlers[i].ucFunctionCode = ucFunctionCode;
+                    xFuncHandlers[i].pxHandler = pxHandler;
+                    break;
+                }
+            }
+            eStatus = ( i != MB_FUNC_HANDLERS_MAX ) ? MB_ENOERR : MB_ENORES;
+        }
+        else
+        {
+            for( i = 0; i < MB_FUNC_HANDLERS_MAX; i++ )
+            {
+                if( xFuncHandlers[i].ucFunctionCode == ucFunctionCode )
+                {
+                    xFuncHandlers[i].ucFunctionCode = 0;
+                    xFuncHandlers[i].pxHandler = NULL;
+                    break;
+                }
+            }
+            /* Remove can't fail. */
+            eStatus = MB_ENOERR;
+        }
+        EXIT_CRITICAL_SECTION(  );
+    }
+    else
+    {
+        eStatus = MB_EINVAL;
+    }
+    return eStatus;
+}
+
+
+eMBErrorCode
+eMBClose( void )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+
+    if( eMBState == STATE_DISABLED )
+    {
+        if( pvMBFrameCloseCur != NULL )
+        {
+            pvMBFrameCloseCur(  );
+        }
+    }
+    else
+    {
+        eStatus = MB_EILLSTATE;
+    }
+    return eStatus;
+}
+
+
+eMBErrorCode
+eMBEnable( void )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+
+    if( eMBState == STATE_DISABLED )
+    {
+        /* Activate the protocol stack. */
+        pvMBFrameStartCur(  );
+        eMBState = STATE_ENABLED;
+    }
+    else
+    {
+        eStatus = MB_EILLSTATE;
+    }
+    return eStatus;
+}
+
+eMBErrorCode
+eMBDisable( void )
+{
+    eMBErrorCode    eStatus;
+
+    if( eMBState == STATE_ENABLED )
+    {
+        pvMBFrameStopCur(  );
+        eMBState = STATE_DISABLED;
+        eStatus = MB_ENOERR;
+    }
+    else if( eMBState == STATE_DISABLED )
+    {
+        eStatus = MB_ENOERR;
+    }
+    else
+    {
+        eStatus = MB_EILLSTATE;
+    }
+    return eStatus;
+}
+
+eMBErrorCode eMBPoll( void )
+{
+    static UCHAR   *ucMBFrame;
+    static UCHAR    ucRcvAddress;
+    static UCHAR    ucFunctionCode;
+    static USHORT   usLength;
+    static eMBException eException;
+
+    int             i;
+    eMBErrorCode    eStatus = MB_ENOERR;
+    eMBEventType    eEvent;
+
+    /* Check if the protocol stack is ready. */
+    if( eMBState != STATE_ENABLED )
+    {
+        return MB_EILLSTATE;
+    }
+
+    /* Check if there is a event available. If not return control to caller.
+     * Otherwise we will handle the event. */
+    if( xMBPortEventGet( &eEvent ) == TRUE )
+    {
+        switch ( eEvent )
+        {
+        case EV_READY:
+            break;
+
+        case EV_FRAME_RECEIVED:
+            eStatus = peMBFrameReceiveCur( &ucRcvAddress, &ucMBFrame, &usLength );
+            if( eStatus == MB_ENOERR )
+            {
+                /* Check if the frame is for us. If not ignore the frame. */
+                if( ( ucRcvAddress == ucMBAddress ) || ( ucRcvAddress == MB_ADDRESS_BROADCAST ) )
+                {
+                    ( void )xMBPortEventPost( EV_EXECUTE );
+                }
+            }
+            break;
+
+        case EV_EXECUTE:
+            ucFunctionCode = ucMBFrame[MB_PDU_FUNC_OFF];
+            eException = MB_EX_ILLEGAL_FUNCTION;
+            for( i = 0; i < MB_FUNC_HANDLERS_MAX; i++ )
+            {
+                /* No more function handlers registered. Abort. */
+                if( xFuncHandlers[i].ucFunctionCode == 0 )
+                {
+                    break;
+                }
+                else if( xFuncHandlers[i].ucFunctionCode == ucFunctionCode )
+                {
+                    eException = xFuncHandlers[i].pxHandler( ucMBFrame, &usLength );
+                    break;
+                }
+            }
+
+            /* If the request was not sent to the broadcast address we
+             * return a reply. */
+            if( ucRcvAddress != MB_ADDRESS_BROADCAST )
+            {
+                if( eException != MB_EX_NONE )
+                {
+                    /* An exception occured. Build an error frame. */
+                    usLength = 0;
+                    ucMBFrame[usLength++] = ( UCHAR )( ucFunctionCode | MB_FUNC_ERROR );
+                    ucMBFrame[usLength++] = eException;
+                }
+                eStatus = peMBFrameSendCur( ucMBAddress, ucMBFrame, usLength );
+            }
+            break;
+
+        case EV_FRAME_SENT:
+            break;
+        }
+    }
+    return MB_ENOERR;
+}

+ 98 - 0
Middlewares/Third_Party/FreeModbus/modbus/rtu/mbcrc.c

@@ -0,0 +1,98 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbcrc.c,v 1.7 2007/02/18 23:50:27 wolti Exp $
+ */
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+static const UCHAR aucCRCHi[] = {
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
+    0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
+    0x00, 0xC1, 0x81, 0x40
+};
+
+static const UCHAR aucCRCLo[] = {
+    0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7,
+    0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E,
+    0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9,
+    0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC,
+    0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3,
+    0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32,
+    0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D,
+    0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38,
+    0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF,
+    0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26,
+    0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1,
+    0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4,
+    0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB,
+    0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA,
+    0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5,
+    0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0,
+    0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97,
+    0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E,
+    0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89,
+    0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C,
+    0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83,
+    0x41, 0x81, 0x80, 0x40
+};
+
+USHORT
+usMBCRC16( UCHAR * pucFrame, USHORT usLen )
+{
+    UCHAR           ucCRCHi = 0xFF;
+    UCHAR           ucCRCLo = 0xFF;
+    int             iIndex;
+
+    while( usLen-- )
+    {
+        iIndex = ucCRCLo ^ *( pucFrame++ );
+        ucCRCLo = ( UCHAR )( ucCRCHi ^ aucCRCHi[iIndex] );
+        ucCRCHi = aucCRCLo[iIndex];
+    }
+    return ( USHORT )( ucCRCHi << 8 | ucCRCLo );
+}

+ 36 - 0
Middlewares/Third_Party/FreeModbus/modbus/rtu/mbcrc.h

@@ -0,0 +1,36 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbcrc.h,v 1.5 2006/12/07 22:10:34 wolti Exp $
+ */
+
+#ifndef _MB_CRC_H
+#define _MB_CRC_H
+
+USHORT          usMBCRC16( UCHAR * pucFrame, USHORT usLen );
+
+#endif

+ 361 - 0
Middlewares/Third_Party/FreeModbus/modbus/rtu/mbrtu.c

@@ -0,0 +1,361 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbrtu.c,v 1.18 2007/09/12 10:15:56 wolti Exp $
+ *            mbrtu.c,v 1.60 2022/07/17          quanghona <lyhonquang@gmail.com> Add send multiple bytes in one call $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+#include "main.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbrtu.h"
+#include "mbframe.h"
+
+#include "mbcrc.h"
+#include "mbport.h"
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_SER_PDU_SIZE_MIN     4       /*!< Minimum size of a Modbus RTU frame. */
+#define MB_SER_PDU_SIZE_MAX     256     /*!< Maximum size of a Modbus RTU frame. */
+#define MB_SER_PDU_SIZE_CRC     2       /*!< Size of CRC field in PDU. */
+#define MB_SER_PDU_ADDR_OFF     0       /*!< Offset of slave address in Ser-PDU. */
+#define MB_SER_PDU_PDU_OFF      1       /*!< Offset of Modbus-PDU in Ser-PDU. */
+
+/* ----------------------- Type definitions ---------------------------------*/
+typedef enum
+{
+    STATE_RX_INIT,              /*!< Receiver is in initial state. */
+    STATE_RX_IDLE,              /*!< Receiver is in idle state. */
+    STATE_RX_RCV,               /*!< Frame is beeing received. */
+    STATE_RX_ERROR              /*!< If the frame is invalid. */
+} eMBRcvState;
+
+typedef enum
+{
+    STATE_TX_IDLE,              /*!< Transmitter is in idle state. */
+    STATE_TX_XMIT               /*!< Transmitter is in transfer state. */
+} eMBSndState;
+
+/* ----------------------- Static variables ---------------------------------*/
+static volatile eMBSndState eSndState;
+static volatile eMBRcvState eRcvState;
+
+volatile UCHAR  ucRTUBuf[MB_SER_PDU_SIZE_MAX];
+
+static volatile UCHAR *pucSndBufferCur;
+static volatile USHORT usSndBufferCount;
+
+static volatile USHORT usRcvBufferPos;
+
+/* ----------------------- Start implementation -----------------------------*/
+eMBErrorCode
+eMBRTUInit( UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate, eMBParity eParity )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+    ULONG           usTimerT35_50us;
+
+    ( void )ucSlaveAddress;
+    ENTER_CRITICAL_SECTION(  );
+
+    /* Modbus RTU uses 8 Databits. */
+    if( xMBPortSerialInit( ucPort, ulBaudRate, 8, eParity ) != TRUE )
+    {
+        eStatus = MB_EPORTERR;
+    }
+    else
+    {
+        /* If baudrate > 19200 then we should use the fixed timer values
+         * t35 = 1750us. Otherwise t35 must be 3.5 times the character time.
+         */
+        if( ulBaudRate > 19200 )
+        {
+            usTimerT35_50us = 35;       /* 1800us. */
+        }
+        else
+        {
+            /* The timer reload value for a character is given by:
+             *
+             * ChTimeValue = Ticks_per_1s / ( Baudrate / 11 )
+             *             = 11 * Ticks_per_1s / Baudrate
+             *             = 220000 / Baudrate
+             * The reload for t3.5 is 1.5 times this value and similary
+             * for t3.5.
+             */
+            usTimerT35_50us = ( 7UL * 220000UL ) / ( 2UL * ulBaudRate );
+        }
+        if( xMBPortTimersInit( ( USHORT ) usTimerT35_50us ) != TRUE )
+        {
+            eStatus = MB_EPORTERR;
+        }
+    }
+    EXIT_CRITICAL_SECTION(  );
+
+    return eStatus;
+}
+
+void
+eMBRTUStart( void )
+{
+    ENTER_CRITICAL_SECTION(  );
+    /* Initially the receiver is in the state STATE_RX_INIT. we start
+     * the timer and if no character is received within t3.5 we change
+     * to STATE_RX_IDLE. This makes sure that we delay startup of the
+     * modbus protocol stack until the bus is free.
+     */
+    eRcvState = STATE_RX_INIT;
+    vMBPortSerialEnable( TRUE, FALSE );
+    vMBPortTimersEnable(  );
+
+    EXIT_CRITICAL_SECTION(  );
+}
+
+void
+eMBRTUStop( void )
+{
+    ENTER_CRITICAL_SECTION(  );
+    vMBPortSerialEnable( FALSE, FALSE );
+    vMBPortTimersDisable(  );
+    EXIT_CRITICAL_SECTION(  );
+}
+
+eMBErrorCode
+eMBRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+
+    ENTER_CRITICAL_SECTION(  );
+    assert_param( usRcvBufferPos < MB_SER_PDU_SIZE_MAX );
+
+    /* Length and CRC check */
+    if( ( usRcvBufferPos >= MB_SER_PDU_SIZE_MIN )
+        && ( usMBCRC16( ( UCHAR * ) ucRTUBuf, usRcvBufferPos ) == 0 ) )
+    {
+        /* Save the address field. All frames are passed to the upper layed
+         * and the decision if a frame is used is done there.
+         */
+        *pucRcvAddress = ucRTUBuf[MB_SER_PDU_ADDR_OFF];
+
+        /* Total length of Modbus-PDU is Modbus-Serial-Line-PDU minus
+         * size of address field and CRC checksum.
+         */
+        *pusLength = ( USHORT )( usRcvBufferPos - MB_SER_PDU_PDU_OFF - MB_SER_PDU_SIZE_CRC );
+
+        /* Return the start of the Modbus PDU to the caller. */
+        *pucFrame = ( UCHAR * ) & ucRTUBuf[MB_SER_PDU_PDU_OFF];
+    }
+    else
+    {
+        eStatus = MB_EIO;
+    }
+
+    EXIT_CRITICAL_SECTION(  );
+    return eStatus;
+}
+
+eMBErrorCode
+eMBRTUSend( UCHAR ucSlaveAddress, const UCHAR * pucFrame, USHORT usLength )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+    USHORT          usCRC16;
+
+    ENTER_CRITICAL_SECTION(  );
+
+    /* Check if the receiver is still in idle state. If not we where to
+     * slow with processing the received frame and the master sent another
+     * frame on the network. We have to abort sending the frame.
+     */
+    if( eRcvState == STATE_RX_IDLE )
+    {
+        /* First byte before the Modbus-PDU is the slave address. */
+        pucSndBufferCur = ( UCHAR * ) pucFrame - 1;
+        usSndBufferCount = 1;
+
+        /* Now copy the Modbus-PDU into the Modbus-Serial-Line-PDU. */
+        pucSndBufferCur[MB_SER_PDU_ADDR_OFF] = ucSlaveAddress;
+        usSndBufferCount += usLength;
+
+        /* Calculate CRC16 checksum for Modbus-Serial-Line-PDU. */
+        usCRC16 = usMBCRC16( ( UCHAR * ) pucSndBufferCur, usSndBufferCount );
+        ucRTUBuf[usSndBufferCount++] = ( UCHAR )( usCRC16 & 0xFF );
+        ucRTUBuf[usSndBufferCount++] = ( UCHAR )( usCRC16 >> 8 );
+
+        /* Activate the transmitter. */
+        eSndState = STATE_TX_XMIT;
+        vMBPortSerialEnable( FALSE, TRUE );
+    }
+    else
+    {
+        eStatus = MB_EIO;
+    }
+    EXIT_CRITICAL_SECTION(  );
+    return eStatus;
+}
+
+BOOL
+xMBRTUReceiveFSM( void )
+{
+    BOOL            xTaskNeedSwitch = FALSE;
+    UCHAR           ucByte;
+
+    assert_param( eSndState == STATE_TX_IDLE );
+
+    /* Always read the character. */
+    ( void )xMBPortSerialGetByte( ( CHAR * ) & ucByte );
+
+    switch ( eRcvState )
+    {
+        /* If we have received a character in the init state we have to
+         * wait until the frame is finished.
+         */
+    case STATE_RX_INIT:
+        vMBPortTimersEnable( );
+        break;
+
+        /* In the error state we wait until all characters in the
+         * damaged frame are transmitted.
+         */
+    case STATE_RX_ERROR:
+        vMBPortTimersEnable( );
+        break;
+
+        /* In the idle state we wait for a new character. If a character
+         * is received the t1.5 and t3.5 timers are started and the
+         * receiver is in the state STATE_RX_RECEIVCE.
+         */
+    case STATE_RX_IDLE:
+        usRcvBufferPos = 0;
+        ucRTUBuf[usRcvBufferPos++] = ucByte;
+        eRcvState = STATE_RX_RCV;
+
+        /* Enable t3.5 timers. */
+        vMBPortTimersEnable( );
+        break;
+
+        /* We are currently receiving a frame. Reset the timer after
+         * every character received. If more than the maximum possible
+         * number of bytes in a modbus frame is received the frame is
+         * ignored.
+         */
+    case STATE_RX_RCV:
+        if( usRcvBufferPos < MB_SER_PDU_SIZE_MAX )
+        {
+            ucRTUBuf[usRcvBufferPos++] = ucByte;
+        }
+        else
+        {
+            eRcvState = STATE_RX_ERROR;
+        }
+        vMBPortTimersEnable();
+        break;
+    }
+    return xTaskNeedSwitch;
+}
+
+BOOL
+xMBRTUTransmitFSM( void )
+{
+    BOOL            xNeedPoll = FALSE;
+
+    assert_param( eRcvState == STATE_RX_IDLE );
+
+    switch ( eSndState )
+    {
+        /* We should not get a transmitter event if the transmitter is in
+         * idle state.  */
+    case STATE_TX_IDLE:
+        /* enable receiver/disable transmitter. */
+        vMBPortSerialEnable( TRUE, FALSE );
+        break;
+
+    case STATE_TX_XMIT:
+        /* check if we are finished. */
+        if( usSndBufferCount != 0 )
+        {
+#if SLAVE_SEND_ALL_BYTES_IN_ONE_CALL > 0
+			xMBPortSerialPutBytes(pucSndBufferCur, usSndBufferCount);
+			usSndBufferCount = 0;
+#else
+            xMBPortSerialPutByte( ( CHAR )*pucSndBufferCur );
+            pucSndBufferCur++;  /* next byte in send buffer. */
+            usSndBufferCount--;
+#endif
+        }
+        else
+        {
+            xNeedPoll = xMBPortEventPost( EV_FRAME_SENT );
+            /* Disable transmitter. This prevents another transmit buffer
+             * empty interrupt. */
+            vMBPortSerialEnable( TRUE, FALSE );
+            eSndState = STATE_TX_IDLE;
+        }
+        break;
+    }
+
+    return xNeedPoll;
+}
+
+BOOL
+xMBRTUTimerT35Expired( void )
+{
+    BOOL            xNeedPoll = FALSE;
+
+    switch ( eRcvState )
+    {
+        /* Timer t35 expired. Startup phase is finished. */
+    case STATE_RX_INIT:
+        xNeedPoll = xMBPortEventPost( EV_READY );
+        break;
+
+        /* A frame was received and t35 expired. Notify the listener that
+         * a new frame was received. */
+    case STATE_RX_RCV:
+        xNeedPoll = xMBPortEventPost( EV_FRAME_RECEIVED );
+        break;
+
+        /* An error occured while receiving the frame. */
+    case STATE_RX_ERROR:
+        break;
+
+        /* Function called in an illegal state. */
+    default:
+        assert_param( ( eRcvState == STATE_RX_INIT ) ||
+                ( eRcvState == STATE_RX_RCV ) || ( eRcvState == STATE_RX_ERROR ) );
+         break;
+    }
+
+    vMBPortTimersDisable(  );
+    eRcvState = STATE_RX_IDLE;
+
+    return xNeedPoll;
+}

+ 64 - 0
Middlewares/Third_Party/FreeModbus/modbus/rtu/mbrtu.h

@@ -0,0 +1,64 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbrtu.h,v 1.9  2006/12/07 22:10:34 wolti Exp $
+ * File: $Id: mbrtu.h,v 1.60 2013/08/17 13:11:42 Armink Add Master Functions $
+ */
+#include "mbconfig.h"
+
+#ifndef _MB_RTU_H
+#define _MB_RTU_H
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+eMBErrorCode    eMBRTUInit( UCHAR slaveAddress, UCHAR ucPort, ULONG ulBaudRate,
+                            eMBParity eParity );
+void            eMBRTUStart( void );
+void            eMBRTUStop( void );
+eMBErrorCode    eMBRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength );
+eMBErrorCode    eMBRTUSend( UCHAR slaveAddress, const UCHAR * pucFrame, USHORT usLength );
+BOOL            xMBRTUReceiveFSM( void );
+BOOL            xMBRTUTransmitFSM( void );
+BOOL            xMBRTUTimerT15Expired( void );
+BOOL            xMBRTUTimerT35Expired( void );
+
+#if MB_MASTER_RTU_ENABLED > 0
+eMBErrorCode    eMBMasterRTUInit( UCHAR ucPort, ULONG ulBaudRate,eMBParity eParity );
+void            eMBMasterRTUStart( void );
+void            eMBMasterRTUStop( void );
+eMBErrorCode    eMBMasterRTUReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength );
+eMBErrorCode    eMBMasterRTUSend( UCHAR slaveAddress, const UCHAR * pucFrame, USHORT usLength );
+BOOL            xMBMasterRTUReceiveFSM( void );
+BOOL            xMBMasterRTUTransmitFSM( void );
+BOOL            xMBMasterRTUTimerExpired( void );
+#endif
+
+#ifdef __cplusplus
+PR_END_EXTERN_C
+#endif
+#endif

+ 158 - 0
Middlewares/Third_Party/FreeModbus/modbus/tcp/mbtcp.c

@@ -0,0 +1,158 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbtcp.c,v 1.3 2006/12/07 22:10:34 wolti Exp $
+ */
+
+/* ----------------------- System includes ----------------------------------*/
+#include "stdlib.h"
+#include "string.h"
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbconfig.h"
+#include "mbtcp.h"
+#include "mbframe.h"
+#include "mbport.h"
+
+#if MB_SLAVE_TCP_ENABLED > 0
+
+/* ----------------------- Defines ------------------------------------------*/
+
+/* ----------------------- MBAP Header --------------------------------------*/
+/*
+ *
+ * <------------------------ MODBUS TCP/IP ADU(1) ------------------------->
+ *              <----------- MODBUS PDU (1') ---------------->
+ *  +-----------+---------------+------------------------------------------+
+ *  | TID | PID | Length | UID  |Code | Data                               |
+ *  +-----------+---------------+------------------------------------------+
+ *  |     |     |        |      |
+ * (2)   (3)   (4)      (5)    (6)
+ *
+ * (2)  ... MB_TCP_TID          = 0 (Transaction Identifier - 2 Byte)
+ * (3)  ... MB_TCP_PID          = 2 (Protocol Identifier - 2 Byte)
+ * (4)  ... MB_TCP_LEN          = 4 (Number of bytes - 2 Byte)
+ * (5)  ... MB_TCP_UID          = 6 (Unit Identifier - 1 Byte)
+ * (6)  ... MB_TCP_FUNC         = 7 (Modbus Function Code)
+ *
+ * (1)  ... Modbus TCP/IP Application Data Unit
+ * (1') ... Modbus Protocol Data Unit
+ */
+
+#define MB_TCP_TID          0
+#define MB_TCP_PID          2
+#define MB_TCP_LEN          4
+#define MB_TCP_UID          6
+#define MB_TCP_FUNC         7
+
+#define MB_TCP_PROTOCOL_ID  0   /* 0 = Modbus Protocol */
+
+
+/* ----------------------- Start implementation -----------------------------*/
+eMBErrorCode
+eMBTCPDoInit( USHORT ucTCPPort )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+
+    if( xMBTCPPortInit( ucTCPPort ) == FALSE )
+    {
+        eStatus = MB_EPORTERR;
+    }
+    return eStatus;
+}
+
+void
+eMBTCPStart( void )
+{
+}
+
+void
+eMBTCPStop( void )
+{
+    /* Make sure that no more clients are connected. */
+    vMBTCPPortDisable( );
+}
+
+eMBErrorCode
+eMBTCPReceive( UCHAR * pucRcvAddress, UCHAR ** ppucFrame, USHORT * pusLength )
+{
+    eMBErrorCode    eStatus = MB_EIO;
+    UCHAR          *pucMBTCPFrame;
+    USHORT          usLength;
+    USHORT          usPID;
+
+    if( xMBTCPPortGetRequest( &pucMBTCPFrame, &usLength ) != FALSE )
+    {
+        usPID = pucMBTCPFrame[MB_TCP_PID] << 8U;
+        usPID |= pucMBTCPFrame[MB_TCP_PID + 1];
+
+        if( usPID == MB_TCP_PROTOCOL_ID )
+        {
+            *ppucFrame = &pucMBTCPFrame[MB_TCP_FUNC];
+            *pusLength = usLength - MB_TCP_FUNC;
+            eStatus = MB_ENOERR;
+
+            /* Modbus TCP does not use any addresses. Fake the source address such
+             * that the processing part deals with this frame.
+             */
+            *pucRcvAddress = MB_TCP_PSEUDO_ADDRESS;
+        }
+    }
+    else
+    {
+        eStatus = MB_EIO;
+    }
+    return eStatus;
+}
+
+eMBErrorCode
+eMBTCPSend( UCHAR _unused, const UCHAR * pucFrame, USHORT usLength )
+{
+    eMBErrorCode    eStatus = MB_ENOERR;
+    UCHAR          *pucMBTCPFrame = ( UCHAR * ) pucFrame - MB_TCP_FUNC;
+    USHORT          usTCPLength = usLength + MB_TCP_FUNC;
+
+    /* The MBAP header is already initialized because the caller calls this
+     * function with the buffer returned by the previous call. Therefore we
+     * only have to update the length in the header. Note that the length
+     * header includes the size of the Modbus PDU and the UID Byte. Therefore
+     * the length is usLength plus one.
+     */
+    pucMBTCPFrame[MB_TCP_LEN] = ( usLength + 1 ) >> 8U;
+    pucMBTCPFrame[MB_TCP_LEN + 1] = ( usLength + 1 ) & 0xFF;
+    if( xMBTCPPortSendResponse( pucMBTCPFrame, usTCPLength ) == FALSE )
+    {
+        eStatus = MB_EIO;
+    }
+    return eStatus;
+}
+
+#endif

+ 53 - 0
Middlewares/Third_Party/FreeModbus/modbus/tcp/mbtcp.h

@@ -0,0 +1,53 @@
+/*
+ * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU.
+ * Copyright (c) 2006-2018 Christian Walter <cwalter@embedded-solutions.at>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * File: $Id: mbtcp.h,v 1.2 2006/12/07 22:10:34 wolti Exp $
+ */
+
+#ifndef _MB_TCP_H
+#define _MB_TCP_H
+
+#ifdef __cplusplus
+PR_BEGIN_EXTERN_C
+#endif
+
+/* ----------------------- Defines ------------------------------------------*/
+#define MB_TCP_PSEUDO_ADDRESS   255
+
+/* ----------------------- Function prototypes ------------------------------*/
+    eMBErrorCode eMBTCPDoInit( USHORT ucTCPPort );
+void            eMBTCPStart( void );
+void            eMBTCPStop( void );
+eMBErrorCode    eMBTCPReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame,
+                               USHORT * pusLength );
+eMBErrorCode    eMBTCPSend( UCHAR _unused, const UCHAR * pucFrame,
+                            USHORT usLength );
+
+#ifdef __cplusplus
+PR_END_EXTERN_C
+#endif
+#endif

+ 30 - 0
Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portcritical.c

@@ -0,0 +1,30 @@
+/**
+* @file portcritical.c
+* @brief FreeModbus Library: CMSIS-RTOS2 Port. Critical section functions definition
+*
+* @details
+* @date 2022 Jun 30
+* @author Ly Hon Quang
+* @e-mail lyhonquang@gmail.com
+*
+*/
+
+/* ----------------------- System includes --------------------------------*/
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "port.h"
+#include "cmsis_os2.h"
+
+/* ----------------------- Variables ----------------------------------------*/
+static int32_t lock;
+
+/* ----------------------- Start implementation -----------------------------*/
+void EnterCriticalSection(void)
+{
+    lock = osKernelLock();
+}
+
+void ExitCriticalSection(void)
+{
+    osKernelRestoreLock(lock);
+}

+ 82 - 0
Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portevent.c

@@ -0,0 +1,82 @@
+/*
+ * FreeModbus Libary: CMSIS-RTOS2 Port
+ * Copyright (C) 2013 Armink <armink.ztl@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * File: $Id: portevent.c,v 1.60 2013/08/13 15:07:05 Armink $
+ *            portevent.c,v 1.60 2022/07/17          quanghona <lyhonquang@gmail.com> CMSIS-RTOS2 port $
+ */
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbport.h"
+#include "cmsis_os2.h"
+
+/* ----------------------- Variables ----------------------------------------*/
+static osEventFlagsId_t     xEventId;
+
+/* ----------------------- Start implementation -----------------------------*/
+BOOL
+xMBPortEventInit( void )
+{
+    xEventId = osEventFlagsNew(NULL);
+    return xEventId != NULL;
+}
+
+BOOL
+xMBPortEventPost( eMBEventType eEvent )
+{
+    if (xEventId != NULL)
+    {
+        return (osEventFlagsSet(xEventId, eEvent) & 0x80000000) == 0;
+    }
+    else
+    {
+        return FALSE;
+    }
+}
+
+BOOL
+xMBPortEventGet( eMBEventType * eEvent )
+{
+    uint32_t receivedEvent;
+    const uint32_t EVENTS = EV_READY | EV_FRAME_RECEIVED | EV_EXECUTE | EV_FRAME_SENT;
+
+    /* waiting forever OS event */
+    receivedEvent = osEventFlagsWait(xEventId, EVENTS, osFlagsWaitAny, osWaitForever);
+    switch (receivedEvent)
+    {
+        case EV_READY:
+            *eEvent = EV_READY;
+            break;
+
+        case EV_FRAME_RECEIVED:
+            *eEvent = EV_FRAME_RECEIVED;
+            break;
+
+        case EV_EXECUTE:
+            *eEvent = EV_EXECUTE;
+            break;
+
+        case EV_FRAME_SENT:
+            *eEvent = EV_FRAME_SENT;
+            break;
+
+        default:
+            return FALSE;
+    }
+    return TRUE;
+}

+ 178 - 0
Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portserial.c

@@ -0,0 +1,178 @@
+#include "port.h"
+#include "main.h"
+#include "cmsis_os2.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbport.h"
+
+/* ----------------------- Static variables ---------------------------------*/
+static volatile uint8_t rx_buff[256];
+static int rx_index;
+static int put_index;
+static osThreadId_t receiveDataHandle;
+static osEventFlagsId_t xSerialEventHandle;
+
+extern UART_HandleTypeDef huart3;
+
+/* ----------------------- Defines ------------------------------------------*/
+#define EVENT_MBSLAVE_HANDLE_RECEIVED_DATA  0x00000001UL
+#define huart                               huart3
+#define RS485_SLAVE_TX_MODE()               HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_SET)
+#define RS485_SLAVE_RX_MODE()               HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_RESET)
+
+/* ----------------------- static functions ---------------------------------*/
+static void handleReceivedDataTask(void *argument);
+
+/* ----------------------- Start implementation -----------------------------*/
+BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
+        eMBParity eParity)
+{
+
+    /* set serial configure parameter */
+    huart.Init.BaudRate = ulBaudRate;
+    huart.Init.WordLength = ucDataBits == 8 ? UART_WORDLENGTH_8B : UART_WORDLENGTH_9B;
+    huart.Init.StopBits = UART_STOPBITS_1;
+    switch (eParity)
+    {
+        case MB_PAR_NONE:
+            huart.Init.Parity = UART_PARITY_NONE;
+            break;
+
+        case MB_PAR_ODD:
+            huart.Init.Parity = UART_PARITY_ODD;
+            break;
+
+        case MB_PAR_EVEN:
+            huart.Init.Parity = UART_PARITY_EVEN;
+            break;
+
+        default:
+            return FALSE;
+    }
+    huart.Init.Mode = UART_MODE_TX_RX;
+    huart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
+    huart.Init.OverSampling = UART_OVERSAMPLING_16;
+    /* open serial device */
+    if (HAL_UART_Init(&huart) != HAL_OK)
+    {
+        Error_Handler();
+        return FALSE;
+    }
+    return TRUE;
+}
+
+void vMBPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable)
+{
+    if (xRxEnable)
+    {
+        /* switch 485 to receive mode */
+        RS485_SLAVE_RX_MODE();
+        __HAL_UART_ENABLE_IT(&huart,UART_IT_RXNE);
+    }
+    else
+    {
+        /* switch 485 to transmit mode */
+        RS485_SLAVE_TX_MODE();
+        __HAL_UART_DISABLE_IT(&huart,UART_IT_RXNE);
+    }
+    if (xTxEnable)
+    {
+        __HAL_UART_ENABLE_IT(&huart,UART_IT_TXE);
+    }
+    else
+    {
+        __HAL_UART_DISABLE_IT(&huart,UART_IT_TXE);
+    }
+
+}
+
+void vMBPortClose(void)
+{
+	HAL_UART_AbortReceive_IT(&huart);
+	HAL_UART_AbortTransmit_IT(&huart);
+}
+
+BOOL xMBPortSerialPutByte(CHAR ucByte)
+{
+    if(HAL_UART_Transmit (&huart ,(uint8_t *)&ucByte,1,0x01) != HAL_OK )
+        return FALSE ;
+    else
+        return TRUE;
+}
+
+/*
+ * A Function to send all bytes in one call.
+ */
+BOOL xMBPortSerialPutBytes(volatile UCHAR *ucByte, USHORT usSize)
+{
+    if(HAL_UART_Transmit (&huart ,(uint8_t *)&ucByte,usSize,1000) != HAL_OK )
+        return FALSE ;
+    else
+        return TRUE;
+}
+
+BOOL xMBPortSerialGetByte(CHAR * pucByte)
+{
+//    *pucByte = rx_buff[rx_index++];
+//
+//    return TRUE;
+    if(HAL_UART_Receive (&huart ,(uint8_t *)pucByte,1,0x01) != HAL_OK )
+        return FALSE ;
+    else
+        return TRUE;
+}
+
+/*
+ * Create an interrupt handler for the transmit buffer empty interrupt
+ * (or an equivalent) for your target processor. This function should then
+ * call pxMBFrameCBTransmitterEmpty( ) which tells the protocol stack that
+ * a new character can be sent. The protocol stack will then call
+ * xMBPortSerialPutByte( ) to send the character.
+ */
+void prvvUARTTxReadyISR(void)
+{
+    pxMBFrameCBTransmitterEmpty();
+}
+
+/*
+ * Create an interrupt handler for the receive interrupt for your target
+ * processor. This function should then call pxMBFrameCBByteReceived( ). The
+ * protocol stack will then call xMBPortSerialGetByte( ) to retrieve the
+ * character.
+ *
+ * quanghona: This function is called when IDLE is detected. thus will then
+ * trigger the received message handler.
+ */
+void prvvUARTRxISR(void)
+{
+    //osEventFlagsSet(xSerialEventHandle, EVENT_MBSLAVE_HANDLE_RECEIVED_DATA);
+    pxMBFrameCBByteReceived(  );
+}
+
+/*
+ * Create an interrupt handler for the receive character for your target processor.
+ * This function should store data to a buffer for received message thread to
+ * handle later.
+ */
+void prvvUARTRxReceiveCharISR(CHAR data)
+{
+    rx_buff[put_index++] = data;
+}
+
+/*
+ * A thread to handle the received message.
+ * This thread is wait until a received message flag is set, then it will call
+ * pxMBFrameCBByteReceived() until all characters in the receive buffer is handled.
+ */
+static void handleReceivedDataTask(void *argument)
+{
+    while (1)
+    {
+        osEventFlagsWait(xSerialEventHandle, EVENT_MBSLAVE_HANDLE_RECEIVED_DATA, osFlagsWaitAny, osWaitForever);
+        while (put_index > 0) {
+            pxMBFrameCBByteReceived();
+            put_index--;
+        }
+    }
+}

+ 79 - 0
Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/porttimer.c

@@ -0,0 +1,79 @@
+/*
+ * FreeModbus Libary: CMSIS-RTOS2 Port
+ * Copyright (C) 2013 Armink <armink.ztl@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * File: $Id: porttimer.c,v 1.60 2013/08/13 15:07:05 Armink $
+ *            porttimer.c,v 1.60 2022/07/17          quanghona <lyhonquang@gmail.com> CMSIS-RTOS2 port $
+ */
+
+/* ----------------------- Platform includes --------------------------------*/
+#include "port.h"
+#include "cmsis_os2.h"
+
+/* ----------------------- Modbus includes ----------------------------------*/
+#include "mb.h"
+#include "mbport.h"
+#include "FreeRTOS.h"
+#include "timers.h"
+#include "tim.h"
+// 使用软定时器
+// #define  USE_SOFT_TIMER
+
+/* ----------------------- static functions ---------------------------------*/
+static TimerHandle_t xTimerId;
+static uint32_t ulTimeout;
+
+void prvvTIMERExpiredISR();
+
+
+/* ----------------------- Start implementation -----------------------------*/
+BOOL xMBPortTimersInit(USHORT usTim1Timerout50us) {
+#ifdef USE_SOFT_TIMER
+    ulTimeout = 50 * usTim1Timerout50us * osKernelGetTickFreq() / 1000000 + 1;
+    xTimerId = osTimerNew(prvvTIMERExpiredISR, osTimerOnce, NULL, NULL);
+    return xTimerId != NULL;
+#else
+    return TRUE;
+#endif
+}
+
+void vMBPortTimersEnable() {
+#ifdef USE_SOFT_TIMER
+    osTimerStart(xTimerId, ulTimeout);
+#else
+    __HAL_TIM_CLEAR_IT(&htim2,TIM_IT_UPDATE);
+    __HAL_TIM_ENABLE_IT(&htim2,TIM_IT_UPDATE);
+    __HAL_TIM_SET_COUNTER(&htim2,0);
+    __HAL_TIM_ENABLE(&htim2);
+#endif
+}
+
+void vMBPortTimersDisable() {
+#ifdef USE_SOFT_TIMER
+
+    osTimerStop(xTimerId);
+#else
+    __HAL_TIM_DISABLE(&htim2);
+__HAL_TIM_SET_COUNTER(&htim2, 0);
+__HAL_TIM_DISABLE_IT(&htim2, TIM_IT_UPDATE);
+__HAL_TIM_CLEAR_IT(&htim2, TIM_IT_UPDATE);
+#endif
+}
+
+void prvvTIMERExpiredISR() {
+    (void) pxMBPortCBTimerExpired();
+}

+ 69 - 0
Middlewares/Third_Party/FreeModbus/port/port.h

@@ -0,0 +1,69 @@
+/*
+ * FreeModbus Libary: BARE Port
+ * Copyright (C) 2013 Armink <armink.ztl@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * File: $Id: port.h ,v 1.60 2013/08/13 15:07:05 Armink add Master Functions $
+ *            port.h ,v 1.60 2022/07/17          quanghona <lyhonquang@gmail.com> CMSIS-RTOS2 port $
+ */
+
+#ifndef _PORT_H
+#define _PORT_H
+
+#include "mbconfig.h"
+
+#include <assert.h>
+#include <inttypes.h>
+#include "main.h"
+
+#define INLINE
+#define PR_BEGIN_EXTERN_C           extern "C" {
+#define PR_END_EXTERN_C             }
+
+#define ENTER_CRITICAL_SECTION()    EnterCriticalSection()
+#define EXIT_CRITICAL_SECTION()    ExitCriticalSection()
+
+typedef uint8_t BOOL;
+
+typedef unsigned char UCHAR;
+typedef char    CHAR;
+
+typedef uint16_t USHORT;
+typedef int16_t SHORT;
+
+typedef uint32_t ULONG;
+typedef int32_t LONG;
+
+#ifndef TRUE
+#define TRUE            1
+#endif
+
+#ifndef FALSE
+#define FALSE           0
+#endif
+
+void EnterCriticalSection(void);
+void ExitCriticalSection(void);
+
+void prvvMBMasterUARTTxReadyISR(void);
+void prvvMBMasterUARTRxISR(void);
+void prvvMBMasterUARTRxReceiveCharISR(CHAR data);
+
+void prvvUARTTxReadyISR(void);
+void prvvUARTRxISR(void);
+void prvvUARTRxReceiveCharISR(CHAR data);
+
+#endif

+ 285 - 0
Middlewares/Third_Party/FreeModbus/port/user_mb_app.c

@@ -0,0 +1,285 @@
+///*
+// * FreeModbus Libary: user callback functions and buffer define in slave mode
+// * Copyright (C) 2013 Armink <armink.ztl@gmail.com>
+// *
+// * This library is free software; you can redistribute it and/or
+// * modify it under the terms of the GNU Lesser General Public
+// * License as published by the Free Software Foundation; either
+// * version 2.1 of the License, or (at your option) any later version.
+// *
+// * This library is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// * Lesser General Public License for more details.
+// *
+// * You should have received a copy of the GNU Lesser General Public
+// * License along with this library; if not, write to the Free Software
+// * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+// *
+// * File: $Id: user_mb_app.c,v 1.60 2013/11/23 11:49:05 Armink $
+// */
+//#include "user_mb_app.h"
+//
+///*------------------------Slave mode use these variables----------------------*/
+////Slave mode:DiscreteInputs variables
+////USHORT   usSDiscInStart                               = S_DISCRETE_INPUT_START;
+////#if S_DISCRETE_INPUT_NDISCRETES%8
+////UCHAR    ucSDiscInBuf[S_DISCRETE_INPUT_NDISCRETES/8+1];
+////#else
+////UCHAR    ucSDiscInBuf[S_DISCRETE_INPUT_NDISCRETES/8]  ;
+////#endif
+//////Slave mode:Coils variables
+////USHORT   usSCoilStart                                 = S_COIL_START;
+////#if S_COIL_NCOILS%8
+////UCHAR    ucSCoilBuf[S_COIL_NCOILS/8+1]                ;
+////#else
+////UCHAR    ucSCoilBuf[S_COIL_NCOILS/8]                  ;
+////#endif
+//////Slave mode:InputRegister variables
+////USHORT   usSRegInStart                                = S_REG_INPUT_START;
+////USHORT   usSRegInBuf[S_REG_INPUT_NREGS]               ;
+//////Slave mode:HoldingRegister variables
+//USHORT   usSRegHoldStart                              = S_REG_HOLDING_START;
+//USHORT   usSRegHoldBuf[S_REG_HOLDING_NREGS]           ;
+//
+///**
+// * Modbus slave input register callback function.
+// *
+// * @param pucRegBuffer input register buffer
+// * @param usAddress input register address
+// * @param usNRegs input register number
+// *
+// * @return result
+// */
+//eMBErrorCode eMBRegInputCB(UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs )
+//{
+//    eMBErrorCode    eStatus = MB_ENOERR;
+////    USHORT          iRegIndex;
+////    USHORT *        pusRegInputBuf;
+////    USHORT          REG_INPUT_START;
+////    USHORT          REG_INPUT_NREGS;
+////    USHORT          usRegInStart;
+////
+////    pusRegInputBuf = usSRegInBuf;
+////    REG_INPUT_START = S_REG_INPUT_START;
+////    REG_INPUT_NREGS = S_REG_INPUT_NREGS;
+////    usRegInStart = usSRegInStart;
+////
+////    /* it already plus one in modbus function method. */
+////    usAddress--;
+////
+////    if ((usAddress >= REG_INPUT_START)
+////            && (usAddress + usNRegs <= REG_INPUT_START + REG_INPUT_NREGS))
+////    {
+////        iRegIndex = usAddress - usRegInStart;
+////        while (usNRegs > 0)
+////        {
+////            *pucRegBuffer++ = (UCHAR) (pusRegInputBuf[iRegIndex] >> 8);
+////            *pucRegBuffer++ = (UCHAR) (pusRegInputBuf[iRegIndex] & 0xFF);
+////            iRegIndex++;
+////            usNRegs--;
+////        }
+////    }
+////    else
+////    {
+////        eStatus = MB_ENOREG;
+////    }
+//
+//    return eStatus;
+//}
+//
+///**
+// * Modbus slave holding register callback function.
+// *
+// * @param pucRegBuffer holding register buffer
+// * @param usAddress holding register address
+// * @param usNRegs holding register number
+// * @param eMode read or write
+// *
+// * @return result
+// */
+//eMBErrorCode eMBRegHoldingCB(UCHAR * pucRegBuffer, USHORT usAddress,
+//        USHORT usNRegs, eMBRegisterMode eMode)
+//{
+//    eMBErrorCode    eStatus = MB_ENOERR;
+//    USHORT          iRegIndex;
+//    USHORT *        pusRegHoldingBuf;
+//    USHORT          REG_HOLDING_START;
+//    USHORT          REG_HOLDING_NREGS;
+//    USHORT          usRegHoldStart;
+//    pusRegHoldingBuf = usSRegHoldBuf;
+//    REG_HOLDING_START = S_REG_HOLDING_START;
+//    REG_HOLDING_NREGS = S_REG_HOLDING_NREGS;
+//    usRegHoldStart = usSRegHoldStart;
+//
+//    /* it already plus one in modbus function method. */
+//    usAddress--;
+//
+//    if ((usAddress >= REG_HOLDING_START)
+//            && (usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS))
+//    {
+//        iRegIndex = usAddress - usRegHoldStart;
+//        switch (eMode)
+//        {
+//        /* read current register values from the protocol stack. */
+//        case MB_REG_READ:
+//            while (usNRegs > 0)
+//            {
+//                *pucRegBuffer++ = (UCHAR) (pusRegHoldingBuf[iRegIndex] >> 8);
+//                *pucRegBuffer++ = (UCHAR) (pusRegHoldingBuf[iRegIndex] & 0xFF);
+//                iRegIndex++;
+//                usNRegs--;
+//            }
+//            break;
+//
+//        /* write current register values with new values from the protocol stack. */
+//        case MB_REG_WRITE:
+//            while (usNRegs > 0)
+//            {
+//                pusRegHoldingBuf[iRegIndex] = *pucRegBuffer++ << 8;
+//                pusRegHoldingBuf[iRegIndex] |= *pucRegBuffer++;
+//                iRegIndex++;
+//                usNRegs--;
+//            }
+//            break;
+//        }
+//    }
+//    else
+//    {
+//        eStatus = MB_ENOREG;
+//    }
+//    return eStatus;
+//}
+//
+///**
+// * Modbus slave coils callback function.
+// *
+// * @param pucRegBuffer coils buffer
+// * @param usAddress coils address
+// * @param usNCoils coils number
+// * @param eMode read or write
+// *
+// * @return result
+// */
+//eMBErrorCode eMBRegCoilsCB(UCHAR * pucRegBuffer, USHORT usAddress,
+//        USHORT usNCoils, eMBRegisterMode eMode)
+//{
+//    eMBErrorCode    eStatus = MB_ENOERR;
+////    USHORT          iRegIndex , iRegBitIndex , iNReg;
+////    UCHAR *         pucCoilBuf;
+////    USHORT          COIL_START;
+////    USHORT          COIL_NCOILS;
+////    USHORT          usCoilStart;
+////    iNReg =  usNCoils / 8 + 1;
+////
+////    pucCoilBuf = ucSCoilBuf;
+////    COIL_START = S_COIL_START;
+////    COIL_NCOILS = S_COIL_NCOILS;
+////    usCoilStart = usSCoilStart;
+////
+////    /* it already plus one in modbus function method. */
+////    usAddress--;
+////
+////    if( ( usAddress >= COIL_START ) &&
+////        ( usAddress + usNCoils <= COIL_START + COIL_NCOILS ) )
+////    {
+////        iRegIndex = (USHORT) (usAddress - usCoilStart) / 8;
+////        iRegBitIndex = (USHORT) (usAddress - usCoilStart) % 8;
+////        switch ( eMode )
+////        {
+////        /* read current coil values from the protocol stack. */
+////        case MB_REG_READ:
+////            while (iNReg > 0)
+////            {
+////                *pucRegBuffer++ = xMBUtilGetBits(&pucCoilBuf[iRegIndex++],
+////                        iRegBitIndex, 8);
+////                iNReg--;
+////            }
+////            pucRegBuffer--;
+////            /* last coils */
+////            usNCoils = usNCoils % 8;
+////            /* filling zero to high bit */
+////            *pucRegBuffer = *pucRegBuffer << (8 - usNCoils);
+////            *pucRegBuffer = *pucRegBuffer >> (8 - usNCoils);
+////            break;
+////
+////            /* write current coil values with new values from the protocol stack. */
+////        case MB_REG_WRITE:
+////            while (iNReg > 1)
+////            {
+////                xMBUtilSetBits(&pucCoilBuf[iRegIndex++], iRegBitIndex, 8,
+////                        *pucRegBuffer++);
+////                iNReg--;
+////            }
+////            /* last coils */
+////            usNCoils = usNCoils % 8;
+////            /* xMBUtilSetBits has bug when ucNBits is zero */
+////            if (usNCoils != 0)
+////            {
+////                xMBUtilSetBits(&pucCoilBuf[iRegIndex++], iRegBitIndex, usNCoils,
+////                        *pucRegBuffer++);
+////            }
+////            break;
+////        }
+////    }
+////    else
+////    {
+////        eStatus = MB_ENOREG;
+////    }
+//    return eStatus;
+//}
+//
+///**
+// * Modbus slave discrete callback function.
+// *
+// * @param pucRegBuffer discrete buffer
+// * @param usAddress discrete address
+// * @param usNDiscrete discrete number
+// *
+// * @return result
+// */
+//eMBErrorCode eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscrete )
+//{
+//    eMBErrorCode    eStatus = MB_ENOERR;
+////    USHORT          iRegIndex , iRegBitIndex , iNReg;
+////    UCHAR *         pucDiscreteInputBuf;
+////    USHORT          DISCRETE_INPUT_START;
+////    USHORT          DISCRETE_INPUT_NDISCRETES;
+////    USHORT          usDiscreteInputStart;
+////    iNReg =  usNDiscrete / 8 + 1;
+////
+////    pucDiscreteInputBuf = ucSDiscInBuf;
+////    DISCRETE_INPUT_START = S_DISCRETE_INPUT_START;
+////    DISCRETE_INPUT_NDISCRETES = S_DISCRETE_INPUT_NDISCRETES;
+////    usDiscreteInputStart = usSDiscInStart;
+////
+////    /* it already plus one in modbus function method. */
+////    usAddress--;
+////
+////    if ((usAddress >= DISCRETE_INPUT_START)
+////            && (usAddress + usNDiscrete    <= DISCRETE_INPUT_START + DISCRETE_INPUT_NDISCRETES))
+////    {
+////        iRegIndex = (USHORT) (usAddress - usDiscreteInputStart) / 8;
+////        iRegBitIndex = (USHORT) (usAddress - usDiscreteInputStart) % 8;
+////
+////        while (iNReg > 0)
+////        {
+////            *pucRegBuffer++ = xMBUtilGetBits(&pucDiscreteInputBuf[iRegIndex++],
+////                    iRegBitIndex, 8);
+////            iNReg--;
+////        }
+////        pucRegBuffer--;
+////        /* last discrete */
+////        usNDiscrete = usNDiscrete % 8;
+////        /* filling zero to high bit */
+////        *pucRegBuffer = *pucRegBuffer << (8 - usNDiscrete);
+////        *pucRegBuffer = *pucRegBuffer >> (8 - usNDiscrete);
+////    }
+////    else
+////    {
+////        eStatus = MB_ENOREG;
+////    }
+//
+//    return eStatus;
+//}
+//

+ 48 - 0
Middlewares/Third_Party/FreeModbus/port/user_mb_app.h

@@ -0,0 +1,48 @@
+//#ifndef    USER_APP
+//#define USER_APP
+///* ----------------------- Modbus includes ----------------------------------*/
+//#include "mb.h"
+//#include "mb_m.h"
+//#include "mbconfig.h"
+//#include "mbframe.h"
+//#include "mbutils.h"
+//
+///* -----------------------Slave Defines -------------------------------------*/
+//#define S_DISCRETE_INPUT_START        0
+//#define S_DISCRETE_INPUT_NDISCRETES   16
+//#define S_COIL_START                  0
+//#define S_COIL_NCOILS                 64
+//#define S_REG_INPUT_START             0
+//#define S_REG_INPUT_NREGS             100
+//#define S_REG_HOLDING_START           0
+//#define S_REG_HOLDING_NREGS           10
+///* salve mode: holding register's all address */
+//#define          S_HD_RESERVE                     0
+//#define          S_HD_CPU_USAGE_MAJOR             1
+//#define          S_HD_CPU_USAGE_MINOR             2
+///* salve mode: input register's all address */
+//#define          S_IN_RESERVE                     0
+///* salve mode: coil's all address */
+//#define          S_CO_RESERVE                     0
+///* salve mode: discrete's all address */
+//#define          S_DI_RESERVE                     0
+//
+///* -----------------------Master Defines -------------------------------------*/
+//#define M_DISCRETE_INPUT_START        0
+//#define M_DISCRETE_INPUT_NDISCRETES   16
+//#define M_COIL_START                  0
+//#define M_COIL_NCOILS                 64
+//#define M_REG_INPUT_START             0
+//#define M_REG_INPUT_NREGS             100
+//#define M_REG_HOLDING_START           0
+//#define M_REG_HOLDING_NREGS           100
+///* master mode: holding register's all address */
+//#define          M_HD_RESERVE                     0
+///* master mode: input register's all address */
+//#define          M_IN_RESERVE                     0
+///* master mode: coil's all address */
+//#define          M_CO_RESERVE                     0
+///* master mode: discrete's all address */
+//#define          M_DI_RESERVE                     0
+//
+//#endif

+ 0 - 1207
cmake-build-debug-mingw/.cmake/api/v1/reply/cache-v2-c2d184a70121e4b5cc51.json

@@ -1,1207 +0,0 @@
-{
-	"entries" : 
-	[
-		{
-			"name" : "CMAKE_ADDR2LINE",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to a program."
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-addr2line.exe"
-		},
-		{
-			"name" : "CMAKE_ASM_COMPILER_AR",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler"
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-gcc-ar.exe"
-		},
-		{
-			"name" : "CMAKE_ASM_COMPILER_RANLIB",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler"
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-gcc-ranlib.exe"
-		},
-		{
-			"name" : "CMAKE_ASM_COMPILER_WORKS",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : ""
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "1"
-		},
-		{
-			"name" : "CMAKE_ASM_FLAGS",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the ASM compiler during all build types."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_ASM_FLAGS_DEBUG",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the ASM compiler during DEBUG builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-g"
-		},
-		{
-			"name" : "CMAKE_ASM_FLAGS_MINSIZEREL",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the ASM compiler during MINSIZEREL builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-Os -DNDEBUG"
-		},
-		{
-			"name" : "CMAKE_ASM_FLAGS_RELEASE",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the ASM compiler during RELEASE builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-O3 -DNDEBUG"
-		},
-		{
-			"name" : "CMAKE_ASM_FLAGS_RELWITHDEBINFO",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the ASM compiler during RELWITHDEBINFO builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-O2 -g -DNDEBUG"
-		},
-		{
-			"name" : "CMAKE_BUILD_TYPE",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ..."
-				}
-			],
-			"type" : "STRING",
-			"value" : "Debug"
-		},
-		{
-			"name" : "CMAKE_CACHEFILE_DIR",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "This is the directory where this CMakeCache.txt was created"
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "c:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw"
-		},
-		{
-			"name" : "CMAKE_CACHE_MAJOR_VERSION",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Major version of cmake used to create the current loaded cache"
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "3"
-		},
-		{
-			"name" : "CMAKE_CACHE_MINOR_VERSION",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Minor version of cmake used to create the current loaded cache"
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "28"
-		},
-		{
-			"name" : "CMAKE_CACHE_PATCH_VERSION",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Patch version of cmake used to create the current loaded cache"
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "1"
-		},
-		{
-			"name" : "CMAKE_COLOR_DIAGNOSTICS",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Enable colored diagnostics throughout."
-				}
-			],
-			"type" : "BOOL",
-			"value" : "ON"
-		},
-		{
-			"name" : "CMAKE_COMMAND",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to CMake executable."
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/bin/cmake.exe"
-		},
-		{
-			"name" : "CMAKE_CPACK_COMMAND",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to cpack program executable."
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/bin/cpack.exe"
-		},
-		{
-			"name" : "CMAKE_CTEST_COMMAND",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to ctest program executable."
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/bin/ctest.exe"
-		},
-		{
-			"name" : "CMAKE_CXX_COMPILER_AR",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler"
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-gcc-ar.exe"
-		},
-		{
-			"name" : "CMAKE_CXX_COMPILER_RANLIB",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler"
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-gcc-ranlib.exe"
-		},
-		{
-			"name" : "CMAKE_CXX_FLAGS",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the CXX compiler during all build types."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_CXX_FLAGS_DEBUG",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the CXX compiler during DEBUG builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-g"
-		},
-		{
-			"name" : "CMAKE_CXX_FLAGS_MINSIZEREL",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the CXX compiler during MINSIZEREL builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-Os -DNDEBUG"
-		},
-		{
-			"name" : "CMAKE_CXX_FLAGS_RELEASE",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the CXX compiler during RELEASE builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-O3 -DNDEBUG"
-		},
-		{
-			"name" : "CMAKE_CXX_FLAGS_RELWITHDEBINFO",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the CXX compiler during RELWITHDEBINFO builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-O2 -g -DNDEBUG"
-		},
-		{
-			"name" : "CMAKE_C_COMPILER_AR",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler"
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-gcc-ar.exe"
-		},
-		{
-			"name" : "CMAKE_C_COMPILER_RANLIB",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler"
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-gcc-ranlib.exe"
-		},
-		{
-			"name" : "CMAKE_C_FLAGS",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the C compiler during all build types."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_C_FLAGS_DEBUG",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the C compiler during DEBUG builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-g"
-		},
-		{
-			"name" : "CMAKE_C_FLAGS_MINSIZEREL",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the C compiler during MINSIZEREL builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-Os -DNDEBUG"
-		},
-		{
-			"name" : "CMAKE_C_FLAGS_RELEASE",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the C compiler during RELEASE builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-O3 -DNDEBUG"
-		},
-		{
-			"name" : "CMAKE_C_FLAGS_RELWITHDEBINFO",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the C compiler during RELWITHDEBINFO builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : "-O2 -g -DNDEBUG"
-		},
-		{
-			"name" : "CMAKE_DLLTOOL",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to a program."
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/mingGW/bin/dlltool.exe"
-		},
-		{
-			"name" : "CMAKE_EXECUTABLE_FORMAT",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Executable file format"
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "ELF"
-		},
-		{
-			"name" : "CMAKE_EXE_LINKER_FLAGS",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during all build types."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_EXE_LINKER_FLAGS_DEBUG",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during DEBUG builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_EXE_LINKER_FLAGS_MINSIZEREL",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during MINSIZEREL builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_EXE_LINKER_FLAGS_RELEASE",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during RELEASE builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during RELWITHDEBINFO builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_EXPORT_COMPILE_COMMANDS",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Enable/Disable output of compile commands during generation."
-				}
-			],
-			"type" : "BOOL",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_EXTRA_GENERATOR",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Name of external makefile project generator."
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_FIND_PACKAGE_REDIRECTS_DIR",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Value Computed by CMake."
-				}
-			],
-			"type" : "STATIC",
-			"value" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/pkgRedirects"
-		},
-		{
-			"name" : "CMAKE_GENERATOR",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Name of generator."
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "Ninja"
-		},
-		{
-			"name" : "CMAKE_GENERATOR_INSTANCE",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Generator instance identifier."
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_GENERATOR_PLATFORM",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Name of generator platform."
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_GENERATOR_TOOLSET",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Name of generator toolset."
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_HOME_DIRECTORY",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Source directory with the top level CMakeLists.txt file for this project"
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "C:/Users/DELL/CLionProjects/gmv-gateway-board"
-		},
-		{
-			"name" : "CMAKE_INSTALL_PREFIX",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Install path prefix, prepended onto install directories."
-				}
-			],
-			"type" : "PATH",
-			"value" : "C:/Program Files (x86)/gmv-gateway-board"
-		},
-		{
-			"name" : "CMAKE_LINKER",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to a program."
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-ld.exe"
-		},
-		{
-			"name" : "CMAKE_MAKE_PROGRAM",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "make program"
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe"
-		},
-		{
-			"name" : "CMAKE_MODULE_LINKER_FLAGS",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of modules during all build types."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_MODULE_LINKER_FLAGS_DEBUG",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of modules during DEBUG builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of modules during MINSIZEREL builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_MODULE_LINKER_FLAGS_RELEASE",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of modules during RELEASE builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of modules during RELWITHDEBINFO builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_NM",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to a program."
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-nm.exe"
-		},
-		{
-			"name" : "CMAKE_NUMBER_OF_MAKEFILES",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "number of local generators"
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "1"
-		},
-		{
-			"name" : "CMAKE_PLATFORM_INFO_INITIALIZED",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Platform information initialized"
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "1"
-		},
-		{
-			"name" : "CMAKE_PROJECT_DESCRIPTION",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Value Computed by CMake"
-				}
-			],
-			"type" : "STATIC",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_PROJECT_HOMEPAGE_URL",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Value Computed by CMake"
-				}
-			],
-			"type" : "STATIC",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_PROJECT_NAME",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Value Computed by CMake"
-				}
-			],
-			"type" : "STATIC",
-			"value" : "gmv-gateway-board"
-		},
-		{
-			"name" : "CMAKE_RANLIB",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to a program."
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-ranlib.exe"
-		},
-		{
-			"name" : "CMAKE_READELF",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to a program."
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-readelf.exe"
-		},
-		{
-			"name" : "CMAKE_ROOT",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to CMake installation."
-				}
-			],
-			"type" : "INTERNAL",
-			"value" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28"
-		},
-		{
-			"name" : "CMAKE_SHARED_LINKER_FLAGS",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of shared libraries during all build types."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_SHARED_LINKER_FLAGS_DEBUG",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of shared libraries during DEBUG builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of shared libraries during MINSIZEREL builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_SHARED_LINKER_FLAGS_RELEASE",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of shared libraries during RELEASE builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of shared libraries during RELWITHDEBINFO builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_SKIP_INSTALL_RPATH",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "If set, runtime paths are not added when installing shared libraries, but are added when building."
-				}
-			],
-			"type" : "BOOL",
-			"value" : "NO"
-		},
-		{
-			"name" : "CMAKE_SKIP_RPATH",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "If set, runtime paths are not added when using shared libraries."
-				}
-			],
-			"type" : "BOOL",
-			"value" : "NO"
-		},
-		{
-			"name" : "CMAKE_STATIC_LINKER_FLAGS",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of static libraries during all build types."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_STATIC_LINKER_FLAGS_DEBUG",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of static libraries during DEBUG builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of static libraries during MINSIZEREL builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_STATIC_LINKER_FLAGS_RELEASE",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of static libraries during RELEASE builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Flags used by the linker during the creation of static libraries during RELWITHDEBINFO builds."
-				}
-			],
-			"type" : "STRING",
-			"value" : ""
-		},
-		{
-			"name" : "CMAKE_STRIP",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to a program."
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "D:/clion/10.2021.10/bin/arm-none-eabi-strip.exe"
-		},
-		{
-			"name" : "CMAKE_TAPI",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "Path to a program."
-				}
-			],
-			"type" : "FILEPATH",
-			"value" : "CMAKE_TAPI-NOTFOUND"
-		},
-		{
-			"name" : "CMAKE_VERBOSE_MAKEFILE",
-			"properties" : 
-			[
-				{
-					"name" : "ADVANCED",
-					"value" : "1"
-				},
-				{
-					"name" : "HELPSTRING",
-					"value" : "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make.  This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo."
-				}
-			],
-			"type" : "BOOL",
-			"value" : "FALSE"
-		},
-		{
-			"name" : "gmv-gateway-board_BINARY_DIR",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Value Computed by CMake"
-				}
-			],
-			"type" : "STATIC",
-			"value" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw"
-		},
-		{
-			"name" : "gmv-gateway-board_IS_TOP_LEVEL",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Value Computed by CMake"
-				}
-			],
-			"type" : "STATIC",
-			"value" : "ON"
-		},
-		{
-			"name" : "gmv-gateway-board_SOURCE_DIR",
-			"properties" : 
-			[
-				{
-					"name" : "HELPSTRING",
-					"value" : "Value Computed by CMake"
-				}
-			],
-			"type" : "STATIC",
-			"value" : "C:/Users/DELL/CLionProjects/gmv-gateway-board"
-		}
-	],
-	"kind" : "cache",
-	"version" : 
-	{
-		"major" : 2,
-		"minor" : 0
-	}
-}

+ 0 - 1238
cmake-build-debug-mingw/.cmake/api/v1/reply/cmakeFiles-v1-27eb94a99a8aa9ca0fc1.json

@@ -1,1238 +0,0 @@
-{
-	"inputs" : 
-	[
-		{
-			"path" : "CMakeLists.txt"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineSystem.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystem.cmake.in"
-		},
-		{
-			"isGenerated" : true,
-			"path" : "cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeSystem.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystemSpecificInitialize.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCompilerIdDetection.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ADSP-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ARMCC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ARMClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/AppleClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Borland-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Bruce-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Compaq-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Cray-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/CrayClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Embarcadero-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Fujitsu-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GHS-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/HP-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IAR-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Intel-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/LCC-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/MSVC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/NVHPC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/NVIDIA-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/OrangeC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/PGI-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/PathScale-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/SCO-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/SDCC-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/SunPro-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/TI-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Tasking-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Watcom-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/XL-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/XLClang-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/zOS-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ADSP-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ARMCC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ARMClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/AppleClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Borland-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Bruce-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Compaq-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Cray-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/CrayClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Embarcadero-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Fujitsu-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GHS-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/HP-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IAR-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Intel-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/LCC-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/MSVC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/NVHPC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/NVIDIA-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/OrangeC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/PGI-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/PathScale-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/SCO-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/SDCC-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/SunPro-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/TI-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Tasking-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Watcom-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/XL-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/XLClang-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/zOS-C-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-FindBinUtils.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompiler.cmake.in"
-		},
-		{
-			"isGenerated" : true,
-			"path" : "cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeCCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCXXCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCompilerIdDetection.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ADSP-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ARMCC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ARMClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/AppleClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Borland-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Cray-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/CrayClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Embarcadero-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Fujitsu-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GHS-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/HP-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IAR-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Intel-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/MSVC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/NVHPC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/NVIDIA-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/OrangeC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/PGI-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/PathScale-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/SCO-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/TI-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Tasking-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Watcom-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/XL-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ADSP-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ARMCC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/ARMClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/AppleClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Borland-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Cray-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/CrayClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Embarcadero-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Fujitsu-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GHS-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/HP-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IAR-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Intel-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/MSVC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/NVHPC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/NVIDIA-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/OrangeC-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/PGI-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/PathScale-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/SCO-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/TI-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Tasking-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/Watcom-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/XL-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-FindBinUtils.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompiler.cmake.in"
-		},
-		{
-			"isGenerated" : true,
-			"path" : "cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeCXXCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineASMCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCompilerIdDetection.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-FindBinUtils.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeASMCompiler.cmake.in"
-		},
-		{
-			"isGenerated" : true,
-			"path" : "cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeASMCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeSystemSpecificInformation.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeGenericSystem.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeInitializeConfigs.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Generic.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCInformation.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-C.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Generic.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeTestCompilerCommon.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeParseImplicitIncludeInfo.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeParseImplicitLinkInfo.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeParseLibraryArchitecture.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeTestCompilerCommon.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompilerABI.c"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCompileFeatures.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Internal/FeatureTesting.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompiler.cmake.in"
-		},
-		{
-			"isGenerated" : true,
-			"path" : "cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeCCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXInformation.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-CXX.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Platform/Generic.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeTestCompilerCommon.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeParseImplicitIncludeInfo.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeParseImplicitLinkInfo.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeParseLibraryArchitecture.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeTestCompilerCommon.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeDetermineCompileFeatures.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Internal/FeatureTesting.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompiler.cmake.in"
-		},
-		{
-			"isGenerated" : true,
-			"path" : "cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeCXXCompiler.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeASMInformation.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU-ASM.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/Compiler/GNU.cmake"
-		},
-		{
-			"isCMake" : true,
-			"isExternal" : true,
-			"path" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeTestASMCompiler.cmake"
-		}
-	],
-	"kind" : "cmakeFiles",
-	"paths" : 
-	{
-		"build" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw",
-		"source" : "C:/Users/DELL/CLionProjects/gmv-gateway-board"
-	},
-	"version" : 
-	{
-		"major" : 1,
-		"minor" : 0
-	}
-}

+ 0 - 60
cmake-build-debug-mingw/.cmake/api/v1/reply/codemodel-v2-6b33da970254852e2625.json

@@ -1,60 +0,0 @@
-{
-	"configurations" : 
-	[
-		{
-			"directories" : 
-			[
-				{
-					"build" : ".",
-					"jsonFile" : "directory-.-Debug-d0094a50bb2071803777.json",
-					"minimumCMakeVersion" : 
-					{
-						"string" : "3.28"
-					},
-					"projectIndex" : 0,
-					"source" : ".",
-					"targetIndexes" : 
-					[
-						0
-					]
-				}
-			],
-			"name" : "Debug",
-			"projects" : 
-			[
-				{
-					"directoryIndexes" : 
-					[
-						0
-					],
-					"name" : "gmv-gateway-board",
-					"targetIndexes" : 
-					[
-						0
-					]
-				}
-			],
-			"targets" : 
-			[
-				{
-					"directoryIndex" : 0,
-					"id" : "gmv-gateway-board.elf::@6890427a1f51a3e7e1df",
-					"jsonFile" : "target-gmv-gateway-board.elf-Debug-326a890ddc764dc957b2.json",
-					"name" : "gmv-gateway-board.elf",
-					"projectIndex" : 0
-				}
-			]
-		}
-	],
-	"kind" : "codemodel",
-	"paths" : 
-	{
-		"build" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw",
-		"source" : "C:/Users/DELL/CLionProjects/gmv-gateway-board"
-	},
-	"version" : 
-	{
-		"major" : 2,
-		"minor" : 6
-	}
-}

+ 0 - 108
cmake-build-debug-mingw/.cmake/api/v1/reply/index-2024-10-17T10-08-27-0165.json

@@ -1,108 +0,0 @@
-{
-	"cmake" : 
-	{
-		"generator" : 
-		{
-			"multiConfig" : false,
-			"name" : "Ninja"
-		},
-		"paths" : 
-		{
-			"cmake" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/bin/cmake.exe",
-			"cpack" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/bin/cpack.exe",
-			"ctest" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/bin/ctest.exe",
-			"root" : "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28"
-		},
-		"version" : 
-		{
-			"isDirty" : false,
-			"major" : 3,
-			"minor" : 28,
-			"patch" : 1,
-			"string" : "3.28.1",
-			"suffix" : ""
-		}
-	},
-	"objects" : 
-	[
-		{
-			"jsonFile" : "codemodel-v2-6b33da970254852e2625.json",
-			"kind" : "codemodel",
-			"version" : 
-			{
-				"major" : 2,
-				"minor" : 6
-			}
-		},
-		{
-			"jsonFile" : "cache-v2-c2d184a70121e4b5cc51.json",
-			"kind" : "cache",
-			"version" : 
-			{
-				"major" : 2,
-				"minor" : 0
-			}
-		},
-		{
-			"jsonFile" : "cmakeFiles-v1-27eb94a99a8aa9ca0fc1.json",
-			"kind" : "cmakeFiles",
-			"version" : 
-			{
-				"major" : 1,
-				"minor" : 0
-			}
-		},
-		{
-			"jsonFile" : "toolchains-v1-2f133e2872d69411fd77.json",
-			"kind" : "toolchains",
-			"version" : 
-			{
-				"major" : 1,
-				"minor" : 0
-			}
-		}
-	],
-	"reply" : 
-	{
-		"cache-v2" : 
-		{
-			"jsonFile" : "cache-v2-c2d184a70121e4b5cc51.json",
-			"kind" : "cache",
-			"version" : 
-			{
-				"major" : 2,
-				"minor" : 0
-			}
-		},
-		"cmakeFiles-v1" : 
-		{
-			"jsonFile" : "cmakeFiles-v1-27eb94a99a8aa9ca0fc1.json",
-			"kind" : "cmakeFiles",
-			"version" : 
-			{
-				"major" : 1,
-				"minor" : 0
-			}
-		},
-		"codemodel-v2" : 
-		{
-			"jsonFile" : "codemodel-v2-6b33da970254852e2625.json",
-			"kind" : "codemodel",
-			"version" : 
-			{
-				"major" : 2,
-				"minor" : 6
-			}
-		},
-		"toolchains-v1" : 
-		{
-			"jsonFile" : "toolchains-v1-2f133e2872d69411fd77.json",
-			"kind" : "toolchains",
-			"version" : 
-			{
-				"major" : 1,
-				"minor" : 0
-			}
-		}
-	}
-}

+ 0 - 1211
cmake-build-debug-mingw/.cmake/api/v1/reply/target-gmv-gateway-board.elf-Debug-326a890ddc764dc957b2.json

@@ -1,1211 +0,0 @@
-{
-	"artifacts" : 
-	[
-		{
-			"path" : "gmv-gateway-board.elf"
-		}
-	],
-	"backtrace" : 1,
-	"backtraceGraph" : 
-	{
-		"commands" : 
-		[
-			"add_executable",
-			"add_link_options",
-			"add_compile_options",
-			"add_definitions",
-			"include_directories"
-		],
-		"files" : 
-		[
-			"CMakeLists.txt"
-		],
-		"nodes" : 
-		[
-			{
-				"file" : 0
-			},
-			{
-				"command" : 0,
-				"file" : 0,
-				"line" : 68,
-				"parent" : 0
-			},
-			{
-				"command" : 1,
-				"file" : 0,
-				"line" : 64,
-				"parent" : 0
-			},
-			{
-				"command" : 1,
-				"file" : 0,
-				"line" : 65,
-				"parent" : 0
-			},
-			{
-				"command" : 1,
-				"file" : 0,
-				"line" : 66,
-				"parent" : 0
-			},
-			{
-				"command" : 2,
-				"file" : 0,
-				"line" : 29,
-				"parent" : 0
-			},
-			{
-				"command" : 2,
-				"file" : 0,
-				"line" : 30,
-				"parent" : 0
-			},
-			{
-				"command" : 2,
-				"file" : 0,
-				"line" : 36,
-				"parent" : 0
-			},
-			{
-				"command" : 2,
-				"file" : 0,
-				"line" : 49,
-				"parent" : 0
-			},
-			{
-				"command" : 3,
-				"file" : 0,
-				"line" : 54,
-				"parent" : 0
-			},
-			{
-				"command" : 4,
-				"file" : 0,
-				"line" : 52,
-				"parent" : 0
-			}
-		]
-	},
-	"compileGroups" : 
-	[
-		{
-			"compileCommandFragments" : 
-			[
-				{
-					"fragment" : "-g -std=gnu11 -fdiagnostics-color=always"
-				},
-				{
-					"backtrace" : 5,
-					"fragment" : "-mcpu=cortex-m3"
-				},
-				{
-					"backtrace" : 5,
-					"fragment" : "-mthumb"
-				},
-				{
-					"backtrace" : 5,
-					"fragment" : "-mthumb-interwork"
-				},
-				{
-					"backtrace" : 6,
-					"fragment" : "-ffunction-sections"
-				},
-				{
-					"backtrace" : 6,
-					"fragment" : "-fdata-sections"
-				},
-				{
-					"backtrace" : 6,
-					"fragment" : "-fno-common"
-				},
-				{
-					"backtrace" : 6,
-					"fragment" : "-fmessage-length=0"
-				},
-				{
-					"backtrace" : 8,
-					"fragment" : "-Og"
-				},
-				{
-					"backtrace" : 8,
-					"fragment" : "-g"
-				}
-			],
-			"defines" : 
-			[
-				{
-					"backtrace" : 9,
-					"define" : "DEBUG"
-				},
-				{
-					"backtrace" : 9,
-					"define" : "STM32F103xE"
-				},
-				{
-					"backtrace" : 9,
-					"define" : "USE_HAL_DRIVER"
-				}
-			],
-			"includes" : 
-			[
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Core/Inc"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Drivers/STM32F1xx_HAL_Driver/Inc"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Middlewares/Third_Party/FreeRTOS/Source/include"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Drivers/CMSIS/Device/ST/STM32F1xx/Include"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Drivers/CMSIS/Include"
-				}
-			],
-			"language" : "C",
-			"languageStandard" : 
-			{
-				"backtraces" : 
-				[
-					1
-				],
-				"standard" : "11"
-			},
-			"sourceIndexes" : 
-			[
-				9,
-				10,
-				11,
-				12,
-				13,
-				14,
-				15,
-				16,
-				17,
-				18,
-				19,
-				20,
-				21,
-				77,
-				78,
-				79,
-				80,
-				81,
-				82,
-				83,
-				84,
-				85,
-				86,
-				87,
-				88,
-				89,
-				90,
-				92,
-				94,
-				95,
-				113,
-				114,
-				116,
-				117,
-				118,
-				119,
-				120
-			]
-		},
-		{
-			"compileCommandFragments" : 
-			[
-				{
-					"fragment" : "-g"
-				},
-				{
-					"backtrace" : 5,
-					"fragment" : "-mcpu=cortex-m3"
-				},
-				{
-					"backtrace" : 5,
-					"fragment" : "-mthumb"
-				},
-				{
-					"backtrace" : 5,
-					"fragment" : "-mthumb-interwork"
-				},
-				{
-					"backtrace" : 6,
-					"fragment" : "-ffunction-sections"
-				},
-				{
-					"backtrace" : 6,
-					"fragment" : "-fdata-sections"
-				},
-				{
-					"backtrace" : 6,
-					"fragment" : "-fno-common"
-				},
-				{
-					"backtrace" : 6,
-					"fragment" : "-fmessage-length=0"
-				},
-				{
-					"backtrace" : 7,
-					"fragment" : "-x"
-				},
-				{
-					"backtrace" : 7,
-					"fragment" : "assembler-with-cpp"
-				},
-				{
-					"backtrace" : 8,
-					"fragment" : "-Og"
-				},
-				{
-					"backtrace" : 8,
-					"fragment" : "-g"
-				}
-			],
-			"defines" : 
-			[
-				{
-					"backtrace" : 9,
-					"define" : "DEBUG"
-				},
-				{
-					"backtrace" : 9,
-					"define" : "STM32F103xE"
-				},
-				{
-					"backtrace" : 9,
-					"define" : "USE_HAL_DRIVER"
-				}
-			],
-			"includes" : 
-			[
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Core/Inc"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Drivers/STM32F1xx_HAL_Driver/Inc"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Middlewares/Third_Party/FreeRTOS/Source/include"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Drivers/CMSIS/Device/ST/STM32F1xx/Include"
-				},
-				{
-					"backtrace" : 10,
-					"path" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/Drivers/CMSIS/Include"
-				}
-			],
-			"language" : "ASM",
-			"sourceIndexes" : 
-			[
-				22
-			]
-		}
-	],
-	"id" : "gmv-gateway-board.elf::@6890427a1f51a3e7e1df",
-	"link" : 
-	{
-		"commandFragments" : 
-		[
-			{
-				"fragment" : "-g",
-				"role" : "flags"
-			},
-			{
-				"fragment" : "",
-				"role" : "flags"
-			},
-			{
-				"backtrace" : 2,
-				"fragment" : "-Wl,-gc-sections,--print-memory-usage,-Map=C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/gmv-gateway-board.map",
-				"role" : "flags"
-			},
-			{
-				"backtrace" : 3,
-				"fragment" : "-mcpu=cortex-m3",
-				"role" : "flags"
-			},
-			{
-				"backtrace" : 3,
-				"fragment" : "-mthumb",
-				"role" : "flags"
-			},
-			{
-				"backtrace" : 3,
-				"fragment" : "-mthumb-interwork",
-				"role" : "flags"
-			},
-			{
-				"backtrace" : 4,
-				"fragment" : "-T",
-				"role" : "flags"
-			},
-			{
-				"backtrace" : 4,
-				"fragment" : "C:/Users/DELL/CLionProjects/gmv-gateway-board/STM32F103RCTX_FLASH.ld",
-				"role" : "flags"
-			},
-			{
-				"backtrace" : 4,
-				"fragment" : "Core/Src/ffx_master.c",
-				"role" : "flags"
-			},
-			{
-				"backtrace" : 4,
-				"fragment" : "Core/Inc/ffx_master.h",
-				"role" : "flags"
-			},
-			{
-				"backtrace" : 4,
-				"fragment" : "Core/Src/mini_gateway_master.c",
-				"role" : "flags"
-			},
-			{
-				"backtrace" : 4,
-				"fragment" : "Core/Inc/mini_gateway_master.h",
-				"role" : "flags"
-			}
-		],
-		"language" : "C"
-	},
-	"name" : "gmv-gateway-board.elf",
-	"nameOnDisk" : "gmv-gateway-board.elf",
-	"paths" : 
-	{
-		"build" : ".",
-		"source" : "."
-	},
-	"sourceGroups" : 
-	[
-		{
-			"name" : "Header Files",
-			"sourceIndexes" : 
-			[
-				0,
-				1,
-				2,
-				3,
-				4,
-				5,
-				6,
-				7,
-				8,
-				23,
-				24,
-				25,
-				27,
-				28,
-				29,
-				30,
-				31,
-				32,
-				33,
-				34,
-				35,
-				36,
-				37,
-				38,
-				39,
-				40,
-				41,
-				42,
-				43,
-				44,
-				45,
-				46,
-				47,
-				49,
-				50,
-				51,
-				52,
-				53,
-				54,
-				55,
-				56,
-				57,
-				58,
-				59,
-				60,
-				61,
-				62,
-				63,
-				64,
-				65,
-				66,
-				67,
-				68,
-				69,
-				70,
-				71,
-				72,
-				73,
-				74,
-				75,
-				91,
-				93,
-				96,
-				97,
-				98,
-				99,
-				100,
-				101,
-				102,
-				103,
-				104,
-				105,
-				106,
-				107,
-				108,
-				109,
-				110,
-				111,
-				112,
-				115
-			]
-		},
-		{
-			"name" : "Source Files",
-			"sourceIndexes" : 
-			[
-				9,
-				10,
-				11,
-				12,
-				13,
-				14,
-				15,
-				16,
-				17,
-				18,
-				19,
-				20,
-				21,
-				77,
-				78,
-				79,
-				80,
-				81,
-				82,
-				83,
-				84,
-				85,
-				86,
-				87,
-				88,
-				89,
-				90,
-				92,
-				94,
-				95,
-				113,
-				114,
-				116,
-				117,
-				118,
-				119,
-				120
-			]
-		},
-		{
-			"name" : "",
-			"sourceIndexes" : 
-			[
-				22,
-				26,
-				48,
-				76,
-				121
-			]
-		}
-	],
-	"sources" : 
-	[
-		{
-			"backtrace" : 1,
-			"path" : "Core/Inc/FreeRTOSConfig.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Core/Inc/ffx_master.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Core/Inc/gpio.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Core/Inc/main.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Core/Inc/mini_gateway_master.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Core/Inc/modbus.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Core/Inc/stm32f1xx_hal_conf.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Core/Inc/stm32f1xx_it.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Core/Inc/usart.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/ffx_master.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/freertos.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/gpio.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/main.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/mini_gateway_master.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/modbus.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/stm32f1xx_hal_msp.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/stm32f1xx_hal_timebase_tim.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/stm32f1xx_it.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/syscalls.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/sysmem.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/system_stm32f1xx.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Core/Src/usart.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 1,
-			"path" : "Core/Startup/startup_stm32f103rctx.s",
-			"sourceGroupIndex" : 2
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Device/ST/STM32F1xx/LICENSE.txt",
-			"sourceGroupIndex" : 2
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/cmsis_armcc.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/cmsis_armclang.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/cmsis_compiler.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/cmsis_gcc.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/cmsis_iccarm.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/cmsis_version.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_armv8mbl.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_armv8mml.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_cm0.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_cm0plus.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_cm1.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_cm23.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_cm3.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_cm33.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_cm4.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_cm7.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_sc000.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/core_sc300.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/mpu_armv7.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/mpu_armv8.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/Include/tz_context.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/CMSIS/LICENSE.txt",
-			"sourceGroupIndex" : 2
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_uart.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_dma.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_exti.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_gpio.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_pwr.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_rcc.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_system.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/LICENSE.txt",
-			"sourceGroupIndex" : 2
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/croutine.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/event_groups.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOS.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/StackMacros.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/croutine.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/deprecated_definitions.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/event_groups.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/list.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/message_buffer.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/mpu_prototypes.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/mpu_wrappers.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/portable.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/projdefs.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/queue.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/semphr.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/stack_macros.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/stream_buffer.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/task.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/include/timers.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/list.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h",
-			"sourceGroupIndex" : 0
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/queue.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/tasks.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"compileGroupIndex" : 0,
-			"path" : "Middlewares/Third_Party/FreeRTOS/Source/timers.c",
-			"sourceGroupIndex" : 1
-		},
-		{
-			"backtrace" : 1,
-			"path" : "STM32F103RCTX_FLASH.ld",
-			"sourceGroupIndex" : 2
-		}
-	],
-	"type" : "EXECUTABLE"
-}

BIN
cmake-build-debug-mingw/.ninja_deps


+ 106 - 38
cmake-build-debug-mingw/.ninja_log

@@ -1,39 +1,107 @@
 # ninja log v6
-6	1488	7508629103956417	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	f8e51b19d8ee9854
-125	1636	7508629105156262	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/freertos.c.obj	1a15aa3ff2902642
-288	1762	7508629106775023	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/gpio.c.obj	d0e6edf741ea9204
-448	1909	7508629108381907	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/main.c.obj	e2556744d952dc45
-640	2028	7508629110294583	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	8066871404895c17
-781	2148	7508629111715465	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/modbus.c.obj	4d7f8e85718ac65
-978	2297	7508629113680288	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_msp.c.obj	7a87745d40081437
-1110	2413	7508629114996270	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_timebase_tim.c.obj	478979b5e65c66c0
-1215	2537	7508629116052528	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_it.c.obj	72d06ad9b66410ac
-1322	2687	7508629117125976	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/syscalls.c.obj	95b98b5768551e2b
-1489	2883	7508629118793172	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/sysmem.c.obj	26cc2dc42220cea2
-1636	3008	7508629120264179	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/system_stm32f1xx.c.obj	a2d4bd4866993dd0
-1762	3145	7508629121526677	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/usart.c.obj	f5c54cc36097f3ce
-1910	3272	7508629122993646	CMakeFiles/gmv-gateway-board.elf.dir/Core/Startup/startup_stm32f103rctx.s.obj	ecccda977fb78bde
-2028	3498	7508629124176486	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c.obj	f26b443a2b312ea2
-2150	3621	7508629125401328	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c.obj	747aa742cac44c54
-2298	3775	7508629126873617	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c.obj	7042df7cd780a9f0
-2413	3919	7508629128033875	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c.obj	d98a6a2391e0df99
-2537	4059	7508629129274600	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c.obj	d856afdf5484cbe9
-2688	4158	7508629130774561	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c.obj	64c046b71588199c
-2883	4250	7508629132737219	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c.obj	696cd15499022d5d
-3008	4384	7508629133990950	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c.obj	f1b9958c418b3178
-3145	4495	7508629135347249	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c.obj	b3abf8e7a6b158a3
-3272	4689	7508629136623023	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c.obj	6500b1a7dbe43166
-3498	4819	7508629138879432	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c.obj	79f3eef5bad627f9
-3622	4973	7508629140116750	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c.obj	e6d95165b244c638
-3775	5107	7508629141658943	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c.obj	95300f5452088596
-3919	5224	7508629143085307	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c.obj	377e91ebd31b84ab
-4059	5315	7508629144502071	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c.obj	a01137c69495b1b8
-4158	5316	7508629145490274	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/croutine.c.obj	98a09c81adc1c236
-4250	5316	7508629146403460	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c.obj	3331839c2585d8e
-4384	5316	7508629147740662	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/list.c.obj	2d269290e0a22af1
-4495	5317	7508629148847887	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c.obj	b76d2371eee02630
-4690	5317	7508629150798384	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c.obj	970c2d2b5c73e2da
-4819	5401	7508629152091734	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/queue.c.obj	6e1a9fd80723901c
-4973	5453	7508629153638448	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c.obj	5d550eef301260dc
-5107	5632	7508629154977916	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/tasks.c.obj	2eac5d5f5d09d89f
-5224	5632	7508629156146232	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/timers.c.obj	1f75bc4e7340b753
+1163	2073	7509483376352891	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncholding.c.obj	f4267e91064d9e38
+9	673	7512895043602271	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	df4f48cfc5af53e5
+2490	3671	7509478622131202	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c.obj	6c0223c37410b9b6
+4	353	7512931572942161	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/led.cpp.obj	a2ed9f56f243f4f3
+2377	3592	7509478620997241	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c.obj	d473059a8c42e1b7
+86	1328	7509478598097469	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/freertos.c.obj	488b546fd0401b54
+1956	2759	7509483384272865	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/rtu/mbrtu.c.obj	ce09c3a94d74ec54
+2073	2761	7509483385447734	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/tcp/mbtcp.c.obj	9b09a9fae28faf2b
+704	1918	7509478604279215	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_msp.c.obj	a09db25ac34bc5c
+865	1875	7509483373362022	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdisc_m.c.obj	f0c3d243bc5672df
+193	1442	7509478599158710	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/gpio.c.obj	cae894cc54e00456
+106	701	7512895044579377	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/main.c.obj	cbc1b3153b918dca
+6114	7349	7509478658370524	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c.obj	fab666565700010d
+2263	3509	7509478619871899	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c.obj	2f96ff616864dab9
+72	433	7512931573632156	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	abed1a0678601283
+584	1806	7509478603076109	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/modbus.c.obj	e6e25f88100c4bb0
+826	2021	7509478605498054	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_timebase_tim.c.obj	b9081ea27a1fe7ef
+1573	2633	7509483380449778	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncother.c.obj	ed2187230f3ac0db
+130	1384	7509483366019369	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_it.c.obj	5dc587b88b9c0c0d
+1039	2263	7509478607625197	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/syscalls.c.obj	d9bdce492fce6e2
+1211	2377	7509478609345551	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/sysmem.c.obj	8c44462201ed5840
+6274	7349	7509478659979837	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/croutine.c.obj	ab6a024bb7fce73f
+1328	2490	7509478610519710	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/system_stm32f1xx.c.obj	d2b497595dcc6f3e
+2760	3956	7509478624831050	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c.obj	15349ad6c2c50c82
+1528	2760	7509478612502757	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/usart.c.obj	bfe8c2204f5d0b6b
+723	1768	7509483371952136	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdisc.c.obj	ef8fdac7f2093dd4
+1630	2885	7509478613543232	CMakeFiles/gmv-gateway-board.elf.dir/Core/Startup/startup_stm32f103rctx.s.obj	86c38990d68fc275
+6765	7351	7509478664882946	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c.obj	511b661de417ebdc
+1806	3000	7509478615294566	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c.obj	ca1ef5f0f4479189
+5969	7262	7509478656921032	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/port/user_mb_app.c.obj	461205c0acf988b8
+2021	3251	7509478617441106	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c.obj	201595e00fe68eae
+1918	3131	7509478616416571	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c.obj	309aac907ef90dcf
+2112	3377	7509478618351262	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c.obj	ccc9e8a62e99a967
+2635	3773	7509478623587217	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c.obj	4f0e587ee685a7a4
+2885	4078	7509478626086143	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c.obj	98aba44c6631b8c9
+2219	2762	7509483386908129	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portcritical.c.obj	d7f5885e4219b344
+3000	4228	7509478627228536	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c.obj	328a35b3d40d661b
+3131	4347	7509478628543812	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c.obj	eb5676f473eb343d
+3251	4475	7509478629748982	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c.obj	647b5f0fb1ac64ec
+558	1687	7509483370297212	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfunccoils_m.c.obj	5a3037369906be8
+3377	4625	7509478631011773	CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c.obj	685efae61c2f03ca
+7024	7509	7509478667472878	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c.obj	2d104472c8870760
+6404	7350	7509478661278499	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c.obj	50e627d39ccd8004
+6511	7351	7509478662344698	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/list.c.obj	c40ab40237b3027f
+7141	7685	7509478668647047	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/tasks.c.obj	b30eda5bd576dd90
+6602	7351	7509478663246593	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c.obj	5bb1a90961e72600
+434	1078	7512931577245161	gmv-gateway-board.elf	2369f5f8cafc0e41
+7263	7655	7509478669857647	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/timers.c.obj	52b9c0a41efb7fd7
+6899	7440	7509478666226459	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/queue.c.obj	a39628c2cb25665a
+425	1573	7509483368973478	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfunccoils.c.obj	5cc41ea2bc135e9
+6	1191	7512932725333724	build.ninja	8f8da1363b934af3
+1442	2635	7509478611664119	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/tim.c.obj	3aa237f439484f33
+282	1456	7509483367541767	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/ascii/mbascii.c.obj	bfab5db9b9ae44c7
+3773	5016	7509478634973147	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncdiag.c.obj	19fe52dce0bee3bb
+1002	1956	7509483374739926	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncfile.c.obj	5a7aa3fb7875566e
+1275	2219	7509483377464274	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncholding_m.c.obj	21c0be396a76e6b3
+2633	3055	7509483391038785	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/porttimer.c.obj	4e446420144bdffc
+1385	2343	7509483378567611	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncinput.c.obj	d61b072a66812a74
+1876	2759	7509483383472169	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/rtu/mbcrc.c.obj	84307e430b50a3cd
+1456	2513	7509483379278145	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbfuncinput_m.c.obj	6bf7fb7ce50749db
+1687	2758	7509483381580305	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/functions/mbutils.c.obj	7b545cbcce54b502
+1768	2758	7509483382389401	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/modbus/mb.c.obj	3790a9391464854
+2343	2881	7509483388145826	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portevent.c.obj	b671c0cd0b7a6f25
+2513	2959	7509483389843272	CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeModbus/port/cmsis_rtos2/portserial.c.obj	cb7a0da40981cc24
+154	656	7509485264052364	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/modbus_slave.c.obj	8274da526cc7281a
+9	318	7512932742426782	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/led.c.obj	597213607b05167f
+319	944	7512932745534193	gmv-gateway-board.elf	a28e4dc80e50c58b
+7	313	7512932901319988	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/led.c.obj	597213607b05167f
+314	900	7512932904384740	gmv-gateway-board.elf	a28e4dc80e50c58b
+59	14212	7513659101626210	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/modbus_slave.c.obj	8274da526cc7281a
+14212	16377	7513659243158927	gmv-gateway-board.elf	a28e4dc80e50c58b
+28	373	7513659809175278	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	abed1a0678601283
+377	947	7513659812669646	gmv-gateway-board.elf	a28e4dc80e50c58b
+4	445	7513663526212707	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	df4f48cfc5af53e5
+88	494	7513663527063028	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/main.c.obj	cbc1b3153b918dca
+192	574	7513663528097832	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	abed1a0678601283
+575	1123	7513663531929051	gmv-gateway-board.elf	a28e4dc80e50c58b
+4	371	7513672841955404	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	abed1a0678601283
+378	1028	7513672845696025	gmv-gateway-board.elf	a28e4dc80e50c58b
+4	331	7513673976202087	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	abed1a0678601283
+333	939	7513673979503165	gmv-gateway-board.elf	a28e4dc80e50c58b
+6	336	7513674367064474	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	abed1a0678601283
+342	1036	7513674370421551	gmv-gateway-board.elf	a28e4dc80e50c58b
+3	370	7513674908387979	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	abed1a0678601283
+373	948	7513674912089202	gmv-gateway-board.elf	a28e4dc80e50c58b
+4	454	7513677975147012	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	df4f48cfc5af53e5
+82	481	7513677975926511	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/main.c.obj	cbc1b3153b918dca
+185	552	7513677976957490	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	abed1a0678601283
+553	1137	7513677980636891	gmv-gateway-board.elf	a28e4dc80e50c58b
+4	373	7513693778812446	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	df4f48cfc5af53e5
+96	461	7513693779737007	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	abed1a0678601283
+466	1102	7513693783429351	gmv-gateway-board.elf	a28e4dc80e50c58b
+5	370	7513695328209752	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	df4f48cfc5af53e5
+372	987	7513695331873729	gmv-gateway-board.elf	a28e4dc80e50c58b
+4	335	7513697420792293	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj	abed1a0678601283
+340	955	7513697424151183	gmv-gateway-board.elf	a28e4dc80e50c58b
+4	339	7513700393638412	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	df4f48cfc5af53e5
+340	946	7513700396994940	gmv-gateway-board.elf	a28e4dc80e50c58b
+4	332	7513701296490013	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	df4f48cfc5af53e5
+333	914	7513701299785948	gmv-gateway-board.elf	a28e4dc80e50c58b
+4	318	7513707629644217	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	df4f48cfc5af53e5
+319	863	7513707632793546	gmv-gateway-board.elf	a28e4dc80e50c58b
+6	368	7513709159861804	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	df4f48cfc5af53e5
+369	995	7513709163484978	gmv-gateway-board.elf	a28e4dc80e50c58b
+4	389	7513710492619188	CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj	df4f48cfc5af53e5
+390	1033	7513710496476690	gmv-gateway-board.elf	a28e4dc80e50c58b

+ 6 - 6
cmake-build-debug-mingw/CMakeCache.txt

@@ -1,5 +1,5 @@
 # This is the CMakeCache file.
-# For build in directory: c:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw
+# For build in directory: c:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw
 # It was generated by CMake: D:/clion/CLion 2024.1.4/bin/cmake/win/x64/bin/cmake.exe
 # You can edit this file to change values found and used by cmake.
 # If you do not want to change any of the values, simply exit the editor.
@@ -115,7 +115,7 @@ CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
 CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=
 
 //Value Computed by CMake.
-CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/pkgRedirects
+CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/pkgRedirects
 
 //Install path prefix, prepended onto install directories.
 CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/gmv-gateway-board
@@ -224,13 +224,13 @@ CMAKE_TAPI:FILEPATH=CMAKE_TAPI-NOTFOUND
 CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
 
 //Value Computed by CMake
-gmv-gateway-board_BINARY_DIR:STATIC=C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw
+gmv-gateway-board_BINARY_DIR:STATIC=C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw
 
 //Value Computed by CMake
 gmv-gateway-board_IS_TOP_LEVEL:STATIC=ON
 
 //Value Computed by CMake
-gmv-gateway-board_SOURCE_DIR:STATIC=C:/Users/DELL/CLionProjects/gmv-gateway-board
+gmv-gateway-board_SOURCE_DIR:STATIC=C:/Users/DELL/Desktop/gmv-gateway-board
 
 
 ########################
@@ -255,7 +255,7 @@ CMAKE_ASM_FLAGS_RELEASE-ADVANCED:INTERNAL=1
 //ADVANCED property for variable: CMAKE_ASM_FLAGS_RELWITHDEBINFO
 CMAKE_ASM_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
 //This is the directory where this CMakeCache.txt was created
-CMAKE_CACHEFILE_DIR:INTERNAL=c:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw
+CMAKE_CACHEFILE_DIR:INTERNAL=c:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw
 //Major version of cmake used to create the current loaded cache
 CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
 //Minor version of cmake used to create the current loaded cache
@@ -324,7 +324,7 @@ CMAKE_GENERATOR_PLATFORM:INTERNAL=
 CMAKE_GENERATOR_TOOLSET:INTERNAL=
 //Source directory with the top level CMakeLists.txt file for this
 // project
-CMAKE_HOME_DIRECTORY:INTERNAL=C:/Users/DELL/CLionProjects/gmv-gateway-board
+CMAKE_HOME_DIRECTORY:INTERNAL=C:/Users/DELL/Desktop/gmv-gateway-board
 //ADVANCED property for variable: CMAKE_LINKER
 CMAKE_LINKER-ADVANCED:INTERNAL=1
 //ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS

BIN
cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeDetermineCompilerABI_C.bin


BIN
cmake-build-debug-mingw/CMakeFiles/3.28.1/CMakeDetermineCompilerABI_CXX.bin


+ 42 - 42
cmake-build-debug-mingw/CMakeFiles/CMakeConfigureLog.yaml

@@ -49,7 +49,7 @@ events:
       Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.o"
       
       The C compiler identification is GNU, found in:
-        C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/3.28.1/CompilerIdC/CMakeCCompilerId.o
+        C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/3.28.1/CompilerIdC/CMakeCCompilerId.o
       
   -
     kind: "message-v1"
@@ -91,7 +91,7 @@ events:
       Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CMakeCXXCompilerId.o"
       
       The CXX compiler identification is GNU, found in:
-        C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/3.28.1/CompilerIdCXX/CMakeCXXCompilerId.o
+        C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/3.28.1/CompilerIdCXX/CMakeCXXCompilerId.o
       
   -
     kind: "message-v1"
@@ -115,8 +115,8 @@ events:
     checks:
       - "Detecting C compiler ABI info"
     directories:
-      source: "C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-xl0cr7"
-      binary: "C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-xl0cr7"
+      source: "C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-xq7tgo"
+      binary: "C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-xq7tgo"
     cmakeVariables:
       CMAKE_C_FLAGS: ""
       CMAKE_C_FLAGS_DEBUG: "-g"
@@ -125,10 +125,10 @@ events:
       variable: "CMAKE_C_ABI_COMPILED"
       cached: true
       stdout: |
-        Change Dir: 'C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-xl0cr7'
+        Change Dir: 'C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-xq7tgo'
         
-        Run Build Command(s): "D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -v cmTC_392d8
-        [1/2] D:\\clion\\10.2021.10\\bin\\arm-none-eabi-gcc.exe   -fdiagnostics-color=always   -v -o CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj -c "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompilerABI.c"
+        Run Build Command(s): "D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -v cmTC_7683a
+        [1/2] D:\\clion\\10.2021.10\\bin\\arm-none-eabi-gcc.exe   -fdiagnostics-color=always   -v -o CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj -c "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompilerABI.c"
         Using built-in specs.
         COLLECT_GCC=D:\\clion\\10.2021.10\\bin\\arm-none-eabi-gcc.exe
         Target: arm-none-eabi
@@ -136,8 +136,8 @@ events:
         Thread model: single
         Supported LTO compression algorithms: zlib
         gcc version 10.3.1 20210824 (release) (GNU Arm Embedded Toolchain 10.3-2021.10) 
-        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'
-         d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/cc1.exe -quiet -v -iprefix d:\\clion\\10.2021.10\\bin\\../lib/gcc/arm-none-eabi/10.3.1/ -isysroot d:\\clion\\10.2021.10\\bin\\../arm-none-eabi -D__USES_INITFINI__ D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mcpu=arm7tdmi -mfloat-abi=soft -marm -mlibarch=armv4t -march=armv4t -auxbase-strip CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj -version -fdiagnostics-color=always -o C:\\Users\\DELL\\AppData\\Local\\Temp\\ccleqgZc.s
+        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'
+         d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/cc1.exe -quiet -v -iprefix d:\\clion\\10.2021.10\\bin\\../lib/gcc/arm-none-eabi/10.3.1/ -isysroot d:\\clion\\10.2021.10\\bin\\../arm-none-eabi -D__USES_INITFINI__ D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mcpu=arm7tdmi -mfloat-abi=soft -marm -mlibarch=armv4t -march=armv4t -auxbase-strip CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj -version -fdiagnostics-color=always -o C:\\Users\\DELL\\AppData\\Local\\Temp\\ccL6fKnF.s
         GNU C17 (GNU Arm Embedded Toolchain 10.3-2021.10) version 10.3.1 20210824 (release) (arm-none-eabi)
         	compiled by GNU C version 7.3-win32 20180312, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP
         
@@ -158,13 +158,13 @@ events:
         
         GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
         Compiler executable checksum: f3937ce18b4177bfd408ca565336596a
-        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'
-         d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/as.exe -v -march=armv4t -mfloat-abi=soft -meabi=5 -o CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj C:\\Users\\DELL\\AppData\\Local\\Temp\\ccleqgZc.s
+        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'
+         d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/as.exe -v -march=armv4t -mfloat-abi=soft -meabi=5 -o CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj C:\\Users\\DELL\\AppData\\Local\\Temp\\ccL6fKnF.s
         GNU assembler version 2.36.1 (arm-none-eabi) using BFD version (GNU Arm Embedded Toolchain 10.3-2021.10) 2.36.1.20210621
         COMPILER_PATH=d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/;d:/clion/10.2021.10/bin/../lib/gcc/;d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/
         LIBRARY_PATH=d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/;d:/clion/10.2021.10/bin/../lib/gcc/;d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/;d:/clion/10.2021.10/bin/../arm-none-eabi/lib/
-        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'\x0d
-        [2/2] C:\\Windows\\system32\\cmd.exe /C "cd . && "D:\\clion\\CLion 2024.1.4\\bin\\cmake\\win\\x64\\bin\\cmake.exe" -E rm -f libcmTC_392d8.a && arm-none-eabi-ar qc libcmTC_392d8.a  CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj && D:\\clion\\10.2021.10\\bin\\arm-none-eabi-ranlib.exe libcmTC_392d8.a && cd ."
+        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'\x0d
+        [2/2] C:\\Windows\\system32\\cmd.exe /C "cd . && "D:\\clion\\CLion 2024.1.4\\bin\\cmake\\win\\x64\\bin\\cmake.exe" -E rm -f libcmTC_7683a.a && arm-none-eabi-ar qc libcmTC_7683a.a  CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj && D:\\clion\\10.2021.10\\bin\\arm-none-eabi-ranlib.exe libcmTC_7683a.a && cd ."
         
       exitCode: 0
   -
@@ -196,10 +196,10 @@ events:
     message: |
       Parsed C implicit link information:
         link line regex: [^( *|.*[/\\])(arm-none-eabi-ld\\.exe|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)]
-        ignore line: [Change Dir: 'C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-xl0cr7']
+        ignore line: [Change Dir: 'C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-xq7tgo']
         ignore line: []
-        ignore line: [Run Build Command(s): "D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -v cmTC_392d8]
-        ignore line: [[1/2] D:\\clion\\10.2021.10\\bin\\arm-none-eabi-gcc.exe   -fdiagnostics-color=always   -v -o CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj -c "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompilerABI.c"]
+        ignore line: [Run Build Command(s): "D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -v cmTC_7683a]
+        ignore line: [[1/2] D:\\clion\\10.2021.10\\bin\\arm-none-eabi-gcc.exe   -fdiagnostics-color=always   -v -o CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj -c "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompilerABI.c"]
         ignore line: [Using built-in specs.]
         ignore line: [COLLECT_GCC=D:\\clion\\10.2021.10\\bin\\arm-none-eabi-gcc.exe]
         ignore line: [Target: arm-none-eabi]
@@ -207,8 +207,8 @@ events:
         ignore line: [Thread model: single]
         ignore line: [Supported LTO compression algorithms: zlib]
         ignore line: [gcc version 10.3.1 20210824 (release) (GNU Arm Embedded Toolchain 10.3-2021.10) ]
-        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t']
-        ignore line: [ d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/cc1.exe -quiet -v -iprefix d:\\clion\\10.2021.10\\bin\\../lib/gcc/arm-none-eabi/10.3.1/ -isysroot d:\\clion\\10.2021.10\\bin\\../arm-none-eabi -D__USES_INITFINI__ D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mcpu=arm7tdmi -mfloat-abi=soft -marm -mlibarch=armv4t -march=armv4t -auxbase-strip CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj -version -fdiagnostics-color=always -o C:\\Users\\DELL\\AppData\\Local\\Temp\\ccleqgZc.s]
+        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t']
+        ignore line: [ d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/cc1.exe -quiet -v -iprefix d:\\clion\\10.2021.10\\bin\\../lib/gcc/arm-none-eabi/10.3.1/ -isysroot d:\\clion\\10.2021.10\\bin\\../arm-none-eabi -D__USES_INITFINI__ D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mcpu=arm7tdmi -mfloat-abi=soft -marm -mlibarch=armv4t -march=armv4t -auxbase-strip CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj -version -fdiagnostics-color=always -o C:\\Users\\DELL\\AppData\\Local\\Temp\\ccL6fKnF.s]
         ignore line: [GNU C17 (GNU Arm Embedded Toolchain 10.3-2021.10) version 10.3.1 20210824 (release) (arm-none-eabi)]
         ignore line: [	compiled by GNU C version 7.3-win32 20180312  GMP version 6.1.0  MPFR version 3.1.4  MPC version 1.0.3  isl version isl-0.18-GMP]
         ignore line: []
@@ -229,8 +229,8 @@ events:
         ignore line: []
         ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
         ignore line: [Compiler executable checksum: f3937ce18b4177bfd408ca565336596a]
-        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t']
-        ignore line: [ d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/as.exe -v -march=armv4t -mfloat-abi=soft -meabi=5 -o CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj C:\\Users\\DELL\\AppData\\Local\\Temp\\ccleqgZc.s]
+        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t']
+        ignore line: [ d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/as.exe -v -march=armv4t -mfloat-abi=soft -meabi=5 -o CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj C:\\Users\\DELL\\AppData\\Local\\Temp\\ccL6fKnF.s]
         ignore line: [GNU assembler version 2.36.1 (arm-none-eabi) using BFD version (GNU Arm Embedded Toolchain 10.3-2021.10) 2.36.1.20210621]
         ignore line: [COMPILER_PATH=d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/]
         ignore line: [d:/clion/10.2021.10/bin/../lib/gcc/]
@@ -239,8 +239,8 @@ events:
         ignore line: [d:/clion/10.2021.10/bin/../lib/gcc/]
         ignore line: [d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/]
         ignore line: [d:/clion/10.2021.10/bin/../arm-none-eabi/lib/]
-        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'\x0d]
-        ignore line: [[2/2] C:\\Windows\\system32\\cmd.exe /C "cd . && "D:\\clion\\CLion 2024.1.4\\bin\\cmake\\win\\x64\\bin\\cmake.exe" -E rm -f libcmTC_392d8.a && arm-none-eabi-ar qc libcmTC_392d8.a  CMakeFiles/cmTC_392d8.dir/CMakeCCompilerABI.c.obj && D:\\clion\\10.2021.10\\bin\\arm-none-eabi-ranlib.exe libcmTC_392d8.a && cd ."]
+        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'\x0d]
+        ignore line: [[2/2] C:\\Windows\\system32\\cmd.exe /C "cd . && "D:\\clion\\CLion 2024.1.4\\bin\\cmake\\win\\x64\\bin\\cmake.exe" -E rm -f libcmTC_7683a.a && arm-none-eabi-ar qc libcmTC_7683a.a  CMakeFiles/cmTC_7683a.dir/CMakeCCompilerABI.c.obj && D:\\clion\\10.2021.10\\bin\\arm-none-eabi-ranlib.exe libcmTC_7683a.a && cd ."]
         ignore line: []
         ignore line: []
         implicit libs: []
@@ -258,8 +258,8 @@ events:
     checks:
       - "Detecting CXX compiler ABI info"
     directories:
-      source: "C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-8s4qro"
-      binary: "C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-8s4qro"
+      source: "C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-qvudpy"
+      binary: "C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-qvudpy"
     cmakeVariables:
       CMAKE_CXX_FLAGS: ""
       CMAKE_CXX_FLAGS_DEBUG: "-g"
@@ -268,10 +268,10 @@ events:
       variable: "CMAKE_CXX_ABI_COMPILED"
       cached: true
       stdout: |
-        Change Dir: 'C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-8s4qro'
+        Change Dir: 'C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-qvudpy'
         
-        Run Build Command(s): "D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -v cmTC_f84a8
-        [1/2] D:\\clion\\10.2021.10\\bin\\arm-none-eabi-g++.exe   -fdiagnostics-color=always   -v -o CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj -c "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp"
+        Run Build Command(s): "D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -v cmTC_414c4
+        [1/2] D:\\clion\\10.2021.10\\bin\\arm-none-eabi-g++.exe   -fdiagnostics-color=always   -v -o CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj -c "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp"
         Using built-in specs.
         COLLECT_GCC=D:\\clion\\10.2021.10\\bin\\arm-none-eabi-g++.exe
         Target: arm-none-eabi
@@ -279,8 +279,8 @@ events:
         Thread model: single
         Supported LTO compression algorithms: zlib
         gcc version 10.3.1 20210824 (release) (GNU Arm Embedded Toolchain 10.3-2021.10) 
-        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'
-         d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/cc1plus.exe -quiet -v -iprefix d:\\clion\\10.2021.10\\bin\\../lib/gcc/arm-none-eabi/10.3.1/ -isysroot d:\\clion\\10.2021.10\\bin\\../arm-none-eabi -D__USES_INITFINI__ D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mcpu=arm7tdmi -mfloat-abi=soft -marm -mlibarch=armv4t -march=armv4t -auxbase-strip CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj -version -fdiagnostics-color=always -o C:\\Users\\DELL\\AppData\\Local\\Temp\\ccpzc8Dc.s
+        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'
+         d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/cc1plus.exe -quiet -v -iprefix d:\\clion\\10.2021.10\\bin\\../lib/gcc/arm-none-eabi/10.3.1/ -isysroot d:\\clion\\10.2021.10\\bin\\../arm-none-eabi -D__USES_INITFINI__ D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mcpu=arm7tdmi -mfloat-abi=soft -marm -mlibarch=armv4t -march=armv4t -auxbase-strip CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj -version -fdiagnostics-color=always -o C:\\Users\\DELL\\AppData\\Local\\Temp\\ccx6w6XV.s
         GNU C++14 (GNU Arm Embedded Toolchain 10.3-2021.10) version 10.3.1 20210824 (release) (arm-none-eabi)
         	compiled by GNU C version 7.3-win32 20180312, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP
         
@@ -307,13 +307,13 @@ events:
         
         GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
         Compiler executable checksum: f8787892a7c5aa84cea58dce52be7118
-        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'
-         d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/as.exe -v -march=armv4t -mfloat-abi=soft -meabi=5 -o CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj C:\\Users\\DELL\\AppData\\Local\\Temp\\ccpzc8Dc.s
+        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'
+         d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/as.exe -v -march=armv4t -mfloat-abi=soft -meabi=5 -o CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj C:\\Users\\DELL\\AppData\\Local\\Temp\\ccx6w6XV.s
         GNU assembler version 2.36.1 (arm-none-eabi) using BFD version (GNU Arm Embedded Toolchain 10.3-2021.10) 2.36.1.20210621
         COMPILER_PATH=d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/;d:/clion/10.2021.10/bin/../lib/gcc/;d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/\x0d
         LIBRARY_PATH=d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/;d:/clion/10.2021.10/bin/../lib/gcc/;d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/;d:/clion/10.2021.10/bin/../arm-none-eabi/lib/\x0d
-        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'\x0d
-        [2/2] C:\\Windows\\system32\\cmd.exe /C "cd . && "D:\\clion\\CLion 2024.1.4\\bin\\cmake\\win\\x64\\bin\\cmake.exe" -E rm -f libcmTC_f84a8.a && arm-none-eabi-ar qc libcmTC_f84a8.a  CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj && D:\\clion\\10.2021.10\\bin\\arm-none-eabi-ranlib.exe libcmTC_f84a8.a && cd ."
+        COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'\x0d
+        [2/2] C:\\Windows\\system32\\cmd.exe /C "cd . && "D:\\clion\\CLion 2024.1.4\\bin\\cmake\\win\\x64\\bin\\cmake.exe" -E rm -f libcmTC_414c4.a && arm-none-eabi-ar qc libcmTC_414c4.a  CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj && D:\\clion\\10.2021.10\\bin\\arm-none-eabi-ranlib.exe libcmTC_414c4.a && cd ."
         
       exitCode: 0
   -
@@ -351,10 +351,10 @@ events:
     message: |
       Parsed CXX implicit link information:
         link line regex: [^( *|.*[/\\])(arm-none-eabi-ld\\.exe|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)]
-        ignore line: [Change Dir: 'C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-8s4qro']
+        ignore line: [Change Dir: 'C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/CMakeScratch/TryCompile-qvudpy']
         ignore line: []
-        ignore line: [Run Build Command(s): "D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -v cmTC_f84a8]
-        ignore line: [[1/2] D:\\clion\\10.2021.10\\bin\\arm-none-eabi-g++.exe   -fdiagnostics-color=always   -v -o CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj -c "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp"]
+        ignore line: [Run Build Command(s): "D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -v cmTC_414c4]
+        ignore line: [[1/2] D:\\clion\\10.2021.10\\bin\\arm-none-eabi-g++.exe   -fdiagnostics-color=always   -v -o CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj -c "D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp"]
         ignore line: [Using built-in specs.]
         ignore line: [COLLECT_GCC=D:\\clion\\10.2021.10\\bin\\arm-none-eabi-g++.exe]
         ignore line: [Target: arm-none-eabi]
@@ -362,8 +362,8 @@ events:
         ignore line: [Thread model: single]
         ignore line: [Supported LTO compression algorithms: zlib]
         ignore line: [gcc version 10.3.1 20210824 (release) (GNU Arm Embedded Toolchain 10.3-2021.10) ]
-        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t']
-        ignore line: [ d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/cc1plus.exe -quiet -v -iprefix d:\\clion\\10.2021.10\\bin\\../lib/gcc/arm-none-eabi/10.3.1/ -isysroot d:\\clion\\10.2021.10\\bin\\../arm-none-eabi -D__USES_INITFINI__ D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mcpu=arm7tdmi -mfloat-abi=soft -marm -mlibarch=armv4t -march=armv4t -auxbase-strip CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj -version -fdiagnostics-color=always -o C:\\Users\\DELL\\AppData\\Local\\Temp\\ccpzc8Dc.s]
+        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t']
+        ignore line: [ d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/cc1plus.exe -quiet -v -iprefix d:\\clion\\10.2021.10\\bin\\../lib/gcc/arm-none-eabi/10.3.1/ -isysroot d:\\clion\\10.2021.10\\bin\\../arm-none-eabi -D__USES_INITFINI__ D:/clion/CLion 2024.1.4/bin/cmake/win/x64/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mcpu=arm7tdmi -mfloat-abi=soft -marm -mlibarch=armv4t -march=armv4t -auxbase-strip CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj -version -fdiagnostics-color=always -o C:\\Users\\DELL\\AppData\\Local\\Temp\\ccx6w6XV.s]
         ignore line: [GNU C++14 (GNU Arm Embedded Toolchain 10.3-2021.10) version 10.3.1 20210824 (release) (arm-none-eabi)]
         ignore line: [	compiled by GNU C version 7.3-win32 20180312  GMP version 6.1.0  MPFR version 3.1.4  MPC version 1.0.3  isl version isl-0.18-GMP]
         ignore line: []
@@ -390,8 +390,8 @@ events:
         ignore line: []
         ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072]
         ignore line: [Compiler executable checksum: f8787892a7c5aa84cea58dce52be7118]
-        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t']
-        ignore line: [ d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/as.exe -v -march=armv4t -mfloat-abi=soft -meabi=5 -o CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj C:\\Users\\DELL\\AppData\\Local\\Temp\\ccpzc8Dc.s]
+        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t']
+        ignore line: [ d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/as.exe -v -march=armv4t -mfloat-abi=soft -meabi=5 -o CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj C:\\Users\\DELL\\AppData\\Local\\Temp\\ccx6w6XV.s]
         ignore line: [GNU assembler version 2.36.1 (arm-none-eabi) using BFD version (GNU Arm Embedded Toolchain 10.3-2021.10) 2.36.1.20210621]
         ignore line: [COMPILER_PATH=d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/]
         ignore line: [d:/clion/10.2021.10/bin/../lib/gcc/]
@@ -400,8 +400,8 @@ events:
         ignore line: [d:/clion/10.2021.10/bin/../lib/gcc/]
         ignore line: [d:/clion/10.2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/]
         ignore line: [d:/clion/10.2021.10/bin/../arm-none-eabi/lib/\x0d]
-        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'\x0d]
-        ignore line: [[2/2] C:\\Windows\\system32\\cmd.exe /C "cd . && "D:\\clion\\CLion 2024.1.4\\bin\\cmake\\win\\x64\\bin\\cmake.exe" -E rm -f libcmTC_f84a8.a && arm-none-eabi-ar qc libcmTC_f84a8.a  CMakeFiles/cmTC_f84a8.dir/CMakeCXXCompilerABI.cpp.obj && D:\\clion\\10.2021.10\\bin\\arm-none-eabi-ranlib.exe libcmTC_f84a8.a && cd ."]
+        ignore line: [COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-v' '-o' 'CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj' '-c' '-mcpu=arm7tdmi' '-mfloat-abi=soft' '-marm' '-mlibarch=armv4t' '-march=armv4t'\x0d]
+        ignore line: [[2/2] C:\\Windows\\system32\\cmd.exe /C "cd . && "D:\\clion\\CLion 2024.1.4\\bin\\cmake\\win\\x64\\bin\\cmake.exe" -E rm -f libcmTC_414c4.a && arm-none-eabi-ar qc libcmTC_414c4.a  CMakeFiles/cmTC_414c4.dir/CMakeCXXCompilerABI.cpp.obj && D:\\clion\\10.2021.10\\bin\\arm-none-eabi-ranlib.exe libcmTC_414c4.a && cd ."]
         ignore line: []
         ignore line: []
         implicit libs: []

+ 3 - 3
cmake-build-debug-mingw/CMakeFiles/TargetDirectories.txt

@@ -1,3 +1,3 @@
-C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir
-C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/edit_cache.dir
-C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/rebuild_cache.dir
+C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir
+C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/edit_cache.dir
+C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw/CMakeFiles/rebuild_cache.dir

+ 3 - 17
cmake-build-debug-mingw/CMakeFiles/clion-Debug-MinGW-log.txt

@@ -1,19 +1,5 @@
-"D:\clion\CLion 2024.1.4\bin\cmake\win\x64\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -G Ninja -S C:\Users\DELL\CLionProjects\gmv-gateway-board -B C:\Users\DELL\CLionProjects\gmv-gateway-board\cmake-build-debug-mingw
--- The C compiler identification is GNU 10.3.1
--- The CXX compiler identification is GNU 10.3.1
--- The ASM compiler identification is GNU
--- Found assembler: D:/clion/10.2021.10/bin/arm-none-eabi-gcc.exe
--- Detecting C compiler ABI info
--- Detecting C compiler ABI info - done
--- Check for working C compiler: D:/clion/10.2021.10/bin/arm-none-eabi-gcc.exe - skipped
--- Detecting C compile features
--- Detecting C compile features - done
--- Detecting CXX compiler ABI info
--- Detecting CXX compiler ABI info - done
--- Check for working CXX compiler: D:/clion/10.2021.10/bin/arm-none-eabi-g++.exe - skipped
--- Detecting CXX compile features
--- Detecting CXX compile features - done
+"D:\clion\CLion 2024.1.4\bin\cmake\win\x64\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_MAKE_PROGRAM=D:/clion/CLion 2024.1.4/bin/ninja/win/x64/ninja.exe" -G Ninja -S C:\Users\DELL\Desktop\gmv-gateway-board -B C:\Users\DELL\Desktop\gmv-gateway-board\cmake-build-debug-mingw
 -- Minimal optimization, debug info included
--- Configuring done (6.8s)
+-- Configuring done (0.6s)
 -- Generating done (0.0s)
--- Build files have been written to: C:/Users/DELL/CLionProjects/gmv-gateway-board/cmake-build-debug-mingw
+-- Build files have been written to: C:/Users/DELL/Desktop/gmv-gateway-board/cmake-build-debug-mingw

BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/ffx_master.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/freertos.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/gpio.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/main.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/mini_gateway_master.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/modbus.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_msp.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_hal_timebase_tim.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/stm32f1xx_it.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/syscalls.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/sysmem.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/system_stm32f1xx.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Src/usart.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Core/Startup/startup_stm32f103rctx.s.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/croutine.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/list.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c.obj


BIN
cmake-build-debug-mingw/CMakeFiles/gmv-gateway-board.elf.dir/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c.obj


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików