| 1 | # modbus_rtu_set_custom_rts |
| 2 | |
| 3 | ## Name |
| 4 | |
| 5 | modbus_rtu_set_custom_rts - set a function to be used for custom RTS implementation |
| 6 | |
| 7 | ## Synopsis |
| 8 | |
| 9 | ```c |
| 10 | int modbus_rtu_set_custom_rts(modbus_t *ctx, void (*set_rts) (modbus_t *ctx, int on)) |
| 11 | ``` |
| 12 | |
| 13 | ## Description |
| 14 | |
| 15 | The `modbus_rtu_set_custom_rts()` function shall set a custom function to be |
| 16 | called when the RTS pin is to be set before and after a transmission. By default |
| 17 | this is set to an internal function that toggles the RTS pin using an ioctl |
| 18 | call. |
| 19 | |
| 20 | Note that this function adheres to the RTS mode, the values `MODBUS_RTU_RTS_UP` or |
| 21 | `MODBUS_RTU_RTS_DOWN` must be used for the function to be called. |
| 22 | |
| 23 | This function can only be used with a context using a RTU backend. |
| 24 | |
| 25 | ## Return value |
| 26 | |
| 27 | The `modbus_rtu_set_custom_rts()` function shall return 0 if successful. |
| 28 | Otherwise it shall return -1 and set errno to one of the values defined below. |
| 29 | |
| 30 | ## Errors |
| 31 | |
| 32 | - *EINVAL*, the libmodbus backend is not RTU. |