o ^ @sFdZddlmZddlZddlZGdddeZGdddejZdS)zThe settings for RS485 are stored in a dedicated object that can be applied to serial ports (where supported). NOTE: Some implementations may only support a subset of the settings. )absolute_importNc@s eZdZ     dddZdS) RS485SettingsTFNcCs"||_||_||_||_||_dSN)rts_level_for_txrts_level_for_rxloopbackdelay_before_txdelay_before_rx)selfrrrrr r ./usr/lib/python3/dist-packages/serial/rs485.py__init__s  zRS485Settings.__init__)TFFNN)__name__ __module__ __qualname__r r r r r rsrcsFeZdZdZfddZfddZeddZejddZZ S) RS485a5 A subclass that replaces the write method with one that toggles RTS according to the RS485 settings. NOTE: This may work unreliably on some serial ports (control signals not synchronized or delayed compared to data). Using delays may be unreliable (varying times, larger than expected) as the OS may not support very fine grained delays (no smaller than in the order of tens of milliseconds). NOTE: Some implementations support this natively. Better performance can be expected when the native version is used. NOTE: The loopback property is ignored by this implementation. The actual behavior depends on the used hardware. Usage: ser = RS485(...) ser.rs485_mode = RS485Settings(...) ser.write(b'hello') cs tt|j|i|d|_dSr)superrr _alternate_rs485_settings)r argskwargs __class__r r r =s zRS485.__init__cs|jdur>||jj|jjdurt|jjtt||tt| |jj dur5t|jj ||jj dStt||dS)z=Write to port, controlling RTS before and after transmitting.N) rsetRTSrrtimesleeprrwriteflushr r)r brr r rAs   z RS485.writecCs|jS)z Enable RS485 mode and apply new settings, set to None to disable. See serial.rs485.RS485Settings for more info about the value. r)r r r r rs485_modeTszRS485.rs485_modecCs ||_dSrr)r rs485_settingsr r r r\s ) rrr__doc__r rpropertyrsetter __classcell__r r rr r%s   r) r! __future__rrserialobjectrSerialrr r r r s