goburrow / serial

Go (golang) serial library for modbus
https://github.com/goburrow/modbus
MIT License
193 stars 90 forks source link

Add support for RS485 ioctl calls in posix builds #9

Closed jonseymour closed 7 years ago

jonseymour commented 7 years ago

In some POSIX environments, particularly Linux, additional ioctl's are required to enable RS485 support in the underlying device drivers. For example, to enable use of a GPIO pin to control the transmit state of a RS485 transceiver.

In this series, we crib the support for RS485 from another golang serial library to add this support to this library.

The support is disabled by default and enabled by setting RS485.Enable = true in the modified Config structure.

This has been tested on a BeagleBone Black Rev C, running Debian 8.7 that had the omap_uart driver (source: tty/serial/omap-serial.c) built in. The hardware was a Mikroe Click RS485 transceiver.

nqv commented 7 years ago

@jonseymour that's awesome. Would you please consider a little thing in your PR:

Thanks

jonseymour commented 7 years ago

@nqv I've made the changes. I am happy to merge these tweaks into the earlier commits with a rebase if you would prefer.

nqv commented 7 years ago

Thank you very much.