24 lines
598 B
Python
Executable file
24 lines
598 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
strings = [["MyManuInfo","Kizarm labs."],["MyProdInfo","USB <=> Serial"],["MySerNumInfo","0123456789"],]
|
|
|
|
def print_string (s):
|
|
name = bytearray (s[1], 'utf-8')
|
|
r = 'const uint8_t {0:s} [] = {{\n '.format (s[0])
|
|
r += '0x{0:02X},0x03,'.format (2 * (len (name) + 1))
|
|
for e in name:
|
|
r += '\'{0:c}\',0,'.format (e)
|
|
r = r[:-1]
|
|
r += '\n};\n'
|
|
return r
|
|
|
|
def print_strings (filename):
|
|
r = ''
|
|
for s in strings: r += print_string (s)
|
|
#print (r)
|
|
f = open (filename, 'w')
|
|
f.write (r)
|
|
f.close
|
|
|
|
if __name__ == "__main__":
|
|
print_strings ('mystrings.inc')
|