emelianov / modbus-esp8266

Most complete Modbus library for Arduino. A library that allows your Arduino board to communicate via Modbus protocol, acting as a master, slave or both. Supports network transport (Modbus TCP) and Serial line/RS-485 (Modbus RTU). Supports Modbus TCP Security for ESP8266/ESP32.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

direction pin

hedva92 opened this issue · comments

Hi, could you implement direction control pin to begin? I have a max485 board installed, but I don't have hardware control of the data direction, I need to add the direction control pin attribute to the begin function, which is mapped to the physical port of the microprocessor.

This is already have implemented:

bool begin(SoftwareSerial* port, int16_t txPin=-1, bool direct=true);
bool begin(HardwareSerial* port, int16_t txPin=-1, bool direct=true);
bool begin(Stream* port, int16_t txPin=-1, bool direct=true);

Assing Serial port. txPin controls transmit enable for MAX-485. Pass direct=false if txPin uses inverse logic.

commented

For "txPin", a better name would be "txEnablePin" to describe its function. The TX pin is normally the UART transmit data pin, not an enable pin.
For "direct", a better name would be "txEnableInvert" to describe its function.

Naming changed in 0bc538d. Just txEnableDirect used as using Invert notation will break API.

Agree about "txEnableInvert" would break the API, however, "Direct" is a non-descript name.
The logic alternative would be "txEnableNoninvert"