miniterm.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:microbit-serial 作者: martinohanlon 项目源码 文件源码
def reader(self):
        """loop and copy serial->console"""
        try:
            while self.alive and self._reader_alive:
                # read all that is there or wait for one byte
                data = self.serial.read(self.serial.in_waiting or 1)
                if data:
                    if self.raw:
                        self.console.write_bytes(data)
                    else:
                        text = self.rx_decoder.decode(data)
                        for transformation in self.rx_transformations:
                            text = transformation.rx(text)
                        self.console.write(text)
        except serial.SerialException:
            self.alive = False
            # XXX would be nice if the writer could be interrupted at this
            #     point... to exit completely
            raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号