Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466

Dependencies:   ssd1331

Committer:
kadonotakashi
Date:
Wed Oct 10 00:33:53 2018 +0000
Revision:
0:8fdf9a60065b
how to make mbed librry

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kadonotakashi 0:8fdf9a60065b 1 from intelhex import IntelHex
kadonotakashi 0:8fdf9a60065b 2 from cStringIO import StringIO
kadonotakashi 0:8fdf9a60065b 3
kadonotakashi 0:8fdf9a60065b 4
kadonotakashi 0:8fdf9a60065b 5 def sections(h):
kadonotakashi 0:8fdf9a60065b 6 start, last_address = None, None
kadonotakashi 0:8fdf9a60065b 7 for a in h.addresses():
kadonotakashi 0:8fdf9a60065b 8 if last_address is None:
kadonotakashi 0:8fdf9a60065b 9 start, last_address = a, a
kadonotakashi 0:8fdf9a60065b 10 continue
kadonotakashi 0:8fdf9a60065b 11
kadonotakashi 0:8fdf9a60065b 12 if a > last_address + 1:
kadonotakashi 0:8fdf9a60065b 13 yield (start, last_address)
kadonotakashi 0:8fdf9a60065b 14 start = a
kadonotakashi 0:8fdf9a60065b 15
kadonotakashi 0:8fdf9a60065b 16 last_address = a
kadonotakashi 0:8fdf9a60065b 17
kadonotakashi 0:8fdf9a60065b 18 if start:
kadonotakashi 0:8fdf9a60065b 19 yield (start, last_address)
kadonotakashi 0:8fdf9a60065b 20
kadonotakashi 0:8fdf9a60065b 21
kadonotakashi 0:8fdf9a60065b 22 def print_sections(h):
kadonotakashi 0:8fdf9a60065b 23 for s in sections(h):
kadonotakashi 0:8fdf9a60065b 24 print "[0x%08X - 0x%08X]" % s
kadonotakashi 0:8fdf9a60065b 25
kadonotakashi 0:8fdf9a60065b 26
kadonotakashi 0:8fdf9a60065b 27 def decode(record):
kadonotakashi 0:8fdf9a60065b 28 h = IntelHex()
kadonotakashi 0:8fdf9a60065b 29 f = StringIO(record)
kadonotakashi 0:8fdf9a60065b 30 h.loadhex(f)
kadonotakashi 0:8fdf9a60065b 31 h.dump()