diff options
Diffstat (limited to 'keyboards/rgbkb')
-rw-r--r-- | keyboards/rgbkb/mun/halconf.h | 6 | ||||
-rw-r--r-- | keyboards/rgbkb/mun/keymaps/default/config.h | 7 | ||||
-rw-r--r-- | keyboards/rgbkb/mun/keymaps/default/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/rgbkb/mun/keymaps/via/config.h | 30 | ||||
-rw-r--r-- | keyboards/rgbkb/mun/keymaps/via/keymap.c | 252 | ||||
-rw-r--r-- | keyboards/rgbkb/mun/keymaps/via/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/rgbkb/mun/matrix.c | 190 | ||||
-rw-r--r-- | keyboards/rgbkb/mun/mcuconf.h | 23 | ||||
-rw-r--r-- | keyboards/rgbkb/mun/mun.c | 8 | ||||
-rw-r--r-- | keyboards/rgbkb/mun/rev1/rgbkb_mun_rev1_default.json | 13 | ||||
-rw-r--r-- | keyboards/rgbkb/mun/rules.mk | 4 |
11 files changed, 334 insertions, 201 deletions
diff --git a/keyboards/rgbkb/mun/halconf.h b/keyboards/rgbkb/mun/halconf.h index c8d832a81d..f5b97499dd 100644 --- a/keyboards/rgbkb/mun/halconf.h +++ b/keyboards/rgbkb/mun/halconf.h @@ -9,16 +9,10 @@ #pragma once -//#define HAL_USE_DAC TRUE - -//#define HAL_USE_GPT TRUE - #define HAL_USE_I2C TRUE #define HAL_USE_PWM TRUE #define HAL_USE_SERIAL TRUE -#define HAL_USE_SERIAL_USB TRUE - #include_next <halconf.h> diff --git a/keyboards/rgbkb/mun/keymaps/default/config.h b/keyboards/rgbkb/mun/keymaps/default/config.h index 967b309f63..9719d17437 100644 --- a/keyboards/rgbkb/mun/keymaps/default/config.h +++ b/keyboards/rgbkb/mun/keymaps/default/config.h @@ -20,11 +20,4 @@ // #define RGB_DISABLE_TIMEOUT 1200000 #define RGB_DISABLE_WHEN_USB_SUSPENDED -#define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 2 -// 224B per layer right now -#define DYNAMIC_KEYMAP_LAYER_COUNT 8 -#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047 - -#define VIA_QMK_RGBLIGHT_ENABLE - #define STM32_ONBOARD_EEPROM_SIZE 2048 diff --git a/keyboards/rgbkb/mun/keymaps/default/rules.mk b/keyboards/rgbkb/mun/keymaps/default/rules.mk deleted file mode 100644 index 1e5b99807c..0000000000 --- a/keyboards/rgbkb/mun/keymaps/default/rules.mk +++ /dev/null @@ -1 +0,0 @@ -VIA_ENABLE = yes diff --git a/keyboards/rgbkb/mun/keymaps/via/config.h b/keyboards/rgbkb/mun/keymaps/via/config.h new file mode 100644 index 0000000000..967b309f63 --- /dev/null +++ b/keyboards/rgbkb/mun/keymaps/via/config.h @@ -0,0 +1,30 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * <https://github.com/Legonut> wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#pragma once + +// No need for the single versions when multi performance isn't a problem =D +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#define DISABLE_RGB_MATRIX_SPLASH +#define DISABLE_RGB_MATRIX_SOLID_SPLASH + +// 20m timeout (20m * 60s * 1000mil) +// #define RGB_DISABLE_TIMEOUT 1200000 +#define RGB_DISABLE_WHEN_USB_SUSPENDED + +#define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 2 +// 224B per layer right now +#define DYNAMIC_KEYMAP_LAYER_COUNT 8 +#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047 + +#define VIA_QMK_RGBLIGHT_ENABLE + +#define STM32_ONBOARD_EEPROM_SIZE 2048 diff --git a/keyboards/rgbkb/mun/keymaps/via/keymap.c b/keyboards/rgbkb/mun/keymaps/via/keymap.c new file mode 100644 index 0000000000..b120c3a37a --- /dev/null +++ b/keyboards/rgbkb/mun/keymaps/via/keymap.c @@ -0,0 +1,252 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * <https://github.com/Legonut> wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#include QMK_KEYBOARD_H +#include "common_oled.h" + +enum keymap_layers { + _QWERTY, + _COLEMAK, + _GAME, + _FN, + _ADJUST, + _VIA1, + _VIA2, + _VIA3 +}; + +enum keymap_keycodes { + // Disables touch processing + TCH_TOG = SAFE_RANGE, + MENU_BTN, + MENU_UP, + MENU_DN +}; + +// Default Layers +#define QWERTY DF(_QWERTY) +#define COLEMAK DF(_COLEMAK) +#define GAME DF(_GAME) + +// Momentary Layers +#define FN MO(_FN) +#define ADJUST MO(_ADJUST) + +#define FN_CAPS LT(_FN, KC_CAPS) +#define FN_ESC LT(_FN, KC_ESC) + +/* This keyboard is enabled with an RGB Menu Control system. +This functionality is enabled, but still requires a little configuration based on your exact setup. +The RGB Menu will appear on the Right Half's OLED and can be controlled by the MENU keycodes: +MENU_BTN - Triggers a button action for the menu +MENU_UP - Triggers an increase action for the menu +MENU_DN - Triggers a decrease action for the menu + +To finish configuration for your board, you will want to change the default keycodes for an encoder on the right half. +Encoder press keycode should be set to MENU_BTN, Clockwise should be MENU_UP, and Counter Clockwise should be MENU_DN. +Depending on where you add an encoder to the right half will determin in the default keymap where you should put those keycodes. +*/ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* QWERTY + * .--------------------------------------------------------------. .--------------------------------------------------------------. + * | `~/ESC | 1 | 2 | 3 | 4 | 5 | - | | = | 6 | 7 | 8 | 9 | 0 | Bckspc | + * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + * | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ | + * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + * | FN/Caps| A | S | D | F | G | ( | | ) | H | J | K | L | : | ' | + * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + * | Shift | Z | X | C | V | B | { | | } | N | M | , | . | / |Shft/Ent| + * |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + * | Ctrl | Win | Alt | RGBTOG | Adjust | Space | Bksp | | Enter | Space | Left | Down | Up | Right | Ctrl | + * '--------+--------+--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------+--------+--------' + * Encoder 1 Encoder 2 Encoder 3 Encoder 4 + * .-----------------------------------. .-----------------------------------. + * | VolUp | VolDn | VolUp | VolDn | | PgUp | PgDn | PgUp | PgDn | + * |--------+--------+--------+--------+--------. .--------+--------+--------+--------+--------| + * | VolDn | VolUp | Next | Play | Prev | Touch Encoder Touch Encoder | RgbHuI | RgbHuD | RgbMdD | RgbTog | RgbMdI | + * '--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------' + */ + [_QWERTY] = LAYOUT( + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_MINS, KC_EQL, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, + FN_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LPRN, KC_RPRN, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LCBR, KC_RCBR, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_SFTENT, + KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, ADJUST, KC_SPC, KC_DEL, KC_ENT, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,KC_RCTL, + + KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_PGDN, KC_PGUP, KC_PGDN, KC_PGUP, + KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, KC_MPRV, RGB_HUI, RGB_HUD, RGB_RMOD,RGB_TOG, RGB_MOD + ), + + [_COLEMAK] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_Q, KC_W, KC_F, KC_P, KC_G, _______, _______, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, _______, + _______, KC_A, KC_R, KC_S, KC_T, KC_D, _______, _______, KC_H, KC_N, KC_E, KC_I, KC_O, _______, + _______, KC_Z, KC_X, KC_C, KC_V, KC_B, _______, _______, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + + _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_GAME] = LAYOUT( + _______, _______, _______, _______, _______, _______, KC_F1, KC_F5, _______, _______, _______, _______, _______, _______, + _______, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_F2, KC_F6, KC_Y, KC_U, KC_I, KC_O, KC_P, _______, + _______, KC_A, KC_S, KC_D, KC_F, KC_G, KC_F3, KC_F7, KC_H, KC_J, KC_K, KC_L, KC_SCLN, _______, + _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_F4, KC_F8, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, + _______, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + + _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_FN] = LAYOUT( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, KC_HOME, KC_UP, KC_END, _______, _______, _______, _______, _______, KC_HOME, KC_UP, KC_END, KC_PSCR, KC_PGUP, + _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_INS, KC_PGDN, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, TCH_TOG, _______, _______, _______, _______, _______, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, + + _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_ADJUST] = LAYOUT( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, RGB_SAD, RGB_VAI, RGB_SAI, RESET, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, _______, _______, + _______, RGB_HUD, RGB_VAD, RGB_HUI, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, + _______, RGB_SPD, _______, RGB_SPI, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, _______, GAME, + _______, RGB_RMOD,_______, RGB_MOD, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_NLCK, QWERTY, COLEMAK, + + _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_VIA1] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + + _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_VIA2] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + + _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_VIA3] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + + _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) + { + case MENU_BTN: + if (record->event.pressed) { + rgb_menu_selection(); + } + return false; + case MENU_UP: + if (record->event.pressed) { + rgb_menu_action(true); + } + return false; + case MENU_DN: + if (record->event.pressed) { + rgb_menu_action(false); + } + return false; + case TCH_TOG: + if (record->event.pressed) { + touch_encoder_toggle(); + } + return false; // Skip all further processing of this key + default: + return true; + } +} + +static void render_layer(void) { + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer"), false); + switch (get_highest_layer(layer_state)) { + case _QWERTY: + oled_write_ln_P(PSTR("QWRTY"), false); + break; + case _COLEMAK: + oled_write_ln_P(PSTR("Colemk"), false); + break; + case _GAME: + oled_write_ln_P(PSTR("Game "), false); + break; + case _FN: + oled_write_ln_P(PSTR("FN "), false); + break; + case _ADJUST: + oled_write_ln_P(PSTR("Adjst"), false); + break; + default: + oled_write_ln_P(PSTR("Undef"), false); + } +} + +static void render_leds(void) +{ + // Host Keyboard LED Status + led_t led_state = host_keyboard_led_state(); + oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false); + oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false); + oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false); +} + +static void render_touch(void) +{ + // Host Touch LED Status + oled_write_P(!touch_encoder_toggled() ? PSTR("TOUCH") : PSTR(" "), false); + oled_write_P(touch_encoder_calibrating() ? PSTR("CLBRT") : PSTR(" "), false); +} + +void oled_task_user(void) { + if (is_keyboard_left()) { + render_icon(); + oled_write_P(PSTR(" "), false); + render_layer(); + oled_write_P(PSTR(" "), false); + render_leds(); + oled_write_P(PSTR(" "), false); + render_touch(); + } + else { + render_icon(); + oled_write_P(PSTR(" "), false); + render_rgb_menu(); + } +} + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_270; +} diff --git a/keyboards/rgbkb/mun/keymaps/via/rules.mk b/keyboards/rgbkb/mun/keymaps/via/rules.mk new file mode 100644 index 0000000000..40bded3991 --- /dev/null +++ b/keyboards/rgbkb/mun/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE=yes
\ No newline at end of file diff --git a/keyboards/rgbkb/mun/matrix.c b/keyboards/rgbkb/mun/matrix.c index 497ab041f4..b859847f10 100644 --- a/keyboards/rgbkb/mun/matrix.c +++ b/keyboards/rgbkb/mun/matrix.c @@ -7,150 +7,56 @@ * ---------------------------------------------------------------------------- */ -#include <stdint.h> -#include <stdbool.h> -#include <string.h> -#include "util.h" #include "matrix.h" -#include "debounce.h" -#include "quantum.h" -#include "split_util.h" -#include "config.h" -#include "transactions.h" - -#define ERROR_DISCONNECT_COUNT 5 -#define ROWS_PER_HAND (MATRIX_ROWS / 2) - -static const pin_t row_pins[ROWS_PER_HAND] = MATRIX_ROW_PINS; -static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; - -/* matrix state(1:on, 0:off) */ -extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values -extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values - -// row offsets for each hand -uint8_t thisHand, thatHand; - -// user-defined overridable functions -__attribute__((weak)) void matrix_slave_scan_kb(void) { matrix_slave_scan_user(); } -__attribute__((weak)) void matrix_slave_scan_user(void) {} - -static void init_pins(void) { - for (size_t i = 0; i < MATRIX_COLS; i++) { - setPinInputHigh(col_pins[i]); - } - for (size_t i = 0; i < ROWS_PER_HAND; i++) { - setPinOutput(row_pins[i]); - writePinHigh(row_pins[i]); - } -} - -void matrix_init(void) { - split_pre_init(); - - thisHand = isLeftHand ? 0 : (ROWS_PER_HAND); - thatHand = ROWS_PER_HAND - thisHand; - - // initialize key pins - init_pins(); - - // initialize matrix state: all keys off - memset(raw_matrix, 0, sizeof(raw_matrix)); - memset(matrix, 0, sizeof(matrix)); - - debounce_init(ROWS_PER_HAND); - - matrix_init_quantum(); - - split_post_init(); -} - -bool matrix_post_scan(void) { - bool changed = false; - if (is_keyboard_master()) { - static uint8_t error_count; - - matrix_row_t slave_matrix[ROWS_PER_HAND] = {0}; - if (!transport_master(matrix + thisHand, slave_matrix)) { - error_count++; - - if (error_count > ERROR_DISCONNECT_COUNT) { - // reset other half if disconnected - memset(&matrix[thatHand], 0, sizeof(slave_matrix)); - memset(slave_matrix, 0, sizeof(slave_matrix)); - - changed = true; - } - } else { - error_count = 0; - - if (memcmp(&matrix[thatHand], slave_matrix, sizeof(slave_matrix)) != 0) { - memcpy(&matrix[thatHand], slave_matrix, sizeof(slave_matrix)); - changed = true; - } - } - - matrix_scan_quantum(); - } else { - transport_slave(matrix + thatHand, matrix + thisHand); - - matrix_slave_scan_kb(); - } - - return changed; +#include "atomic_util.h" +#include "gpio.h" + +static pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; + +void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { + /* Drive row pin low. */ + ATOMIC_BLOCK_FORCEON { writePinLow(row_pins[current_row]); } + matrix_output_select_delay(); + + /* Read all columns in one go, aka port scanning. */ + uint16_t porta = palReadPort(GPIOA); + uint16_t portb = palReadPort(GPIOB); + + /* Order of pins on the mun is: A0, B11, B0, B10, B12, B2, A8 + Pin is active low, therefore we have to invert the result. */ + matrix_row_t cols = ~(((porta & (0x1 << 0)) >> 0) // A0 (0) + | ((portb & (0x1 << 11)) >> 10) // B11 (1) + | ((portb & (0x1 << 0)) << 2) // B0 (2) + | ((portb & (0x1 << 10)) >> 7) // B10 (3) + | ((portb & (0x1 << 12)) >> 8) // B12 (4) + | ((portb & (0x1 << 2)) << 3) // B2 (5) + | ((porta & (0x1 << 8)) >> 2)); // A8 (6) + + /* Reverse the order of columns for left hand as the board is flipped. */ + // if (isLeftHand) { + // #if defined(__arm__) + // /* rbit assembly reverses bit order of 32bit registers. */ + // uint32_t temp = cols; + // __asm__("rbit %0, %1" : "=r"(temp) : "r"(temp)); + // cols = temp >> 24; + // #else + // /* RISC-V bit manipulation extension not present. Use bit-hack. + // https://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits */ + // cols = (matrix_row_t)(((cols * 0x0802LU & 0x22110LU) | (cols * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16); + // #endif + // } + + current_matrix[current_row] = cols; + + /* Drive row pin high again. */ + ATOMIC_BLOCK_FORCEON { writePinHigh(row_pins[current_row]); } + matrix_output_unselect_delay(current_row, row_pins[current_row] != 0); } -uint8_t matrix_scan(void) { - bool local_changed = false; - matrix_row_t current_matrix[ROWS_PER_HAND]; - - for (size_t row_idx = 0; row_idx < ROWS_PER_HAND; row_idx++) { - /* Drive row pin low. */ - ATOMIC_BLOCK_FORCEON { writePinLow(row_pins[row_idx]); } - matrix_output_select_delay(); - - /* Read all columns in one go, aka port scanning. */ - uint16_t porta = palReadPort(GPIOA); - uint16_t portb = palReadPort(GPIOB); - - /* Order of pins on the mun is: A0, B11, B0, B10, B12, B2, A8 - Pin is active low, therefore we have to invert the result. */ - matrix_row_t cols = ~(((porta & (0x1 << 0)) >> 0) // A0 (0) - | ((portb & (0x1 << 11)) >> 10) // B11 (1) - | ((portb & (0x1 << 0)) << 2) // B0 (2) - | ((portb & (0x1 << 10)) >> 7) // B10 (3) - | ((portb & (0x1 << 12)) >> 8) // B12 (4) - | ((portb & (0x1 << 2)) << 3) // B2 (5) - | ((porta & (0x1 << 8)) >> 2)); // A8 (6) - - /* Reverse the order of columns for left hand as the board is flipped. */ - // if (isLeftHand) { - // #if defined(__arm__) - // /* rbit assembly reverses bit order of 32bit registers. */ - // uint32_t temp = cols; - // __asm__("rbit %0, %1" : "=r"(temp) : "r"(temp)); - // cols = temp >> 24; - // #else - // /* RISC-V bit manipulation extension not present. Use bit-hack. - // https://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits */ - // cols = (matrix_row_t)(((cols * 0x0802LU & 0x22110LU) | (cols * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16); - // #endif - // } - - current_matrix[row_idx] = cols; - - /* Drive row pin high again. */ - ATOMIC_BLOCK_FORCEON { writePinHigh(row_pins[row_idx]); } - matrix_output_unselect_delay(row_idx, row_pins[row_idx] != 0); +#if defined(BUSY_WAIT) +void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { + for (int32_t i = 0; i < BUSY_WAIT_INSTRUCTIONS; i++) { + __asm__ volatile("nop" ::: "memory"); } - - if (memcmp(raw_matrix, current_matrix, sizeof(current_matrix)) != 0) { - memcpy(raw_matrix, current_matrix, sizeof(current_matrix)); - local_changed = true; - } - - debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, local_changed); - - bool remote_changed = matrix_post_scan(); - return (uint8_t)(local_changed || remote_changed); } +#endif diff --git a/keyboards/rgbkb/mun/mcuconf.h b/keyboards/rgbkb/mun/mcuconf.h index acc083d8a5..dd6e38509c 100644 --- a/keyboards/rgbkb/mun/mcuconf.h +++ b/keyboards/rgbkb/mun/mcuconf.h @@ -11,32 +11,11 @@ #include_next <mcuconf.h> -#undef STM32_DAC_USE_DAC1_CH1 -#define STM32_DAC_USE_DAC1_CH1 TRUE - -#undef STM32_DAC_USE_DAC1_CH2 -#define STM32_DAC_USE_DAC1_CH2 TRUE - -#undef STM32_GPT_USE_TIM6 -#define STM32_GPT_USE_TIM6 TRUE - -#undef STM32_GPT_USE_TIM7 -#define STM32_GPT_USE_TIM7 TRUE - -#undef STM32_GPT_USE_TIM8 -#define STM32_GPT_USE_TIM8 TRUE - -#undef STM32_GPT_USE_TIM15 -#define STM32_GPT_USE_TIM15 TRUE - #undef STM32_I2C_USE_I2C1 #define STM32_I2C_USE_I2C1 TRUE #undef STM32_PWM_USE_TIM3 #define STM32_PWM_USE_TIM3 TRUE -#undef STM32_PWM_USE_TIM4 -#define STM32_PWM_USE_TIM4 TRUE - #undef STM32_SERIAL_USE_USART1 -#define STM32_SERIAL_USE_USART1 TRUE
\ No newline at end of file +#define STM32_SERIAL_USE_USART1 TRUE diff --git a/keyboards/rgbkb/mun/mun.c b/keyboards/rgbkb/mun/mun.c index 6cc95c46e9..f64de3342c 100644 --- a/keyboards/rgbkb/mun/mun.c +++ b/keyboards/rgbkb/mun/mun.c @@ -23,11 +23,3 @@ void housekeeping_task_kb(void) { touch_encoder_update(TOUCH_ENCODER_SYNC); rgb_menu_update(RGB_MENU_SYNC); } - -#if defined(BUSY_WAIT) -void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { - for (int32_t i = 0; i < BUSY_WAIT_INSTRUCTIONS; i++) { - __asm__ volatile("nop" ::: "memory"); - } -} -#endif diff --git a/keyboards/rgbkb/mun/rev1/rgbkb_mun_rev1_default.json b/keyboards/rgbkb/mun/rev1/rgbkb_mun_rev1_default.json deleted file mode 100644 index ccf70ef5f9..0000000000 --- a/keyboards/rgbkb/mun/rev1/rgbkb_mun_rev1_default.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "keyboard": "rgbkb/mun/rev1", - "keymap": "default", - "commit": "xxxxxxxxxxxxxxxxxxxxx", - "layout": "LAYOUT", - "layers": [ - ["KC_GESC","KC_1","KC_2","KC_3","KC_4","KC_5","KC_MINS","KC_EQL","KC_6","KC_7","KC_8","KC_9","KC_0","KC_BSPC","KC_TAB","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_LBRC","KC_RBRC","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_BSLS","LT(3,KC_CAPS)","KC_A","KC_S","KC_D","KC_F","KC_G","KC_LPRN","KC_RPRN","KC_H","KC_J","KC_K","KC_L","KC_SCLN","KC_QUOT","KC_LSFT","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_LCBR","KC_RCBR","KC_N","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_SFTENT","KC_LCTL","KC_LGUI","KC_LALT","RGB_TOG","MO(4)","KC_SPC","KC_BSPC","KC_ENT","KC_SPC","KC_LEFT","KC_DOWN","KC_UP","KC_RGHT","KC_RCTL","KC_VOLU","KC_VOLD","KC_VOLU","KC_VOLD","KC_PGUP","KC_PGDN","KC_PGUP","KC_PGDN","KC_VOLD","KC_VOLU","KC_MRWD","KC_MPLY","KC_MFFD","RGB_HUI","RGB_HUD","RGB_RMOD","RGB_TOG","RGB_MOD"], - ["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_Q","KC_W","KC_F","KC_P","KC_G","KC_TRNS","KC_TRNS","KC_J","KC_L","KC_U","KC_Y","KC_SCLN","KC_TRNS","KC_TRNS","KC_A","KC_R","KC_S","KC_T","KC_D","KC_TRNS","KC_TRNS","KC_H","KC_N","KC_E","KC_I","KC_O","KC_TRNS","KC_TRNS","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_TRNS","KC_TRNS","KC_K","KC_M","KC_COMM","KC_DOT","KC_SLSH","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","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","KC_TRNS","KC_TRNS","KC_TRNS","KC_F1","KC_F5","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_F2","KC_F6","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_TRNS","KC_TRNS","KC_A","KC_S","KC_D","KC_F","KC_G","KC_F3","KC_F7","KC_H","KC_J","KC_K","KC_L","KC_SCLN","KC_TRNS","KC_TRNS","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_F4","KC_F8","KC_N","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_TRNS","KC_TRNS","KC_NO","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","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_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_F11","KC_F12","KC_F6","KC_F7","KC_F8","KC_F9","KC_F10","KC_TRNS","KC_TRNS","KC_HOME","KC_UP","KC_END","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_HOME","KC_UP","KC_END","KC_PSCR","KC_PGUP","KC_TRNS","KC_LEFT","KC_DOWN","KC_RGHT","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_LEFT","KC_DOWN","KC_RGHT","KC_INS","KC_PGDN","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","ANY(TCH_TOG)","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_MPLY","KC_MNXT","KC_MUTE","KC_VOLD","KC_VOLU","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"], - ["KC_TRNS","KC_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_F11","KC_F12","KC_F6","KC_F7","KC_F8","KC_F9","KC_F10","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P7","KC_P8","KC_P9","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P4","KC_P5","KC_P6","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P1","KC_P2","KC_P3","KC_TRNS","DF(2)","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P0","KC_PDOT","KC_NLCK","DF(0)","DF(1)","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"] - ] -}
\ No newline at end of file diff --git a/keyboards/rgbkb/mun/rules.mk b/keyboards/rgbkb/mun/rules.mk index f016c6c710..85ee63346c 100644 --- a/keyboards/rgbkb/mun/rules.mk +++ b/keyboards/rgbkb/mun/rules.mk @@ -40,7 +40,7 @@ OPT = 3 OPT_DEFS += -DOLED_FONT_H=\"../common/glcdfont.c\" OPT_DEFS += -Ikeyboards/rgbkb/common -CUSTOM_MATRIX = yes -SRC += matrix.c matrix_common.c +# matrix optimisations +SRC += matrix.c DEFAULT_FOLDER = rgbkb/mun/rev1
\ No newline at end of file |