Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate dip switch config to info.json - keychron #23037

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions keyboards/keychron/c1_pro/c1_pro.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@

#include "quantum.h"

// clang-format off

const matrix_row_t matrix_mask[] = {
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111101111,
};

// clang-format on

#ifdef DIP_SWITCH_ENABLE

bool dip_switch_update_kb(uint8_t index, bool active) {
Expand Down
6 changes: 0 additions & 6 deletions keyboards/keychron/c1_pro/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@

#pragma once

/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { { 5, 4 } }

/* Disable DIP switch in matrix data */
#define MATRIX_MASKED

/* EEPROM Driver Configuration */
#define WEAR_LEVELING_LOGICAL_SIZE 2048
#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2)
Expand Down
3 changes: 3 additions & 0 deletions keyboards/keychron/c1_pro/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"mousekey": true,
"nkro": true
},
"dip_switch": {
"matrix_grid": [ [5, 4] ]
},
"matrix_pins": {
"cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "A10", "H3"],
"rows": ["B5", "B4", "B3", "A15", "A14", "A13"]
Expand Down
12 changes: 0 additions & 12 deletions keyboards/keychron/c2_pro/c2_pro.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@

#include "quantum.h"

// clang-format off
const matrix_row_t matrix_mask[] = {
0b11111111111111111111,
0b11111111111111111111,
0b11111111111111111111,
0b11111111111111111111,
0b11111111111111111111,
0b11111111111111101111,
};

// clang-format on

#ifdef DIP_SWITCH_ENABLE

bool dip_switch_update_kb(uint8_t index, bool active) {
Expand Down
6 changes: 0 additions & 6 deletions keyboards/keychron/c2_pro/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@

#pragma once

/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { { 5, 4 } }

/* Disable DIP switch in matrix data */
#define MATRIX_MASKED

/* EEPROM Driver Configuration */
#define WEAR_LEVELING_LOGICAL_SIZE 2048
#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2)
Expand Down
3 changes: 3 additions & 0 deletions keyboards/keychron/c2_pro/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"mousekey": true,
"nkro": true
},
"dip_switch": {
"matrix_grid": [ [5, 4] ]
},
"matrix_pins": {
"cols": ["A10", "A9", "A8", "B1", "B0", "A7", "A6", "A5", "A4", "A3", "A2", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "NO_PIN", "C14"],
"rows": ["B5", "B4", "B3", "A15", "A14", "A13"],
Expand Down
6 changes: 0 additions & 6 deletions keyboards/keychron/q10/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@
#define SNLED27351_CURRENT_TUNE \
{ 0x98, 0x98, 0x4A, 0x98, 0x98, 0x4A, 0x98, 0x98, 0x4A, 0x98, 0x98, 0x4A }

/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { {5,5} }

/* Disable DIP switch in matrix data */
#define MATRIX_MASKED

/* Disable RGB lighting when PC is in suspend */
#define RGB_MATRIX_SLEEP

Expand Down
5 changes: 5 additions & 0 deletions keyboards/keychron/q10/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dip_switch": {
"matrix_grid": [ [5, 5] ]
}
}
9 changes: 0 additions & 9 deletions keyboards/keychron/q10/q10.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@

#include "quantum.h"

const matrix_row_t matrix_mask[] = {
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111011111,
};

#ifdef DIP_SWITCH_ENABLE

bool dip_switch_update_kb(uint8_t index, bool active) {
Expand Down
9 changes: 0 additions & 9 deletions keyboards/keychron/q11/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@

#pragma once

// Connects each switch in the dip switch to the GPIO pin of the MCU
#define DIP_SWITCH_PINS \
{ A8 }

/* handedness */
#define SPLIT_HAND_MATRIX_GRID A2, A15

#define MATRIX_MASKED // actual mask is defined by `matrix_mask` in `q11.c`

/* RGB Matrix Driver Configuration */
#define SNLED27351_I2C_ADDRESS_1 SNLED27351_I2C_ADDRESS_GND

Expand Down
6 changes: 6 additions & 0 deletions keyboards/keychron/q11/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"bootmagic": {
"matrix": [0, 1]
},
"dip_switch": {
"pins": ["A8"]
},
"features": {
"bootmagic": true,
"command": false,
Expand All @@ -36,6 +39,9 @@
]
}
},
"handedness": {
"matrix_grid": ["A2", "A15"]
},
"matrix_pins": {
"right": {
"cols": ["A8", "A7", "A6", "A5", "A4", "A3", "A2", "A1", "A0"],
Expand Down
19 changes: 0 additions & 19 deletions keyboards/keychron/q11/q11.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,6 @@

#include "quantum.h"

// Mask out handedness diode to prevent it
// from keeping the keyboard awake
// - just mirroring `KC_NO` in the `LAYOUT`
// macro to keep it simple
const matrix_row_t matrix_mask[] = {
0b011111111,
0b011111111,
0b011011111,
0b001111111,
0b011111111,
0b001011111,
0b111111111,
0b101111111,
0b111111111,
0b110111111,
0b010111111,
0b111011110,
};

#ifdef DIP_SWITCH_ENABLE
bool dip_switch_update_kb(uint8_t index, bool active) {
if (!dip_switch_update_user(index, active)) {
Expand Down
8 changes: 0 additions & 8 deletions keyboards/keychron/q12/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,8 @@
#define SNLED27351_CURRENT_TUNE \
{ 0xAD, 0xAD, 0x55, 0xAD, 0xAD, 0x55, 0xAD, 0xAD, 0x55, 0xAD, 0xAD, 0x55 }

/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID \
{ \
{ 5, 4 } \
}
#define SCAN_COUNT_MAX 100

/* Disable DIP switch in matrix data */
#define MATRIX_MASKED

/* turn off effects when suspended */
#define RGB_MATRIX_SLEEP

Expand Down
5 changes: 5 additions & 0 deletions keyboards/keychron/q12/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dip_switch": {
"matrix_grid": [ [5, 4] ]
}
}
10 changes: 0 additions & 10 deletions keyboards/keychron/q12/q12.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@

#include "quantum.h"

// clang-format off
const matrix_row_t matrix_mask[] = {
0b111111111111111111,
0b111111111111111111,
0b111111111111111111,
0b111111111111111111,
0b111111111111111111,
0b111111111111101111,
};
// clang-format on
#ifdef DIP_SWITCH_ENABLE
bool dip_switch_update_kb(uint8_t index, bool active) {
if (!dip_switch_update_user(index, active)) {
Expand Down
9 changes: 0 additions & 9 deletions keyboards/keychron/q1v1/ansi/ansi.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@

#include "quantum.h"

const matrix_row_t matrix_mask[] = {
0b0111111111111101,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
};

#ifdef RGB_MATRIX_ENABLE
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
/* Refer to IS31 manual for these locations
Expand Down
9 changes: 0 additions & 9 deletions keyboards/keychron/q1v1/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@

#include "quantum.h"

const matrix_row_t matrix_mask[] = {
0b0111111111111101,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
};

#ifdef RGB_MATRIX_ENABLE
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
/* Refer to IS31 manual for these locations
Expand Down
6 changes: 0 additions & 6 deletions keyboards/keychron/q1v1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
#define IS31FL3733_I2C_ADDRESS_2 IS31FL3733_I2C_ADDRESS_VCC_VCC

/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { {0,1} }

/* Disable DIP switch in matrix data */
#define MATRIX_MASKED

/* Encoder Configuration*/
#define ENCODER_DEFAULT_POS 0x3

Expand Down
3 changes: 3 additions & 0 deletions keyboards/keychron/q1v1/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"nkro": true,
"rgb_matrix": true
},
"dip_switch": {
"matrix_grid": [ [0, 1] ]
},
"matrix_pins": {
"cols": ["D5", "D4", "D6", "D7", "B4", "B5", "B6", "C6", "C7", "F7", "F6", "F5", "F4", "F1", "F0"],
"rows": ["D3", "D2", "B3", "B2", "B1", "B0"]
Expand Down
9 changes: 0 additions & 9 deletions keyboards/keychron/q1v1/iso/iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@

#include "quantum.h"

const matrix_row_t matrix_mask[] = {
0b0111111111111101,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
};

#ifdef RGB_MATRIX_ENABLE
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
/* Refer to IS31 manual for these locations
Expand Down
9 changes: 0 additions & 9 deletions keyboards/keychron/q1v1/iso_encoder/iso_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@

#include "quantum.h"

const matrix_row_t matrix_mask[] = {
0b0111111111111101,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
0b0111111111111111,
};

#ifdef RGB_MATRIX_ENABLE

const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
Expand Down
9 changes: 0 additions & 9 deletions keyboards/keychron/q1v2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@
#define I2C1_TIMINGR_SCLH 15U
#define I2C1_TIMINGR_SCLL 51U

/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID \
{ \
{ 5, 4 } \
}

/* Disable DIP switch in matrix data */
#define MATRIX_MASKED

/* Disable RGB lighting when PC is in suspend */
#define RGB_MATRIX_SLEEP

Expand Down
3 changes: 3 additions & 0 deletions keyboards/keychron/q1v2/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"rgb_matrix": true,
"dip_switch": true
},
"dip_switch": {
"matrix_grid": [ [5, 4] ]
},
"matrix_pins": {
"cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", null, null, null, null, null, null, null, null],
"rows": ["B5", "B4", "B3", "A15", "A14", "A13"],
Expand Down
9 changes: 0 additions & 9 deletions keyboards/keychron/q1v2/q1v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@

#include "quantum.h"

const matrix_row_t matrix_mask[] = {
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111101111,
};

#ifdef DIP_SWITCH_ENABLE
bool dip_switch_update_kb(uint8_t index, bool active) {
if (!dip_switch_update_user(index, active)) {
Expand Down
6 changes: 0 additions & 6 deletions keyboards/keychron/q2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@

#define MATRIX_UNSELECT_DRIVE_HIGH

/* DIP switch */
#define DIP_SWITCH_MATRIX_GRID { {4, 4} }

/* RGB Matrix Driver Configuration */
#define SNLED27351_I2C_ADDRESS_1 SNLED27351_I2C_ADDRESS_VDDIO
#define SNLED27351_I2C_ADDRESS_2 SNLED27351_I2C_ADDRESS_GND

#define SNLED27351_PHASE_CHANNEL SNLED27351_SCAN_PHASE_9_CHANNEL

/* Disable DIP switch in matrix data */
#define MATRIX_MASKED

/* turn off effects when suspended */
#define RGB_MATRIX_SLEEP

Expand Down
3 changes: 3 additions & 0 deletions keyboards/keychron/q2/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"nkro": true,
"rgb_matrix": true
},
"dip_switch": {
"matrix_grid": [ [4, 4] ]
},
"matrix_pins": {
"cols": ["C14", "C15", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "B0", "B1", "A8", "A9", "H3"],
"rows": ["B4", "B3", "A15", "A14", "A13"]
Expand Down
8 changes: 0 additions & 8 deletions keyboards/keychron/q2/q2.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@

#include "quantum.h"

const matrix_row_t matrix_mask[] = {
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111111111,
0b1111111111101111,
};

#ifdef DIP_SWITCH_ENABLE

bool dip_switch_update_kb(uint8_t index, bool active) {
Expand Down
Loading
Loading