def write(self, addr, data):
"""
Writes data from the array into the device starting at the given address.
@param int addr: Start address of the memory block to write.
@param sequence data: Data to write. Any type that implements the sequence API (i.e. string, list, bytearray...) is valid as input.
"""
if not self._is_u32(addr):
raise ValueError('The addr parameter must be an unsigned 32-bit value.')
if not self._is_valid_buf(data):
raise ValueError('The data parameter must be a sequence type with at least one item.')
addr = ctypes.c_uint32(addr)
data_len = ctypes.c_uint32(len(data))
data = (ctypes.c_uint8 * data_len.value)(*data)
self.jlink.JLINKARM_WriteMem(addr, data_len, ctypes.byref(data))
评论列表
文章目录