Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into xap
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr committed Nov 1, 2023
2 parents d4f82ed + a19ae3d commit 60cf8ba
Show file tree
Hide file tree
Showing 223 changed files with 5,317 additions and 1,244 deletions.
11 changes: 11 additions & 0 deletions data/mappings/info_config.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
// Combos
"COMBO_TERM": {"info_key": "combo.term", "value_type": "int"},

"DIP_SWITCH_MATRIX_GRID": {"info_key": "dip_switch.matrix_grid", "value_type": "array.array.int", "to_json": false},
"DIP_SWITCH_PINS": {"info_key": "dip_switch.pins", "value_type": "array"},
"DIP_SWITCH_PINS_RIGHT": {"info_key": "split.dip_switch.right.pins", "value_type": "array"},

// Dynamic Keymap
"DYNAMIC_KEYMAP_EEPROM_MAX_ADDR": {"info_key": "dynamic_keymap.eeprom_max_addr", "value_type": "int"},
"DYNAMIC_KEYMAP_LAYER_COUNT": {"info_key": "dynamic_keymap.layer_count", "value_type": "int"},
Expand Down Expand Up @@ -150,6 +154,8 @@
// Split Keyboard
"SOFT_SERIAL_PIN": {"info_key": "split.soft_serial_pin"},
"SOFT_SERIAL_SPEED": {"info_key": "split.soft_serial_speed"},
"SPLIT_HAND_MATRIX_GRID": {"info_key": "split.handedness.matrix_grid", "value_type": "array", "to_c": false},
"SPLIT_HAND_PIN": {"info_key": "split.handedness.pin"},
"SPLIT_USB_DETECT": {"info_key": "split.usb_detect.enabled", "value_type": "bool"},
"SPLIT_USB_TIMEOUT": {"info_key": "split.usb_detect.timeout", "value_type": "int"},
"SPLIT_USB_TIMEOUT_POLL": {"info_key": "split.usb_detect.polling_interval", "value_type": "int"},
Expand Down Expand Up @@ -214,4 +220,9 @@
"PRODUCT": {"info_key": "keyboard_name", "warn_duplicate": false, "value_type": "str", "deprecated": true, "replace_with": "`keyboard_name` in info.json"},
"PRODUCT_ID": {"info_key": "usb.pid", "value_type": "hex", "deprecated": true, "replace_with": "`usb.pid` in info.json"},
"VENDOR_ID": {"info_key": "usb.vid", "value_type": "hex", "deprecated": true, "replace_with": "`usb.vid` in info.json"},

// Items we want flagged in lint
"VIAL_KEYBOARD_UID": {"info_key": "_invalid.vial_uid", "invalid": true},
"VIAL_UNLOCK_COMBO_COLS": {"info_key": "_invalid.vial_unlock_cols", "invalid": true},
"VIAL_UNLOCK_COMBO_ROWS": {"info_key": "_invalid.vial_unlock_rows", "invalid": true}
}
1 change: 1 addition & 0 deletions data/mappings/info_rules.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"BOOTLOADER": {"info_key": "bootloader", "warn_duplicate": false},
"BOOTMAGIC_ENABLE": {"info_key": "bootmagic.enabled", "value_type": "bool"},
"CAPS_WORD_ENABLE": {"info_key": "caps_word.enabled", "value_type": "bool"},
"DIP_SWITCH_ENABLE": {"info_key": "dip_switch.enabled", "value_type": "bool"},
"DEBOUNCE_TYPE": {"info_key": "build.debounce_type"},
"EEPROM_DRIVER": {"info_key": "eeprom.driver"},
"ENCODER_ENABLE": {"info_key": "encoder.enabled", "value_type": "bool"},
Expand Down
66 changes: 58 additions & 8 deletions data/schemas/keyboard.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@
}
}
}
}
},
"dip_switch_config": {
"type": "object",
"properties": {
"pins": {
"$ref": "qmk.definitions.v1#/mcu_pin_array"
}
}
},
},
"type": "object",
"not": { "required": [ "vendorId", "productId" ] }, // reject via keys...
Expand Down Expand Up @@ -245,6 +253,25 @@
"type": "array",
"items": {"$ref": "qmk.definitions.v1#/filename"}
},
"dip_switch": {
"$ref": "#/definitions/dip_switch_config",
"properties": {
"enabled": {"type": "boolean"},
"matrix_grid": {
"type": "array",
"minItems": 1,
"items": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": {
"type": "integer",
"minimum": 0
}
}
}
}
},
"eeprom": {
"properties": {
"driver": {"type": "string"},
Expand Down Expand Up @@ -613,10 +640,6 @@
}
}
},
"matrix_grid": {
"type": "array",
"items": {"$ref": "qmk.definitions.v1#/mcu_pin"}
},
"matrix_pins": {
"type": "object",
"additionalProperties": false,
Expand All @@ -636,6 +659,15 @@
}
}
},
"dip_switch": {
"type": "object",
"additionalProperties": false,
"properties": {
"right": {
"$ref": "#/definitions/dip_switch_config"
}
}
},
"encoder": {
"type": "object",
"additionalProperties": false,
Expand All @@ -645,9 +677,17 @@
}
}
},
"main": {
"type": "string",
"enum": ["eeprom", "left", "matrix_grid", "pin", "right"]
"handedness": {
"type": "object",
"additionalProperties": false,
"properties": {
"pin": {"$ref": "qmk.definitions.v1#/mcu_pin"},
"matrix_grid": {
"$ref": "qmk.definitions.v1#/mcu_pin_array",
"minItems": 2,
"maxItems": 2
}
}
},
"soft_serial_pin": {"$ref": "qmk.definitions.v1#/mcu_pin"},
"soft_serial_speed": {
Expand Down Expand Up @@ -699,6 +739,16 @@
"polling_interval": {"$ref": "qmk.definitions.v1#/unsigned_int"},
"timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"}
}
},
"main": {
"type": "string",
"enum": ["eeprom", "left", "matrix_grid", "pin", "right"],
"$comment": "Deprecated: use config.h options for now"
},
"matrix_grid": {
"type": "array",
"items": {"$ref": "qmk.definitions.v1#/mcu_pin"},
"$comment": "Deprecated: use split.handedness.matrix_grid instead"
}
}
},
Expand Down
24 changes: 24 additions & 0 deletions docs/reference_info_json.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,20 @@ Configures the [Combo](feature_combo.md) feature.
* The amount of time to recognize a combo in milliseconds.
* Default: `50` (50 ms)

