Compare commits

...

8 Commits

Author SHA1 Message Date
Simon
7f5f984099
Merge 250c987bc8 into c843ad1268 2024-11-20 20:45:38 -08:00
Nick Brassel
c843ad1268
Add Sagittarius encoder support. (#24617) 2024-11-20 08:59:07 +11:00
russell-myers1
0988523851
Fix typo in docs/api_development_overview.md (#24620) 2024-11-19 13:37:39 -07:00
Buckwich
250c987bc8 condense 2024-11-13 21:53:29 +01:00
Buckwich
9ba088133e reformat 2024-11-13 20:48:57 +01:00
Buckwich
5d59e06f8d add description, default, and examples from docs/reference_info_json.md to json schema 2024-11-12 00:12:45 +01:00
Buckwich
2e2ae506ce format keyboard.jsonschema with prettier 2024-11-11 23:47:12 +01:00
Buckwich
d667eb193d use valid json syntax for jsonschema 2024-11-11 23:45:13 +01:00
10 changed files with 1749 additions and 937 deletions

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,8 @@
"$ref": "qmk.definitions.v1#/hex_number_4d" "$ref": "qmk.definitions.v1#/hex_number_4d"
}, },
"additionalProperties": { "additionalProperties": {
"type": "object", // use 'qmk.definitions.v1#/keycode_decl' when problem keycodes are removed "$comment": "use 'qmk.definitions.v1#/keycode_decl' when problem keycodes are removed",
"type": "object",
"required": [ "required": [
"key" "key"
], ],

View File

@ -8,7 +8,7 @@
], ],
"properties": { "properties": {
"userspace_version": { "userspace_version": {
"type": "string", "type": "string"
}, }
} }
} }

View File

@ -9,7 +9,7 @@
{"$ref": "qmk.definitions.v1#/keyboard_keymap_tuple"}, {"$ref": "qmk.definitions.v1#/keyboard_keymap_tuple"},
{"$ref": "qmk.definitions.v1#/json_file_path"} {"$ref": "qmk.definitions.v1#/json_file_path"}
] ]
}, }
}, },
"required": [ "required": [
"userspace_version", "userspace_version",

View File

@ -10,7 +10,7 @@
{"$ref": "qmk.definitions.v1#/keyboard_keymap_env"}, {"$ref": "qmk.definitions.v1#/keyboard_keymap_env"},
{"$ref": "qmk.definitions.v1#/json_file_path"} {"$ref": "qmk.definitions.v1#/json_file_path"}
] ]
}, }
}, },
"required": [ "required": [
"userspace_version", "userspace_version",

View File

@ -4,7 +4,7 @@ This page attempts to introduce developers to the QMK Compiler. It does not go i
# Overview # Overview
The QMK Compile API consists of a few movings parts: The QMK Compile API consists of a few moving parts:
![Architecture Diagram](https://raw.githubusercontent.com/qmk/qmk_api/master/docs/architecture.svg) ![Architecture Diagram](https://raw.githubusercontent.com/qmk/qmk_api/master/docs/architecture.svg)

View File

@ -60,6 +60,14 @@
"resync": true "resync": true
} }
}, },
"encoder": {
"rotary": [
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
{"pin_a": "B12", "pin_b": "B11", "resolution": 2}
]
},
"layouts": { "layouts": {
"LAYOUT_default": { "LAYOUT_default": {
"layout": [ "layout": [

View File

@ -44,3 +44,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
) )
}; };
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN), ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(UG_HUED, UG_HUEU), ENCODER_CCW_CW(UG_SATD, UG_SATU) },
[1] = { ENCODER_CCW_CW(UG_VALD, UG_VALU), ENCODER_CCW_CW(UG_SPDD, UG_SPDU), ENCODER_CCW_CW(UG_PREV, UG_NEXT), ENCODER_CCW_CW(KC_RIGHT, KC_LEFT) },
};
#endif

View File

@ -0,0 +1,2 @@
ENCODER_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@ -0,0 +1,40 @@
// Copyright 2024 Nick Brassel (@tzarc)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
#if defined(ENCODER_ENABLE) || defined(ENCODER_MAP_ENABLE)
# if !defined(ENCODER_SETTLE_PIN_STATE_DELAY_US)
# define ENCODER_SETTLE_PIN_STATE_DELAY_US 2
# endif
static pin_t matrix_row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
void encoder_driver_task(void) {
// Set all relevant rows to output, which is different to the matrix expectations
for (uint8_t i = 0; i < 4; i++) {
gpio_set_pin_output(matrix_row_pins[i]);
}
// Read each encoder
for (uint8_t i = 0; i < 4; i++) {
// Set the row pin low for the corresponding encoder...
for (uint8_t j = 0; j < 4; j++) {
gpio_write_pin(matrix_row_pins[j], (i == j) ? 0 : 1);
}
// ...and let them settle.
wait_us(ENCODER_SETTLE_PIN_STATE_DELAY_US);
// Run the normal encoder handling
extern void encoder_quadrature_handle_read(uint8_t index, uint8_t pin_a_state, uint8_t pin_b_state);
extern uint8_t encoder_quadrature_read_pin(uint8_t index, bool pad_b);
encoder_quadrature_handle_read(i, encoder_quadrature_read_pin(i, false), encoder_quadrature_read_pin(i, true));
}
// Set all rows back to input-high as per matrix expectations
for (uint8_t i = 0; i < 4; i++) {
gpio_set_pin_input_high(matrix_row_pins[i]);
}
}
#endif // defined(ENCODER_ENABLE) || defined(ENCODER_MAP_ENABLE)