From cd94ba031c832266cca609951abc97eb52c90567 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 20 Mar 2023 14:13:53 +1100 Subject: Quantum Painter QoL enhancements -- auto-poweroff, auto-flush, buffer sizing (#20013) --- drivers/painter/gc9a01/qp_gc9a01.c | 7 +++++++ drivers/painter/ili9xxx/qp_ili9163.c | 8 +++++++- drivers/painter/ili9xxx/qp_ili9341.c | 8 +++++++- drivers/painter/ili9xxx/qp_ili9488.c | 8 +++++++- drivers/painter/ssd1351/qp_ssd1351.c | 8 +++++++- drivers/painter/st77xx/qp_st7735.c | 8 +++++++- drivers/painter/st77xx/qp_st7789.c | 8 +++++++- 7 files changed, 49 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/painter/gc9a01/qp_gc9a01.c b/drivers/painter/gc9a01/qp_gc9a01.c index 5d079435c6..56140fa50e 100644 --- a/drivers/painter/gc9a01/qp_gc9a01.c +++ b/drivers/painter/gc9a01/qp_gc9a01.c @@ -1,4 +1,5 @@ // Copyright 2021 Paul Cotter (@gr1mr3aver) +// Copyright 2023 Nick Brassel (@tzarc) // SPDX-License-Identifier: GPL-2.0-or-later #include @@ -141,6 +142,12 @@ painter_device_t qp_gc9a01_make_spi_device(uint16_t panel_width, uint16_t panel_ driver->spi_dc_reset_config.spi_config.mode = spi_mode; driver->spi_dc_reset_config.dc_pin = dc_pin; driver->spi_dc_reset_config.reset_pin = reset_pin; + + if (!qp_internal_register_device((painter_device_t)driver)) { + memset(driver, 0, sizeof(tft_panel_dc_reset_painter_device_t)); + return NULL; + } + return (painter_device_t)driver; } } diff --git a/drivers/painter/ili9xxx/qp_ili9163.c b/drivers/painter/ili9xxx/qp_ili9163.c index af37686631..917650953d 100644 --- a/drivers/painter/ili9xxx/qp_ili9163.c +++ b/drivers/painter/ili9xxx/qp_ili9163.c @@ -1,4 +1,4 @@ -// Copyright 2021 Nick Brassel (@tzarc) +// Copyright 2021-2023 Nick Brassel (@tzarc) // SPDX-License-Identifier: GPL-2.0-or-later #include "qp_internal.h" @@ -110,6 +110,12 @@ painter_device_t qp_ili9163_make_spi_device(uint16_t panel_width, uint16_t panel driver->spi_dc_reset_config.spi_config.mode = spi_mode; driver->spi_dc_reset_config.dc_pin = dc_pin; driver->spi_dc_reset_config.reset_pin = reset_pin; + + if (!qp_internal_register_device((painter_device_t)driver)) { + memset(driver, 0, sizeof(tft_panel_dc_reset_painter_device_t)); + return NULL; + } + return (painter_device_t)driver; } } diff --git a/drivers/painter/ili9xxx/qp_ili9341.c b/drivers/painter/ili9xxx/qp_ili9341.c index aca3809912..ed6766666c 100644 --- a/drivers/painter/ili9xxx/qp_ili9341.c +++ b/drivers/painter/ili9xxx/qp_ili9341.c @@ -1,4 +1,4 @@ -// Copyright 2021 Nick Brassel (@tzarc) +// Copyright 2021-2023 Nick Brassel (@tzarc) // SPDX-License-Identifier: GPL-2.0-or-later #include "qp_internal.h" @@ -117,6 +117,12 @@ painter_device_t qp_ili9341_make_spi_device(uint16_t panel_width, uint16_t panel driver->spi_dc_reset_config.spi_config.mode = spi_mode; driver->spi_dc_reset_config.dc_pin = dc_pin; driver->spi_dc_reset_config.reset_pin = reset_pin; + + if (!qp_internal_register_device((painter_device_t)driver)) { + memset(driver, 0, sizeof(tft_panel_dc_reset_painter_device_t)); + return NULL; + } + return (painter_device_t)driver; } } diff --git a/drivers/painter/ili9xxx/qp_ili9488.c b/drivers/painter/ili9xxx/qp_ili9488.c index e51f0e1d51..3740666583 100644 --- a/drivers/painter/ili9xxx/qp_ili9488.c +++ b/drivers/painter/ili9xxx/qp_ili9488.c @@ -1,4 +1,4 @@ -// Copyright 2021 Nick Brassel (@tzarc) +// Copyright 2021-2023 Nick Brassel (@tzarc) // SPDX-License-Identifier: GPL-2.0-or-later #include "qp_internal.h" @@ -110,6 +110,12 @@ painter_device_t qp_ili9488_make_spi_device(uint16_t panel_width, uint16_t panel driver->spi_dc_reset_config.spi_config.mode = spi_mode; driver->spi_dc_reset_config.dc_pin = dc_pin; driver->spi_dc_reset_config.reset_pin = reset_pin; + + if (!qp_internal_register_device((painter_device_t)driver)) { + memset(driver, 0, sizeof(tft_panel_dc_reset_painter_device_t)); + return NULL; + } + return (painter_device_t)driver; } } diff --git a/drivers/painter/ssd1351/qp_ssd1351.c b/drivers/painter/ssd1351/qp_ssd1351.c index 548785a1bd..7ee249752b 100644 --- a/drivers/painter/ssd1351/qp_ssd1351.c +++ b/drivers/painter/ssd1351/qp_ssd1351.c @@ -1,4 +1,4 @@ -// Copyright 2021 Nick Brassel (@tzarc) +// Copyright 2021-2023 Nick Brassel (@tzarc) // SPDX-License-Identifier: GPL-2.0-or-later #include "qp_internal.h" @@ -114,6 +114,12 @@ painter_device_t qp_ssd1351_make_spi_device(uint16_t panel_width, uint16_t panel driver->spi_dc_reset_config.spi_config.mode = spi_mode; driver->spi_dc_reset_config.dc_pin = dc_pin; driver->spi_dc_reset_config.reset_pin = reset_pin; + + if (!qp_internal_register_device((painter_device_t)driver)) { + memset(driver, 0, sizeof(tft_panel_dc_reset_painter_device_t)); + return NULL; + } + return (painter_device_t)driver; } } diff --git a/drivers/painter/st77xx/qp_st7735.c b/drivers/painter/st77xx/qp_st7735.c index 7ee5a6b562..1fd8f42186 100644 --- a/drivers/painter/st77xx/qp_st7735.c +++ b/drivers/painter/st77xx/qp_st7735.c @@ -1,5 +1,5 @@ // Copyright 2021 Paul Cotter (@gr1mr3aver) -// Copyright 2021 Nick Brassel (@tzarc) +// Copyright 2021-2023 Nick Brassel (@tzarc) // Copyright 2022 David Hoelscher (@customMK) // SPDX-License-Identifier: GPL-2.0-or-later @@ -134,6 +134,12 @@ painter_device_t qp_st7735_make_spi_device(uint16_t panel_width, uint16_t panel_ driver->spi_dc_reset_config.spi_config.mode = spi_mode; driver->spi_dc_reset_config.dc_pin = dc_pin; driver->spi_dc_reset_config.reset_pin = reset_pin; + + if (!qp_internal_register_device((painter_device_t)driver)) { + memset(driver, 0, sizeof(tft_panel_dc_reset_painter_device_t)); + return NULL; + } + return (painter_device_t)driver; } } diff --git a/drivers/painter/st77xx/qp_st7789.c b/drivers/painter/st77xx/qp_st7789.c index 9f474369d6..df43437733 100644 --- a/drivers/painter/st77xx/qp_st7789.c +++ b/drivers/painter/st77xx/qp_st7789.c @@ -1,5 +1,5 @@ // Copyright 2021 Paul Cotter (@gr1mr3aver) -// Copyright 2021 Nick Brassel (@tzarc) +// Copyright 2021-2023 Nick Brassel (@tzarc) // SPDX-License-Identifier: GPL-2.0-or-later #include "qp_internal.h" @@ -133,6 +133,12 @@ painter_device_t qp_st7789_make_spi_device(uint16_t panel_width, uint16_t panel_ driver->spi_dc_reset_config.spi_config.mode = spi_mode; driver->spi_dc_reset_config.dc_pin = dc_pin; driver->spi_dc_reset_config.reset_pin = reset_pin; + + if (!qp_internal_register_device((painter_device_t)driver)) { + memset(driver, 0, sizeof(tft_panel_dc_reset_painter_device_t)); + return NULL; + } + return (painter_device_t)driver; } } -- cgit v1.2.3