diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/painter/gc9a01/qp_gc9a01.c | 1 | ||||
-rw-r--r-- | drivers/painter/generic/qp_rgb565_surface.c | 7 | ||||
-rw-r--r-- | drivers/painter/ili9xxx/qp_ili9163.c | 1 | ||||
-rw-r--r-- | drivers/painter/ili9xxx/qp_ili9341.c | 1 | ||||
-rw-r--r-- | drivers/painter/ili9xxx/qp_ili9488.c | 1 | ||||
-rw-r--r-- | drivers/painter/ssd1351/qp_ssd1351.c | 1 | ||||
-rw-r--r-- | drivers/painter/st77xx/qp_st7735.c | 1 | ||||
-rw-r--r-- | drivers/painter/st77xx/qp_st7789.c | 1 | ||||
-rw-r--r-- | drivers/painter/tft_panel/qp_tft_panel.c | 5 | ||||
-rw-r--r-- | drivers/painter/tft_panel/qp_tft_panel.h | 2 | ||||
-rw-r--r-- | drivers/sensors/pmw3360.c | 2 | ||||
-rw-r--r-- | drivers/sensors/pmw3389.c | 2 | ||||
-rw-r--r-- | drivers/sensors/pmw33xx_common.c | 8 | ||||
-rw-r--r-- | drivers/sensors/pmw33xx_common.h | 16 |
14 files changed, 42 insertions, 7 deletions
diff --git a/drivers/painter/gc9a01/qp_gc9a01.c b/drivers/painter/gc9a01/qp_gc9a01.c index 5bdab1e520..5d079435c6 100644 --- a/drivers/painter/gc9a01/qp_gc9a01.c +++ b/drivers/painter/gc9a01/qp_gc9a01.c @@ -104,6 +104,7 @@ const struct tft_panel_dc_reset_painter_driver_vtable_t gc9a01_driver_vtable = { .viewport = qp_tft_panel_viewport, .palette_convert = qp_tft_panel_palette_convert_rgb565_swapped, .append_pixels = qp_tft_panel_append_pixels_rgb565, + .append_pixdata = qp_tft_panel_append_pixdata, }, .num_window_bytes = 2, .swap_window_coords = false, diff --git a/drivers/painter/generic/qp_rgb565_surface.c b/drivers/painter/generic/qp_rgb565_surface.c index c4de336535..474c86feec 100644 --- a/drivers/painter/generic/qp_rgb565_surface.c +++ b/drivers/painter/generic/qp_rgb565_surface.c @@ -164,6 +164,12 @@ static bool qp_rgb565_surface_append_pixels_rgb565(painter_device_t device, uint return true; } +// Append data to the target location +static bool qp_rgb565_surface_append_pixdata(painter_device_t device, uint8_t *target_buffer, uint32_t pixdata_offset, uint8_t pixdata_byte) { + target_buffer[pixdata_offset] = pixdata_byte; + return true; +} + const struct painter_driver_vtable_t rgb565_surface_driver_vtable = { .init = qp_rgb565_surface_init, .power = qp_rgb565_surface_power, @@ -173,6 +179,7 @@ const struct painter_driver_vtable_t rgb565_surface_driver_vtable = { .viewport = qp_rgb565_surface_viewport, .palette_convert = qp_rgb565_surface_palette_convert_rgb565_swapped, .append_pixels = qp_rgb565_surface_append_pixels_rgb565, + .append_pixdata = qp_rgb565_surface_append_pixdata, }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/drivers/painter/ili9xxx/qp_ili9163.c b/drivers/painter/ili9xxx/qp_ili9163.c index 8bb01d12e0..af37686631 100644 --- a/drivers/painter/ili9xxx/qp_ili9163.c +++ b/drivers/painter/ili9xxx/qp_ili9163.c @@ -69,6 +69,7 @@ const struct tft_panel_dc_reset_painter_driver_vtable_t ili9163_driver_vtable = .viewport = qp_tft_panel_viewport, .palette_convert = qp_tft_panel_palette_convert_rgb565_swapped, .append_pixels = qp_tft_panel_append_pixels_rgb565, + .append_pixdata = qp_tft_panel_append_pixdata, }, .num_window_bytes = 2, .swap_window_coords = false, diff --git a/drivers/painter/ili9xxx/qp_ili9341.c b/drivers/painter/ili9xxx/qp_ili9341.c index 2a97388316..aca3809912 100644 --- a/drivers/painter/ili9xxx/qp_ili9341.c +++ b/drivers/painter/ili9xxx/qp_ili9341.c @@ -76,6 +76,7 @@ const struct tft_panel_dc_reset_painter_driver_vtable_t ili9341_driver_vtable = .viewport = qp_tft_panel_viewport, .palette_convert = qp_tft_panel_palette_convert_rgb565_swapped, .append_pixels = qp_tft_panel_append_pixels_rgb565, + .append_pixdata = qp_tft_panel_append_pixdata, }, .num_window_bytes = 2, .swap_window_coords = false, diff --git a/drivers/painter/ili9xxx/qp_ili9488.c b/drivers/painter/ili9xxx/qp_ili9488.c index cda9a9be00..e51f0e1d51 100644 --- a/drivers/painter/ili9xxx/qp_ili9488.c +++ b/drivers/painter/ili9xxx/qp_ili9488.c @@ -69,6 +69,7 @@ const struct tft_panel_dc_reset_painter_driver_vtable_t ili9488_driver_vtable = .viewport = qp_tft_panel_viewport, .palette_convert = qp_tft_panel_palette_convert_rgb888, .append_pixels = qp_tft_panel_append_pixels_rgb888, + .append_pixdata = qp_tft_panel_append_pixdata, }, .num_window_bytes = 2, .swap_window_coords = false, diff --git a/drivers/painter/ssd1351/qp_ssd1351.c b/drivers/painter/ssd1351/qp_ssd1351.c index 85146490a0..548785a1bd 100644 --- a/drivers/painter/ssd1351/qp_ssd1351.c +++ b/drivers/painter/ssd1351/qp_ssd1351.c @@ -73,6 +73,7 @@ const struct tft_panel_dc_reset_painter_driver_vtable_t ssd1351_driver_vtable = .viewport = qp_tft_panel_viewport, .palette_convert = qp_tft_panel_palette_convert_rgb565_swapped, .append_pixels = qp_tft_panel_append_pixels_rgb565, + .append_pixdata = qp_tft_panel_append_pixdata, }, .num_window_bytes = 1, .swap_window_coords = true, diff --git a/drivers/painter/st77xx/qp_st7735.c b/drivers/painter/st77xx/qp_st7735.c index 74145e0e4e..7ee5a6b562 100644 --- a/drivers/painter/st77xx/qp_st7735.c +++ b/drivers/painter/st77xx/qp_st7735.c @@ -93,6 +93,7 @@ const struct tft_panel_dc_reset_painter_driver_vtable_t st7735_driver_vtable = { .viewport = qp_tft_panel_viewport, .palette_convert = qp_tft_panel_palette_convert_rgb565_swapped, .append_pixels = qp_tft_panel_append_pixels_rgb565, + .append_pixdata = qp_tft_panel_append_pixdata, }, .num_window_bytes = 2, .swap_window_coords = false, diff --git a/drivers/painter/st77xx/qp_st7789.c b/drivers/painter/st77xx/qp_st7789.c index 905f6bb270..9f474369d6 100644 --- a/drivers/painter/st77xx/qp_st7789.c +++ b/drivers/painter/st77xx/qp_st7789.c @@ -92,6 +92,7 @@ const struct tft_panel_dc_reset_painter_driver_vtable_t st7789_driver_vtable = { .viewport = qp_tft_panel_viewport, .palette_convert = qp_tft_panel_palette_convert_rgb565_swapped, .append_pixels = qp_tft_panel_append_pixels_rgb565, + .append_pixdata = qp_tft_panel_append_pixdata, }, .num_window_bytes = 2, .swap_window_coords = false, diff --git a/drivers/painter/tft_panel/qp_tft_panel.c b/drivers/painter/tft_panel/qp_tft_panel.c index e7c744ab34..4a24cf9953 100644 --- a/drivers/painter/tft_panel/qp_tft_panel.c +++ b/drivers/painter/tft_panel/qp_tft_panel.c @@ -126,3 +126,8 @@ bool qp_tft_panel_append_pixels_rgb888(painter_device_t device, uint8_t *target_ } return true; } + +bool qp_tft_panel_append_pixdata(painter_device_t device, uint8_t *target_buffer, uint32_t pixdata_offset, uint8_t pixdata_byte) { + target_buffer[pixdata_offset] = pixdata_byte; + return true; +} diff --git a/drivers/painter/tft_panel/qp_tft_panel.h b/drivers/painter/tft_panel/qp_tft_panel.h index 3cb015891b..83b8dd5406 100644 --- a/drivers/painter/tft_panel/qp_tft_panel.h +++ b/drivers/painter/tft_panel/qp_tft_panel.h @@ -59,3 +59,5 @@ bool qp_tft_panel_palette_convert_rgb888(painter_device_t device, int16_t palett bool qp_tft_panel_append_pixels_rgb565(painter_device_t device, uint8_t *target_buffer, qp_pixel_t *palette, uint32_t pixel_offset, uint32_t pixel_count, uint8_t *palette_indices); bool qp_tft_panel_append_pixels_rgb888(painter_device_t device, uint8_t *target_buffer, qp_pixel_t *palette, uint32_t pixel_offset, uint32_t pixel_count, uint8_t *palette_indices); + +bool qp_tft_panel_append_pixdata(painter_device_t device, uint8_t *target_buffer, uint32_t pixdata_offset, uint8_t pixdata_byte); diff --git a/drivers/sensors/pmw3360.c b/drivers/sensors/pmw3360.c index 2c6d91d588..81dca002e2 100644 --- a/drivers/sensors/pmw3360.c +++ b/drivers/sensors/pmw3360.c @@ -9,8 +9,6 @@ #include "pmw33xx_common.h" #include "progmem.h" -extern const size_t pmw33xx_number_of_sensors; - uint16_t pmw33xx_get_cpi(uint8_t sensor) { if (sensor >= pmw33xx_number_of_sensors) { return 0; diff --git a/drivers/sensors/pmw3389.c b/drivers/sensors/pmw3389.c index cba94d6c65..c5781a5ffe 100644 --- a/drivers/sensors/pmw3389.c +++ b/drivers/sensors/pmw3389.c @@ -8,8 +8,6 @@ #include "pmw33xx_common.h" #include "progmem.h" -extern const size_t pmw33xx_number_of_sensors; - uint16_t pmw33xx_get_cpi(uint8_t sensor) { if (sensor >= pmw33xx_number_of_sensors) { return 0; diff --git a/drivers/sensors/pmw33xx_common.c b/drivers/sensors/pmw33xx_common.c index b8d4e532ca..82a7ec3297 100644 --- a/drivers/sensors/pmw33xx_common.c +++ b/drivers/sensors/pmw33xx_common.c @@ -1,3 +1,4 @@ +// Copyright 2022 Pablo Martinez (@elpekenin) // Copyright 2022 Daniel Kao (dkao) // Copyright 2022 Stefan Kerkmann (KarlK90) // Copyright 2022 Ulrich Spörlein (@uqs) @@ -17,10 +18,11 @@ extern const uint8_t pmw33xx_firmware_data[PMW33XX_FIRMWARE_LENGTH] PROGMEM; extern const uint8_t pmw33xx_firmware_signature[3] PROGMEM; -static const pin_t cs_pins[] = PMW33XX_CS_PINS; -static bool in_burst[ARRAY_SIZE(cs_pins)] = {0}; +static const pin_t cs_pins_left[] = PMW33XX_CS_PINS; +static const pin_t cs_pins_right[] = PMW33XX_CS_PINS_RIGHT; -const size_t pmw33xx_number_of_sensors = ARRAY_SIZE(cs_pins); +static bool in_burst_left[ARRAY_SIZE(cs_pins_left)] = {0}; +static bool in_burst_right[ARRAY_SIZE(cs_pins_right)] = {0}; bool __attribute__((cold)) pmw33xx_upload_firmware(uint8_t sensor); bool __attribute__((cold)) pmw33xx_check_signature(uint8_t sensor); diff --git a/drivers/sensors/pmw33xx_common.h b/drivers/sensors/pmw33xx_common.h index c725e80f24..88523b8420 100644 --- a/drivers/sensors/pmw33xx_common.h +++ b/drivers/sensors/pmw33xx_common.h @@ -1,3 +1,4 @@ +// Copyright 2022 Pablo Martinez (@elpekenin) // Copyright 2022 Daniel Kao (dkao) // Copyright 2022 Stefan Kerkmann (KarlK90) // Copyright 2022 Ulrich Spörlein (@uqs) @@ -9,6 +10,7 @@ #pragma once +#include "quantum.h" //to get is_keyboard_left #include <stdint.h> #include "spi_master.h" #include "util.h" @@ -79,6 +81,20 @@ _Static_assert(sizeof((pmw33xx_report_t){0}.motion) == 1, "pmw33xx_report_t.moti # endif #endif +// Support single spelling and default to be the same as left side +#if !defined(PMW33XX_CS_PINS_RIGHT) +# if !defined(PMW33XX_CS_PIN_RIGHT) +# define PMW33XX_CS_PIN_RIGHT PMW33XX_CS_PIN +# endif +# define PMW33XX_CS_PINS_RIGHT \ + { PMW33XX_CS_PIN_RIGHT } +#endif + +// Defines so the old variable names are swapped by the appropiate value on each half +#define cs_pins (is_keyboard_left() ? cs_pins_left : cs_pins_right) +#define in_burst (is_keyboard_left() ? in_burst_left : in_burst_right) +#define pmw33xx_number_of_sensors (is_keyboard_left() ? ARRAY_SIZE((pin_t[])PMW33XX_CS_PINS) : ARRAY_SIZE((pin_t[])PMW33XX_CS_PINS_RIGHT)) + #if PMW33XX_CPI > PMW33XX_CPI_MAX || PMW33XX_CPI < PMW33XX_CPI_MIN || (PMW33XX_CPI % PMW33XX_CPI_STEP) != 0U # pragma message "PMW33XX_CPI has to be in the range of " STR(PMW33XX_CPI_MAX) "-" STR(PMW33XX_CPI_MIN) " in increments of " STR(PMW33XX_CPI_STEP) ". But it is " STR(PMW33XX_CPI) "." # error Use correct PMW33XX_CPI value. |