summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/lcd/hd44780.c2
-rw-r--r--drivers/painter/gc9a01/qp_gc9a01.c1
-rw-r--r--drivers/painter/generic/qp_rgb565_surface.c7
-rw-r--r--drivers/painter/ili9xxx/qp_ili9163.c1
-rw-r--r--drivers/painter/ili9xxx/qp_ili9341.c1
-rw-r--r--drivers/painter/ili9xxx/qp_ili9488.c1
-rw-r--r--drivers/painter/ssd1351/qp_ssd1351.c1
-rw-r--r--drivers/painter/st77xx/qp_st7735.c1
-rw-r--r--drivers/painter/st77xx/qp_st7789.c1
-rw-r--r--drivers/painter/tft_panel/qp_tft_panel.c5
-rw-r--r--drivers/painter/tft_panel/qp_tft_panel.h2
-rw-r--r--drivers/sensors/adns5050.h1
-rw-r--r--drivers/sensors/adns9800.c2
-rw-r--r--drivers/sensors/cirque_pinnacle.c2
-rw-r--r--drivers/sensors/pmw3360.c2
-rw-r--r--drivers/sensors/pmw3389.c2
-rw-r--r--drivers/sensors/pmw33xx_common.c8
-rw-r--r--drivers/sensors/pmw33xx_common.h16
-rw-r--r--drivers/usb2422.c8
19 files changed, 50 insertions, 14 deletions
diff --git a/drivers/lcd/hd44780.c b/drivers/lcd/hd44780.c
index c988ebe56c..ccc50117ab 100644
--- a/drivers/lcd/hd44780.c
+++ b/drivers/lcd/hd44780.c
@@ -158,7 +158,7 @@ void hd44780_on(bool cursor, bool blink) {
}
}
-void hd44780_off() {
+void hd44780_off(void) {
hd44780_command(HD44780_CMD_DISPLAY);
}
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/adns5050.h b/drivers/sensors/adns5050.h
index f20c2f74bc..8ef0f7cc7c 100644
--- a/drivers/sensors/adns5050.h
+++ b/drivers/sensors/adns5050.h
@@ -20,6 +20,7 @@
#pragma once
#include <stdbool.h>
+#include <stdint.h>
// CPI values
// clang-format off
diff --git a/drivers/sensors/adns9800.c b/drivers/sensors/adns9800.c
index 3633f23e52..083ab34d9f 100644
--- a/drivers/sensors/adns9800.c
+++ b/drivers/sensors/adns9800.c
@@ -99,7 +99,7 @@ uint8_t adns9800_read(uint8_t reg_addr) {
return data;
}
-void adns9800_init() {
+void adns9800_init(void) {
setPinOutput(ADNS9800_CS_PIN);
spi_init();
diff --git a/drivers/sensors/cirque_pinnacle.c b/drivers/sensors/cirque_pinnacle.c
index 4aed5fe67a..3131805c20 100644
--- a/drivers/sensors/cirque_pinnacle.c
+++ b/drivers/sensors/cirque_pinnacle.c
@@ -87,7 +87,7 @@ void cirque_pinnacle_scale_data(pinnacle_data_t* coordinates, uint16_t xResoluti
}
// Clears Status1 register flags (SW_CC and SW_DR)
-void cirque_pinnacle_clear_flags() {
+void cirque_pinnacle_clear_flags(void) {
RAP_Write(HOSTREG__STATUS1, HOSTREG__STATUS1_DEFVAL & ~(HOSTREG__STATUS1__COMMAND_COMPLETE | HOSTREG__STATUS1__DATA_READY));
wait_us(50);
}
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.
diff --git a/drivers/usb2422.c b/drivers/usb2422.c
index 8ee54b24ee..1d33b5acf8 100644
--- a/drivers/usb2422.c
+++ b/drivers/usb2422.c
@@ -344,7 +344,7 @@ static void USB2422_write_block(void) {
// ***************************************************************
-void USB2422_init() {
+void USB2422_init(void) {
#ifdef USB2422_RESET_PIN
setPinOutput(USB2422_RESET_PIN);
#endif
@@ -355,7 +355,7 @@ void USB2422_init() {
i2c_init(); // IC2 clk must be high at USB2422 reset release time to signal SMB configuration
}
-void USB2422_configure() {
+void USB2422_configure(void) {
static const char SERNAME[] = "Unavailable";
memset(&config, 0, sizeof(Usb2422_t));
@@ -385,7 +385,7 @@ void USB2422_configure() {
USB2422_write_block();
}
-void USB2422_reset() {
+void USB2422_reset(void) {
#ifdef USB2422_RESET_PIN
writePinLow(USB2422_RESET_PIN);
wait_us(2);
@@ -393,7 +393,7 @@ void USB2422_reset() {
#endif
}
-bool USB2422_active() {
+bool USB2422_active(void) {
#ifdef USB2422_ACTIVE_PIN
return readPin(USB2422_ACTIVE_PIN);
#else