diff --git a/components/freemodbus/port/portevent.c b/components/freemodbus/port/portevent.c index adb5865..229635b 100644 --- a/components/freemodbus/port/portevent.c +++ b/components/freemodbus/port/portevent.c @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause * - * SPDX-FileContributor: 2016-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD */ /* * FreeModbus Libary: ESP32 Port Demo Application @@ -47,7 +47,7 @@ #include "sdkconfig.h" #include "port_serial_slave.h" /* ----------------------- Variables ----------------------------------------*/ -static xQueueHandle xQueueHdl; +static QueueHandle_t xQueueHdl; #define MB_EVENT_QUEUE_SIZE (6) #define MB_EVENT_QUEUE_TIMEOUT (pdMS_TO_TICKS(CONFIG_FMB_EVENT_QUEUE_TIMEOUT)) @@ -113,7 +113,7 @@ xMBPortEventGet(eMBEventType * peEvent) return xEventHappened; } -xQueueHandle +QueueHandle_t xMBPortEventGetHandle(void) { if(xQueueHdl != NULL) diff --git a/components/freemodbus/tcp_slave/port/port_tcp_slave.c b/components/freemodbus/tcp_slave/port/port_tcp_slave.c index 317e2c9..5130e9b 100644 --- a/components/freemodbus/tcp_slave/port/port_tcp_slave.c +++ b/components/freemodbus/tcp_slave/port/port_tcp_slave.c @@ -87,19 +87,19 @@ static void vxMBTCPPortMStoTimeVal(USHORT usTimeoutMs, struct timeval *pxTimeout pxTimeout->tv_usec = (usTimeoutMs - (pxTimeout->tv_sec * 1000)) * 1000; } -static xQueueHandle xMBTCPPortRespQueueCreate(void) +static QueueHandle_t xMBTCPPortRespQueueCreate(void) { - xQueueHandle xRespQueueHandle = xQueueCreate(2, sizeof(void*)); + QueueHandle_t xRespQueueHandle = xQueueCreate(2, sizeof(void*)); MB_PORT_CHECK((xRespQueueHandle != NULL), NULL, "TCP respond queue creation failure."); return xRespQueueHandle; } -static void vMBTCPPortRespQueueDelete(xQueueHandle xRespQueueHandle) +static void vMBTCPPortRespQueueDelete(QueueHandle_t xRespQueueHandle) { vQueueDelete(xRespQueueHandle); } -static void* vxMBTCPPortRespQueueRecv(xQueueHandle xRespQueueHandle) +static void* vxMBTCPPortRespQueueRecv(QueueHandle_t xRespQueueHandle) { void* pvResp = NULL; MB_PORT_CHECK(xRespQueueHandle != NULL, NULL, "Response queue is not initialized."); @@ -111,7 +111,7 @@ static void* vxMBTCPPortRespQueueRecv(xQueueHandle xRespQueueHandle) return pvResp; } -static BOOL vxMBTCPPortRespQueueSend(xQueueHandle xRespQueueHandle, void* pvResp) +static BOOL vxMBTCPPortRespQueueSend(QueueHandle_t xRespQueueHandle, void* pvResp) { MB_PORT_CHECK(xRespQueueHandle != NULL, FALSE, "Response queue is not initialized."); BaseType_t xStatus = xQueueSend(xConfig.xRespQueueHandle, diff --git a/components/freemodbus/tcp_slave/port/port_tcp_slave.h b/components/freemodbus/tcp_slave/port/port_tcp_slave.h index 3a447b0..68a2fe8 100644 --- a/components/freemodbus/tcp_slave/port/port_tcp_slave.h +++ b/components/freemodbus/tcp_slave/port/port_tcp_slave.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-3-Clause * - * SPDX-FileContributor: 2016-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD */ /* * FreeModbus Libary: ESP32 TCP Port @@ -76,7 +76,7 @@ typedef struct { typedef struct { TaskHandle_t xMbTcpTaskHandle; /*!< Server task handle */ - xQueueHandle xRespQueueHandle; /*!< Response queue handle */ + QueueHandle_t xRespQueueHandle; /*!< Response queue handle */ MbClientInfo_t* pxCurClientInfo; /*!< Current client info */ MbClientInfo_t** pxMbClientInfo; /*!< Pointers to information about connected clients */ USHORT usPort; /*!< TCP/UDP port number */ diff --git a/docs/en/api-reference/protocols/modbus.rst b/docs/en/api-reference/protocols/modbus.rst index c646147..6e17cf9 100644 --- a/docs/en/api-reference/protocols/modbus.rst +++ b/docs/en/api-reference/protocols/modbus.rst @@ -559,7 +559,7 @@ Example to get event when holding or input registers accessed in the slave: #define MB_READ_MASK (MB_EVENT_INPUT_REG_RD | MB_EVENT_HOLDING_REG_RD) #define MB_WRITE_MASK (MB_EVENT_HOLDING_REG_WR) #define MB_READ_WRITE_MASK (MB_READ_MASK | MB_WRITE_MASK) - #define MB_PAR_INFO_GET_TOUT (10 / portTICK_RATE_MS) + #define MB_PAR_INFO_GET_TOUT (10 / portTICK_PERIOD_MS) .... // The function blocks while waiting for register access diff --git a/examples/protocols/modbus/serial/mb_master/main/master.c b/examples/protocols/modbus/serial/mb_master/main/master.c index a8a32ef..bbec346 100644 --- a/examples/protocols/modbus/serial/mb_master/main/master.c +++ b/examples/protocols/modbus/serial/mb_master/main/master.c @@ -24,11 +24,11 @@ // Timeout to update cid over Modbus #define UPDATE_CIDS_TIMEOUT_MS (500) -#define UPDATE_CIDS_TIMEOUT_TICS (UPDATE_CIDS_TIMEOUT_MS / portTICK_RATE_MS) +#define UPDATE_CIDS_TIMEOUT_TICS (UPDATE_CIDS_TIMEOUT_MS / portTICK_PERIOD_MS) // Timeout between polls #define POLL_TIMEOUT_MS (1) -#define POLL_TIMEOUT_TICS (POLL_TIMEOUT_MS / portTICK_RATE_MS) +#define POLL_TIMEOUT_TICS (POLL_TIMEOUT_MS / portTICK_PERIOD_MS) // The macro to get offset for parameter in the appropriate structure #define HOLD_OFFSET(field) ((uint16_t)(offsetof(holding_reg_params_t, field) + 1)) diff --git a/examples/protocols/modbus/tcp/mb_tcp_master/main/tcp_master.c b/examples/protocols/modbus/tcp/mb_tcp_master/main/tcp_master.c index a9c858f..748c8c7 100644 --- a/examples/protocols/modbus/tcp/mb_tcp_master/main/tcp_master.c +++ b/examples/protocols/modbus/tcp/mb_tcp_master/main/tcp_master.c @@ -32,11 +32,11 @@ // Timeout to update cid over Modbus #define UPDATE_CIDS_TIMEOUT_MS (500) -#define UPDATE_CIDS_TIMEOUT_TICS (UPDATE_CIDS_TIMEOUT_MS / portTICK_RATE_MS) +#define UPDATE_CIDS_TIMEOUT_TICS (UPDATE_CIDS_TIMEOUT_MS / portTICK_PERIOD_MS) // Timeout between polls #define POLL_TIMEOUT_MS (1) -#define POLL_TIMEOUT_TICS (POLL_TIMEOUT_MS / portTICK_RATE_MS) +#define POLL_TIMEOUT_TICS (POLL_TIMEOUT_MS / portTICK_PERIOD_MS) #define MB_MDNS_PORT (502) // The macro to get offset for parameter in the appropriate structure