def flash(self, firmware_path=None): """ Flash the given firmware on Leonardo node :param firmware_path: Path to the firmware to be flashed on `node`. If None, flash 'idle' firmware """ if AvrDude.trigger_bootloader(self.TTY, self.TTY_PROG, timeout=15): LOGGER.error("FLASH : Leonardo's jtag port not available") return 1 ret_val = 0 firmware_path = firmware_path or self.FW_IDLE LOGGER.info('Flash firmware on Leonardo: %s', firmware_path) ret_val += self.avrdude.flash(firmware_path) ret_val += common.wait_tty(self.TTY, LOGGER, self.TTY_RESTORE_TIME) return ret_val
def flash(self, firmware_path=None, binary=False, offset=0): """ Flash the given firmware on Leonardo node :param firmware_path: Path to the firmware to be flashed on `node`. If None, flash 'idle' firmware :param binary: whether to flash a binary file :param offset: at which offset to flash the binary file """ if AvrDude.trigger_bootloader(self.TTY, self.TTY_PROG, timeout=15): LOGGER.error("FLASH : Leonardo's jtag port not available") return 1 if binary: LOGGER.error('FLASH: binary mode not supported with Leonardo') return 1 if offset != 0: LOGGER.error('FLASH: flash offset is not supported with Leonardo') return 1 ret_val = 0 firmware_path = firmware_path or self.FW_IDLE LOGGER.info('Flash firmware on Leonardo: %s', firmware_path) ret_val += self.avrdude.flash(firmware_path) ret_val += common.wait_tty(self.TTY, LOGGER, self.TTY_RESTORE_TIME) return ret_val
def reset(self): """ Reset the Leonardo node using jtag """ ret_val = 0 ret_val += AvrDude.trigger_bootloader(self.TTY, self.TTY_PROG) ret_val += common.wait_tty(self.TTY, LOGGER, self.TTY_RESTORE_TIME) return ret_val