diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fd00045 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2024 Veles Labs s.r.o. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/modbus.c b/modbus.c index 1b03d13..938cc98 100644 --- a/modbus.c +++ b/modbus.c @@ -1,8 +1,34 @@ /* - * modbus.c + * File: modbus.c + * Description: MODBUS RTU library + * Author: Jan Mrna + * Date: 2021-07-18 + * + * Modbus slave RTU library (does NOT support ASCII and TCP) + * + * Note that byte order is big endian. + * + * + * Copyright (c) 2024 Veles Labs s.r.o. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Created on: Jul 18, 2021 - * Author: user */ #include "modbus.h" diff --git a/modbus.h b/modbus.h index ff01f65..a619591 100644 --- a/modbus.h +++ b/modbus.h @@ -1,37 +1,33 @@ /* - * modbus.h + * File: modbus.h + * Description: MODBUS RTU library + * Author: Jan Mrna + * Date: 2021-07-18 * - * Created on: Jul 18, 2021 - * Author: user + * Modbus slave RTU library (does NOT support ASCII and TCP) * - * Modbus slave RTU library (does NOT support ASCII and TCP) + * Note that byte order is big endian. * - * Useful links: - * https://www.picotech.com/library/oscilloscopes/modbus-serial-protocol-decoding - * https://ipc2u.com/articles/knowledge-base/modbus-rtu-made-simple-with-detailed-descriptions-and-examples/ - * https://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf - * https://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf * - * Note that byte order is big endian. + * Copyright (c) 2024 Veles Labs s.r.o. * - * USAGE: + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * 1) Implement functions modbus_callback_function() and modbus_uart_transmit_function() - * - modbus_uart_transmit_function() sends data via UART - * - modbus_callback_function() does the real work: read sensors, set outputs... - * note that when filling buffers (e.g. input_registers[]) user must - * ensure that all data is big-endian - * These functions are implementation-specific. - * 2) Set device address (variable modbus_device_address); you can do this either - * - setting modbus_device_address directly (modbus.h needs to be included, duh) - * - using modbus_set_device_address(uint8_t address) function - * Or you can leave address as-is (MODBUS_DEFAULT_SLAVE_ADDRESS) and set it via - * Modbus during runtime - * 3) Call modbus_process_msg() after message reception; you need to observe Modbus RTU timing: - * - pauses between chars in frame are less or equal to 1.5 char - * - pauses between frames are at least 3.5 chars (of silence) - * For more information see section 2.5.1.1 (MODBUS Message RTU Framing) - * in "MODBUS over Serial Line: Specification and Implementation Guide" + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */