我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用serial.XON。
def set_output_flow_control(self, enable=True): """\ Manually control flow - when software flow control is enabled. This will do the same as if XON (true) or XOFF (false) are received from the other device and control the transmission accordingly. WARNING: this function is not portable to different platforms! """ if not self._port_handle: raise portNotOpenError if enable: win32.EscapeCommFunction(self._port_handle, win32.SETXON) else: win32.EscapeCommFunction(self._port_handle, win32.SETXOFF)
def set_output_flow_control(self, enable=True): """\ Manually control flow - when software flow control is enabled. This will do the same as if XON (true) or XOFF (false) are received from the other device and control the transmission accordingly. WARNING: this function is not portable to different platforms! """ if not self.is_open: raise portNotOpenError if enable: win32.EscapeCommFunction(self._port_handle, win32.SETXON) else: win32.EscapeCommFunction(self._port_handle, win32.SETXOFF)
def tearDown(self): self.s.reset_output_buffer() self.s.flush() #~ self.s.write(serial.XON) self.s.close() # reopen... some faulty USB-serial adapter make next test fail otherwise... self.s.timeout = 1 self.s.xonxoff = False self.s.open() self.s.read(3000) self.s.close()