bootloader_serial.py 文件源码

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

项目:tockloader 作者: helena-project 项目源码 文件源码
def _change_baud_rate (self, baud_rate):
        '''
        If the bootloader on the board supports it and if it succeeds, try to
        increase the baud rate to make everything faster.
        '''
        pkt = struct.pack('<BI', 0x01, baud_rate)
        success, ret = self._issue_command(self.COMMAND_CHANGE_BAUD_RATE, pkt, True, 0, self.RESPONSE_OK, show_errors=False)

        if success:
            # The bootloader is new enough to support this.
            # Increase the baud rate
            self.sp.baudrate = baud_rate
            # Now confirm that everything is working.
            pkt = struct.pack('<BI', 0x02, baud_rate)
            success, ret = self._issue_command(self.COMMAND_CHANGE_BAUD_RATE, pkt, False, 0, self.RESPONSE_OK, show_errors=False)

            if not success:
                # Something went wrong. Go back to old baud rate
                self.sp.baudrate = 115200
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号