modbus_tcp
Make the tcp_pcb a global static variable
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
char registers[MAX_REG];
|
||||
static char* TAG = "Modbus_TCP"; // Tag used in logs
|
||||
|
||||
static struct tcp_pcb* modbus_pcb;
|
||||
|
||||
// Functions
|
||||
static err_t modbus_incoming_data(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err);
|
||||
static err_t modbus_accept(void* arg, struct tcp_pcb* pcb, err_t err);
|
||||
@@ -162,7 +164,6 @@ static err_t modbus_accept(void* arg, struct tcp_pcb* pcb, err_t err) {
|
||||
* @brief Initializes the modbus tcp
|
||||
*/
|
||||
void modbus_init(void) {
|
||||
struct tcp_pcb* modbus_pcb;
|
||||
LOG_INFO(TAG, "Initializing\n");
|
||||
modbus_pcb = tcp_new(); // Creating a new tcp pcb
|
||||
tcp_bind(modbus_pcb, IP_ADDR_ANY, MODBUSPORT); // Bind the modbus_pcb to port 502
|
||||
|
||||
Reference in New Issue
Block a user