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 #include "esp_err.h" // for esp_err_t 17 #include "esp_modbus_slave.h" // for public slave defines 18 #include "mbc_tcp_slave.h" // for public interface defines 19 20 /** 21 * Initialization of Modbus TCP Slave controller 22 */ mbc_slave_init_tcp(void ** handler)23esp_err_t mbc_slave_init_tcp(void** handler) 24 { 25 void* port_handler = NULL; 26 esp_err_t error = mbc_tcp_slave_create(&port_handler); 27 28 if ((port_handler != NULL) && (error == ESP_OK)) { 29 mbc_slave_init_iface(port_handler); 30 *handler = port_handler; 31 } 32 return error; 33 } 34