## DIP Switches :id=dip-switch

Configures the [DIP Switches](feature_dip_switch.md) feature.

* `dip_switch`
* `enabled`
* Enable the DIP Switches feature.
* Default: `false`
* `pins`
* A list of GPIO pins connected to the MCU.
* `matrix_grid`
* A list of matrix locations in the key matrix.
* Example: `[ [0,6], [1,6], [2,6] ]`

## EEPROM :id=eeprom

Configures the [EEPROM](eeprom_driver.md) driver.
Expand Down Expand Up @@ -622,13 +636,23 @@ Configures the [Split Keyboard](feature_split_keyboard.md) feature.
* `bootmagic`
* `matrix`
* See [Bootmagic](#bootmagic) config.
* `dip_switch`
* `right`
* `pins`
* See [DIP Switches](#dip-switch) config.
* `enabled`
* Enable the Split Keyboard feature.
* Default: `false`
* `encoder`
* `right`
* `rotary`
* See [Encoder](#encoder) config.
* `handedness`
* `pin`
* The GPIO pin connected to determine handedness.
* `matrix_grid`
* The GPIO pins of the matrix position which determines the handedness.
* Example: `["A1", "B5"]`
* `matrix_pins`
* `right`
* See [Matrix](#matrix) config.
Expand Down
11 changes: 10 additions & 1 deletion drivers/led/aw20216s.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ static inline void aw20216s_auto_lowpower(pin_t cs_pin) {
aw20216s_write_register(cs_pin, AW20216S_PAGE_FUNCTION, AW20216S_REG_MIXFUNCTION, AW20216S_MIXCR_DEFAULT | AW20216S_LPEN);
}

void aw20216s_init_drivers(void) {
spi_init();

aw20216s_init(AW20216S_CS_PIN_1, AW20216S_EN_PIN_1);
#if defined(AW20216S_CS_PIN_2)
aw20216s_init(AW20216S_CS_PIN_2, AW20216S_EN_PIN_2);
#endif
}

void aw20216s_init(pin_t cs_pin, pin_t en_pin) {
setPinOutput(en_pin);
writePinHigh(en_pin);
Expand Down Expand Up @@ -155,7 +164,7 @@ void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}

void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
for (uint8_t i = 0; i < AW20216S_LED_COUNT; i++) {
aw20216s_set_color(i, red, green, blue);
}
}
Expand Down
7 changes: 6 additions & 1 deletion drivers/led/aw20216s.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,20 @@
#define g_aw_leds g_aw20216s_leds
// ========

#if defined(RGB_MATRIX_AW20216S)
# define AW20216S_LED_COUNT RGB_MATRIX_LED_COUNT
#endif

typedef struct aw20216s_led_t {
uint8_t driver : 2;
uint8_t r;
uint8_t g;
uint8_t b;
} aw20216s_led_t;

extern const aw20216s_led_t PROGMEM g_aw20216s_leds[RGB_MATRIX_LED_COUNT];
extern const aw20216s_led_t PROGMEM g_aw20216s_leds[AW20216S_LED_COUNT];

void aw20216s_init_drivers(void);
void aw20216s_init(pin_t cs_pin, pin_t en_pin);
void aw20216s_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
void aw20216s_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
Expand Down
12 changes: 10 additions & 2 deletions drivers/led/issi/is31fl3218-simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) {
}

void is31fl3218_init(void) {
i2c_init();

// In case we ever want to reinitialize (?)
is31fl3218_write_register(IS31FL3218_REG_RESET, 0x00);

Expand All @@ -86,11 +88,17 @@ void is31fl3218_init(void) {

// Load PWM registers and LED Control register data
is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01);

for (int i = 0; i < IS31FL3218_LED_COUNT; i++) {
is31fl3218_set_led_control_register(i, true);
}

is31fl3218_update_led_control_registers();
}

void is31fl3218_set_value(int index, uint8_t value) {
is31fl3218_led_t led;
if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
if (index >= 0 && index < IS31FL3218_LED_COUNT) {
memcpy_P(&led, (&g_is31fl3218_leds[index]), sizeof(led));
}
if (g_pwm_buffer[led.v - IS31FL3218_REG_PWM] == value) {
Expand All @@ -101,7 +109,7 @@ void is31fl3218_set_value(int index, uint8_t value) {
}

void is31fl3218_set_value_all(uint8_t value) {
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
for (int i = 0; i < IS31FL3218_LED_COUNT; i++) {
is31fl3218_set_value(i, value);
}
}
Expand Down
6 changes: 5 additions & 1 deletion drivers/led/issi/is31fl3218-simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@

#define IS31FL3218_I2C_ADDRESS 0x54

#if defined(LED_MATRIX_IS31FL3218)
# define IS31FL3218_LED_COUNT LED_MATRIX_LED_COUNT
#endif

typedef struct is31fl3218_led_t {
uint8_t v;
} __attribute__((packed)) is31fl3218_led_t;

extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[LED_MATRIX_LED_COUNT];
extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT];

void is31fl3218_init(void);

Expand Down
12 changes: 10 additions & 2 deletions drivers/led/issi/is31fl3218.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ void is31fl3218_write_pwm_buffer(uint8_t *pwm_buffer) {
}

void is31fl3218_init(void) {
i2c_init();

// In case we ever want to reinitialize (?)
is31fl3218_write_register(IS31FL3218_REG_RESET, 0x00);

Expand All @@ -86,11 +88,17 @@ void is31fl3218_init(void) {

// Load PWM registers and LED Control register data
is31fl3218_write_register(IS31FL3218_REG_UPDATE, 0x01);

for (int i = 0; i < IS31FL3218_LED_COUNT; i++) {
is31fl3218_set_led_control_register(i, true, true, true);
}

is31fl3218_update_led_control_registers();
}

void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
is31fl3218_led_t led;
if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
if (index >= 0 && index < IS31FL3218_LED_COUNT) {
memcpy_P(&led, (&g_is31fl3218_leds[index]), sizeof(led));
}
if (g_pwm_buffer[led.r - IS31FL3218_REG_PWM] == red && g_pwm_buffer[led.g - IS31FL3218_REG_PWM] == green && g_pwm_buffer[led.b - IS31FL3218_REG_PWM] == blue) {
Expand All @@ -103,7 +111,7 @@ void is31fl3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
}

void is31fl3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
for (int i = 0; i < IS31FL3218_LED_COUNT; i++) {
is31fl3218_set_color(i, red, green, blue);
}
}
Expand Down
6 changes: 5 additions & 1 deletion drivers/led/issi/is31fl3218.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@

#define IS31FL3218_I2C_ADDRESS 0x54

#if defined(RGB_MATRIX_IS31FL3218)
# define IS31FL3218_LED_COUNT RGB_MATRIX_LED_COUNT
#endif

typedef struct is31fl3218_led_t {
uint8_t r;
uint8_t g;
uint8_t b;
} __attribute__((packed)) is31fl3218_led_t;

extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[RGB_MATRIX_LED_COUNT];
extern const is31fl3218_led_t PROGMEM g_is31fl3218_leds[IS31FL3218_LED_COUNT];

void is31fl3218_init(void);

Expand Down
Loading

0 comments on commit 60cf8ba

Please sign in to comment.