Improve the Modbus TCP server

The 'modbus_tcp.c' file has been extensively rewritten to handle parsing TCP Application Data Units (ADUs), handling incoming Modbus requests, and generating appropriate responses. The modbus tcp server now interacts better with the LWIP TCP functionality, due to better utilization of the callback functions.

temp: modbus refactor
This commit is contained in:
L-diy
2023-11-29 14:04:32 +01:00
committed by Sander Speetjens
parent e5273c7012
commit 4181b98f83
2 changed files with 574 additions and 150 deletions

View File

@@ -1,27 +1,20 @@
/**
* @file modbus_tcp.h
*
* @brief TCP Modbus handler
* @date Nov 6, 2023
* @brief TCP Modbus server
* @date Nov 29, 2023
* @author Obe
* @author Lorenz C.
*/
#ifndef INC_MODBUS_H_
#define INC_MODBUS_H_
#define MODBUSPORT 502 // 502 is the default
#define MODBUS_TCP_PORT 502
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <tcp.h>
#include "lcd_api.h"
#include "llfs.h"
/**
* @fn void modbus_init
* @brief Initializes the modbus tcp
* @brief Initializes the modbus tcp server
*/
void modbus_init(void);
void modbus_tcp_init(void);
#endif /* INC_MODBUS_H_ */