[Keyboard] Vision keyboard by SatT (#9768)
* Add vision keyboard * Remove bootloader_defs.h * Update keyboards/satt/vision/readme.md * Change Vendor ID * Update keyboards/satt/vision/config.h * Update keyboards/satt/vision/rules.mk * Fix info.json * Apply suggestions from code review * Add license header * Apply suggestions from code review
This commit is contained in:
		
							parent
							
								
									993d4058a1
								
							
						
					
					
						commit
						e4a0a5f4e1
					
				
					 18 changed files with 2129 additions and 0 deletions
				
			
		
							
								
								
									
										93
									
								
								keyboards/satt/vision/keymaps/default/keymap.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								keyboards/satt/vision/keymaps/default/keymap.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,93 @@
 | 
			
		|||
/*
 | 
			
		||||
Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
 | 
			
		||||
 | 
			
		||||
This program is free software: you can redistribute it and/or modify
 | 
			
		||||
it under the terms of the GNU General Public License as published by
 | 
			
		||||
the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
(at your option) any later version.
 | 
			
		||||
 | 
			
		||||
This program is distributed in the hope that it will be useful,
 | 
			
		||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
You should have received a copy of the GNU General Public License
 | 
			
		||||
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*/
 | 
			
		||||
#include QMK_KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
 | 
			
		||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
 | 
			
		||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
 | 
			
		||||
// entirely and just use numbers.
 | 
			
		||||
enum layer_names {
 | 
			
		||||
    _QWERTY,
 | 
			
		||||
    _LOWER,
 | 
			
		||||
    _RAISE,
 | 
			
		||||
    _ADJUST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum custom_keycodes {
 | 
			
		||||
  LOWER = SAFE_RANGE,
 | 
			
		||||
  RAISE,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define ADJUST MO(_ADJUST)
 | 
			
		||||
 | 
			
		||||
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		||||
 | 
			
		||||
	[_QWERTY] = LAYOUT(
 | 
			
		||||
        KC_PGUP, KC_ESC,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSPC, KC_DEL,
 | 
			
		||||
        KC_PGDN, KC_TAB,  KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    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_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, ADJUST,
 | 
			
		||||
                 KC_LGUI,          KC_LALT,     LOWER,        KC_SPC,      RAISE,        KC_ENT,      KC_RALT,               KC_RCTL
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_LOWER] = LAYOUT(
 | 
			
		||||
        _______, _______, KC_EXLM, KC_AT,   KC_HASH, KC_DLR,  KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, _______,
 | 
			
		||||
        _______, _______, _______, _______, _______, _______, KC_GRV,  KC_BSLS, KC_MINS, KC_EQL,  KC_LBRC, KC_RBRC,      _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, KC_TILD, _______, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_RAISE] = LAYOUT(
 | 
			
		||||
        _______, _______, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    _______, _______,
 | 
			
		||||
        _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, KC_END,       _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, _______, KC_HOME, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX, _______, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_ADJUST] = LAYOUT(
 | 
			
		||||
        RESET,   _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,
 | 
			
		||||
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,      _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    )
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
  switch (keycode) {
 | 
			
		||||
    case LOWER:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        layer_on(_LOWER);
 | 
			
		||||
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
 | 
			
		||||
      } else {
 | 
			
		||||
        layer_off(_LOWER);
 | 
			
		||||
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
    case RAISE:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        layer_on(_RAISE);
 | 
			
		||||
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
 | 
			
		||||
      } else {
 | 
			
		||||
        layer_off(_RAISE);
 | 
			
		||||
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										149
									
								
								keyboards/satt/vision/keymaps/satt/action_pseudo.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										149
									
								
								keyboards/satt/vision/keymaps/satt/action_pseudo.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,149 @@
 | 
			
		|||
/* Copyright 2020 shela
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "quantum.h"
 | 
			
		||||
#include "command.h"
 | 
			
		||||
#include "action_pseudo.h"
 | 
			
		||||
 | 
			
		||||
static uint8_t send_key_shift_bit[SHIFT_BIT_SIZE];
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Action Pseudo Process.
 | 
			
		||||
 * Gets the keycode in the same position of the specified layer.
 | 
			
		||||
 * The keycode is sent after conversion according to the conversion keymap.
 | 
			
		||||
 */
 | 
			
		||||
void action_pseudo_process(keyrecord_t *record, uint8_t base_layer, const uint16_t (*keymap)[2]) {
 | 
			
		||||
    uint8_t  prev_shift;
 | 
			
		||||
    uint16_t keycode;
 | 
			
		||||
    uint16_t pseudo_keycode;
 | 
			
		||||
 | 
			
		||||
    /* Get keycode from specified layer */
 | 
			
		||||
    keycode = keymap_key_to_keycode(base_layer, record->event.key);
 | 
			
		||||
 | 
			
		||||
    prev_shift = get_mods() & MOD_MASK_SHIFT;
 | 
			
		||||
 | 
			
		||||
    if (record->event.pressed) {
 | 
			
		||||
        /* If magic commands entered, keycode is not converted */
 | 
			
		||||
        if (IS_COMMAND()) {
 | 
			
		||||
            if (prev_shift) {
 | 
			
		||||
                add_shift_bit(keycode);
 | 
			
		||||
            }
 | 
			
		||||
            register_code(keycode);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (prev_shift) {
 | 
			
		||||
            pseudo_keycode = convert_keycode(keymap, keycode, true);
 | 
			
		||||
            dprintf("pressed: %02X, converted: %04X\n", keycode, pseudo_keycode);
 | 
			
		||||
            add_shift_bit(keycode);
 | 
			
		||||
 | 
			
		||||
            if (IS_LSFT(pseudo_keycode)) {
 | 
			
		||||
                register_code(QK_LSFT ^ pseudo_keycode);
 | 
			
		||||
            } else {
 | 
			
		||||
                /* Delete shift mod temporarily */
 | 
			
		||||
                unregister_mods(prev_shift);
 | 
			
		||||
                register_code(pseudo_keycode);
 | 
			
		||||
                register_mods(prev_shift);
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            pseudo_keycode = convert_keycode(keymap, keycode, false);
 | 
			
		||||
            dprintf("pressed: %02X, converted: %04X\n", keycode, pseudo_keycode);
 | 
			
		||||
 | 
			
		||||
            if (IS_LSFT(pseudo_keycode)) {
 | 
			
		||||
                register_weak_mods(MOD_LSFT);
 | 
			
		||||
                register_code(QK_LSFT ^ pseudo_keycode);
 | 
			
		||||
                /* Prevent key repeat to avoid unintended output on Windows */
 | 
			
		||||
                unregister_code(QK_LSFT ^ pseudo_keycode);
 | 
			
		||||
                unregister_weak_mods(MOD_LSFT);
 | 
			
		||||
            } else {
 | 
			
		||||
                register_code(pseudo_keycode);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        if (get_shift_bit(keycode)) {
 | 
			
		||||
            del_shift_bit(keycode);
 | 
			
		||||
            pseudo_keycode = convert_keycode(keymap, keycode, true);
 | 
			
		||||
        } else {
 | 
			
		||||
            pseudo_keycode = convert_keycode(keymap, keycode, false);
 | 
			
		||||
        }
 | 
			
		||||
        dprintf("released: %02X, converted: %04X\n", keycode, pseudo_keycode);
 | 
			
		||||
 | 
			
		||||
        if (IS_LSFT(pseudo_keycode)) {
 | 
			
		||||
            unregister_code(QK_LSFT ^ pseudo_keycode);
 | 
			
		||||
        } else {
 | 
			
		||||
            unregister_code(pseudo_keycode);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Convert keycode according to the keymap */
 | 
			
		||||
uint16_t convert_keycode(const uint16_t (*keymap)[2], uint16_t keycode, bool shift_modded) {
 | 
			
		||||
    uint16_t pseudo_keycode = 0x00; /* default value */
 | 
			
		||||
 | 
			
		||||
    switch (keycode) {
 | 
			
		||||
        case KC_A ... KC_CAPSLOCK:
 | 
			
		||||
#if defined(__AVR__)
 | 
			
		||||
            if (shift_modded) {
 | 
			
		||||
                pseudo_keycode = pgm_read_word(&keymap[keycode][1]);
 | 
			
		||||
            } else {
 | 
			
		||||
                pseudo_keycode = pgm_read_word(&keymap[keycode][0]);
 | 
			
		||||
            }
 | 
			
		||||
#else
 | 
			
		||||
            if (shift_modded) {
 | 
			
		||||
                pseudo_keycode = keymap[keycode][1];
 | 
			
		||||
            } else {
 | 
			
		||||
                pseudo_keycode = keymap[keycode][0];
 | 
			
		||||
            }
 | 
			
		||||
#endif
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* If pseudo keycode is the default value, use the keycode as it is */
 | 
			
		||||
    if (pseudo_keycode == 0x00) {
 | 
			
		||||
        if (shift_modded) {
 | 
			
		||||
            pseudo_keycode = S(keycode);
 | 
			
		||||
        } else {
 | 
			
		||||
            pseudo_keycode = keycode;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return pseudo_keycode;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t get_shift_bit(uint16_t keycode) {
 | 
			
		||||
    if ((keycode >> 3) < SHIFT_BIT_SIZE) {
 | 
			
		||||
        return send_key_shift_bit[keycode >> 3] & (1 << (keycode & 7));
 | 
			
		||||
    } else {
 | 
			
		||||
        dprintf("get_shift_bit: Can't get shift bit. keycode: %02X\n", keycode);
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void add_shift_bit(uint16_t keycode) {
 | 
			
		||||
    if ((keycode >> 3) < SHIFT_BIT_SIZE) {
 | 
			
		||||
        send_key_shift_bit[keycode >> 3] |= (1 << (keycode & 7));
 | 
			
		||||
    } else {
 | 
			
		||||
        dprintf("add_shift_bit: Can't add shift bit. keycode: %02X\n", keycode);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void del_shift_bit(uint16_t keycode) {
 | 
			
		||||
    if ((keycode >> 3) < SHIFT_BIT_SIZE) {
 | 
			
		||||
        send_key_shift_bit[keycode >> 3] &= ~(1 << (keycode & 7));
 | 
			
		||||
    } else {
 | 
			
		||||
        dprintf("del_shift_bit: Can't delete shift bit. keycode: %02X\n", keycode);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								keyboards/satt/vision/keymaps/satt/action_pseudo.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								keyboards/satt/vision/keymaps/satt/action_pseudo.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
/* Copyright 2020 shela
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#define SHIFT_BIT_SIZE (0xE7 / 8 + 1) /* 1bit per 1key */
 | 
			
		||||
#define IS_LSFT(kc) ((QK_LSFT & (kc)) == QK_LSFT)
 | 
			
		||||
 | 
			
		||||
void     action_pseudo_process(keyrecord_t *, uint8_t, const uint16_t (*)[2]);
 | 
			
		||||
uint16_t convert_keycode(const uint16_t (*)[2], uint16_t, bool);
 | 
			
		||||
 | 
			
		||||
uint8_t get_shift_bit(uint16_t);
 | 
			
		||||
void    add_shift_bit(uint16_t);
 | 
			
		||||
void    del_shift_bit(uint16_t);
 | 
			
		||||
							
								
								
									
										168
									
								
								keyboards/satt/vision/keymaps/satt/keymap.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										168
									
								
								keyboards/satt/vision/keymaps/satt/keymap.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,168 @@
 | 
			
		|||
/*
 | 
			
		||||
Copyright 2019 Sekigon
 | 
			
		||||
 | 
			
		||||
This program is free software: you can redistribute it and/or modify
 | 
			
		||||
it under the terms of the GNU General Public License as published by
 | 
			
		||||
the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
(at your option) any later version.
 | 
			
		||||
 | 
			
		||||
This program is distributed in the hope that it will be useful,
 | 
			
		||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
You should have received a copy of the GNU General Public License
 | 
			
		||||
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include QMK_KEYBOARD_H
 | 
			
		||||
#include "keymap_jis2us.h"
 | 
			
		||||
#include "action_pseudo.h"
 | 
			
		||||
#include "keymap_jp.h"
 | 
			
		||||
 | 
			
		||||
enum custom_keycodes {
 | 
			
		||||
    JIS2US = SAFE_RANGE,  /* JIS2US keycode                       */
 | 
			
		||||
    QWERTY,               /* Layer  keycode                       */
 | 
			
		||||
    PSEU_US,              /* Layer  keycode                       */
 | 
			
		||||
    LOWER,                /* Layer  keycode                       */
 | 
			
		||||
    RAISE,                /* Layer  keycode                       */
 | 
			
		||||
    P_LOWER,              /* Layer  keycode                       */
 | 
			
		||||
    P_RAISE               /* Layer  keycode                       */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum layer_names {
 | 
			
		||||
    _QWERTY,
 | 
			
		||||
    _LOWER,
 | 
			
		||||
    _RAISE,
 | 
			
		||||
    _PSEUDO_US,
 | 
			
		||||
    _PSEUDO_US_LOWER,
 | 
			
		||||
    _PSEUDO_US_RAISE,
 | 
			
		||||
    _ADJUST,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Layer related keycodes
 | 
			
		||||
#define ADJUST  MO(_ADJUST)
 | 
			
		||||
 | 
			
		||||
// Special keycodes
 | 
			
		||||
#define SPC_CTL CTL_T(KC_SPC)
 | 
			
		||||
#define ENT_SFT SFT_T(KC_ENT)
 | 
			
		||||
#define TB_CTSF C_S_T(KC_TAB)
 | 
			
		||||
#define IMON_AL ALT_T(KC_F13)
 | 
			
		||||
#define IMOF_AL ALT_T(KC_F14)
 | 
			
		||||
#define CTALDEL LCA(KC_DEL)
 | 
			
		||||
#define ESC_ADJ LT(_ADJUST, KC_ESC)
 | 
			
		||||
#define GUI_E LGUI(KC_E)
 | 
			
		||||
#define GUI_R LGUI(KC_R)
 | 
			
		||||
#define CTLGRV LCTL(KC_GRV)
 | 
			
		||||
 | 
			
		||||
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		||||
 | 
			
		||||
	[_QWERTY] = LAYOUT(
 | 
			
		||||
        GUI_E,   ESC_ADJ, KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_DEL, KC_DEL,
 | 
			
		||||
        GUI_R,   TB_CTSF, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN,     KC_BSPC,
 | 
			
		||||
                 KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    CTLGRV,  KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_QUOT,
 | 
			
		||||
                 KC_LGUI,          IMOF_AL,     LOWER,        SPC_CTL,     RAISE,        ENT_SFT, IMON_AL,                   KC_RCTL
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_LOWER] = LAYOUT(
 | 
			
		||||
        _______, _______, KC_EXLM, KC_AT,   KC_HASH, KC_DLR,  KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, _______,
 | 
			
		||||
        _______, _______, _______, KC_F2,   KC_F5,   KC_F10,  KC_GRV,  KC_BSLS, KC_MINS, KC_EQL,  KC_LBRC, KC_RBRC,     _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, KC_TILD, _______, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_RAISE] = LAYOUT(
 | 
			
		||||
        _______, _______, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    _______, _______,
 | 
			
		||||
        _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, KC_END,      _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, _______, KC_HOME, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX, _______, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_PSEUDO_US] = LAYOUT(
 | 
			
		||||
        _______, _______, KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    _______, _______,
 | 
			
		||||
        _______, _______, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    JIS2US,      _______,
 | 
			
		||||
                 _______, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    JP_ZHTG, KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, JIS2US,
 | 
			
		||||
                 _______,          _______,     P_LOWER,      _______,     P_RAISE,      _______, _______,                   _______
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_PSEUDO_US_LOWER] = LAYOUT(
 | 
			
		||||
        _______, _______, JP_EXLM, JP_AT,   JP_HASH, JP_DLR,  JP_PERC, JP_CIRC, JP_AMPR, JP_ASTR, JP_LPRN, JP_RPRN, _______, _______,
 | 
			
		||||
        _______, _______, _______, KC_F2,   KC_F5,   KC_F10,  JP_GRV,  JP_BSLS, JP_MINS, JP_EQL,  JP_LBRC, JP_RBRC,     _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, JP_TILD, _______, JP_PIPE, JP_UNDS, JP_PLUS, JP_LCBR, JP_RCBR, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_PSEUDO_US_RAISE] = LAYOUT(
 | 
			
		||||
        _______, _______, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    _______, _______,
 | 
			
		||||
        _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, KC_END,      _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, _______, KC_HOME, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX, _______, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_ADJUST] = LAYOUT(
 | 
			
		||||
        RESET,   _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,
 | 
			
		||||
        _______, _______, _______, _______, QWERTY,  PSEU_US, CTALDEL, _______, _______, _______, _______, _______,     _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    )
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
  switch (keycode) {
 | 
			
		||||
    case LOWER:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        layer_on(_LOWER);
 | 
			
		||||
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
 | 
			
		||||
      } else {
 | 
			
		||||
        layer_off(_LOWER);
 | 
			
		||||
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
    case RAISE:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        layer_on(_RAISE);
 | 
			
		||||
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
 | 
			
		||||
      } else {
 | 
			
		||||
        layer_off(_RAISE);
 | 
			
		||||
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
    case P_LOWER:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        layer_on(_PSEUDO_US_LOWER);
 | 
			
		||||
        update_tri_layer(_PSEUDO_US_LOWER, _PSEUDO_US_RAISE, _ADJUST);
 | 
			
		||||
      } else {
 | 
			
		||||
        layer_off(_PSEUDO_US_LOWER);
 | 
			
		||||
        update_tri_layer(_PSEUDO_US_LOWER, _PSEUDO_US_RAISE, _ADJUST);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
    case P_RAISE:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        layer_on(_PSEUDO_US_RAISE);
 | 
			
		||||
        update_tri_layer(_PSEUDO_US_LOWER, _PSEUDO_US_RAISE, _ADJUST);
 | 
			
		||||
      } else {
 | 
			
		||||
        layer_off(_PSEUDO_US_RAISE);
 | 
			
		||||
        update_tri_layer(_PSEUDO_US_LOWER, _PSEUDO_US_RAISE, _ADJUST);
 | 
			
		||||
      }
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
    case QWERTY:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        set_single_persistent_default_layer(_QWERTY);
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    case PSEU_US:
 | 
			
		||||
      if (record->event.pressed) {
 | 
			
		||||
        set_single_persistent_default_layer(_PSEUDO_US);
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    case JIS2US:
 | 
			
		||||
      action_pseudo_process(record, _QWERTY, keymap_jis2us);
 | 
			
		||||
      return false;
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										49
									
								
								keyboards/satt/vision/keymaps/satt/keymap_jis2us.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								keyboards/satt/vision/keymaps/satt/keymap_jis2us.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,49 @@
 | 
			
		|||
/* Copyright 2020 shela
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "keymap_jp.h"
 | 
			
		||||
 | 
			
		||||
// clang-format off
 | 
			
		||||
/* Keymap for converting JIS to US */
 | 
			
		||||
const uint16_t PROGMEM keymap_jis2us[][2] = {
 | 
			
		||||
    [KC_A ... KC_CAPS] = { 0x00, 0x00 }, /* default value */
 | 
			
		||||
 | 
			
		||||
    [KC_1]    = { KC_1,    JP_EXLM }, /* 1 and ! -> 1 and ! */
 | 
			
		||||
    [KC_2]    = { KC_2,    JP_AT   }, /* 2 and " -> 2 and @ */
 | 
			
		||||
    [KC_3]    = { KC_3,    JP_HASH }, /* 3 and # -> 3 and # */
 | 
			
		||||
    [KC_4]    = { KC_4,    JP_DLR  }, /* 4 and $ -> 4 and $ */
 | 
			
		||||
    [KC_5]    = { KC_5,    JP_PERC }, /* 5 and % -> 5 and % */
 | 
			
		||||
    [KC_6]    = { KC_6,    JP_CIRC }, /* 6 and & -> 6 and ^ */
 | 
			
		||||
    [KC_7]    = { KC_7,    JP_AMPR }, /* 7 and ' -> 7 and & */
 | 
			
		||||
    [KC_8]    = { KC_8,    JP_ASTR }, /* 8 and ( -> 8 and * */
 | 
			
		||||
    [KC_9]    = { KC_9,    JP_LPRN }, /* 9 and ) -> 9 and ( */
 | 
			
		||||
    [KC_0]    = { KC_0,    JP_RPRN }, /* 0       -> 0 and ) */
 | 
			
		||||
    [KC_MINS] = { JP_MINS, JP_UNDS }, /* - and = -> - and _ */
 | 
			
		||||
    [KC_EQL]  = { JP_EQL,  JP_PLUS }, /* ^ and ~ -> = and + */
 | 
			
		||||
    [KC_LBRC] = { JP_LBRC, JP_LCBR }, /* @ and ` -> [ and { */
 | 
			
		||||
    [KC_RBRC] = { JP_RBRC, JP_RCBR }, /* [ and { -> ] and } */
 | 
			
		||||
    [KC_BSLS] = { JP_YEN,  JP_PIPE }, /* ] and } -> \ and | */
 | 
			
		||||
    [KC_NUHS] = { JP_YEN,  JP_PIPE }, /* ] and } -> \ and | */
 | 
			
		||||
    [KC_SCLN] = { JP_SCLN, JP_COLN }, /* ; and + -> ; and : */
 | 
			
		||||
    [KC_QUOT] = { JP_QUOT, JP_DQT  }, /* : and * -> ' and " */
 | 
			
		||||
    [KC_GRV]  = { JP_GRV,  JP_TILD }, /* Han/Zen -> ` and ~ */
 | 
			
		||||
    [KC_COMM] = { JP_COMM, JP_LT   }, /* , and < -> , and < */
 | 
			
		||||
    [KC_DOT]  = { JP_DOT,  JP_GT   }, /* . and > -> . and > */
 | 
			
		||||
    [KC_SLSH] = { JP_SLSH, JP_QUES }, /* / and ? -> / and ? */
 | 
			
		||||
};
 | 
			
		||||
// clang-format on
 | 
			
		||||
							
								
								
									
										6
									
								
								keyboards/satt/vision/keymaps/satt/readme.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								keyboards/satt/vision/keymaps/satt/readme.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
## Pseudo US Layout
 | 
			
		||||
 | 
			
		||||
On a Japanese Windows environment, ANSI keyboards may be recognized wrongly as a JIS keyboard.  
 | 
			
		||||
By using this code, you can use your ANSI keyboard under a JIS keyboard environment without changing the settings and registry of your environment.
 | 
			
		||||
 | 
			
		||||
Original code by [Shela](https://github.com/qmk/qmk_firmware/tree/master/keyboards/hhkb/keymaps/shela)
 | 
			
		||||
							
								
								
									
										1
									
								
								keyboards/satt/vision/keymaps/satt/rules.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								keyboards/satt/vision/keymaps/satt/rules.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
SRC += action_pseudo.c
 | 
			
		||||
							
								
								
									
										64
									
								
								keyboards/satt/vision/keymaps/via/keymap.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								keyboards/satt/vision/keymaps/via/keymap.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,64 @@
 | 
			
		|||
/*
 | 
			
		||||
Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
 | 
			
		||||
 | 
			
		||||
This program is free software: you can redistribute it and/or modify
 | 
			
		||||
it under the terms of the GNU General Public License as published by
 | 
			
		||||
the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
(at your option) any later version.
 | 
			
		||||
 | 
			
		||||
This program is distributed in the hope that it will be useful,
 | 
			
		||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
You should have received a copy of the GNU General Public License
 | 
			
		||||
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
*/
 | 
			
		||||
#include QMK_KEYBOARD_H
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
 | 
			
		||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
 | 
			
		||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
 | 
			
		||||
// entirely and just use numbers.
 | 
			
		||||
enum layer_names {
 | 
			
		||||
    _QWERTY,
 | 
			
		||||
    _LOWER,
 | 
			
		||||
    _RAISE,
 | 
			
		||||
    _ADJUST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define LOWER MO(_LOWER)
 | 
			
		||||
#define RAISE MO(_RAISE)
 | 
			
		||||
#define ADJUST MO(_ADJUST)
 | 
			
		||||
 | 
			
		||||
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		||||
 | 
			
		||||
	[_QWERTY] = LAYOUT(
 | 
			
		||||
        KC_PGUP, KC_ESC,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSPC, KC_DEL,
 | 
			
		||||
        KC_PGDN, KC_TAB,  KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    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_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, ADJUST,
 | 
			
		||||
                 KC_LGUI,          KC_LALT,     LOWER,        KC_SPC,      RAISE,        KC_ENT,      KC_RALT,               KC_RCTL
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_LOWER] = LAYOUT(
 | 
			
		||||
        _______, _______, KC_EXLM, KC_AT,   KC_HASH, KC_DLR,  KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, _______,
 | 
			
		||||
        _______, _______, _______, _______, _______, _______, KC_GRV,  KC_BSLS, KC_MINS, KC_EQL,  KC_LBRC, KC_RBRC,      _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, KC_TILD, _______, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_RAISE] = LAYOUT(
 | 
			
		||||
        _______, _______, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    _______, _______,
 | 
			
		||||
        _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, KC_END,       _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, _______, KC_HOME, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX, _______, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    ),
 | 
			
		||||
 | 
			
		||||
	[_ADJUST] = LAYOUT(
 | 
			
		||||
        RESET,   _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,
 | 
			
		||||
        _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,      _______,
 | 
			
		||||
                 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
 | 
			
		||||
                 _______,          _______,     _______,      _______,     _______,      _______, _______,                   _______
 | 
			
		||||
    )
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										3
									
								
								keyboards/satt/vision/keymaps/via/rules.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								keyboards/satt/vision/keymaps/via/rules.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
# rules.mk overrides to enable VIA
 | 
			
		||||
 | 
			
		||||
VIA_ENABLE = yes
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue