forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bastard Keyboards: Add support for Dilemma v2 (3x5+3) (qmk#22185)
Co-authored-by: Drashna Jaelre <[email protected]> Co-authored-by: Ryan <[email protected]> Co-authored-by: Charly Delay <[email protected]>
- Loading branch information
Showing
13 changed files
with
511 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
* Copyright 2020 Christopher Courtney <[email protected]> (@drashna) | ||
* Copyright 2021 Quentin LEBASTARD <[email protected]> | ||
* Copyright 2022 Charly Delay <[email protected]> (@0xcharly) | ||
* Copyright 2023 casuanoob <[email protected]> (@casuanoob) | ||
* | ||
* 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 | ||
|
@@ -19,65 +20,74 @@ | |
|
||
#include "quantum.h" | ||
|
||
/** | ||
* LEDs index. | ||
* | ||
* ╭────────────────────╮ ╭────────────────────╮ | ||
* 2 3 8 9 12 30 27 26 21 20 | ||
* ├────────────────────┤ ├────────────────────┤ | ||
* 1 4 7 10 13 31 28 25 22 19 | ||
* ├────────────────────┤ ├────────────────────┤ | ||
* 0 5 6 11 14 32 29 24 23 18 | ||
* ╰────────────────────╯ ╰────────────────────╯ | ||
* 15 16 17 35 34 33 | ||
* ╰────────────╯ ╰────────────╯ | ||
*/ | ||
// clang-format off | ||
#ifdef ENCODER_ENABLE | ||
bool encoder_update_kb(uint8_t index, bool clockwise) { | ||
if (!encoder_update_user(index, clockwise)) { | ||
return false; | ||
} | ||
switch (index) { | ||
case 0: // Left-half encoder, mouse scroll. | ||
tap_code(clockwise ? KC_MS_WH_UP : KC_MS_WH_DOWN); | ||
break; | ||
case 1: // Right-half encoder, volume control. | ||
tap_code(clockwise ? KC_AUDIO_VOL_UP : KC_AUDIO_VOL_DOWN); | ||
break; | ||
} | ||
return true; | ||
} | ||
#endif // ENCODER_ENABLE | ||
|
||
#ifdef RGB_MATRIX_ENABLE | ||
led_config_t g_led_config = { { | ||
/* Key Matrix to LED index. */ | ||
// Left split. | ||
{ 2, 3, 8, 9, 12 }, // Top row | ||
{ 1, 4, 7, 10, 13 }, // Middle row | ||
{ 0, 5, 6, 11, 14 }, // Bottom row | ||
{ 17, NO_LED, 15, 16, NO_LED }, // Thumb cluster | ||
// Right split. | ||
{ 20, 21, 26, 27, 30 }, // Top row | ||
{ 19, 22, 25, 28, 31 }, // Middle row | ||
{ 18, 23, 24, 29, 32 }, // Bottom row | ||
{ 35, NO_LED, 33, 34, NO_LED }, // Thumb cluster | ||
}, { | ||
/* LED index to physical position. */ | ||
// Left split. | ||
/* index=0 */ { 0, 42 }, { 0, 21 }, { 0, 0 }, // col 1 (left most) | ||
/* index=3 */ { 18, 0 }, { 18, 21 }, { 18, 42 }, // col 2 | ||
/* index=6 */ { 36, 42 }, { 36, 21 }, { 36, 0 }, | ||
/* index=9 */ { 54, 0 }, { 54, 21 }, { 54, 42 }, | ||
/* index=12 */ { 72, 0 }, { 72, 21 }, { 72, 42 }, | ||
/* index=15 */ { 72, 64 }, { 90, 64 }, { 108, 64 }, // Thumb cluster | ||
// Right split. | ||
/* index=18 */ { 224, 42 }, { 224, 21 }, { 224, 0 }, // col 10 (right most) | ||
/* index=21 */ { 206, 0 }, { 206, 21 }, { 206, 42 }, // col 9 | ||
/* index=24 */ { 188, 42 }, { 188, 21 }, { 188, 0 }, | ||
/* index=27 */ { 170, 0 }, { 170, 21 }, { 170, 42 }, | ||
/* index=30 */ { 152, 0 }, { 152, 21 }, { 152, 42 }, | ||
/* index=33 */ { 152, 64 }, { 134, 64 }, { 116, 64 }, // Thumb cluster | ||
}, { | ||
/* LED index to flag. */ | ||
// Left split. | ||
/* index=0 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 1 | ||
/* index=3 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 2 | ||
/* index=6 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
/* index=9 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
/* index=12 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
/* index=15 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster | ||
// Right split. | ||
/* index=18 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 10 | ||
/* index=21 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // col 9 | ||
/* index=24 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
/* index=27 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
/* index=30 */ LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, | ||
/* index=33 */ LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, LED_FLAG_MODIFIER, // Thumb cluster | ||
} }; | ||
#endif | ||
// clang-format on | ||
// Layer state indicator | ||
bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { | ||
if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { return false; } | ||
if (host_keyboard_led_state().caps_lock) { | ||
for (int i = led_min; i <= led_max; i++) { | ||
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { | ||
rgb_matrix_set_color(i, MIN(rgb_matrix_get_val() + 76, 255), 0x00, 0x00); | ||
} | ||
} | ||
} | ||
|
||
uint8_t layer = get_highest_layer(layer_state); | ||
if (layer > 0) { | ||
HSV hsv = rgb_matrix_get_hsv(); | ||
switch (get_highest_layer(layer_state)) { | ||
case 1: | ||
hsv = (HSV){HSV_BLUE}; | ||
break; | ||
case 2: | ||
hsv = (HSV){HSV_AZURE}; | ||
break; | ||
case 3: | ||
hsv = (HSV){HSV_ORANGE}; | ||
break; | ||
case 4: | ||
hsv = (HSV){HSV_GREEN}; | ||
break; | ||
case 5: | ||
hsv = (HSV){HSV_TEAL}; | ||
break; | ||
case 6: | ||
hsv = (HSV){HSV_PURPLE}; | ||
break; | ||
case 7: | ||
default: | ||
hsv = (HSV){HSV_RED}; | ||
break; | ||
}; | ||
|
||
if (hsv.v > rgb_matrix_get_val()) { | ||
hsv.v = MIN(rgb_matrix_get_val() + 22, 255); | ||
} | ||
RGB rgb = hsv_to_rgb(hsv); | ||
|
||
for (uint8_t i = led_min; i < led_max; i++) { | ||
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_UNDERGLOW)) { | ||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); | ||
} | ||
} | ||
} | ||
return false; | ||
}; | ||
#endif // RGB_MATRIX_ENABLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/** | ||
* Copyright 2022 Charly Delay <[email protected]> (@0xcharly) | ||
* Copyright 2023 casuanoob <[email protected]> (@casuanoob) | ||
* | ||
* 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 | ||
|
@@ -21,32 +22,35 @@ | |
#define SPLIT_HAND_PIN GP29 | ||
#define SPLIT_HAND_PIN_LOW_IS_LEFT // High -> right, Low -> left. | ||
|
||
/* VBUS detection. */ | ||
#define USB_VBUS_PIN GP19 | ||
|
||
/* CRC. */ | ||
#define CRC8_USE_TABLE | ||
#define CRC8_OPTIMIZE_SPEED | ||
|
||
/* Cirque trackpad over SPI. */ | ||
#define SPI_DRIVER SPID0 | ||
#define SPI_SCK_PIN GP22 | ||
#define SPI_MOSI_PIN GP23 | ||
#define SPI_MISO_PIN GP20 | ||
#define POINTING_DEVICE_CS_PIN GP21 | ||
|
||
/* OLED over i2c. */ | ||
#define I2C1_CLOCK_SPEED 400000 | ||
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9 | ||
#define OLED_DISPLAY_HEIGHT 128 | ||
#undef CIRQUE_PINNACLE_DIAMETER_MM | ||
#define CIRQUE_PINNACLE_DIAMETER_MM 40 | ||
|
||
/* Reset. */ | ||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET | ||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP17 | ||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 1000U | ||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U | ||
|
||
/* RGB matrix support. */ | ||
#ifdef RGB_MATRIX_ENABLE | ||
# define SPLIT_TRANSPORT_MIRROR | ||
# define RGB_MATRIX_LED_COUNT 36 | ||
# define RGB_MATRIX_SPLIT { 18, 18 } | ||
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 50 | ||
# define RGB_DISABLE_WHEN_USB_SUSPENDED | ||
# define RGB_MATRIX_KEYPRESSES | ||
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||
|
||
// Startup values. | ||
# define RGB_MATRIX_DEFAULT_VAL 128 | ||
# define RGB_MATRIX_DEFAULT_SPD 32 | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
|
||
#pragma once | ||
|
||
#define HAL_USE_I2C TRUE | ||
#define HAL_USE_SPI TRUE | ||
|
||
#include_next <halconf.h> |
Oops, something went wrong.