Open fel115 opened 1 year ago
This is the link to the documentation
our custom rts-function should look like the following code. fd_273
and fd_272
are the file-descriptor to our PINs which should be set.
void set_rts_custom(modbus_t *ctx, int on){
if (on){
if (write(fd_272, "1", 1) != 1) {
perror("Error writing to /sys/class/gpio/gpio272/value");
exit(1);
}
if (write(fd_273, "1", 1) != 1) {
perror("Error writing to /sys/class/gpio/gpio273/value");
exit(1);
}
}else{
if (write(fd_272, "0", 1) != 1) {
perror("Error writing to /sys/class/gpio/gpio272/value");
exit(1);
}
if (write(fd_273, "0", 1) != 1) {
perror("Error writing to /sys/class/gpio/gpio273/value");
exit(1);
}
}
}
This works fine in C
, but we would like to use this function also in Rust
I require the activation of 2 pins in the high state during transmission, and in the low state for receiving. To achieve this, I need to utilize the 'rtu_set_custom_rts' function. Alternatively, is there another approach to accomplish the same task?