MODBUS_RTU_SET_CUSTO(3)
β¨ modbus_rtu_set_custom_rts β¨
okay bestie, so this one lives in the libmodbus Manual, section 3, and it's literally all about making the RTS pin do your bidding. π
πΈ NAME πΈ
modbus_rtu_set_custom_rts β set a function to be used for custom RTS implementation
π SYNOPSIS π
int modbus_rtu_set_custom_rts(modbus_t *ctx, void (set_rts) (modbus_t ctx, int on))
π¦ DESCRIPTION π¦
so the modbus_rtu_set_custom_rts() function shall set a custom function to be called when the RTS pin is to be set before and after a transmission. by default this is set to an internal function that toggles the RTS pin using an ioctl call. no cap, that's the factory vibe. β¨
β οΈ note that this function adheres to the RTS mode, the valuesMODBUS_RTU_RTS_UPorMODBUS_RTU_RTS_DOWNmust be used for the function to be called. like, your custom function literally will not get called without one of those, so don't come crying to me. π
and this function can only be used with a context using a RTU backend. that's the whole rule. π«Ά
π RETURN VALUE π
the modbus_rtu_set_custom_rts() function shall return 0 if successful. π
otherwise it shall return -1 and set errno to one of the values defined below. π
π ERRORS π
EINVALβ the libmodbus backend is not RTU. π
π AUTHORS π
Jimmy BergstrΓΆm <jimmy@ekontroll.com> π§
the libmodbus documentation was written by StΓ©phane Raimbault <stephane.raimbault@gmail.com> πΈ
and that's the whole page, bestie β libmodbus v3.1.6, dated 11/17/2025. go forth and toggle those pins responsibly π β¨π¦
π¦ where this page comes from
- debian bookworm: libmodbus-dev 3.1.6-2.1+deb12u1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms