modbus: stop bits can now be set individually in client mode
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>
This commit is contained in:
parent
0d9c1c2516
commit
8ee675946c
5 changed files with 31 additions and 2 deletions
|
@ -238,6 +238,8 @@ int modbus_init_server(const int iface, struct modbus_iface_param param)
|
|||
goto init_server_error;
|
||||
}
|
||||
|
||||
ctx->client = false;
|
||||
|
||||
switch (param.mode) {
|
||||
case MODBUS_MODE_RTU:
|
||||
case MODBUS_MODE_ASCII:
|
||||
|
@ -262,7 +264,6 @@ int modbus_init_server(const int iface, struct modbus_iface_param param)
|
|||
goto init_server_error;
|
||||
}
|
||||
|
||||
ctx->client = false;
|
||||
ctx->unit_id = param.server.unit_id;
|
||||
ctx->mbs_user_cb = param.server.user_cb;
|
||||
if (IS_ENABLED(CONFIG_MODBUS_FC08_DIAGNOSTIC)) {
|
||||
|
@ -298,6 +299,8 @@ int modbus_init_client(const int iface, struct modbus_iface_param param)
|
|||
goto init_client_error;
|
||||
}
|
||||
|
||||
ctx->client = true;
|
||||
|
||||
switch (param.mode) {
|
||||
case MODBUS_MODE_RTU:
|
||||
case MODBUS_MODE_ASCII:
|
||||
|
@ -322,7 +325,6 @@ int modbus_init_client(const int iface, struct modbus_iface_param param)
|
|||
goto init_client_error;
|
||||
}
|
||||
|
||||
ctx->client = true;
|
||||
ctx->unit_id = 0;
|
||||
ctx->mbs_user_cb = NULL;
|
||||
ctx->rxwait_to = param.rx_timeout;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue