Skip to content

Commit 2daee2a

Browse files
committed
Adds support for device type in Platform DB
1 parent fcfc075 commit 2daee2a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

mbed_lstools/platform_database.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@
4747
u'0003': u'LPC2368',
4848
u'0004': u'LPC2368',
4949
u'0005': u'LPC2368',
50-
u'0006': u'LPC2368',
50+
u'0006': {
51+
u'default': 'daplink',
52+
u'devices': {
53+
u'daplink': u'LPC2368',
54+
u'jlink': u'NRF52_DK'
55+
}
56+
},
5157
u'0007': u'LPC2368',
5258
u'0100': u'LPC2368',
5359
u'0183': u'UBLOX_C027',
@@ -335,12 +341,18 @@ def items(self):
335341
def all_ids(self):
336342
return iter(self._keys)
337343

338-
def get(self, index, default=None):
344+
def get(self, index, default=None, device_type=None):
339345
"""Standard lookup function. Works exactly like a dict"""
340346
for db in self._dbs.values():
341347
maybe_answer = db.get(index, None)
342348
if maybe_answer:
343-
return maybe_answer
349+
if isinstance(maybe_answer, dict):
350+
if device_type is None:
351+
device_type = maybe_answer['default']
352+
353+
return maybe_answer['devices'][device_type]
354+
else:
355+
return maybe_answer
344356

345357
return default
346358

0 commit comments

Comments
 (0)