Merge pull request #3292 from jepler/allocate_display_bus_bug

allocate_display_bus: fix bug where in-use bus would be returned
This commit is contained in:
Scott Shawcroft 2020-08-21 11:19:50 -07:00 committed by GitHub
commit 5771be9510
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -394,8 +394,8 @@ primary_display_t *allocate_display_or_raise(void) {
}
primary_display_t *allocate_display_bus(void) {
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
mp_const_obj_t display_type = displays[i].display.base.type;
if (display_type == NULL || display_type == &mp_type_NoneType) {
mp_const_obj_t display_bus_type = displays[i].bus_base.type;
if (display_bus_type == NULL || display_bus_type == &mp_type_NoneType) {
return &displays[i];
}
}