Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
QMK Bot 2023-06-21 00:33:07 +00:00
commit 6ec91a75d5
7 changed files with 103 additions and 45 deletions

View file

@ -46,8 +46,10 @@
{"matrix": [0, 12], "x": 12, "y": 0},
{"matrix": [0, 13], "x": 13, "y": 0},
{"matrix": [1, 14], "x": 14, "y": 0},
{"matrix": [0, 14], "x": 15.75, "y": 0},
{"matrix": [1, 0], "w": 1.5, "x": 0, "y": 1},
{"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
{"matrix": [1, 1], "x": 1.5, "y": 1},
{"matrix": [1, 2], "x": 2.5, "y": 1},
{"matrix": [1, 3], "x": 3.5, "y": 1},
@ -60,9 +62,11 @@
{"matrix": [1, 10], "x": 10.5, "y": 1},
{"matrix": [1, 11], "x": 11.5, "y": 1},
{"matrix": [1, 12], "x": 12.5, "y": 1},
{"matrix": [1, 13], "w": 1.5, "x": 13.5, "y": 1},
{"matrix": [1, 13], "x": 13.5, "y": 1, "w": 1.5},
{"matrix": [2, 14], "x": 15.5, "y": 1.5},
{"matrix": [2, 0], "w": 1.75, "x": 0, "y": 2},
{"matrix": [2, 0], "x": 0, "y": 2, "w": 1.75},
{"matrix": [2, 1], "x": 1.75, "y": 2},
{"matrix": [2, 2], "x": 2.75, "y": 2},
{"matrix": [2, 3], "x": 3.75, "y": 2},
@ -74,11 +78,13 @@
{"matrix": [2, 9], "x": 9.75, "y": 2},
{"matrix": [2, 10], "x": 10.75, "y": 2},
{"matrix": [2, 11], "x": 11.75, "y": 2},
{"matrix": [2, 12], "w": 2.25, "x": 12.75, "y": 2},
{"matrix": [2, 12], "x": 12.75, "y": 2, "w": 2.25},
{"matrix": [3, 14], "x": 15.5, "y": 2.5},
{"matrix": [3, 0], "w": 1.25, "x": 0, "y": 3},
{"matrix": [4, 4], "x": 2.25, "y": 3},
{"matrix": [3, 1], "x": 1.25, "y": 3},
{"matrix": [3, 0], "x": 0, "y": 3, "w": 1.25},
{"matrix": [4, 4], "x": 1.25, "y": 3},
{"matrix": [3, 1], "x": 2.25, "y": 3},
{"matrix": [3, 2], "x": 3.25, "y": 3},
{"matrix": [3, 3], "x": 4.25, "y": 3},
{"matrix": [3, 4], "x": 5.25, "y": 3},
@ -88,17 +94,20 @@
{"matrix": [3, 8], "x": 9.25, "y": 3},
{"matrix": [3, 9], "x": 10.25, "y": 3},
{"matrix": [3, 10], "x": 11.25, "y": 3},
{"matrix": [3, 12], "w": 1.75, "x": 12.25, "y": 3},
{"matrix": [3, 12], "x": 12.25, "y": 3, "w": 1.75},
{"matrix": [2, 13], "x": 14.25, "y": 3.25},
{"matrix": [4, 0], "w": 1.25, "x": 0, "y": 4},
{"matrix": [4, 1], "w": 1.25, "x": 1.25, "y": 4},
{"matrix": [4, 2], "w": 1.25, "x": 2.5, "y": 4},
{"matrix": [4, 3], "w": 3, "x": 3.75, "y": 4},
{"matrix": [4, 5], "w": 6.25, "x": 3.75, "y": 4},
{"matrix": [4, 6], "w": 3.25, "x": 6.75, "y": 4},
{"matrix": [4, 0], "x": 0, "y": 4, "w": 1.25},
{"matrix": [4, 1], "x": 1.25, "y": 4, "w": 1.25},
{"matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.25},
{"matrix": [4, 3], "x": 3.75, "y": 4, "w": 3, "h": 0.625},
{"matrix": [4, 5], "x": 3.75, "y": 4.625, "w": 6.25, "h": 0.625},
{"matrix": [4, 6], "x": 6.75, "y": 4, "w": 3.25, "h": 0.625},
{"matrix": [4, 10], "x": 10, "y": 4},
{"matrix": [4, 11], "x": 11, "y": 4},
{"matrix": [4, 12], "x": 12, "y": 4},
{"matrix": [3, 13], "x": 13.25, "y": 4.25},
{"matrix": [4, 13], "x": 14.25, "y": 4.25},
{"matrix": [4, 14], "x": 15.25, "y": 4.25}

View file

@ -0,0 +1,38 @@
# Matrix Diagram for Kalakos Bahrnob65
```
┌───────┐
2u Backspace │0D │
└───────┘
┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ ┌───┐
│00 │01 │02 │03 │04 │05 │06 │07 │08 │09 │0A │0B │0C │0D │1E │ │0E │
├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤ └───┘ ┌─────┐
│10 │11 │12 │13 │14 │15 │16 │17 │18 │19 │1A │1B │1C │1D │ ┌───┐ │ │
├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ │2E │ ┌──┴┐1D │ ISO Enter
│20 │21 │22 │23 │24 │25 │26 │27 │28 │29 │2A │2B │2C │ ├───┤ │2C │ │
├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┘ │3E │ └───┴────┘
│30 │44 │31 │32 │33 │34 │35 │36 │37 │38 │39 │3A │3C │┌───┐└───┘
├────┼───┴┬──┴─┬─┴───┴───┴─┬─┴───┴───┴──┬┴──┬┴──┬┴──┬───┘│2D │
│40 │41 │42 │43 │46 │4A │4B │4C │┌───┼───┼───┐
└────┴────┴────┴───────────┴────────────┴───┴───┴───┘│3D │4D │4E │
└───┴───┴───┘
┌────────┐
│30 │ 2.25u LShift
└────────┘
┌────┬────┬────┬────────────────────────┬───┬───┬───┐
│40 │41 │42 │45 │4A │4B │4C │ Standard
└────┴────┴────┴────────────────────────┴───┴───┴───┘
┌─────┬─────┬───────────────────────────┬───┬───┬───┐
│40 │41 │45 │4A │4B │4C │ LWKL
└─────┴─────┴───────────────────────────┴───┴───┴───┘
┌────┬────┬────┬────────────────────────┬─────┬─────┐
│40 │41 │42 │45 │4A │4C │ RWKL
└────┴────┴────┴────────────────────────┴─────┴─────┘
┌────┬────┬────┬───────────┬────────────┬─────┬─────┐
│40 │41 │42 │43 │46 │4A │4C │ RWKL with Split (3/3.25u) Spacebars
└────┴────┴────┴───────────┴────────────┴─────┴─────┘
┌─────┬─────┬───────────────────────────┬─────┬─────┐
│40 │41 │45 │4A │4C │ WKL
└─────┴─────┴───────────────────────────┴─────┴─────┘
```

View file

@ -27,6 +27,7 @@ void matrix_init_custom(void) {
// actual matrix setup - cols
for (int i = 0; i < MATRIX_COLS; i++) {
setPinOutput(matrix_col_pins[i]);
writePinLow(matrix_col_pins[i]);
}
// rows

View file

@ -41,9 +41,3 @@
- etc.
*/
// #define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
// #define MIDI_TONE_KEYCODE_OCTAVES 2
// Most tactile encoders have detents every 4 stages
#define ENCODER_RESOLUTION 4

View file

@ -189,17 +189,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
#ifdef KEYBOARD_planck_rev5
writePinLow(E6);
#endif
} else {
unregister_code(KC_RSFT);
#ifdef KEYBOARD_planck_rev5
writePinHigh(E6);
#endif
}
return false;
break;

View file

@ -31,21 +31,36 @@
#define STM32_IWDG_RL_MS(s) STM32_IWDG_RL_US(s * 1000.0)
#define STM32_IWDG_RL_S(s) STM32_IWDG_RL_US(s * 1000000.0)
#if !defined(PLANCK_ENCODER_RESOLUTION)
# define PLANCK_ENCODER_RESOLUTION 4
#endif
#if !defined(PLANCK_WATCHDOG_TIMEOUT)
# define PLANCK_WATCHDOG_TIMEOUT 1.0
#endif
#ifdef ENCODER_MAP_ENABLE
#error "The encoder map feature is not currently supported by the Planck's encoder matrix"
#endif
/* matrix state(1:on, 0:off) */
static pin_t matrix_row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static pin_t matrix_col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
static matrix_row_t matrix_inverted[MATRIX_COLS];
#ifdef ENCODER_ENABLE
int8_t encoder_LUT[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0};
uint8_t encoder_state[8] = {0};
int8_t encoder_pulses[8] = {0};
uint8_t encoder_value[8] = {0};
#endif
void matrix_init_custom(void) {
// actual matrix setup - cols
for (int i = 0; i < MATRIX_COLS; i++) {
setPinOutput(matrix_col_pins[i]);
writePinLow(matrix_col_pins[i]);
}
// rows
@ -57,50 +72,47 @@ void matrix_init_custom(void) {
setPinInputLow(B12);
setPinInputLow(B13);
// setup watchdog timer for 1 second
#ifndef PLANCK_WATCHDOG_DISABLE
wdgInit();
static WDGConfig wdgcfg;
wdgcfg.pr = STM32_IWDG_PR_S(1.0);
wdgcfg.rlr = STM32_IWDG_RL_S(1.0);
wdgcfg.pr = STM32_IWDG_PR_S(PLANCK_WATCHDOG_TIMEOUT);
wdgcfg.rlr = STM32_IWDG_RL_S(PLANCK_WATCHDOG_TIMEOUT);
wdgcfg.winr = STM32_IWDG_WIN_DISABLED;
wdgStart(&WDGD1, &wdgcfg);
#endif
}
#ifdef ENCODER_ENABLE
bool encoder_update(uint8_t index, uint8_t state) {
bool changed = false;
uint8_t i = index;
encoder_pulses[i] += encoder_LUT[state & 0xF];
if (encoder_pulses[i] >= ENCODER_RESOLUTION) {
if (encoder_pulses[i] >= PLANCK_ENCODER_RESOLUTION) {
encoder_value[index]++;
changed = true;
#ifdef ENCODER_MAP_ENABLE
encoder_exec_mapping(index, false);
#else // ENCODER_MAP_ENABLE
encoder_update_kb(index, false);
#endif // ENCODER_MAP_ENABLE
}
if (encoder_pulses[i] <= -ENCODER_RESOLUTION) {
if (encoder_pulses[i] <= -PLANCK_ENCODER_RESOLUTION) {
encoder_value[index]--;
changed = true;
#ifdef ENCODER_MAP_ENABLE
encoder_exec_mapping(index, true);
#else // ENCODER_MAP_ENABLE
encoder_update_kb(index, true);
#endif // ENCODER_MAP_ENABLE
}
encoder_pulses[i] %= ENCODER_RESOLUTION;
encoder_pulses[i] %= PLANCK_ENCODER_RESOLUTION;
#ifdef ENCODER_DEFAULT_POS
encoder_pulses[i] = 0;
#endif
return changed;
}
#endif
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
#ifndef PLANCK_WATCHDOG_DISABLE
// reset watchdog
wdgReset(&WDGD1);
#endif
bool changed = false;
@ -136,6 +148,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
changed |= old != current_matrix[row];
}
#ifdef ENCODER_ENABLE
// encoder-matrix functionality
// set up C/rows for encoder read
@ -168,6 +181,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
for (int i = 0; i < MATRIX_ROWS; i++) {
setPinInputLow(matrix_row_pins[i]);
}
#endif
return changed;
}

View file

@ -14,7 +14,7 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to
## Encoders
Encoders must have matching pulse & detent resolutions (e.g. 24/24) for the scanning to work properly. Multiple encoders can be used at the same time, and are zero-indexed (compared to being one-indexed on the PCB's silkscreen) in the `encoder_update_user(index, clockwise)` function:
Encoders must have matching pulse & detent resolutions (e.g. 24/24) for the scanning to work properly. Multiple encoders can be used at the same time, and are zero-indexed (compared to being one-indexed on the PCB's silkscreen) in the `encoder_update_user(uint8_t index, bool clockwise)` function:
```
,-----------------------------------------------------------------------------------.
@ -28,4 +28,15 @@ Encoders must have matching pulse & detent resolutions (e.g. 24/24) for the scan
`-----------------------------------------------------------------------------------'
```
If an encoder has a switch built-in, it's connected to the key at that location. On the default keymap, each encoder will play its own rising/falling tone sequence when rotated, and will reset the pitch after one second of inactivity.
If an encoder has a switch built-in, it's connected to the key at that location. On the default keymap, each encoder will play its own rising/falling tone sequence when rotated, and will reset the pitch after one second of inactivity. The encoder map feature is not currently supported.
## Some Planck-specific config.h options:
```c
// sets the length (in seconds) of the watchdog timer, which will reset the keyboard due to hang/crash in the code
#define PLANCK_WATCHDOG_TIMEOUT 1.0
// disables the watchdog timer - you may want to disable the watchdog timer if you use longer macros
#define PLANCK_WATCHDOG_DISABLE
// the resolution of the encoders used in the encoder matrix
#define PLANCK_ENCODER_RESOLUTION 4
```