summaryrefslogtreecommitdiffstats
path: root/keyboards/bastardkb/dilemma
diff options
context:
space:
mode:
authorCharly Delay <0xcharly@users.noreply.github.com>2022-07-25 18:11:28 +0900
committerGitHub <noreply@github.com>2022-07-25 10:11:28 +0100
commit50a12c06b9c3dd4bda1fbe6dac1f692fade2d4d1 (patch)
tree5864026dbbb2c2b35cfdff17a668d448738995a9 /keyboards/bastardkb/dilemma
parent336df3297e2853dca189e084057f59169ded5195 (diff)
[keyboard] bastardkb: restructure folder hierarchy (#16778)
* bastardkb: restructure folder hierarchy ahead of supporting other adapters/mcus Upcoming support for the following (adapter, mcu) pairs will be submitted in follow-up PRs: - `v2/elitec` - `v2/stemcell` - `blackpill` This PR contains the following changes: - Move previous implementation to an inner `v1/elitec` folder - Move keyboard USB IDs and strings to data driven - Update headers to update maintainers list - Run `qmk format-c` * bastardkb/charybdis: remove broken acceleration implementation * bastardkb/charybdis: fix debug output * bastardkb: add support for BastardKb the `v2/elitec` (adapter, mcu) pair * bastardkb: add Blackpill support * bastardkb/charybdis/3x5: add `bstiq` keymap * bastardkb/charybdis: add fake LEDs to the configuration For the Charybdis 3x5 (respectively 4x6), the LED config now simulates 36 (respectively 58) LEDs instead of the actual 35 (respectively 56) to prevent confusion when testing LEDs during assembly when handedness is not set correctly. Those fake LEDs are bound to the physical bottom-left corner. * bastardkbk/charybdis/readme.md: update build commands Merge pull request #5 from Nathancooke7/update_charybdis_readme_v2_shield. * bastardkb/charybdis: fix Via keymap with blackpill * bastardkb/charybdis: add 3x6 configuration * bastardkb/charybdis: remove unnecessary files * bastardkb/charybdis: remove obsolete code * bastardkb/charybdis/3x6: add Via keymap * bastardkb: add support for Splinky (RP2040) board * bastardkb: initial configuration for the Splinky (SPI not working yet) * bastardkb/charybdis/3x5/v2/splinky: tentative change to enable trackball * bastardkb/charybdis/3x5/v2/splinky: fix SCK, MISO, MOSI pins * bastardkb/charybdis/3x5/v2/splinky: fix SCK, MISO, MOSI pins * bastardkb/charybdis/4x6/v2/splinky: add SPI configuration and enable trackball * bastardkb/charybdis/3x6: add splinky config * bastardkb/*/v2/splinky: update drivers to `vendor` * bastardkb/dilemma: add new board * bastardkb/charybdis: fix infinite loop in `layer_state_set_user(…)` in the `via` keymaps * bastardkb/dilemma: add `bstiq` keymap * bastardkb: specify blackpill boards * bastardkb/charybdis: fix blackpill-specific define syntax * bastardkb: remove `NO_ACTION_MACRO` and `NO_ACTION_FUNCTION` which are no longer valid options * bastardkb: fix `QK_BOOT` keycodes * bastardkb/dilemma: fix mouse direction on X axis * bastardkb/charybdis/3x6: adjust CS * bastardkb/dilemma: adjust trackpad configuration * charybdis: fix `PWM33XX_CS_PIN` defines This is a follow-up of https://github.com/qmk/qmk_firmware/pull/17613. * bastardkb: remove Vial mentions from `bstiq` keymaps * Cleanup unnecessary comments Co-authored-by: Nathan <nathan.cooke@compass.com> Co-authored-by: Charly Delay <0xcharly@codesink.dev>
Diffstat (limited to 'keyboards/bastardkb/dilemma')
-rw-r--r--keyboards/bastardkb/dilemma/config.h49
-rw-r--r--keyboards/bastardkb/dilemma/dilemma.c326
-rw-r--r--keyboards/bastardkb/dilemma/dilemma.h134
-rw-r--r--keyboards/bastardkb/dilemma/elitec/config.h37
-rw-r--r--keyboards/bastardkb/dilemma/elitec/info.json6
-rw-r--r--keyboards/bastardkb/dilemma/elitec/rules.mk5
-rw-r--r--keyboards/bastardkb/dilemma/info.json46
-rw-r--r--keyboards/bastardkb/dilemma/keymaps/bstiq/README.md3
-rw-r--r--keyboards/bastardkb/dilemma/keymaps/bstiq/config.h153
-rw-r--r--keyboards/bastardkb/dilemma/keymaps/bstiq/keymap.c224
-rw-r--r--keyboards/bastardkb/dilemma/keymaps/default/keymap.c84
-rw-r--r--keyboards/bastardkb/dilemma/readme.md14
-rw-r--r--keyboards/bastardkb/dilemma/rules.mk23
-rw-r--r--keyboards/bastardkb/dilemma/splinky/config.h46
-rw-r--r--keyboards/bastardkb/dilemma/splinky/halconf.h21
-rw-r--r--keyboards/bastardkb/dilemma/splinky/info.json6
-rw-r--r--keyboards/bastardkb/dilemma/splinky/mcuconf.h23
-rw-r--r--keyboards/bastardkb/dilemma/splinky/rules.mk9
-rw-r--r--keyboards/bastardkb/dilemma/splinky/splinky.c32
19 files changed, 1241 insertions, 0 deletions
diff --git a/keyboards/bastardkb/dilemma/config.h b/keyboards/bastardkb/dilemma/config.h
new file mode 100644
index 0000000000..af59efb709
--- /dev/null
+++ b/keyboards/bastardkb/dilemma/config.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com>
+ * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "config_common.h"
+
+/* Key matrix configuration. */
+
+#define MATRIX_ROWS 8 // Rows are doubled-up.
+#define MATRIX_COLS 5
+
+#define DIODE_DIRECTION ROW2COL
+
+// Set 0 if debouncing isn't needed.
+#define DEBOUNCE 5
+
+/* Pointing device configuration. */
+
+// Enable use of pointing device on slave split.
+#define SPLIT_POINTING_ENABLE
+
+// Pointing device is on the right split.
+#define POINTING_DEVICE_RIGHT
+
+// Limits the frequency that the sensor is polled for motion.
+#define POINTING_DEVICE_TASK_THROTTLE_MS 10
+
+// Adjust trackpad rotation.
+#define POINTING_DEVICE_ROTATION_90
+
+// Configure for the Cirque model used on the Dilemma.
+#define CIRQUE_PINNACLE_DIAMETER_MM 35
+#define CIRQUE_PINNACLE_CURVED_OVERLAY
diff --git a/keyboards/bastardkb/dilemma/dilemma.c b/keyboards/bastardkb/dilemma/dilemma.c
new file mode 100644
index 0000000000..b4d3ba5de1
--- /dev/null
+++ b/keyboards/bastardkb/dilemma/dilemma.c
@@ -0,0 +1,326 @@
+/*
+ * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna)
+ * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com>
+ * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Publicw License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "dilemma.h"
+
+#ifdef CONSOLE_ENABLE
+# include "print.h"
+#endif // CONSOLE_ENABLE
+
+#ifdef POINTING_DEVICE_ENABLE
+# ifndef DILEMMA_MINIMUM_DEFAULT_DPI
+# define DILEMMA_MINIMUM_DEFAULT_DPI 400
+# endif // DILEMMA_MINIMUM_DEFAULT_DPI
+
+# ifndef DILEMMA_DEFAULT_DPI_CONFIG_STEP
+# define DILEMMA_DEFAULT_DPI_CONFIG_STEP 200
+# endif // DILEMMA_DEFAULT_DPI_CONFIG_STEP
+
+# ifndef DILEMMA_MINIMUM_SNIPING_DPI
+# define DILEMMA_MINIMUM_SNIPING_DPI 200
+# endif // DILEMMA_MINIMUM_SNIPING_DPI
+
+# ifndef DILEMMA_SNIPING_DPI_CONFIG_STEP
+# define DILEMMA_SNIPING_DPI_CONFIG_STEP 100
+# endif // DILEMMA_SNIPING_DPI_CONFIG_STEP
+
+// Fixed DPI for drag-scroll.
+# ifndef DILEMMA_DRAGSCROLL_DPI
+# define DILEMMA_DRAGSCROLL_DPI 100
+# endif // DILEMMA_DRAGSCROLL_DPI
+
+# ifndef DILEMMA_DRAGSCROLL_BUFFER_SIZE
+# define DILEMMA_DRAGSCROLL_BUFFER_SIZE 6
+# endif // !DILEMMA_DRAGSCROLL_BUFFER_SIZE
+
+typedef union {
+ uint8_t raw;
+ struct {
+ uint8_t pointer_default_dpi : 4; // 16 steps available.
+ uint8_t pointer_sniping_dpi : 2; // 4 steps available.
+ bool is_dragscroll_enabled : 1;
+ bool is_sniping_enabled : 1;
+ } __attribute__((packed));
+} dilemma_config_t;
+
+static dilemma_config_t g_dilemma_config = {0};
+
+/**
+ * \brief Set the value of `config` from EEPROM.
+ *
+ * Note that `is_dragscroll_enabled` and `is_sniping_enabled` are purposefully
+ * ignored since we do not want to persist this state to memory. In practice,
+ * this state is always written to maximize write-performances. Therefore, we
+ * explicitly set them to `false` in this function.
+ */
+static void read_dilemma_config_from_eeprom(dilemma_config_t* config) {
+ config->raw = eeconfig_read_kb() & 0xff;
+ config->is_dragscroll_enabled = false;
+ config->is_sniping_enabled = false;
+}
+
+/**
+ * \brief Save the value of `config` to eeprom.
+ *
+ * Note that all values are written verbatim, including whether drag-scroll
+ * and/or sniper mode are enabled. `read_dilemma_config_from_eeprom(…)`
+ * resets these 2 values to `false` since it does not make sense to persist
+ * these across reboots of the board.
+ */
+static void write_dilemma_config_to_eeprom(dilemma_config_t* config) {
+ eeconfig_update_kb(config->raw);
+}
+
+/** \brief Return the current value of the pointer's default DPI. */
+static uint16_t get_pointer_default_dpi(dilemma_config_t* config) {
+ return (uint16_t)config->pointer_default_dpi * DILEMMA_DEFAULT_DPI_CONFIG_STEP + DILEMMA_MINIMUM_DEFAULT_DPI;
+}
+
+/** \brief Return the current value of the pointer's sniper-mode DPI. */
+static uint16_t get_pointer_sniping_dpi(dilemma_config_t* config) {
+ return (uint16_t)config->pointer_sniping_dpi * DILEMMA_SNIPING_DPI_CONFIG_STEP + DILEMMA_MINIMUM_SNIPING_DPI;
+}
+
+/** \brief Set the appropriate DPI for the input config. */
+static void maybe_update_pointing_device_cpi(dilemma_config_t* config) {
+ if (config->is_dragscroll_enabled) {
+ pointing_device_set_cpi(DILEMMA_DRAGSCROLL_DPI);
+ } else if (config->is_sniping_enabled) {
+ pointing_device_set_cpi(get_pointer_sniping_dpi(config));
+ } else {
+ pointing_device_set_cpi(get_pointer_default_dpi(config));
+ }
+}
+
+/**
+ * \brief Update the pointer's default DPI to the next or previous step.
+ *
+ * Increases the DPI value if `forward` is `true`, decreases it otherwise.
+ * The increment/decrement steps are equal to DILEMMA_DEFAULT_DPI_CONFIG_STEP.
+ */
+static void step_pointer_default_dpi(dilemma_config_t* config, bool forward) {
+ config->pointer_default_dpi += forward ? 1 : -1;
+ maybe_update_pointing_device_cpi(config);
+}
+
+/**
+ * \brief Update the pointer's sniper-mode DPI to the next or previous step.
+ *
+ * Increases the DPI value if `forward` is `true`, decreases it otherwise.
+ * The increment/decrement steps are equal to DILEMMA_SNIPING_DPI_CONFIG_STEP.
+ */
+static void step_pointer_sniping_dpi(dilemma_config_t* config, bool forward) {
+ config->pointer_sniping_dpi += forward ? 1 : -1;
+ maybe_update_pointing_device_cpi(config);
+}
+
+uint16_t dilemma_get_pointer_default_dpi(void) {
+ return get_pointer_default_dpi(&g_dilemma_config);
+}
+
+uint16_t dilemma_get_pointer_sniping_dpi(void) {
+ return get_pointer_sniping_dpi(&g_dilemma_config);
+}
+
+void dilemma_cycle_pointer_default_dpi_noeeprom(bool forward) {
+ step_pointer_default_dpi(&g_dilemma_config, forward);
+}
+
+void dilemma_cycle_pointer_default_dpi(bool forward) {
+ step_pointer_default_dpi(&g_dilemma_config, forward);
+ write_dilemma_config_to_eeprom(&g_dilemma_config);
+}
+
+void dilemma_cycle_pointer_sniping_dpi_noeeprom(bool forward) {
+ step_pointer_sniping_dpi(&g_dilemma_config, forward);
+}
+
+void dilemma_cycle_pointer_sniping_dpi(bool forward) {
+ step_pointer_sniping_dpi(&g_dilemma_config, forward);
+ write_dilemma_config_to_eeprom(&g_dilemma_config);
+}
+
+bool dilemma_get_pointer_sniping_enabled(void) {
+ return g_dilemma_config.is_sniping_enabled;
+}
+
+void dilemma_set_pointer_sniping_enabled(bool enable) {
+ g_dilemma_config.is_sniping_enabled = enable;
+ maybe_update_pointing_device_cpi(&g_dilemma_config);
+}
+
+bool dilemma_get_pointer_dragscroll_enabled(void) {
+ return g_dilemma_config.is_dragscroll_enabled;
+}
+
+void dilemma_set_pointer_dragscroll_enabled(bool enable) {
+ g_dilemma_config.is_dragscroll_enabled = enable;
+ maybe_update_pointing_device_cpi(&g_dilemma_config);
+}
+
+void pointing_device_init_kb(void) {
+ maybe_update_pointing_device_cpi(&g_dilemma_config);
+ pointing_device_init_user();
+}
+
+/**
+ * \brief Augment the pointing device behavior.
+ *
+ * Implement drag-scroll.
+ */
+static void pointing_device_task_dilemma(report_mouse_t* mouse_report) {
+ static int16_t scroll_buffer_x = 0;
+ static int16_t scroll_buffer_y = 0;
+ if (g_dilemma_config.is_dragscroll_enabled) {
+# ifdef DILEMMA_DRAGSCROLL_REVERSE_X
+ scroll_buffer_x -= mouse_report->x;
+# else
+ scroll_buffer_x += mouse_report->x;
+# endif // DILEMMA_DRAGSCROLL_REVERSE_X
+# ifdef DILEMMA_DRAGSCROLL_REVERSE_Y
+ scroll_buffer_y -= mouse_report->y;
+# else
+ scroll_buffer_y += mouse_report->y;
+# endif // DILEMMA_DRAGSCROLL_REVERSE_Y
+ mouse_report->x = 0;
+ mouse_report->y = 0;
+ if (abs(scroll_buffer_x) > DILEMMA_DRAGSCROLL_BUFFER_SIZE) {
+ mouse_report->h = scroll_buffer_x > 0 ? 1 : -1;
+ scroll_buffer_x = 0;
+ }
+ if (abs(scroll_buffer_y) > DILEMMA_DRAGSCROLL_BUFFER_SIZE) {
+ mouse_report->v = scroll_buffer_y > 0 ? 1 : -1;
+ scroll_buffer_y = 0;
+ }
+ }
+}
+
+report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
+ if (is_keyboard_master()) {
+ pointing_device_task_dilemma(&mouse_report);
+ mouse_report = pointing_device_task_user(mouse_report);
+ }
+ return mouse_report;
+}
+
+# if defined(POINTING_DEVICE_ENABLE) && !defined(NO_DILEMMA_KEYCODES)
+/** \brief Whether SHIFT mod is enabled. */
+static bool has_shift_mod(void) {
+# ifdef NO_ACTION_ONESHOT
+ return mod_config(get_mods()) & MOD_MASK_SHIFT;
+# else
+ return mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT;
+# endif // NO_ACTION_ONESHOT
+}
+# endif // POINTING_DEVICE_ENABLE && !NO_DILEMMA_KEYCODES
+
+/**
+ * \brief Outputs the Dilemma configuration to console.
+ *
+ * Prints the in-memory configuration structure to console, for debugging.
+ * Includes:
+ * - raw value
+ * - drag-scroll: on/off
+ * - sniping: on/off
+ * - default DPI: internal table index/actual DPI
+ * - sniping DPI: internal table index/actual DPI
+ */
+static void debug_dilemma_config_to_console(dilemma_config_t* config) {
+# ifdef CONSOLE_ENABLE
+ dprintf("(dilemma) process_record_kb: config = {\n"
+ "\traw = 0x%X,\n"
+ "\t{\n"
+ "\t\tis_dragscroll_enabled=%b\n"
+ "\t\tis_sniping_enabled=%b\n"
+ "\t\tdefault_dpi=0x%X (%ld)\n"
+ "\t\tsniping_dpi=0x%X (%ld)\n"
+ "\t}\n"
+ "}\n",
+ config->raw, config->is_dragscroll_enabled, config->is_sniping_enabled, config->pointer_default_dpi, get_pointer_default_dpi(config), config->pointer_sniping_dpi, get_pointer_sniping_dpi(config));
+# endif // CONSOLE_ENABLE
+}
+
+bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
+ if (!process_record_user(keycode, record)) {
+ debug_dilemma_config_to_console(&g_dilemma_config);
+ return false;
+ }
+# ifdef POINTING_DEVICE_ENABLE
+# ifndef NO_DILEMMA_KEYCODES
+ switch (keycode) {
+ case POINTER_DEFAULT_DPI_FORWARD:
+ if (record->event.pressed) {
+ // Step backward if shifted, forward otherwise.
+ dilemma_cycle_pointer_default_dpi(/* forward= */ !has_shift_mod());
+ }
+ break;
+ case POINTER_DEFAULT_DPI_REVERSE:
+ if (record->event.pressed) {
+ // Step forward if shifted, backward otherwise.
+ dilemma_cycle_pointer_default_dpi(/* forward= */ has_shift_mod());
+ }
+ break;
+ case POINTER_SNIPING_DPI_FORWARD:
+ if (record->event.pressed) {
+ // Step backward if shifted, forward otherwise.
+ dilemma_cycle_pointer_sniping_dpi(/* forward= */ !has_shift_mod());
+ }
+ break;
+ case POINTER_SNIPING_DPI_REVERSE:
+ if (record->event.pressed) {
+ // Step forward if shifted, backward otherwise.
+ dilemma_cycle_pointer_sniping_dpi(/* forward= */ has_shift_mod());
+ }
+ break;
+ case SNIPING_MODE:
+ dilemma_set_pointer_sniping_enabled(record->event.pressed);
+ break;
+ case SNIPING_MODE_TOGGLE:
+ if (record->event.pressed) {
+ dilemma_set_pointer_sniping_enabled(!dilemma_get_pointer_sniping_enabled());
+ }
+ break;
+ case DRAGSCROLL_MODE:
+ dilemma_set_pointer_dragscroll_enabled(record->event.pressed);
+ break;
+ case DRAGSCROLL_MODE_TOGGLE:
+ if (record->event.pressed) {
+ dilemma_set_pointer_dragscroll_enabled(!dilemma_get_pointer_dragscroll_enabled());
+ }
+ break;
+ }
+# endif // !NO_DILEMMA_KEYCODES
+# endif // POINTING_DEVICE_ENABLE
+ debug_dilemma_config_to_console(&g_dilemma_config);
+ return true;
+}
+
+void eeconfig_init_kb(void) {
+ g_dilemma_config.raw = 0;
+ g_dilemma_config.pointer_default_dpi = 4;
+ write_dilemma_config_to_eeprom(&g_dilemma_config);
+ maybe_update_pointing_device_cpi(&g_dilemma_config);
+ eeconfig_init_user();
+}
+
+void matrix_init_kb(void) {
+ read_dilemma_config_from_eeprom(&g_dilemma_config);
+ matrix_init_user();
+}
+#endif // POINTING_DEVICE_ENABLE
diff --git a/keyboards/bastardkb/dilemma/dilemma.h b/keyboards/bastardkb/dilemma/dilemma.h
new file mode 100644
index 0000000000..fbf54c804b
--- /dev/null
+++ b/keyboards/bastardkb/dilemma/dilemma.h
@@ -0,0 +1,134 @@
+/**
+ * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "quantum.h"
+
+// clang-format off
+#define LAYOUT_split_3x5_2( \
+ k00, k01, k02, k03, k04, k44, k43, k42, k41, k40, \
+ k10, k11, k12, k13, k14, k54, k53, k52, k51, k50, \
+ k20, k21, k22, k23, k24, k64, k63, k62, k61, k60, \
+ k30, k32, k72, k70 \
+) \
+{ \
+ { k00, k01, k02, k03, k04 }, \
+ { k10, k11, k12, k13, k14 }, \
+ { k20, k21, k22, k23, k24 }, \
+ { k30, KC_NO, k32, KC_NO, KC_NO }, \
+ { k40, k41, k42, k43, k44 }, \
+ { k50, k51, k52, k53, k54 }, \
+ { k60, k61, k62, k63, k64 }, \
+ { k70, KC_NO, k72, KC_NO, KC_NO }, \
+}
+// clang-format on
+
+#ifdef POINTING_DEVICE_ENABLE
+# ifndef NO_DILEMMA_KEYCODES
+enum dilemma_keycodes {
+# ifdef VIA_ENABLE
+ POINTER_DEFAULT_DPI_FORWARD = USER00,
+# else
+ POINTER_DEFAULT_DPI_FORWARD = SAFE_RANGE,
+# endif // VIA_ENABLE
+ POINTER_DEFAULT_DPI_REVERSE,
+ POINTER_SNIPING_DPI_FORWARD,
+ POINTER_SNIPING_DPI_REVERSE,
+ SNIPING_MODE,
+ SNIPING_MODE_TOGGLE,
+ DRAGSCROLL_MODE,
+ DRAGSCROLL_MODE_TOGGLE,
+ DILEMMA_SAFE_RANGE,
+};
+
+# define DPI_MOD POINTER_DEFAULT_DPI_FORWARD
+# define DPI_RMOD POINTER_DEFAULT_DPI_REVERSE
+# define S_D_MOD POINTER_SNIPING_DPI_FORWARD
+# define S_D_RMOD POINTER_SNIPING_DPI_REVERSE
+# define SNIPING SNIPING_MODE
+# define SNP_TOG SNIPING_MODE_TOGGLE
+# define DRGSCRL DRAGSCROLL_MODE
+# define DRG_TOG DRAGSCROLL_MODE_TOGGLE
+# endif // !NO_DILEMMA_KEYCODES
+
+/** \brief Return the current DPI value for the pointer's default mode. */
+uint16_t dilemma_get_pointer_default_dpi(void);
+
+/**
+ * \brief Update the pointer's default DPI to the next or previous step.
+ *
+ * Increases the DPI value if `forward` is `true`, decreases it otherwise.
+ * The increment/decrement steps are equal to DILEMMA_DEFAULT_DPI_CONFIG_STEP.
+ *
+ * The new value is persisted in EEPROM.
+ */
+void dilemma_cycle_pointer_default_dpi(bool forward);
+
+/**
+ * \brief Same as `dilemma_cycle_pointer_default_dpi`, but do not write to
+ * EEPROM.
+ *
+ * This means that reseting the board will revert the value to the last
+ * persisted one.
+ */
+void dilemma_cycle_pointer_default_dpi_noeeprom(bool forward);
+
+/** \brief Return the current DPI value for the pointer's sniper-mode. */
+uint16_t dilemma_get_pointer_sniping_dpi(void);
+
+/**
+ * \brief Update the pointer's sniper-mode DPI to the next or previous step.
+ *
+ * Increases the DPI value if `forward` is `true`, decreases it otherwise.
+ * The increment/decrement steps are equal to DILEMMA_SNIPING_DPI_CONFIG_STEP.
+ *
+ * The new value is persisted in EEPROM.
+ */
+void dilemma_cycle_pointer_sniping_dpi(bool forward);
+
+/**
+ * \brief Same as `dilemma_cycle_pointer_sniping_dpi`, but do not write to
+ * EEPROM.
+ *
+ * This means that reseting the board will revert the value to the last
+ * persisted one.
+ */
+void dilemma_cycle_pointer_sniping_dpi_noeeprom(bool forward);
+
+/** \brief Whether sniper-mode is enabled. */
+bool dilemma_get_pointer_sniping_enabled(void);
+
+/**
+ * \brief Enable/disable sniper mode.
+ *
+ * When sniper mode is enabled the dpi is reduced to slow down the pointer for
+ * more accurate movements.
+ */
+void dilemma_set_pointer_sniping_enabled(bool enable);
+
+/** \brief Whether drag-scroll is enabled. */
+bool dilemma_get_pointer_dragscroll_enabled(void);
+
+/**
+ * \brief Enable/disable drag-scroll mode.
+ *
+ * When drag-scroll mode is enabled, horizontal and vertical pointer movements
+ * are translated into horizontal and vertical scroll movements.
+ */
+void dilemma_set_pointer_dragscroll_enabled(bool enable);
+#endif // POINTING_DEVICE_ENABLE
diff --git a/keyboards/bastardkb/dilemma/elitec/config.h b/keyboards/bastardkb/dilemma/elitec/config.h
new file mode 100644
index 0000000000..0f26e46fdb
--- /dev/null
+++ b/keyboards/bastardkb/dilemma/elitec/config.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+/* Key matrix configuration. */
+#define MATRIX_ROW_PINS \
+ { D4, C6, F5, F7 }
+#define MATRIX_COL_PINS \
+ { B4, B5, E6, D7, F6 }
+
+/* Handedness. */
+#define MASTER_RIGHT
+
+// To use the handedness pin, resistors need to be installed on the PCB.
+// If so, uncomment the following code, and undefine MASTER_RIGHT above.
+//#define SPLIT_HAND_PIN F4
+// If you've soldered the handedness pull-up on the upper side instead of the
+// left one, uncomment the following line.
+//#define SPLIT_HAND_PIN_LOW_IS_LEFT // High -> right, Low -> left.
+
+/* serial.c configuration (for split keyboard). */
+#define SOFT_SERIAL_PIN D2
diff --git a/keyboards/bastardkb/dilemma/elitec/info.json b/keyboards/bastardkb/dilemma/elitec/info.json
new file mode 100644
index 0000000000..f5916f3ab1
--- /dev/null
+++ b/keyboards/bastardkb/dilemma/elitec/info.json
@@ -0,0 +1,6 @@
+{
+ "keyboard_name": "Dilemma Elite-C",
+ "usb": {
+ "device_version": "1.0.0",
+ },
+}
diff --git a/keyboards/bastardkb/dilemma/elitec/rules.mk b/keyboards/bastardkb/dilemma/elitec/rules.mk
new file mode 100644
index 0000000000..e8326bcf09
--- /dev/null
+++ b/keyboards/bastardkb/dilemma/elitec/rules.mk
@@ -0,0 +1,5 @@
+# MCU name
+MCU = atmega32u4
+
+# Bootloader selection
+BOOTLOADER = atmel-dfu
diff --git a/keyboards/bastardkb/dilemma/info.json b/keyboards/bastardkb/dilemma/info.json
new file mode 100644
index 0000000000..6764219969
--- /dev/null
+++ b/keyboards/bastardkb/dilemma/info.json
@@ -0,0 +1,46 @@
+{
+ "url": "https://bastardkb.com/dilemma",
+ "usb": {
+ "pid": "0x1835",
+ },
+ "layouts": {
+ "LAYOUT_split_3x5_2": {
+ "layout": [
+ {"label":"L00", "x":0, "y":0},
+ {"label":"L01", "x":1, "y":0},
+ {"label":"L02", "x":2, "y":0},
+ {"label":"L03", "x":3, "y":0},
+ {"label":"L04", "x":4, "y":0},
+ {"label":"R00", "x":11, "y":0},
+ {"label":"R01", "x":12, "y":0},
+ {"label":"R02", "x":13, "y":0},
+ {"label":"R03", "x":14, "y":0},
+ {"label":"R04", "x":15, "y":0},
+ {"label":"L10", "x":0, "y":1},
+ {"label":"L11", "x":1, "y":1},
+ {"label":"L12", "x":2, "y":1},
+ {"label":"L13", "x":3, "y":1},
+ {"label":"L14", "x":4, "y":1},
+ {"label":"R10", "x":11, "y":1},
+ {"label":"R11", "x":12, "y":1},
+ {"label":"R12", "x":13, "y":1},
+ {"label":"R13", "x":14, "y":1},
+ {"label":"R14", "x":15, "y":1},
+ {"label":"L20", "x":0, "y":2},
+ {"label":"L21", "x":1, "y":2},
+ {"label":"L22", "x":2, "y":2},
+ {"label":"L23", "x":3, "y":2},
+ {"label":"L24", "x":4, "y":2},
+ {"label":"R20", "x":11, "y":2},
+ {"label":"R21", "x":12, "y":2},
+ {"label":"R22", "x":13, "y":2},
+ {"label":"R23", "x":14, "y":2},
+ {"label":"R24", "x":15, "y":2},
+ {"label":"L30", "x":4, "y":3},
+ {"label":"L32", "x":5, "y":3},
+ {"label":"R32", "x":10, "y":3},
+ {"label":"R30", "x":11, "y":3}
+ ]
+ }
+ }
+}
diff --git a/keyboards/bastardkb/dilemma/keymaps/bstiq/README.md b/keyboards/bastardkb/dilemma/keymaps/bstiq/README.md
new file mode 100644
index 0000000000..df1f43cbcb
--- /dev/null
+++ b/keyboards/bastardkb/dilemma/keymaps/bstiq/README.md
@@ -0,0 +1,3 @@
+# Dilemma @bstiq keymap
+
+Inspired from Miryoku, using home-rows.
diff --git a/keyboards/bastardkb/dilemma/keymaps/bstiq/config.h b/keyboards/bastardkb/dilemma/keymaps/bstiq/config.h
new file mode 100644
index 0000000000..b2e49c8c6e
--- /dev/null
+++ b/keyboards/bastardkb/dilemma/keymaps/bstiq/config.h
@@ -0,0 +1,153 @@
+/**
+ * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com>
+ * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#ifdef VIA_ENABLE
+/* Via configuration. */
+# define DYNAMIC_KEYMAP_LAYER_COUNT 8
+#endif // VIA_ENABLE
+
+/**
+ * Configure the global tapping term (default: 200ms).
+ * If you have a lot of accidental mod activations, crank up the tapping term.
+ *
+ * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-term
+ */
+#ifndef TAPPING_TERM
+# define TAPPING_TERM 160
+#endif // TAPPING_TERM
+
+// disable trackpad taps
+// #define CIRQUE_PINNACLE_TAPPING_TERM 0
+
+/**
+ * Enable rapid switch from tap to hold. Disable auto-repeat when pressing key
+ * twice, except for one-shot keys.
+ *
+ * See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-force-hold
+ */
+#define TAPPING_FORCE_HOLD
+
+/*
+ * Tap-or-Hold decision modes.
+ *
+ * Note that the following flags behave differently when combined (ie. when 2 or
+ * more are enabled).
+ *
+ * See bit.ly/tap-or-hold for a visual explanation of the following tap-or-hold
+ * decision modes.
+ */
+
+/**
+ * Faster tap-hold trigger.
+ *
+ * Without `PERMISSIVE_HOLD`, within `TAPPING_TERM`:
+ * Mod(a)🠗 e🠗 e🠕 Mod(a)🠕 ➞ ae
+ * With `PERMISSIVE_HOLD`, within `TAPPING_TERM`:
+ * Mod(a)🠗 e🠗 e🠕 Mod(a)🠕 ➞ Mod+e
+ *
+ * See docs.qmk.fm/using-qmk/software-features/tap_hold#permissive-hold
+ */
+#define PERMISSIVE_HOLD
+
+/**
+ * Prevent normal rollover on alphas from accidentally triggering mods.
+ *
+ * Ignores key presses that interrupt a mod-tap. Must-have for Home Row mod.
+ *
+ * Without `IGNORE_MOD_TAP_INTERRUPT`, within `TAPPING_TERM`:
+ * Mod(a)🠗 e🠗 Mod(a)🠕 e🠕 ➞ Mod+e
+ * With `IGNORE_MOD_TAP_INTERRUPT`, within `TAPPING_TERM`:
+ * Mod(a)🠗 e🠗 Mod(a)🠕 e🠕 ➞ ae
+ *
+ * See docs.qmk.fm/using-qmk/software-features/tap_hold#ignore-mod-tap-interrupt
+ */
+#define IGNORE_MOD_TAP_INTERRUPT
+
+/** Dilemma-specific features. */
+
+#ifdef POINTING_DEVICE_ENABLE
+// Flip horizontal direction for drag-scroll.
+# define DILEMMA_DRAGSCROLL_REVERSE_X
+// #define DILEMMA_DRAGSCROLL_REVERSE_Y
+#endif // POINTING_DEVICE_ENABLE
+
+/** RGB Matrix. */
+
+#ifdef RGB_MATRIX_ENABLE
+// Enable all animations on ARM boards since they have plenty of memory
+// available for it.
+# define ENABLE_RGB_MATRIX_ALPHAS_MODS
+# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
+# define ENABLE_RGB_MATRIX_BREATHING
+# define ENABLE_RGB_MATRIX_BAND_SAT
+# define ENABLE_RGB_MATRIX_BAND_VAL
+# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
+# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
+# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
+# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
+# define ENABLE_RGB_MATRIX_CYCLE_ALL
+# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
+# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
+# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
+# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
+# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
+# define ENABLE_RGB_MATRIX_DUAL_BEACON
+# define ENABLE_RGB_MATRIX_RAINBOW_BEACON
+# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
+# define ENABLE_RGB_MATRIX_RAINDROPS
+# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+# define ENABLE_RGB_MATRIX_HUE_BREATHING
+# define ENABLE_RGB_MATRIX_HUE_PENDULUM
+# define ENABLE_RGB_MATRIX_HUE_WAVE
+# define ENABLE_RGB_MATRIX_TYPING_HEATMAP
+# define ENABLE_RGB_MATRIX_DIGITAL_RAIN
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# define ENABLE_RGB_MATRIX_SPLASH
+# define ENABLE_RGB_MATRIX_MULTISPLASH
+# define ENABLE_RGB_MATRIX_SOLID_SPLASH
+# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
+
+// Limit maximum brightness to keep power consumption reasonable, and avoid
+// disconnects.
+# undef RGB_MATRIX_MAXIMUM_BRIGHTNESS
+# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 64
+
+// Rainbow swirl as startup mode.
+# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT
+
+// Slow swirl at startup.
+# define RGB_MATRIX_STARTUP_SPD 32
+
+// Startup values.
+# define RGB_MATRIX_STARTUP_HUE 0
+# define RGB_MATRIX_STARTUP_SAT 255
+# define RGB_MATRIX_