improve devlib/util.py
This commit is contained in:
@@ -16,5 +16,5 @@ STI_PARAMETER = {
|
||||
'STI_NUM': 10,
|
||||
}
|
||||
|
||||
print_instruction(STI_INSTRUCTION['GLOBAL'], STI_PARAMETER)
|
||||
print_instruction(STI_INSTRUCTION['LOCAL'], STI_PARAMETER)
|
||||
print_instruction(STI_INSTRUCTION['GLOBAL'], STI_PARAMETER, c_style_uint8_array='buf')
|
||||
print_instruction(STI_INSTRUCTION['LOCAL'], STI_PARAMETER, c_style_uint8_array='buf')
|
||||
|
||||
@@ -569,7 +569,10 @@ def eval_instruction(expr: str, context: Dict[str, Any], buffer: Optional[List[i
|
||||
return buffer
|
||||
|
||||
|
||||
def print_instruction(expr: str, context: Dict[str, Any], append_ris_type: bool = True):
|
||||
def print_instruction(expr: str,
|
||||
context: Dict[str, Any],
|
||||
append_ris_type: bool = True,
|
||||
c_style_uint8_array: Optional[str] = None):
|
||||
buffer = []
|
||||
|
||||
eval_instruction(expr, context, buffer)
|
||||
@@ -579,4 +582,8 @@ def print_instruction(expr: str, context: Dict[str, Any], append_ris_type: bool
|
||||
buffer.insert(0, 0x30)
|
||||
buffer.insert(1, length)
|
||||
|
||||
print(hex_line(buffer))
|
||||
if c_style_uint8_array is None:
|
||||
print(hex_line(buffer))
|
||||
else:
|
||||
for i, v in enumerate(buffer):
|
||||
print(c_style_uint8_array, '[%d]' % i, ' = ', '0x%02X' % v, ';', sep='')
|
||||
|
||||
Reference in New Issue
Block a user