summaryrefslogtreecommitdiffstats
path: root/keyboards/keychron/q11/ansi_encoder/ansi_encoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/keychron/q11/ansi_encoder/ansi_encoder.c')
-rwxr-xr-xkeyboards/keychron/q11/ansi_encoder/ansi_encoder.c116
1 files changed, 0 insertions, 116 deletions
diff --git a/keyboards/keychron/q11/ansi_encoder/ansi_encoder.c b/keyboards/keychron/q11/ansi_encoder/ansi_encoder.c
index 0d4fd2cd98..0585ae9c96 100755
--- a/keyboards/keychron/q11/ansi_encoder/ansi_encoder.c
+++ b/keyboards/keychron/q11/ansi_encoder/ansi_encoder.c
@@ -17,9 +17,6 @@
#include "quantum.h"
#ifdef RGB_MATRIX_ENABLE
-
-// clang-format off
-
const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
@@ -128,117 +125,4 @@ const ckled2001_led PROGMEM g_ckled2001_leds[RGB_MATRIX_LED_COUNT] = {
{0, G_1, I_1, H_1}, // Down
{0, G_7, I_7, H_7}, // Right
};
-
-#define __ NO_LED
-
-led_config_t g_led_config = {
- {
- // Key Matrix to LED Index
- { __, 0, 1, 2, 3, 4, 5, 6, __ },
- { 7, 8, 9, 10, 11, 12, 13, 14, __ },
- { 15, 16, 17, 18, 19, __, 20, 21, __ },
- { 22, 23, 24, 25, 26, 27, 28, __, __ },
- { 29, __, 30, 31, 32, 33, 34, 35, __ },
- { 36, 37, 38, 39, 40, __, 41, __, __ },
- { 42, 43, 44, 45, 46, 47, 48, 49, __ },
- { 50, 51, 52, 53, 54, 55, 56, __, 57 },
- { 58, 59, 60, 61, 62, 63, 64, 65, 66 },
- { 67, 68, 69, 70, 71, 72, __, 73, 74 },
- { 75, 76, 77, 78, 79, 80, __, 81, __ },
- { __, 82, 83, 84, 85, __, 86, 87, 88 },
- },
- {
- // LED Index to Physical Position
- {17,0}, {31,0}, {45,0}, {59,0}, {72,0}, {86,0}, {100,0},
- {0,15}, {17,15}, {31,15}, {45,15}, {59,15}, {72,15}, {86,15}, {100,15},
- {0,27}, {21,27}, {38,27}, {52,27}, {66,27}, {79,27}, {93,27},
- {0,40}, {22,40}, {41,40}, {55,40}, {69,40}, {83,40}, {97,40},
- {0,52}, {26,52}, {48,52}, {61,52}, {76,52}, {90,52}, {102,52},
- {0,64}, {19,64}, {36,64}, {53,64}, {70,64}, {94,64},
- {110,0}, {124,0}, {138,0}, {152,0}, {165,0}, {179,0}, {193,0}, {207,0},
- {110,15}, {124,15}, {138,15}, {152,15}, {165,15}, {179,15}, {200,15}, {224,15},
- {104,27}, {117,27}, {131,27}, {145,27}, {158,27}, {172,27}, {186,27}, {203,27}, {224,27},
- {107,40}, {121,40}, {134,40}, {148,40}, {162,40}, {176,40}, {198,40}, {224,40},
- {114,52}, {127,52}, {141,52}, {155,52}, {169,52}, {188,52}, {210,52},
- {126,64}, {152,64}, {166,64}, {180,64}, {196,64}, {210,64}, {224,64},
- },
- {
- // RGB LED Index to Flag
- 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 4, 4, 4, 4, 4, 4,
- 1, 1, 4, 4, 4, 4, 4,
- 1, 8, 4, 4, 4, 4, 4,
- 1, 1, 4, 4, 4, 4, 4,
- 1, 1, 1, 1, 1, 4,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 4, 4, 4, 4, 4, 4, 1, 1,
- 4, 4, 4, 4, 4, 4, 4, 4, 1,
- 4, 4, 4, 4, 4, 4, 1, 1,
- 4, 4, 4, 4, 4, 1, 1,
- 4, 1, 1, 1, 1, 1, 1,
- }
-};
-
-// clang-format on
-
#endif
-
-#define ADC_BUFFER_DEPTH 1
-#define ADC_NUM_CHANNELS 1
-#define ADC_SAMPLING_RATE ADC_SMPR_SMP_12P5
-#define ADC_RESOLUTION ADC_CFGR_RES_10BITS
-
-static int16_t analogReadPin_my(pin_t pin) {
- ADCConfig adcCfg = {};
- adcsample_t sampleBuffer[ADC_NUM_CHANNELS*ADC_BUFFER_DEPTH];
- ADCDriver* targetDriver = &ADCD1;
- ADCConversionGroup adcConversionGroup = {
- .circular = FALSE,
- .num_channels = (uint16_t)(ADC_NUM_CHANNELS),
- .cfgr = ADC_RESOLUTION,
- };
-
- palSetLineMode(pin, PAL_MODE_INPUT_ANALOG);
- switch (pin) {
- case B0:
- adcConversionGroup.smpr[2] = ADC_SMPR2_SMP_AN15(ADC_SAMPLING_RATE);
- adcConversionGroup.sqr[0] = ADC_SQR1_SQ1_N(ADC_CHANNEL_IN15);
- sampleBuffer[0] = 0;
- break;
- case B1:
- adcConversionGroup.smpr[2] = ADC_SMPR2_SMP_AN16(ADC_SAMPLING_RATE);
- adcConversionGroup.sqr[0] = ADC_SQR1_SQ1_N(ADC_CHANNEL_IN16);
- sampleBuffer[0] = 0;
- break;
- default:
- return 0;
- }
- adcStart(targetDriver, &adcCfg);
- if (adcConvert(targetDriver, &adcConversionGroup, &sampleBuffer[0], ADC_BUFFER_DEPTH) != MSG_OK) {
- return 0;
- }
-
- return *sampleBuffer;
-}
-
-void keyboard_post_init_kb(void) {
- // 1. The pin A5/B5 of the USB C interface in the left hand is connected to the pin A0 of MCU,
- // A0 will be set to output and write high when keyboard initial.
- // 2. The same pin in the right hand is connected to the pin B0 and B1 of MCU respectively,
- // and the ADC function of B0 and B1 will be enabled when keyboard initial.
- // 3. because the serial usart RXD and TXD is multiplexed on USB's D+ and D- in the right hand.
- // So detect the voltage on the pin A5/B5 of the USB C interface by ADC,
- // and disable USB connectivity when the ADC value exceeds 1000,
- // to avoid affecting the serial usart communication between the left hand and the right hand.
- if (is_keyboard_left()) {
- setPinOutput(A0);
- writePinHigh(A0);
- } else {
- if ((analogReadPin_my(B0) > 1000) || (analogReadPin_my(B1) > 1000)) {
- setPinInput(A11);
- setPinInput(A12);
- }
- }
-
- keyboard_post_init_user();
-}