Skip to content

Commit

Permalink
Fix bug when checking if device has been allocated (qmk#10)
Browse files Browse the repository at this point in the history
* Correctly check if device has been allocated

* Update qp_ili9341.c
  • Loading branch information
M1Sports20 authored and tzarc committed May 10, 2021
1 parent a90ff09 commit c58e522
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion drivers/painter/ili9341/qp_ili9341.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ static ili9xxx_painter_device_t drivers[ILI9341_NUM_DEVICES] = {0};
painter_device_t qp_ili9341_make_device(pin_t chip_select_pin, pin_t data_pin, pin_t reset_pin, uint16_t spi_divisor, bool uses_backlight) {
for (uint32_t i = 0; i < ILI9341_NUM_DEVICES; ++i) {
ili9xxx_painter_device_t *driver = &drivers[i];
memset(driver, 0, sizeof(ili9xxx_painter_device_t));
if (!driver->allocated) {
driver->allocated = true;
driver->qp_driver.init = qp_ili9341_init;
Expand Down
2 changes: 1 addition & 1 deletion drivers/painter/ili9488/qp_ili9488.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ static ili9xxx_painter_device_t drivers[ILI9488_NUM_DEVICES] = {0};
painter_device_t qp_ili9488_make_device(pin_t chip_select_pin, pin_t data_pin, pin_t reset_pin, uint16_t spi_divisor, bool uses_backlight) {
for (uint32_t i = 0; i < ILI9488_NUM_DEVICES; ++i) {
ili9xxx_painter_device_t *driver = &drivers[i];
memset(driver, 0, sizeof(ili9xxx_painter_device_t));
if (!driver->allocated) {
memset(driver, 0, sizeof(ili9xxx_painter_device_t));
driver->allocated = true;
driver->qp_driver.init = qp_ili9488_init;
driver->qp_driver.clear = qp_ili9xxx_clear;
Expand Down

0 comments on commit c58e522

Please sign in to comment.