Add keyboardio-dvorak.scm layout.

This commit is contained in:
Phil Hagelberg 2021-06-05 17:05:28 -07:00
parent 71e98173e8
commit 9b59db6754
2 changed files with 80 additions and 1 deletions

View file

@ -1,6 +1,7 @@
MCU=atmega32u4 MCU=atmega32u4
F_CPU=16000000 F_CPU=16000000
MODEL?=LEO
LAYOUT?=qwerty LAYOUT?=qwerty
USB=/dev/ttyACM0 USB=/dev/ttyACM0
@ -25,7 +26,7 @@ $(LAYOUT).hex: $(LAYOUT).elf
avr-objcopy --output-target=ihex $(LAYOUT).elf $(LAYOUT).hex avr-objcopy --output-target=ihex $(LAYOUT).elf $(LAYOUT).hex
$(LAYOUT).s: $(LAYOUT).scm menelaus.scm keycodes.scm $(LAYOUT).s: $(LAYOUT).scm menelaus.scm keycodes.scm
microscheme -m LEO $(LAYOUT).scm microscheme -m $(MODEL) $(LAYOUT).scm
%.elf: %.s usb_keyboard.s %.elf: %.s usb_keyboard.s
avr-gcc -mmcu=$(MCU) -o $(LAYOUT).elf $(LAYOUT).s usb_keyboard.s avr-gcc -mmcu=$(MCU) -o $(LAYOUT).elf $(LAYOUT).s usb_keyboard.s

78
keyboardio-dvorak.scm Normal file
View file

@ -0,0 +1,78 @@
;;; This is the soft dvorak Kebyoardio layout.
;; It is written with the assumption that the host OS is set to dvorak mode, so
;; it sends keycodes with the assumption that the OS will apply the dvorak
;; mapping; for instance it sends [ as -, which the OS then turns back into [.
;; Currently requires this branch of microscheme:
;; https://github.com/ryansuchocki/microscheme/pull/36
(include "keycodes.scm")
;; What are the rows and columns we care about?
(define rows (list 0 1 2 3))
(define columns (list 0 1 2 3 4 5 6 7 8 9 10 11))
;; Which GPIO pins are responsible for each row or column?
;; These are the pins used by the Keyboardio Atreus.
(define row-pins (vector 0 1 2 3))
(define column-pins (vector 4 5 6 7 8 9 10 11 12 13 14 15))
;; We have to declare this up front and set it later because of circularity.
(define layers #f)
(define current-layer #f)
(define momentary-layer #f)
(define (fn on?) (set! momentary-layer (and on? (vector-ref layers 1))))
(define (set-layer n)
(lambda (_) (set! current-layer (vector-ref layers n))))
;;;; Layers
(define base-layer
(vector key-q key-w key-e key-r key-t 0
0 key-y key-u key-i key-o key-p
key-a key-s key-d key-f key-g 0
0 key-h key-j key-k key-l key-semicolon
key-z key-x key-c key-v key-b key-backtick
key-backslash key-n key-m key-comma key-period key-slash
key-esc key-tab mod-super mod-shift key-backspace mod-ctrl
mod-alt key-space fn key-quote key-left-bracket key-enter))
(define fn-layer
(vector (sft key-1) (sft key-2) key-up (sft key-4) (sft key-5) 0
0 key-page-up key-7 key-8 key-9 key-backspace
(sft key-9) key-left key-down key-right (sft key-0) 0
0 key-page-down key-4 key-5 key-6 0
key-dash key-equal (sft key-3) (sft key-dash) (sft key-equal) (sft key-6)
(sft key-7) (sft key-8) key-1 key-2 key-3 (sft key-right-bracket)
;; set-layer 2 takes us to l2-layer below; doesn't need to be held
(set-layer 2) key-insert mod-super mod-shift key-backspace mod-ctrl
mod-alt key-space fn key-e key-0 key-right-bracket))
(define l2-layer
(vector key-insert key-home key-up key-end key-page-up 0
0 key-up key-f7 key-f8 key-f9 key-f10
key-delete key-left key-down key-right key-page-down 0
0 key-down key-f4 key-f5 key-f6 key-f11
;; the B key enters the bootloader
0 key-vol-up 0 0 reset 0
0 0 key-f1 key-f2 key-f3 key-f12
(set-layer 0) key-vol-down mod-super mod-shift key-backspace mod-ctrl
;; tapping the fn key brings us back to the base layer
0 0 (set-layer 0) key-printscreen key-scroll-lock key-pause))
(set! layers (vector base-layer fn-layer l2-layer))
(set! current-layer (vector-ref layers 0))
(include "menelaus.scm")