- Requires the pywinusb (https://pypi.python.org/pypi/pywinusb/) and
- IntelHex (http://bialix.com/intelhex/) libraries.
+ Requires the hidapi (https://pypi.python.org/pypi/hidapi) and
+ IntelHex (https://pypi.python.org/pypi/IntelHex) libraries.
device_info_map = dict()
device_info_map['at90usb1287'] = {'page_size': 256, 'flash_kb': 128}
device_info_map['at90usb1286'] = {'page_size': 256, 'flash_kb': 128}
device_info_map = dict()
device_info_map['at90usb1287'] = {'page_size': 256, 'flash_kb': 128}
device_info_map['at90usb1286'] = {'page_size': 256, 'flash_kb': 128}
-device_info_map['at90usb647'] = {'page_size': 256, 'flash_kb': 64}
-device_info_map['at90usb646'] = {'page_size': 256, 'flash_kb': 64}
-device_info_map['atmega32u4'] = {'page_size': 128, 'flash_kb': 32}
-device_info_map['atmega32u2'] = {'page_size': 128, 'flash_kb': 32}
-device_info_map['atmega16u4'] = {'page_size': 128, 'flash_kb': 16}
-device_info_map['atmega16u2'] = {'page_size': 128, 'flash_kb': 16}
-device_info_map['at90usb162'] = {'page_size': 128, 'flash_kb': 16}
-device_info_map['atmega8u2'] = {'page_size': 128, 'flash_kb': 8}
-device_info_map['at90usb82'] = {'page_size': 128, 'flash_kb': 8}
+device_info_map['at90usb647'] = {'page_size': 256, 'flash_kb': 64}
+device_info_map['at90usb646'] = {'page_size': 256, 'flash_kb': 64}
+device_info_map['atmega32u4'] = {'page_size': 128, 'flash_kb': 32}
+device_info_map['atmega32u2'] = {'page_size': 128, 'flash_kb': 32}
+device_info_map['atmega16u4'] = {'page_size': 128, 'flash_kb': 16}
+device_info_map['atmega16u2'] = {'page_size': 128, 'flash_kb': 16}
+device_info_map['at90usb162'] = {'page_size': 128, 'flash_kb': 16}
+device_info_map['atmega8u2'] = {'page_size': 128, 'flash_kb': 8}
+device_info_map['at90usb82'] = {'page_size': 128, 'flash_kb': 8}
def send_page_data(hid_device, address, data):
# Bootloader page data should be the HID Report ID (always zero) followed
# by the starting address to program, then one device's flash page worth
# of data
def send_page_data(hid_device, address, data):
# Bootloader page data should be the HID Report ID (always zero) followed
# by the starting address to program, then one device's flash page worth
# of data
- output_report_data = [0]
- output_report_data.extend([address & 0xFF, address >> 8])
- output_report_data.extend(data)
+ output_report_data = bytearray(65)
+ output_report_data[0] = 0
+ output_report_data[1] = address & 0xFF
+ output_report_data[2] = address >> 8
+ output_report_data[3 : ] = data
# address and convert it to a regular list of bytes
page_data = [hex_data[i] for i in current_page_range]
# address and convert it to a regular list of bytes
page_data = [hex_data[i] for i in current_page_range]
# Devices with more than 64KB of flash should shift down the page
# address so that it is 16-bit (page size is guaranteed to be
# Devices with more than 64KB of flash should shift down the page
# address so that it is 16-bit (page size is guaranteed to be
# Once programming is complete, start the application via a dummy page
# program to the page address 0xFFFF
# Once programming is complete, start the application via a dummy page
# program to the page address 0xFFFF