Skip to content

Commit b91cd83

Browse files
committed
qt: implemented get of chip by ID API
1 parent ae4b95e commit b91cd83

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

qt/chip_db.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,18 @@ ChipInfo *getChipInfoByName(char *name)
2929

3030
return 0;
3131
}
32+
33+
ChipInfo *getChipInfoById(uint32_t id)
34+
{
35+
if (id == CHIP_ID_NONE || id >= CHIP_ID_LAST)
36+
return NULL;
37+
38+
return &chipDB[id];
39+
}
40+
41+
uint32_t getChipPageSize(uint32_t id)
42+
{
43+
ChipInfo *info = getChipInfoById(id);
44+
45+
return info ? info->page_size : 0;
46+
}

qt/chip_db.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ typedef struct
2828

2929
uint32_t getChipDB(ChipInfo *&db);
3030
ChipInfo *getChipInfoByName(char *name);
31+
ChipInfo *getChipInfoById(uint32_t id);
32+
uint32_t getChipPageSize(uint32_t id);
3133

3234
#endif // CHIP_DB_H
3335

0 commit comments

Comments
 (0)