Enables support for custom function codes. Modbus specification allows
vendor specific function codes in the range 65-72 & 100-110 [1] and this
feature allows users to implement custom logic for those codes.
Additionally, since the Zephyr Modbus stack doesn't implement all defined
Modbus fcs this feature allows users to add support for codes outside the
basic register reading / writing functionality offered by Zephyr.
Custom function codes can be added on a per-interface basis and the handler
structures are allocated by the caller.
[1]: https://modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf
Signed-off-by: Henrik Lindblom <henrik.lindblom@vaisala.com>
Allow to periodically initializes/disables the modbus interface.
Switch from modbus line discipline to serial and switch back to modbus.
This can be required when the serial is shared by two sensors
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
add user data for adu callback, which helps in passing
socket and relevant application parameters.
Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Although it is possible to simply use the interface number,
it has proven convenient to use the names for the interfaces
in the samples.
Migrate to DEVICE_DT_NAME().
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
In order to bring consistency in-tree, migrate all subsystems code to
the new prefix <zephyr/...>. Note that the conversion has been scripted,
refer to zephyrproject-rtos#45388 for more details.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Added the stop_bits_client parameter to the modbus_serial_param struct.
Being able to configure the number of stop bits for the client
independently from the parity setting, allows to support connecting to
modbus server that do not follow the MODBUS over Serial Line Specification
and Implementation Guide.
Signed-off-by: Constantin Krischke <constantin.krischke@lemonbeat.com>
Signed-off-by: Jan Geldmacher <jan.geldmacher@lemonbeat.com>
Let the core call the modbus_tx_adu() to make
the process more comprehensible.
Move tx-wait-for-rx handling outside of client code.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Prefix internal functions and structs with modbus_.
Use unit_id consistently instead of node_addr.
Fix mbm_ remainder and rename to mbc_.
Rename struct modbus_frame to modbus_adu since
ADU is closer to what the structure represents.
Let the compiler/linker do the job and
remove ifdef around mbc_validate_fc03fp_response().
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>