From 90ae33e487c28ae8836c128f178f42a8e31fd0b7 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Thu, 17 Jul 2025 22:41:45 -0400 Subject: [PATCH] Macro the serial port part of mouse config --- src/device/mouse_serial.c | 91 ++++++++++----------------------------- 1 file changed, 23 insertions(+), 68 deletions(-) diff --git a/src/device/mouse_serial.c b/src/device/mouse_serial.c index a664e35bd..ad75cb0aa 100644 --- a/src/device/mouse_serial.c +++ b/src/device/mouse_serial.c @@ -943,25 +943,28 @@ sermouse_init(const device_t *info) return dev; } +#define SERMOUSE_PORT_CONFIG_COMMON \ + { \ + .name = "port", \ + .description = "Serial Port", \ + .type = CONFIG_SELECTION, \ + .default_string = NULL, \ + .default_int = 0, \ + .file_filter = NULL, \ + .spinner = { 0 }, \ + .selection = { \ + { .description = "COM1", .value = 0 }, \ + { .description = "COM2", .value = 1 }, \ + { .description = "COM3", .value = 2 }, \ + { .description = "COM4", .value = 3 }, \ + { .description = "" } \ + }, \ + .bios = { { 0 } } \ + } + static const device_config_t msssermouse_config[] = { // clang-format off - { - .name = "port", - .description = "Serial Port", - .type = CONFIG_SELECTION, - .default_string = NULL, - .default_int = 0, - .file_filter = NULL, - .spinner = { 0 }, - .selection = { - { .description = "COM1", .value = 0 }, - { .description = "COM2", .value = 1 }, - { .description = "COM3", .value = 2 }, - { .description = "COM4", .value = 3 }, - { .description = "" } - }, - .bios = { { 0 } } - }, + SERMOUSE_PORT_CONFIG_COMMON, { .name = "buttons", .description = "Buttons", @@ -1066,23 +1069,7 @@ static const device_config_t mssbusmouse_config[] = { static const device_config_t mssermouse_config[] = { // clang-format off - { - .name = "port", - .description = "Serial Port", - .type = CONFIG_SELECTION, - .default_string = NULL, - .default_int = 0, - .file_filter = NULL, - .spinner = { 0 }, - .selection = { - { .description = "COM1", .value = 0 }, - { .description = "COM2", .value = 1 }, - { .description = "COM3", .value = 2 }, - { .description = "COM4", .value = 3 }, - { .description = "" } - }, - .bios = { { 0 } } - }, + SERMOUSE_PORT_CONFIG_COMMON, { .name = "buttons", .description = "Buttons", @@ -1105,46 +1092,14 @@ static const device_config_t mssermouse_config[] = { static const device_config_t msballpoint_config[] = { // clang-format off - { - .name = "port", - .description = "Serial Port", - .type = CONFIG_SELECTION, - .default_string = NULL, - .default_int = 0, - .file_filter = NULL, - .spinner = { 0 }, - .selection = { - { .description = "COM1", .value = 0 }, - { .description = "COM2", .value = 1 }, - { .description = "COM3", .value = 2 }, - { .description = "COM4", .value = 3 }, - { .description = "" } - }, - .bios = { { 0 } } - }, + SERMOUSE_PORT_CONFIG_COMMON, { .name = "", .description = "", .type = CONFIG_END } // clang-format on }; static const device_config_t ltsermouse_config[] = { // clang-format off - { - .name = "port", - .description = "Serial Port", - .type = CONFIG_SELECTION, - .default_string = NULL, - .default_int = 0, - .file_filter = NULL, - .spinner = { 0 }, - .selection = { - { .description = "COM1", .value = 0 }, - { .description = "COM2", .value = 1 }, - { .description = "COM3", .value = 2 }, - { .description = "COM4", .value = 3 }, - { .description = "" } - }, - .bios = { { 0 } } - }, + SERMOUSE_PORT_CONFIG_COMMON, { .name = "buttons", .description = "Buttons",