1 /* Copyright 2018 Espressif Systems (Shanghai) PTE LTD
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14 */
15 
16 //  mbc_tcp_slave.h Modbus controller TCP slave implementation header file
17 
18 #ifndef _MODBUS_TCP_CONTROLLER_SLAVE
19 #define _MODBUS_TCP_CONTROLLER_SLAVE
20 
21 #include <stdint.h>                 // for standard int types definition
22 #include <stddef.h>                 // for NULL and std defines
23 #include "esp_modbus_common.h"      // for common defines
24 
25 /* ----------------------- Defines ------------------------------------------*/
26 
27 #define MB_CONTROLLER_NOTIFY_QUEUE_SIZE     (CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE) // Number of messages in parameter notification queue
28 #define MB_CONTROLLER_NOTIFY_TIMEOUT        (pdMS_TO_TICKS(CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT)) // notification timeout
29 
30 /**
31  * @brief Initialize Modbus controller and stack for TCP slave
32  *
33  * @param[out] handler handler(pointer) to slave data structure
34  * @return
35  *     - ESP_OK   Success
36  *     - ESP_ERR_NO_MEM Parameter error
37  */
38 esp_err_t mbc_tcp_slave_create(void** handler);
39 
40 #endif // _MODBUS_TCP_CONTROLLER_SLAVE
41