From 42d5a324eb673b2214a87c8911d850105c3bdaab Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Mon, 10 Jul 2017 11:18:47 -0400 Subject: Start mvoing hardware drivers to /drivers/ (#1433) * start driver isolation * update nyquist and orthodox boards * update atreus62 * move drivers to avr * update avr conditional --- keyboards/nyquist/pro_micro.h | 362 ------------------------------------------ 1 file changed, 362 deletions(-) delete mode 100644 keyboards/nyquist/pro_micro.h (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/pro_micro.h b/keyboards/nyquist/pro_micro.h deleted file mode 100644 index f9e7ed75d..000000000 --- a/keyboards/nyquist/pro_micro.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ -*/ - -#ifndef Pins_Arduino_h -#define Pins_Arduino_h - -#include - -// Workaround for wrong definitions in "iom32u4.h". -// This should be fixed in the AVR toolchain. -#undef UHCON -#undef UHINT -#undef UHIEN -#undef UHADDR -#undef UHFNUM -#undef UHFNUML -#undef UHFNUMH -#undef UHFLEN -#undef UPINRQX -#undef UPINTX -#undef UPNUM -#undef UPRST -#undef UPCONX -#undef UPCFG0X -#undef UPCFG1X -#undef UPSTAX -#undef UPCFG2X -#undef UPIENX -#undef UPDATX -#undef TCCR2A -#undef WGM20 -#undef WGM21 -#undef COM2B0 -#undef COM2B1 -#undef COM2A0 -#undef COM2A1 -#undef TCCR2B -#undef CS20 -#undef CS21 -#undef CS22 -#undef WGM22 -#undef FOC2B -#undef FOC2A -#undef TCNT2 -#undef TCNT2_0 -#undef TCNT2_1 -#undef TCNT2_2 -#undef TCNT2_3 -#undef TCNT2_4 -#undef TCNT2_5 -#undef TCNT2_6 -#undef TCNT2_7 -#undef OCR2A -#undef OCR2_0 -#undef OCR2_1 -#undef OCR2_2 -#undef OCR2_3 -#undef OCR2_4 -#undef OCR2_5 -#undef OCR2_6 -#undef OCR2_7 -#undef OCR2B -#undef OCR2_0 -#undef OCR2_1 -#undef OCR2_2 -#undef OCR2_3 -#undef OCR2_4 -#undef OCR2_5 -#undef OCR2_6 -#undef OCR2_7 - -#define NUM_DIGITAL_PINS 30 -#define NUM_ANALOG_INPUTS 12 - -#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) -#define TXLED0 PORTD |= (1<<5) -#define TXLED1 PORTD &= ~(1<<5) -#define RXLED0 PORTB |= (1<<0) -#define RXLED1 PORTB &= ~(1<<0) - -static const uint8_t SDA = 2; -static const uint8_t SCL = 3; -#define LED_BUILTIN 13 - -// Map SPI port to 'new' pins D14..D17 -static const uint8_t SS = 17; -static const uint8_t MOSI = 16; -static const uint8_t MISO = 14; -static const uint8_t SCK = 15; - -// Mapping of analog pins as digital I/O -// A6-A11 share with digital pins -static const uint8_t ADC0 = 18; -static const uint8_t ADC1 = 19; -static const uint8_t ADC2 = 20; -static const uint8_t ADC3 = 21; -static const uint8_t ADC4 = 22; -static const uint8_t ADC5 = 23; -static const uint8_t ADC6 = 24; // D4 -static const uint8_t ADC7 = 25; // D6 -static const uint8_t ADC8 = 26; // D8 -static const uint8_t ADC9 = 27; // D9 -static const uint8_t ADC10 = 28; // D10 -static const uint8_t ADC11 = 29; // D12 - -#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) -#define digitalPinToPCICRbit(p) 0 -#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) -#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) - -// __AVR_ATmega32U4__ has an unusual mapping of pins to channels -extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; -#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) - -#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) - -#ifdef ARDUINO_MAIN - -// On the Arduino board, digital pins are also used -// for the analog output (software PWM). Analog input -// pins are a separate set. - -// ATMEL ATMEGA32U4 / ARDUINO LEONARDO -// -// D0 PD2 RXD1/INT2 -// D1 PD3 TXD1/INT3 -// D2 PD1 SDA SDA/INT1 -// D3# PD0 PWM8/SCL OC0B/SCL/INT0 -// D4 A6 PD4 ADC8 -// D5# PC6 ??? OC3A/#OC4A -// D6# A7 PD7 FastPWM #OC4D/ADC10 -// D7 PE6 INT6/AIN0 -// -// D8 A8 PB4 ADC11/PCINT4 -// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 -// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 -// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 -// D12 A11 PD6 T1/#OC4D/ADC9 -// D13# PC7 PWM10 CLK0/OC4A -// -// A0 D18 PF7 ADC7 -// A1 D19 PF6 ADC6 -// A2 D20 PF5 ADC5 -// A3 D21 PF4 ADC4 -// A4 D22 PF1 ADC1 -// A5 D23 PF0 ADC0 -// -// New pins D14..D17 to map SPI port to digital pins -// -// MISO D14 PB3 MISO,PCINT3 -// SCK D15 PB1 SCK,PCINT1 -// MOSI D16 PB2 MOSI,PCINT2 -// SS D17 PB0 RXLED,SS/PCINT0 -// -// Connected LEDs on board for TX and RX -// TXLED D24 PD5 XCK1 -// RXLED D17 PB0 -// HWB PE2 HWB - -// these arrays map port names (e.g. port B) to the -// appropriate addresses for various functions (e.g. reading -// and writing) -const uint16_t PROGMEM port_to_mode_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &DDRB, - (uint16_t) &DDRC, - (uint16_t) &DDRD, - (uint16_t) &DDRE, - (uint16_t) &DDRF, -}; - -const uint16_t PROGMEM port_to_output_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PORTB, - (uint16_t) &PORTC, - (uint16_t) &PORTD, - (uint16_t) &PORTE, - (uint16_t) &PORTF, -}; - -const uint16_t PROGMEM port_to_input_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PINB, - (uint16_t) &PINC, - (uint16_t) &PIND, - (uint16_t) &PINE, - (uint16_t) &PINF, -}; - -const uint8_t PROGMEM digital_pin_to_port_PGM[] = { - PD, // D0 - PD2 - PD, // D1 - PD3 - PD, // D2 - PD1 - PD, // D3 - PD0 - PD, // D4 - PD4 - PC, // D5 - PC6 - PD, // D6 - PD7 - PE, // D7 - PE6 - - PB, // D8 - PB4 - PB, // D9 - PB5 - PB, // D10 - PB6 - PB, // D11 - PB7 - PD, // D12 - PD6 - PC, // D13 - PC7 - - PB, // D14 - MISO - PB3 - PB, // D15 - SCK - PB1 - PB, // D16 - MOSI - PB2 - PB, // D17 - SS - PB0 - - PF, // D18 - A0 - PF7 - PF, // D19 - A1 - PF6 - PF, // D20 - A2 - PF5 - PF, // D21 - A3 - PF4 - PF, // D22 - A4 - PF1 - PF, // D23 - A5 - PF0 - - PD, // D24 - PD5 - PD, // D25 / D6 - A7 - PD7 - PB, // D26 / D8 - A8 - PB4 - PB, // D27 / D9 - A9 - PB5 - PB, // D28 / D10 - A10 - PB6 - PD, // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { - _BV(2), // D0 - PD2 - _BV(3), // D1 - PD3 - _BV(1), // D2 - PD1 - _BV(0), // D3 - PD0 - _BV(4), // D4 - PD4 - _BV(6), // D5 - PC6 - _BV(7), // D6 - PD7 - _BV(6), // D7 - PE6 - - _BV(4), // D8 - PB4 - _BV(5), // D9 - PB5 - _BV(6), // D10 - PB6 - _BV(7), // D11 - PB7 - _BV(6), // D12 - PD6 - _BV(7), // D13 - PC7 - - _BV(3), // D14 - MISO - PB3 - _BV(1), // D15 - SCK - PB1 - _BV(2), // D16 - MOSI - PB2 - _BV(0), // D17 - SS - PB0 - - _BV(7), // D18 - A0 - PF7 - _BV(6), // D19 - A1 - PF6 - _BV(5), // D20 - A2 - PF5 - _BV(4), // D21 - A3 - PF4 - _BV(1), // D22 - A4 - PF1 - _BV(0), // D23 - A5 - PF0 - - _BV(5), // D24 - PD5 - _BV(7), // D25 / D6 - A7 - PD7 - _BV(4), // D26 / D8 - A8 - PB4 - _BV(5), // D27 / D9 - A9 - PB5 - _BV(6), // D28 / D10 - A10 - PB6 - _BV(6), // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - TIMER0B, /* 3 */ - NOT_ON_TIMER, - TIMER3A, /* 5 */ - TIMER4D, /* 6 */ - NOT_ON_TIMER, - - NOT_ON_TIMER, - TIMER1A, /* 9 */ - TIMER1B, /* 10 */ - TIMER0A, /* 11 */ - - NOT_ON_TIMER, - TIMER4A, /* 13 */ - - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, -}; - -const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { - 7, // A0 PF7 ADC7 - 6, // A1 PF6 ADC6 - 5, // A2 PF5 ADC5 - 4, // A3 PF4 ADC4 - 1, // A4 PF1 ADC1 - 0, // A5 PF0 ADC0 - 8, // A6 D4 PD4 ADC8 - 10, // A7 D6 PD7 ADC10 - 11, // A8 D8 PB4 ADC11 - 12, // A9 D9 PB5 ADC12 - 13, // A10 D10 PB6 ADC13 - 9 // A11 D12 PD6 ADC9 -}; - -#endif /* ARDUINO_MAIN */ - -// These serial port names are intended to allow libraries and architecture-neutral -// sketches to automatically default to the correct port name for a particular type -// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, -// the first hardware serial port whose RX/TX pins are not dedicated to another use. -// -// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor -// -// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial -// -// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library -// -// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. -// -// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX -// pins are NOT connected to anything by default. -#define SERIAL_PORT_MONITOR Serial -#define SERIAL_PORT_USBVIRTUAL Serial -#define SERIAL_PORT_HARDWARE Serial1 -#define SERIAL_PORT_HARDWARE_OPEN Serial1 - -#endif /* Pins_Arduino_h */ -- cgit v1.2.3 From e0caf94323d5cc0baae38af11984902fb1a5375f Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Thu, 3 Aug 2017 14:23:12 -0400 Subject: Move avrdude flashing script from individual keyboard rules.mk to common location and improve script. Port detection script is now more informative and better handles first time flashing of a Pro Micro --- keyboards/deltasplit75/rules.mk | 12 ------------ keyboards/handwired/atreus50/rules.mk | 12 ------------ keyboards/handwired/magicforce61/rules.mk | 12 ------------ keyboards/handwired/magicforce68/rules.mk | 12 ------------ keyboards/handwired/numpad20/rules.mk | 12 ------------ keyboards/handwired/ortho5x13/rules.mk | 12 ------------ keyboards/lets_split/rules.mk | 12 ------------ keyboards/nyquist/rules.mk | 12 ------------ keyboards/orthodox/rules.mk | 12 ------------ tmk_core/avr.mk | 14 ++++++++++++++ 10 files changed, 14 insertions(+), 108 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/deltasplit75/rules.mk b/keyboards/deltasplit75/rules.mk index 0efa78550..1aee5313c 100644 --- a/keyboards/deltasplit75/rules.mk +++ b/keyboards/deltasplit75/rules.mk @@ -73,15 +73,3 @@ USE_I2C ?= yes SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend CUSTOM_MATRIX = yes - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/handwired/atreus50/rules.mk b/keyboards/handwired/atreus50/rules.mk index 5e808dfa7..2e2d48f6a 100644 --- a/keyboards/handwired/atreus50/rules.mk +++ b/keyboards/handwired/atreus50/rules.mk @@ -67,15 +67,3 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/handwired/magicforce61/rules.mk b/keyboards/handwired/magicforce61/rules.mk index 913bcb93e..a3fdd3d70 100644 --- a/keyboards/handwired/magicforce61/rules.mk +++ b/keyboards/handwired/magicforce61/rules.mk @@ -69,15 +69,3 @@ AUDIO_ENABLE ?= no # Audio output on port C6 ifndef QUANTUM_DIR include ../../../Makefile endif - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/handwired/magicforce68/rules.mk b/keyboards/handwired/magicforce68/rules.mk index 0e07bde40..0d21623ce 100644 --- a/keyboards/handwired/magicforce68/rules.mk +++ b/keyboards/handwired/magicforce68/rules.mk @@ -69,15 +69,3 @@ AUDIO_ENABLE = no # Audio output on port C6 ifndef QUANTUM_DIR include ../../../Makefile endif - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/handwired/numpad20/rules.mk b/keyboards/handwired/numpad20/rules.mk index 0e07bde40..0d21623ce 100644 --- a/keyboards/handwired/numpad20/rules.mk +++ b/keyboards/handwired/numpad20/rules.mk @@ -69,15 +69,3 @@ AUDIO_ENABLE = no # Audio output on port C6 ifndef QUANTUM_DIR include ../../../Makefile endif - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/handwired/ortho5x13/rules.mk b/keyboards/handwired/ortho5x13/rules.mk index 0e07bde40..0d21623ce 100644 --- a/keyboards/handwired/ortho5x13/rules.mk +++ b/keyboards/handwired/ortho5x13/rules.mk @@ -69,15 +69,3 @@ AUDIO_ENABLE = no # Audio output on port C6 ifndef QUANTUM_DIR include ../../../Makefile endif - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/lets_split/rules.mk b/keyboards/lets_split/rules.mk index cc87ee31c..c2b7d556e 100644 --- a/keyboards/lets_split/rules.mk +++ b/keyboards/lets_split/rules.mk @@ -74,15 +74,3 @@ USE_I2C = yes SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend CUSTOM_MATRIX = yes - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [ -z $$USB ]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/nyquist/rules.mk b/keyboards/nyquist/rules.mk index dfcff1d90..3f40ff2f8 100644 --- a/keyboards/nyquist/rules.mk +++ b/keyboards/nyquist/rules.mk @@ -73,15 +73,3 @@ USE_I2C = yes SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend CUSTOM_MATRIX = yes - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/orthodox/rules.mk b/keyboards/orthodox/rules.mk index dfcff1d90..3f40ff2f8 100644 --- a/keyboards/orthodox/rules.mk +++ b/keyboards/orthodox/rules.mk @@ -73,15 +73,3 @@ USE_I2C = yes SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend CUSTOM_MATRIX = yes - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index 4af34ba57..0d0eec3bf 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -144,6 +144,20 @@ dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep fi $(DFU_PROGRAMMER) $(MCU) reset +avrdude: $(BUILD_DIR)/$(TARGET).hex + ls /dev/tty* > /tmp/1; \ + echo "Detecting Pro Micro port, reset your Pro Micro now.\c"; \ + while [ -z $$USB ]; do \ + sleep 1; \ + echo ".\c"; \ + ls /dev/tty* > /tmp/2; \ + USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ + done; \ + echo ""; \ + echo "Detected Pro Micro port at $$USB"; \ + sleep 1; \ + avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex + # Convert hex to bin. flashbin: $(BUILD_DIR)/$(TARGET).hex $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin -- cgit v1.2.3 From 479139f9d4ef981a2f10918f0fb5a2c148ca0c8b Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Thu, 3 Aug 2017 14:33:55 -0400 Subject: Fix location of where the make command should be run --- keyboards/lets_split/readme.md | 4 ++-- keyboards/minidox/readme.md | 4 ++-- keyboards/nyquist/readme.md | 4 +++- keyboards/orthodox/readme.md | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/lets_split/readme.md b/keyboards/lets_split/readme.md index 610b776ee..0ef7ff59d 100644 --- a/keyboards/lets_split/readme.md +++ b/keyboards/lets_split/readme.md @@ -106,7 +106,7 @@ Notes on Software Configuration ------------------------------- Configuring the firmware is similar to any other QMK project. One thing -to note is that `MATIX_ROWS` in `config.h` is the total number of rows between +to note is that `MATRIX_ROWS` in `config.h` is the total number of rows between the two halves, i.e. if your split keyboard has 4 rows in each half, then `MATRIX_ROWS=8`. @@ -115,7 +115,7 @@ not be very difficult to adapt it to support more if required. Flashing ------- -From the keymap directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. +From the `lets_split` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. Example: `make rev2-default-avrdude` diff --git a/keyboards/minidox/readme.md b/keyboards/minidox/readme.md index da8971486..c15fd244a 100644 --- a/keyboards/minidox/readme.md +++ b/keyboards/minidox/readme.md @@ -1,7 +1,7 @@ MiniDox ===== -![MimiDox](http://i.imgur.com/iWb3yO0.jpg) +![MiniDox](http://i.imgur.com/iWb3yO0.jpg) A compact version of the ErgoDox @@ -22,7 +22,7 @@ Flashing ------- Note: Most of this is copied from the Let's Split readme, because it is awesome -From the keymap directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. +From the `minidox` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. Example: `make rev1-default-avrdude` Choosing which board to plug the USB cable into (choosing Master) diff --git a/keyboards/nyquist/readme.md b/keyboards/nyquist/readme.md index c70bf0257..61b9317d5 100644 --- a/keyboards/nyquist/readme.md +++ b/keyboards/nyquist/readme.md @@ -6,6 +6,8 @@ The Nyquist is a 60% split ortholinear board by [Keebio](https://keeb.io). It ha ## Build Guide +A build log of the Nyquist can be found here: [Nyquist Build Log](http://imgur.com/a/dD4sX). + Since the design is very similar to the Let's Split v2, the build guide for that can be used while the build guide for the Nyquist is being fully developed. A build guide for putting together the Let's Split v2 can be found here: [An Overly Verbose Guide to Building a Let's Split Keyboard](https://github.com/nicinabox/lets-split-guide) There is additional information there about flashing and adding RGB underglow. @@ -98,7 +100,7 @@ unnecessary in simple use cases. Flashing ------- -From the keymap directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. +From the `nyquist` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. Example: `make rev1-serial-avrdude` diff --git a/keyboards/orthodox/readme.md b/keyboards/orthodox/readme.md index 57e940b0f..e1fbf94ba 100644 --- a/keyboards/orthodox/readme.md +++ b/keyboards/orthodox/readme.md @@ -96,7 +96,7 @@ the two halves, i.e. if your split keyboard has 3 rows in each half, then Flashing ------- -From the keymap directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. +From the `orthodox` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. Example: `make rev2-default-avrdude` -- cgit v1.2.3 From 396f97068beba45a84ac01e47128b40d2e24d9e5 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Fri, 4 Aug 2017 14:55:42 -0400 Subject: Add RGB commands to default Nyquist keymap --- keyboards/nyquist/keymaps/default/Makefile | 2 ++ keyboards/nyquist/keymaps/default/config.h | 7 +++++++ keyboards/nyquist/keymaps/default/keymap.c | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/keymaps/default/Makefile b/keyboards/nyquist/keymaps/default/Makefile index 457a3d01d..1e5761278 100644 --- a/keyboards/nyquist/keymaps/default/Makefile +++ b/keyboards/nyquist/keymaps/default/Makefile @@ -1,3 +1,5 @@ +RGBLIGHT_ENABLE = yes + ifndef QUANTUM_DIR include ../../../../Makefile endif diff --git a/keyboards/nyquist/keymaps/default/config.h b/keyboards/nyquist/keymaps/default/config.h index 624d284ca..072d4a7ce 100644 --- a/keyboards/nyquist/keymaps/default/config.h +++ b/keyboards/nyquist/keymaps/default/config.h @@ -31,4 +31,11 @@ along with this program. If not, see . // #define _MASTER_RIGHT // #define EE_HANDS +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + #endif \ No newline at end of file diff --git a/keyboards/nyquist/keymaps/default/keymap.c b/keyboards/nyquist/keymaps/default/keymap.c index dcb68a6e0..97fee4e1e 100644 --- a/keyboards/nyquist/keymaps/default/keymap.c +++ b/keyboards/nyquist/keymaps/default/keymap.c @@ -139,7 +139,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------------------------------------------------. * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | Reset| | | | | | | | | | Del | + * | | Reset|RGB Tg|RGB Md|Hue Up|Hue Dn|Sat Up|Sat Dn|Val Up|Val Dn| | Del | * |------+------+------+------+------+-------------+------+------+------+------+------| * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | * |------+------+------+------+------+------|------+------+------+------+------+------| @@ -150,7 +150,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_ADJUST] = KEYMAP( \ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ - _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, RESET , RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, KC_DEL, \ _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ -- cgit v1.2.3 From b20a87e3cc7079e1ab92692d9c89126547551528 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Fri, 4 Aug 2017 14:58:52 -0400 Subject: Add .eep files for setting hands --- keyboards/nyquist/eeprom-lefthand.eep | 2 ++ keyboards/nyquist/eeprom-righthand.eep | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 keyboards/nyquist/eeprom-lefthand.eep create mode 100644 keyboards/nyquist/eeprom-righthand.eep (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/eeprom-lefthand.eep b/keyboards/nyquist/eeprom-lefthand.eep new file mode 100644 index 000000000..b9666a74c --- /dev/null +++ b/keyboards/nyquist/eeprom-lefthand.eep @@ -0,0 +1,2 @@ +:0B0000000000000000000000000001F4 +:00000001FF diff --git a/keyboards/nyquist/eeprom-righthand.eep b/keyboards/nyquist/eeprom-righthand.eep new file mode 100644 index 000000000..94cc5be7f --- /dev/null +++ b/keyboards/nyquist/eeprom-righthand.eep @@ -0,0 +1,2 @@ +:0B0000000000000000000000000000F5 +:00000001FF -- cgit v1.2.3 From 7b5f02aa6a6d5c4fe4bff0d32c2dbb0abf20e51c Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Fri, 4 Aug 2017 15:32:45 -0400 Subject: Port updated debouncing algorithm from Let's Split to Nyquist --- keyboards/nyquist/matrix.c | 242 +++++++++++++++++++++++++++++++++-------- keyboards/nyquist/split_util.c | 2 + 2 files changed, 197 insertions(+), 47 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/matrix.c b/keyboards/nyquist/matrix.c index dcb94c67c..21eef9456 100644 --- a/keyboards/nyquist/matrix.c +++ b/keyboards/nyquist/matrix.c @@ -21,9 +21,7 @@ along with this program. If not, see . #include #include #include -#include -#include -#include +#include "wait.h" #include "print.h" #include "debug.h" #include "util.h" @@ -31,6 +29,7 @@ along with this program. If not, see . #include "split_util.h" #include "pro_micro.h" #include "config.h" +#include "timer.h" #ifdef USE_I2C # include "i2c.h" @@ -38,14 +37,29 @@ along with this program. If not, see . # include "serial.h" #endif -#ifndef DEBOUNCE -# define DEBOUNCE 5 +#ifndef DEBOUNCING_DELAY +# define DEBOUNCING_DELAY 5 #endif +#if (DEBOUNCING_DELAY > 0) + static uint16_t debouncing_time; + static bool debouncing = false; +#endif + +#if (MATRIX_COLS <= 8) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop(matrix[i]) +# define ROW_SHIFTER ((uint8_t)1) +#else +# error "Currently only supports 8 COLS" +#endif +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + #define ERROR_DISCONNECT_COUNT 5 -static uint8_t debouncing = DEBOUNCE; -static const int ROWS_PER_HAND = MATRIX_ROWS/2; +#define ROWS_PER_HAND (MATRIX_ROWS/2) + static uint8_t error_count = 0; static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; @@ -55,11 +69,19 @@ static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static matrix_row_t matrix[MATRIX_ROWS]; static matrix_row_t matrix_debouncing[MATRIX_ROWS]; -static matrix_row_t read_cols(void); -static void init_cols(void); -static void unselect_rows(void); -static void select_row(uint8_t row); - +#if (DIODE_DIRECTION == COL2ROW) + static void init_cols(void); + static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row); + static void unselect_rows(void); + static void select_row(uint8_t row); + static void unselect_row(uint8_t row); +#elif (DIODE_DIRECTION == ROW2COL) + static void init_rows(void); + static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); + static void unselect_cols(void); + static void unselect_col(uint8_t col); + static void select_col(uint8_t col); +#endif __attribute__ ((weak)) void matrix_init_quantum(void) { matrix_init_kb(); @@ -118,33 +140,54 @@ void matrix_init(void) } matrix_init_quantum(); + } uint8_t _matrix_scan(void) { - // Right hand is stored after the left in the matirx so, we need to offset it int offset = isLeftHand ? 0 : (ROWS_PER_HAND); +#if (DIODE_DIRECTION == COL2ROW) + // Set row, read cols + for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row); + + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + PORTD ^= (1 << 2); + } + +# else + read_cols_on_row(matrix+offset, current_row); +# endif + + } + +#elif (DIODE_DIRECTION == ROW2COL) + // Set col, read rows + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col); + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + } +# else + read_rows_on_col(matrix+offset, current_col); +# endif - for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { - select_row(i); - _delay_us(30); // without this wait read unstable value. - matrix_row_t cols = read_cols(); - if (matrix_debouncing[i+offset] != cols) { - matrix_debouncing[i+offset] = cols; - debouncing = DEBOUNCE; - } - unselect_rows(); } +#endif - if (debouncing) { - if (--debouncing) { - _delay_ms(1); - } else { +# if (DEBOUNCING_DELAY > 0) + if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) { for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { matrix[i+offset] = matrix_debouncing[i+offset]; } + debouncing = false; } - } +# endif return 1; } @@ -200,9 +243,7 @@ int serial_transaction(void) { uint8_t matrix_scan(void) { - int ret = _matrix_scan(); - - + uint8_t ret = _matrix_scan(); #ifdef USE_I2C if( i2c_transaction() ) { @@ -233,11 +274,10 @@ uint8_t matrix_scan(void) void matrix_slave_scan(void) { _matrix_scan(); - int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2); + int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; #ifdef USE_I2C for (int i = 0; i < ROWS_PER_HAND; ++i) { - /* i2c_slave_buffer[i] = matrix[offset+i]; */ i2c_slave_buffer[i] = matrix[offset+i]; } #else // USE_SERIAL @@ -284,33 +324,141 @@ uint8_t matrix_key_count(void) return count; } -static void init_cols(void) +#if (DIODE_DIRECTION == COL2ROW) + +static void init_cols(void) { - for(int x = 0; x < MATRIX_COLS; x++) { - _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF); - _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); + for(uint8_t x = 0; x < MATRIX_COLS; x++) { + uint8_t pin = col_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI } } -static matrix_row_t read_cols(void) +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { - matrix_row_t result = 0; - for(int x = 0; x < MATRIX_COLS; x++) { - result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // Select row and wait for row selecton to stabilize + select_row(current_row); + wait_us(30); + + // For each col... + for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + + // Select the col pin to read (active low) + uint8_t pin = col_pins[col_index]; + uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)); + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); } - return result; + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + +static void select_row(uint8_t row) +{ + uint8_t pin = row_pins[row]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static void unselect_row(uint8_t row) +{ + uint8_t pin = row_pins[row]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI } static void unselect_rows(void) { - for(int x = 0; x < ROWS_PER_HAND; x++) { - _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); - _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); + for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { + uint8_t pin = row_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI } } -static void select_row(uint8_t row) +#elif (DIODE_DIRECTION == ROW2COL) + +static void init_rows(void) +{ + for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { + uint8_t pin = row_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) +{ + bool matrix_changed = false; + + // Select col and wait for col selecton to stabilize + select_col(current_col); + wait_us(30); + + // For each row... + for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) + { + + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[row_index]; + + // Check row pin state + if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0) + { + // Pin LO, set col bit + current_matrix[row_index] |= (ROW_SHIFTER << current_col); + } + else + { + // Pin HI, clear col bit + current_matrix[row_index] &= ~(ROW_SHIFTER << current_col); + } + + // Determine if the matrix changed state + if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) + { + matrix_changed = true; + } + } + + // Unselect col + unselect_col(current_col); + + return matrix_changed; +} + +static void select_col(uint8_t col) +{ + uint8_t pin = col_pins[col]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static void unselect_col(uint8_t col) +{ + uint8_t pin = col_pins[col]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI +} + +static void unselect_cols(void) { - _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); - _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); + for(uint8_t x = 0; x < MATRIX_COLS; x++) { + uint8_t pin = col_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } } + +#endif diff --git a/keyboards/nyquist/split_util.c b/keyboards/nyquist/split_util.c index 39639c3b4..346cbc908 100644 --- a/keyboards/nyquist/split_util.c +++ b/keyboards/nyquist/split_util.c @@ -8,6 +8,7 @@ #include "matrix.h" #include "keyboard.h" #include "config.h" +#include "timer.h" #ifdef USE_I2C # include "i2c.h" @@ -42,6 +43,7 @@ static void keyboard_master_setup(void) { } static void keyboard_slave_setup(void) { + timer_init(); #ifdef USE_I2C i2c_slave_init(SLAVE_I2C_ADDRESS); #else -- cgit v1.2.3 From 1219da753bc5475f48b1cfe420bd916aa399fc60 Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Sat, 5 Aug 2017 00:58:10 -0700 Subject: Initial nyquist keymap --- keyboards/nyquist/keymaps/333fred/Makefile | 3 + keyboards/nyquist/keymaps/333fred/config.h | 34 +++++ keyboards/nyquist/keymaps/333fred/keymap.c | 218 +++++++++++++++++++++++++++++ 3 files changed, 255 insertions(+) create mode 100644 keyboards/nyquist/keymaps/333fred/Makefile create mode 100644 keyboards/nyquist/keymaps/333fred/config.h create mode 100644 keyboards/nyquist/keymaps/333fred/keymap.c (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/keymaps/333fred/Makefile b/keyboards/nyquist/keymaps/333fred/Makefile new file mode 100644 index 000000000..457a3d01d --- /dev/null +++ b/keyboards/nyquist/keymaps/333fred/Makefile @@ -0,0 +1,3 @@ +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/nyquist/keymaps/333fred/config.h b/keyboards/nyquist/keymaps/333fred/config.h new file mode 100644 index 000000000..f2408c0e3 --- /dev/null +++ b/keyboards/nyquist/keymaps/333fred/config.h @@ -0,0 +1,34 @@ +/* +Copyright 2017 Danny Nguyen + +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 . +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + +#endif diff --git a/keyboards/nyquist/keymaps/333fred/keymap.c b/keyboards/nyquist/keymaps/333fred/keymap.c new file mode 100644 index 000000000..74a12c54a --- /dev/null +++ b/keyboards/nyquist/keymaps/333fred/keymap.c @@ -0,0 +1,218 @@ +#include "nyquist.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +// 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. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _VIM 5 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + LOWER, + RAISE, + ADJUST, +}; + +enum custom_macros { + DLEFT, + DRIGHT, + PSCREEN_APP +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | Y | U | I | O | P | \ | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D |LTVIMF| G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . |/ Ctrl| Shift| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower | Bksp | Ent | Spc | Raise| + | Up | Del | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = KEYMAP( \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, \ + KC_ESC, KC_A, KC_S, KC_D, LT(_VIM, KC_F), KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RCTL_T(KC_SLSH), OSM(MOD_RSFT), \ + ADJUST, KC_LCTL, KC_LGUI, KC_LALT, OSL(_LOWER), KC_BSPC, KC_ENT, KC_SPC, RAISE, KC_PLUS, KC_UP, KC_DEL \ +), + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | Caps | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | ! | @ | ( | ) | | | 7 | 8 | 9 | * | ) | F12 | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | # | $ | { | } | ` | 4 | 5 | 6 | + | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | APscr| % | ^ | [ | ] | ~ | 1 | 2 | 3 | \ | Vol- | Vol+ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Pscr | | | | | | 0 | . | = | Prev | Next | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = KEYMAP( \ + KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, \ + _______, KC_EXLM, KC_AT, KC_LPRN, KC_RPRN, KC_PIPE, KC_7, KC_8, KC_9, KC_ASTR, KC_RPRN, KC_F12, \ + _______, KC_HASH, KC_DLR, KC_LCBR, KC_RCBR, KC_GRV, KC_4, KC_5, KC_6, KC_PLUS, KC_RCBR, KC_PIPE, \ + M(PSCREEN_APP), KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD, KC_1, KC_2, KC_3, KC_BSLS, KC_VOLD, KC_VOLU, \ + KC_PSCR, _______, _______, _______, _______, _______, KC_0, KC_DOT, KC_EQL, KC_MPRV, KC_MNXT, KC_MPLY \ +), + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ~ | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | { | } | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = KEYMAP( \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ + KC_DEL, KC_F1, KC_F2, KC_LCBR, KC_RBRC, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = KEYMAP( \ + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | DLeft|DRight| LCTRL| | | Left | Down | Up | Right| | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | LShft| | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_VIM] = KEYMAP( \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, M(DLEFT), M(DRIGHT), KC_LCTL, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, KC_LSFT, _______, _______, _______, _______, _______, _______, _______ \ +) + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + 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 ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + switch(id) { + case DLEFT: + if (record->event.pressed) { // Windows move desktop left + return MACRO(D(LCTL), D(LGUI), T(LEFT), U(LGUI), U(LCTL), END); + } + break; + case DRIGHT: + if (record->event.pressed) { // Windows move desktop right + return MACRO(D(LCTL), D(LGUI), T(RIGHT), U(LGUI), U(LCTL), END); + } + break; + case PSCREEN_APP: + if (record->event.pressed) { + return MACRO(D(LALT), T(PSCR), U(LALT), END); + } + break; + } + return MACRO_NONE; +} -- cgit v1.2.3 From fb91d9008b051c4af5b8ff8952a02836061b8e60 Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Sat, 5 Aug 2017 14:54:16 -0700 Subject: Additional keymap updates. --- keyboards/nyquist/keymaps/333fred/config.h | 5 +++++ keyboards/nyquist/keymaps/333fred/keymap.c | 20 +++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/keymaps/333fred/config.h b/keyboards/nyquist/keymaps/333fred/config.h index f2408c0e3..92096eba2 100644 --- a/keyboards/nyquist/keymaps/333fred/config.h +++ b/keyboards/nyquist/keymaps/333fred/config.h @@ -31,4 +31,9 @@ along with this program. If not, see . // #define _MASTER_RIGHT // #define EE_HANDS +#undef TAPPING_TERM +#define TAPPING_TERM 150 + +#define PERMISSIVE_HOLD + #endif diff --git a/keyboards/nyquist/keymaps/333fred/keymap.c b/keyboards/nyquist/keymaps/333fred/keymap.c index 74a12c54a..afa8b75b6 100644 --- a/keyboards/nyquist/keymaps/333fred/keymap.c +++ b/keyboards/nyquist/keymaps/333fred/keymap.c @@ -9,11 +9,9 @@ extern keymap_config_t keymap_config; // Layer names don't all need to be of the same length, obviously, and you can also skip them // entirely and just use numbers. #define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _VIM 5 +#define _LOWER 1 +#define _RAISE 2 +#define _VIM 3 #define _ADJUST 16 enum custom_keycodes { @@ -45,15 +43,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * | Shift| Z | X | C | V | B | N | M | , | . |/ Ctrl| Shift| * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Adjust| Ctrl | Alt | GUI |Lower | Bksp | Ent | Spc | Raise| + | Up | Del | + * | Ctrl | Alt | F4 | GUI |Lower | Bksp | Spc | Ent | Raise| + | Up | Del | * `-----------------------------------------------------------------------------------' */ [_QWERTY] = KEYMAP( \ - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, \ - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, \ - KC_ESC, KC_A, KC_S, KC_D, LT(_VIM, KC_F), KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ - OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RCTL_T(KC_SLSH), OSM(MOD_RSFT), \ - ADJUST, KC_LCTL, KC_LGUI, KC_LALT, OSL(_LOWER), KC_BSPC, KC_ENT, KC_SPC, RAISE, KC_PLUS, KC_UP, KC_DEL \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, \ + KC_ESC, KC_A, KC_S, KC_D, LT(_VIM, KC_F), KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RCTL_T(KC_SLSH), OSM(MOD_RSFT), \ + KC_LCTL, KC_LALT, KC_F4, KC_LGUI, OSL(_LOWER), KC_BSPC, KC_SPC, KC_ENT, RAISE, KC_PLUS, KC_UP, KC_DEL \ ), /* Lower -- cgit v1.2.3 From b66a9af3526d27764c85115dcc8375a031aa361f Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Sat, 5 Aug 2017 15:34:14 -0700 Subject: Finished initial Nyquist keymap. --- keyboards/nyquist/keymaps/333fred/keymap.c | 131 ++++++----------------------- 1 file changed, 27 insertions(+), 104 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/keymaps/333fred/keymap.c b/keyboards/nyquist/keymaps/333fred/keymap.c index afa8b75b6..d3a347803 100644 --- a/keyboards/nyquist/keymaps/333fred/keymap.c +++ b/keyboards/nyquist/keymaps/333fred/keymap.c @@ -10,16 +10,8 @@ extern keymap_config_t keymap_config; // entirely and just use numbers. #define _QWERTY 0 #define _LOWER 1 -#define _RAISE 2 -#define _VIM 3 -#define _ADJUST 16 - -enum custom_keycodes { - QWERTY = SAFE_RANGE, - LOWER, - RAISE, - ADJUST, -}; +#define _VIM 2 +#define _GAME 3 enum custom_macros { DLEFT, @@ -43,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * | Shift| Z | X | C | V | B | N | M | , | . |/ Ctrl| Shift| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Ctrl | Alt | F4 | GUI |Lower | Bksp | Spc | Ent | Raise| + | Up | Del | + * | Ctrl | Alt | F4 | GUI |Lower | Bksp | Spc | Ent | Alt | + | Game | Del | * `-----------------------------------------------------------------------------------' */ [_QWERTY] = KEYMAP( \ @@ -51,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, \ KC_ESC, KC_A, KC_S, KC_D, LT(_VIM, KC_F), KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RCTL_T(KC_SLSH), OSM(MOD_RSFT), \ - KC_LCTL, KC_LALT, KC_F4, KC_LGUI, OSL(_LOWER), KC_BSPC, KC_SPC, KC_ENT, RAISE, KC_PLUS, KC_UP, KC_DEL \ + KC_LCTL, KC_LALT, KC_F4, KC_LGUI, OSL(_LOWER), KC_BSPC, KC_SPC, KC_ENT, KC_RALT, KC_PLUS, TG(_GAME), KC_DEL \ ), /* Lower @@ -75,49 +67,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_PSCR, _______, _______, _______, _______, _______, KC_0, KC_DOT, KC_EQL, KC_MPRV, KC_MNXT, KC_MPLY \ ), -/* Raise - * ,-----------------------------------------------------------------------------------. - * | ~ | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F0 | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Del | F1 | F2 | { | } | F5 | F6 | - | = | [ | ] | \ | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ -[_RAISE] = KEYMAP( \ - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ - KC_DEL, KC_F1, KC_F2, KC_LCBR, KC_RBRC, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, KC_VOLU, KC_MPLY \ -), - -/* Adjust (Lower + Raise) - * ,-----------------------------------------------------------------------------------. - * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | Reset| | | | | | | | | | Del | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | | - * `-----------------------------------------------------------------------------------' - */ -[_ADJUST] = KEYMAP( \ - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ - _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ - _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ -), - -/* Adjust (Lower + Raise) +/* Vim Movement (Hold down F) * ,-----------------------------------------------------------------------------------. * | | | | | | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| @@ -136,64 +86,37 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, M(DLEFT), M(DRIGHT), KC_LCTL, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ _______, _______, _______, _______, KC_LSFT, _______, _______, _______, _______, _______, _______, _______ \ +), + +/* Gaming mode (Raise) + * All one-shot mods are disabled on this layer + * ,-----------------------------------------------------------------------------------. + * | ESC | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | CTRL | | | | F | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Enter| | | | Alt | Spc | Left | Up | Down | Right| | | + * `-----------------------------------------------------------------------------------' + */ +[_GAME] = KEYMAP( \ + KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + KC_LCTL, _______, _______, _______, KC_F, _______, _______, _______, _______, _______, _______, _______, \ + KC_LSFT, KC_Z, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + KC_ENT, _______, _______, _______, KC_LALT, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______ \ ) }; -#ifdef AUDIO_ENABLE -float tone_qwerty[][2] = SONG(QWERTY_SOUND); -float tone_dvorak[][2] = SONG(DVORAK_SOUND); -float tone_colemak[][2] = SONG(COLEMAK_SOUND); -#endif - void persistent_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); } -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QWERTY: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_NOTE_ARRAY(tone_qwerty, false, 0); - #endif - persistent_default_layer_set(1UL<<_QWERTY); - } - return false; - break; - 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 ADJUST: - if (record->event.pressed) { - layer_on(_ADJUST); - } else { - layer_off(_ADJUST); - } - return false; - break; - } - return true; -} - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { switch(id) { case DLEFT: -- cgit v1.2.3 From 8cb413b6b708ecafbccf553876cac51d5f999588 Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Sat, 5 Aug 2017 15:40:19 -0700 Subject: Updated licensing --- keyboards/nyquist/keymaps/333fred/config.h | 25 ------------------------- keyboards/nyquist/keymaps/333fred/keymap.c | 4 ---- 2 files changed, 29 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/keymaps/333fred/config.h b/keyboards/nyquist/keymaps/333fred/config.h index 92096eba2..86fe52165 100644 --- a/keyboards/nyquist/keymaps/333fred/config.h +++ b/keyboards/nyquist/keymaps/333fred/config.h @@ -1,35 +1,10 @@ -/* -Copyright 2017 Danny Nguyen - -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 . -*/ - #ifndef CONFIG_USER_H #define CONFIG_USER_H #include "../../config.h" -/* Use I2C or Serial, not both */ - #define USE_SERIAL -// #define USE_I2C - -/* Select hand configuration */ - #define MASTER_LEFT -// #define _MASTER_RIGHT -// #define EE_HANDS #undef TAPPING_TERM #define TAPPING_TERM 150 diff --git a/keyboards/nyquist/keymaps/333fred/keymap.c b/keyboards/nyquist/keymaps/333fred/keymap.c index d3a347803..a2bb74ca2 100644 --- a/keyboards/nyquist/keymaps/333fred/keymap.c +++ b/keyboards/nyquist/keymaps/333fred/keymap.c @@ -4,10 +4,6 @@ extern keymap_config_t keymap_config; -// 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. #define _QWERTY 0 #define _LOWER 1 #define _VIM 2 -- cgit v1.2.3 From 7a9fb7c96b876cf0d6c44c4649d3504572e56fa3 Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Sat, 5 Aug 2017 16:16:38 -0700 Subject: Added readme, fixed eql vs plus --- keyboards/nyquist/keymaps/333fred/README.md | 76 +++++++++++++++++++++++++++++ keyboards/nyquist/keymaps/333fred/keymap.c | 10 ++-- 2 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 keyboards/nyquist/keymaps/333fred/README.md (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/keymaps/333fred/README.md b/keyboards/nyquist/keymaps/333fred/README.md new file mode 100644 index 000000000..a25f9fcec --- /dev/null +++ b/keyboards/nyquist/keymaps/333fred/README.md @@ -0,0 +1,76 @@ +# 333fred's Nyquist Layout + +This nyquist layout is based on my Ergodox Infinity Layout, which is [here](../../../ergodox/keymaps/333fred/README.md). It doesn't have all of my VS extensions, as I have my nyquist at home, not at work. + +## Layers + +### QWERTY +The shift modifiers on this layer all use OSM to allow for quick single capitalization. Press and hold F to go to the VIM movement layer. Layer is also a one-shot layer toggle, and can be held down to type multiple characters on the Lower layer. Game is a regular toggle layer. + +``` +Qwerty +,-----------------------------------------------------------------------------------. +| ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | +|------+------+------+------+------+------+------+------+------+------+------+------| +| Tab | Q | W | E | R | T | Y | U | I | O | P | \ | +|------+------+------+------+------+-------------+------+------+------+------+------| +| Esc | A | S | D |LTVIMF| G | H | J | K | L | ; | " | +|------+------+------+------+------+------|------+------+------+------+------+------| +| Shift| Z | X | C | V | B | N | M | , | . |/ Ctrl| Shift| +|------+------+------+------+------+------+------+------+------+------+------+------| +| Ctrl | Alt | F4 | GUI |Lower | Bksp | Spc | Ent | Alt | = | Game | Del r +`-----------------------------------------------------------------------------------' +``` + +### Lower +My symbol and numpad layer. APscr is a macro that sends ALT+PRSC, to take a screenshot of the current application. + +``` +Lower +,-----------------------------------------------------------------------------------. +| Caps | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | +|------+------+------+------+------+-------------+------+------+------+------+------| +| | ! | @ | ( | ) | | | 7 | 8 | 9 | * | ) | F12 | +|------+------+------+------+------+-------------+------+------+------+------+------| +| | # | $ | { | } | ` | 4 | 5 | 6 | + | } | | | +|------+------+------+------+------+------|------+------+------+------+------+------| +| APscr| % | ^ | [ | ] | ~ | 1 | 2 | 3 | \ | Vol- | Vol+ | +|------+------+------+------+------+------+------+------+------+------+------+------| +| Pscr | | | | | | 0 | . | = | Prev | Next | Play | +`-----------------------------------------------------------------------------------' +``` + +### VIM Movement +Pressing and holding F moves to this layer, which turns hjkl into vim movement keys. a and d are macros which send WIN+Left and WIN+Right, respectively. Shift and CTRL have been remapped for ease of selecting text. +``` +Vim Movement (Hold down F) +,-----------------------------------------------------------------------------------. +| | | | | | | | | | | | | +|------+------+------+------+------+------+------+------+------+------+------+------| +| | | | | | | | | | | | | +|------+------+------+------+------+------+------+------+------+------+------+------| +| | DLeft|DRight| LCTRL| | | Left | Down | Up | Right| | | +|------+------+------+------+------+------+------+------+------+------+------+------| +| | | | | | | | | | | | | +|------+------+------+------+------+------+------+------+------+------+------+------| +| | | | | LShft| | | | | | | | +`-----------------------------------------------------------------------------------' + ``` + +### Gaming +This layer is designed for playing games. All one-shot modification has been turned off, and the common game controls keys have been moved around for easier access. +``` +Gaming mode (Raise) +All one-shot mods are disabled on this layer +,-----------------------------------------------------------------------------------. +| ESC | | | | | | | | | | | | +|------+------+------+------+------+------+------+------+------+------+------+------| +| | | | | | | | | | | | | +|------+------+------+------+------+------+------+------+------+------+------+------| +| CTRL | | | | F | | | | | | | | +|------+------+------+------+------+------+------+------+------+------+------+------| +| Shift| Z | | | | | | | | | | | +|------+------+------+------+------+------+------+------+------+------+------+------| +| Enter| | | | Alt | Spc | Left | Up | Down | Right| | | +`-----------------------------------------------------------------------------------' +``` diff --git a/keyboards/nyquist/keymaps/333fred/keymap.c b/keyboards/nyquist/keymaps/333fred/keymap.c index a2bb74ca2..07434d93f 100644 --- a/keyboards/nyquist/keymaps/333fred/keymap.c +++ b/keyboards/nyquist/keymaps/333fred/keymap.c @@ -35,11 +35,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_QWERTY] = KEYMAP( \ - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, \ - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, \ - KC_ESC, KC_A, KC_S, KC_D, LT(_VIM, KC_F), KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ - OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RCTL_T(KC_SLSH), OSM(MOD_RSFT), \ - KC_LCTL, KC_LALT, KC_F4, KC_LGUI, OSL(_LOWER), KC_BSPC, KC_SPC, KC_ENT, KC_RALT, KC_PLUS, TG(_GAME), KC_DEL \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, \ + KC_ESC, KC_A, KC_S, KC_D, LT(_VIM, KC_F), KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RCTL_T(KC_SLSH), OSM(MOD_RSFT), \ + KC_LCTL, KC_LALT, KC_F4, KC_LGUI, OSL(_LOWER), KC_BSPC, KC_SPC, KC_ENT, KC_RALT, KC_EQL, TG(_GAME), KC_DEL \ ), /* Lower -- cgit v1.2.3 From 8e1be7c792c4c9f65ba7e990f2a773a23b40d20c Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Sun, 6 Aug 2017 01:50:20 -0700 Subject: Initial implementation of the key_lock feature. --- common_features.mk | 7 +- keyboards/nyquist/keymaps/333fred/Makefile | 2 + keyboards/nyquist/keymaps/333fred/keymap.c | 2 +- quantum/process_keycode/process_key_lock.c | 120 +++++++++++++++++++++++++++++ quantum/process_keycode/process_key_lock.h | 24 ++++++ quantum/quantum.c | 4 + quantum/quantum.h | 4 + quantum/quantum_keycodes.h | 4 + 8 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 quantum/process_keycode/process_key_lock.c create mode 100644 quantum/process_keycode/process_key_lock.h (limited to 'keyboards/nyquist') diff --git a/common_features.mk b/common_features.mk index 0adf81afa..f405d5c07 100644 --- a/common_features.mk +++ b/common_features.mk @@ -104,6 +104,11 @@ ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c endif +ifeq ($(strip $(KEY_LOCK_ENABLE)), yes) + OPT_DEFS += -DKEY_LOCK_ENABLE + SRC += $(QUANTUM_DIR)/process_keycode/process_key_lock.c +endif + ifeq ($(strip $(PRINTING_ENABLE)), yes) OPT_DEFS += -DPRINTING_ENABLE SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c @@ -156,4 +161,4 @@ QUANTUM_SRC:= \ ifndef CUSTOM_MATRIX QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c -endif \ No newline at end of file +endif diff --git a/keyboards/nyquist/keymaps/333fred/Makefile b/keyboards/nyquist/keymaps/333fred/Makefile index 457a3d01d..471eac8b5 100644 --- a/keyboards/nyquist/keymaps/333fred/Makefile +++ b/keyboards/nyquist/keymaps/333fred/Makefile @@ -1,3 +1,5 @@ +KEY_LOCK_ENABLE = yes + ifndef QUANTUM_DIR include ../../../../Makefile endif diff --git a/keyboards/nyquist/keymaps/333fred/keymap.c b/keyboards/nyquist/keymaps/333fred/keymap.c index 07434d93f..20bf29887 100644 --- a/keyboards/nyquist/keymaps/333fred/keymap.c +++ b/keyboards/nyquist/keymaps/333fred/keymap.c @@ -39,7 +39,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH, \ KC_ESC, KC_A, KC_S, KC_D, LT(_VIM, KC_F), KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ OSM(MOD_LSFT), LCTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RCTL_T(KC_SLSH), OSM(MOD_RSFT), \ - KC_LCTL, KC_LALT, KC_F4, KC_LGUI, OSL(_LOWER), KC_BSPC, KC_SPC, KC_ENT, KC_RALT, KC_EQL, TG(_GAME), KC_DEL \ + KC_LCTL, KC_LALT, KC_F4, KC_LGUI, OSL(_LOWER), KC_BSPC, KC_SPC, KC_ENT, KC_LOCK, KC_EQL, TG(_GAME), KC_DEL \ ), /* Lower diff --git a/quantum/process_keycode/process_key_lock.c b/quantum/process_keycode/process_key_lock.c new file mode 100644 index 000000000..60b0fcd9b --- /dev/null +++ b/quantum/process_keycode/process_key_lock.c @@ -0,0 +1,120 @@ +/* Copyright 2017 Fredric Silberberg + * + * 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 . + */ + +#include "inttypes.h" +#include "stdint.h" +#include "process_key_lock.h" + +#define SHIFT(shift) (((uint64_t)1) << (shift)) +#define GET_KEY_ARRAY(code) (((code) < 0x40) ? key_state[0] : \ + ((code) < 0x80) ? key_state[1] : \ + ((code) < 0xC0) ? key_state[2] : key_state[3]) +#define GET_CODE_INDEX(code) (((code) < 0x40) ? (code) : \ + ((code) < 0x80) ? (code) - 0x40 : \ + ((code) < 0xC0) ? (code) - 0x80 : (code) - 0xC0) +#define KEY_STATE(code) (GET_KEY_ARRAY(code) & SHIFT(GET_CODE_INDEX(code))) == SHIFT(GET_CODE_INDEX(code)) +#define SET_KEY_ARRAY_STATE(code, val) do { \ + switch (code) { \ + case 0x00 ... 0x3F: \ + key_state[0] = (val); \ + break; \ + case 0x40 ... 0x7F: \ + key_state[1] = (val); \ + break; \ + case 0x80 ... 0xBF: \ + key_state[2] = (val); \ + break; \ + case 0xC0 ... 0xFF: \ + key_state[3] = (val); \ + break; \ + } \ +} while(0) +#define SET_KEY_STATE(code) SET_KEY_ARRAY_STATE(code, (GET_KEY_ARRAY(code) | SHIFT(GET_CODE_INDEX(code)))) +#define UNSET_KEY_STATE(code) SET_KEY_ARRAY_STATE(code, (GET_KEY_ARRAY(code)) & ~(SHIFT(GET_CODE_INDEX(code)))) +#define IS_STANDARD_KEYCODE(code) ((code) <= 0xFF) +#define print_hex64(num) do { print_hex32((num & 0xFFFFFFFF00000000) >> 32); print_hex32(num & 0x00000000FFFFFFFF); } while (0) + +// Locked key state. This is an array of 256 bits, one for each of the standard keys supported qmk. +uint64_t key_state[4] = { 0x0, 0x0, 0x0, 0x0 }; +bool watching = false; + +bool process_key_lock(uint16_t keycode, keyrecord_t *record) { + // We start by categorizing the keypress event. In the event of a down + // event, there are several possibilities: + // 1. The key is not being locked, and we are not watching for new keys. + // In this case, we bail immediately. This is the common case for down events. + // 2. The key was locked, and we need to unlock it. In this case, we will + // reset the state in our map and return false. When the user releases the + // key, the up event will no longer be masked and the OS will observe the + // released key. + // 3. KC_LOCK was just pressed. In this case, we set up the state machine + // to watch for the next key down event, and finish processing + // 4. The keycode is below 0xFF, and we are watching for new keys. In this case, + // we will send the key down event to the os, and set the key_state for that + // key to mask the up event. + // 5. The keycode is above 0xFF, and we're wathing for new keys. In this case, + // the user pressed a key that we cannot "lock", as it's a series of keys, + // or a macro invocation, or a layer transition, or a custom-defined key, or + // or some other arbitrary code. In this case, we bail immediately, reset + // our watch state, and return true. + // + // In the event of an up event, there are these possibilities: + // 1. The key is not being locked. In this case, we return true and bail + // immediately. This is the common case. + // 2. The key is being locked. In this case, we will mask the up event + // by returning false, so the OS never sees that the key was released + // until the user pressed the key again. + if (record->event.pressed) { + // Non-standard keycode, reset and return + if (!(IS_STANDARD_KEYCODE(keycode) || keycode == KC_LOCK)) { + watching = false; + return true; + } + + // If we're already watching, turn off the watch. + if (keycode == KC_LOCK) { + watching = !watching; + return false; + } + + if (IS_STANDARD_KEYCODE(keycode)) { + // We check watching first. This is so that in the following scenario, we continue to + // hold the key: KC_LOCK, KC_F, KC_LOCK, KC_F + // If we checked in reverse order, we'd end up holding the key pressed after the second + // KC_F press is registered, when the user likely meant to hold F + if (watching) { + watching = false; + SET_KEY_STATE(keycode); + // Let the standard keymap send the keycode down event. The up event will be masked. + return true; + } + + if (KEY_STATE(keycode)) { + UNSET_KEY_STATE(keycode); + // The key is already held, stop this process. The up event will be sent when the user + // releases the key. + return false; + } + } + + // Either the key isn't a standard key, or we need to send the down event. Continue standard + // processing + return true; + } else { + // Stop processing if it's a standard key and we're masking up. + return !(IS_STANDARD_KEYCODE(keycode) && KEY_STATE(keycode)); + } +} diff --git a/quantum/process_keycode/process_key_lock.h b/quantum/process_keycode/process_key_lock.h new file mode 100644 index 000000000..237e103bc --- /dev/null +++ b/quantum/process_keycode/process_key_lock.h @@ -0,0 +1,24 @@ +/* Copyright 2017 Fredric Silberberg + * + * 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 . + */ + +#ifndef PROCESS_KEY_LOCK_H +#define PROCESS_KEY_LOCK_H + +#include "quantum.h" + +bool process_key_lock(uint16_t keycode, keyrecord_t *record); + +#endif // PROCESS_KEY_LOCK_H diff --git a/quantum/quantum.c b/quantum/quantum.c index 1f8ce6c46..c71a97bf2 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -193,6 +193,10 @@ bool process_record_quantum(keyrecord_t *record) { // } if (!( + #if defined(KEY_LOCK_ENABLE) + // Must run first to be able to mask key_up events. + process_key_lock(keycode, record) && + #endif process_record_kb(keycode, record) && #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) process_midi(keycode, record) && diff --git a/quantum/quantum.h b/quantum/quantum.h index 453cb43f8..9a6d691a1 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -99,6 +99,10 @@ extern uint32_t default_layer_state; #include "process_combo.h" #endif +#ifdef KEY_LOCK_ENABLE + #include "process_key_lock.h" +#endif + #define SEND_STRING(str) send_string(PSTR(str)) extern const bool ascii_to_shift_lut[0x80]; extern const uint8_t ascii_to_keycode_lut[0x80]; diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index acdb9248d..1bb6706ba 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -419,6 +419,10 @@ enum quantum_keycodes { OUT_BT, #endif +#ifdef KEY_LOCK_ENABLE + KC_LOCK, +#endif + // always leave at the end SAFE_RANGE }; -- cgit v1.2.3 From 7935f563e9d078e0f9530576cdccc6cef294345f Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Sun, 6 Aug 2017 13:00:46 -0700 Subject: Updated nyquist gaming layout. --- keyboards/nyquist/keymaps/333fred/README.md | 5 ++--- keyboards/nyquist/keymaps/333fred/keymap.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/keymaps/333fred/README.md b/keyboards/nyquist/keymaps/333fred/README.md index a25f9fcec..96a03ea9b 100644 --- a/keyboards/nyquist/keymaps/333fred/README.md +++ b/keyboards/nyquist/keymaps/333fred/README.md @@ -18,7 +18,7 @@ Qwerty |------+------+------+------+------+------|------+------+------+------+------+------| | Shift| Z | X | C | V | B | N | M | , | . |/ Ctrl| Shift| |------+------+------+------+------+------+------+------+------+------+------+------| -| Ctrl | Alt | F4 | GUI |Lower | Bksp | Spc | Ent | Alt | = | Game | Del r +| Ctrl | Alt | F4 | GUI |Lower | Bksp | Spc | Ent | Lock | = | Game | Del | `-----------------------------------------------------------------------------------' ``` @@ -61,7 +61,6 @@ Vim Movement (Hold down F) This layer is designed for playing games. All one-shot modification has been turned off, and the common game controls keys have been moved around for easier access. ``` Gaming mode (Raise) -All one-shot mods are disabled on this layer ,-----------------------------------------------------------------------------------. | ESC | | | | | | | | | | | | |------+------+------+------+------+------+------+------+------+------+------+------| @@ -71,6 +70,6 @@ All one-shot mods are disabled on this layer |------+------+------+------+------+------+------+------+------+------+------+------| | Shift| Z | | | | | | | | | | | |------+------+------+------+------+------+------+------+------+------+------+------| -| Enter| | | | Alt | Spc | Left | Up | Down | Right| | | +| Enter| | Lock | | Alt | Spc | Left | Up | Down | Right| | | `-----------------------------------------------------------------------------------' ``` diff --git a/keyboards/nyquist/keymaps/333fred/keymap.c b/keyboards/nyquist/keymaps/333fred/keymap.c index 20bf29887..5d68a2de2 100644 --- a/keyboards/nyquist/keymaps/333fred/keymap.c +++ b/keyboards/nyquist/keymaps/333fred/keymap.c @@ -95,7 +95,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | Shift| Z | | | | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Enter| | | | Alt | Spc | Left | Up | Down | Right| | | + * | Enter| | Lock | | Alt | Spc | Left | Up | Down | Right| | | * `-----------------------------------------------------------------------------------' */ [_GAME] = KEYMAP( \ @@ -103,7 +103,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ KC_LCTL, _______, _______, _______, KC_F, _______, _______, _______, _______, _______, _______, _______, \ KC_LSFT, KC_Z, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - KC_ENT, _______, _______, _______, KC_LALT, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______ \ + KC_ENT, _______, KC_LOCK, _______, KC_LALT, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______ \ ) }; -- cgit v1.2.3 From 916c4d799d277fe5ddf68d5f8426f89cd6f90b93 Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Sun, 6 Aug 2017 13:18:06 -0700 Subject: Added NKRO to nyquist layout. --- keyboards/nyquist/keymaps/333fred/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/keymaps/333fred/Makefile b/keyboards/nyquist/keymaps/333fred/Makefile index 471eac8b5..576bb3c30 100644 --- a/keyboards/nyquist/keymaps/333fred/Makefile +++ b/keyboards/nyquist/keymaps/333fred/Makefile @@ -1,4 +1,5 @@ KEY_LOCK_ENABLE = yes +NKRO_ENABLE = yes ifndef QUANTUM_DIR include ../../../../Makefile -- cgit v1.2.3 From a3e1d9a8cc8b3d376d52f86aacae6315b15efebf Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Sun, 6 Aug 2017 14:14:27 -0700 Subject: Added support for locking One Shot modifiers. --- docs/key_lock.md | 2 +- keyboards/nyquist/keymaps/333fred/Makefile | 1 + quantum/process_keycode/process_key_lock.c | 41 ++++++++++++++++++++++-------- quantum/process_keycode/process_key_lock.h | 2 +- quantum/quantum.c | 2 +- 5 files changed, 34 insertions(+), 14 deletions(-) (limited to 'keyboards/nyquist') diff --git a/docs/key_lock.md b/docs/key_lock.md index 03cea2089..e424061a9 100644 --- a/docs/key_lock.md +++ b/docs/key_lock.md @@ -8,4 +8,4 @@ Here's how to use it: 2. Enable key lock by including `KEY_LOCK_ENABLE = yes` in your Makefile. 3. That's it! -Important: switching layers does not cancel the key lock. Additionally, key lock is only able to hold standard action keys. This does not include any of the QMK special functions, or shifted versions of keys such as KC_LPRN. If it's in the [basic_keycodes](basic_keycodes.md) list, it can be held. If it's not, then it can't be. +Important: switching layers does not cancel the key lock. Additionally, key lock is only able to hold standard action keys and One Shot modifier keys (for example, if you have your shift defined as `OSM(KC_LSFT)`; see [One Shot Keys](quantum_keycodes.md#one-shot-keys)). This does not include any of the QMK special functions (except One Shot modifiers), or shifted versions of keys such as KC_LPRN. If it's in the [basic_keycodes](basic_keycodes.md) list, it can be held. If it's not, then it can't be. diff --git a/keyboards/nyquist/keymaps/333fred/Makefile b/keyboards/nyquist/keymaps/333fred/Makefile index 576bb3c30..f85443280 100644 --- a/keyboards/nyquist/keymaps/333fred/Makefile +++ b/keyboards/nyquist/keymaps/333fred/Makefile @@ -1,5 +1,6 @@ KEY_LOCK_ENABLE = yes NKRO_ENABLE = yes +CONSOLE_ENABLE = yes ifndef QUANTUM_DIR include ../../../../Makefile diff --git a/quantum/process_keycode/process_key_lock.c b/quantum/process_keycode/process_key_lock.c index e3632b74f..b1ba397a0 100644 --- a/quantum/process_keycode/process_key_lock.c +++ b/quantum/process_keycode/process_key_lock.c @@ -50,7 +50,16 @@ uint64_t key_state[4] = { 0x0, 0x0, 0x0, 0x0 }; bool watching = false; -bool process_key_lock(uint16_t keycode, keyrecord_t *record) { +// Translate any OSM keycodes back to their unmasked versions. +uint16_t inline translate_keycode(uint16_t keycode) { + if (keycode > QK_ONE_SHOT_MOD && keycode <= QK_ONE_SHOT_MOD_MAX) { + return keycode ^ QK_ONE_SHOT_MOD; + } else { + return keycode; + } +} + +bool process_key_lock(uint16_t *keycode, keyrecord_t *record) { // We start by categorizing the keypress event. In the event of a down // event, there are several possibilities: // 1. The key is not being locked, and we are not watching for new keys. @@ -76,44 +85,54 @@ bool process_key_lock(uint16_t keycode, keyrecord_t *record) { // 2. The key is being locked. In this case, we will mask the up event // by returning false, so the OS never sees that the key was released // until the user pressed the key again. + + // We translate any OSM keycodes back to their original keycodes, so that if the key being + // one-shot modded is a standard keycode, we can handle it. This is the only set of special + // keys that we handle + uint16_t translated_keycode = translate_keycode(*keycode); + if (record->event.pressed) { // Non-standard keycode, reset and return - if (!(IS_STANDARD_KEYCODE(keycode) || keycode == KC_LOCK)) { + if (!(IS_STANDARD_KEYCODE(translated_keycode) || translated_keycode == KC_LOCK)) { watching = false; return true; } // If we're already watching, turn off the watch. - if (keycode == KC_LOCK) { + if (translated_keycode == KC_LOCK) { watching = !watching; return false; } - - if (IS_STANDARD_KEYCODE(keycode)) { + + if (IS_STANDARD_KEYCODE(translated_keycode)) { // We check watching first. This is so that in the following scenario, we continue to // hold the key: KC_LOCK, KC_F, KC_LOCK, KC_F // If we checked in reverse order, we'd end up holding the key pressed after the second // KC_F press is registered, when the user likely meant to hold F if (watching) { watching = false; - SET_KEY_STATE(keycode); + SET_KEY_STATE(translated_keycode); + // We need to set the keycode passed in to be the translated keycode, in case we + // translated a OSM back to the original keycode. + *keycode = translated_keycode; // Let the standard keymap send the keycode down event. The up event will be masked. return true; } - - if (KEY_STATE(keycode)) { - UNSET_KEY_STATE(keycode); + + if (KEY_STATE(translated_keycode)) { + UNSET_KEY_STATE(translated_keycode); // The key is already held, stop this process. The up event will be sent when the user // releases the key. return false; } } - + // Either the key isn't a standard key, or we need to send the down event. Continue standard // processing return true; } else { // Stop processing if it's a standard key and we're masking up. - return !(IS_STANDARD_KEYCODE(keycode) && KEY_STATE(keycode)); + return !(IS_STANDARD_KEYCODE(translated_keycode) && KEY_STATE(translated_keycode)); } } + diff --git a/quantum/process_keycode/process_key_lock.h b/quantum/process_keycode/process_key_lock.h index 237e103bc..876db4a32 100644 --- a/quantum/process_keycode/process_key_lock.h +++ b/quantum/process_keycode/process_key_lock.h @@ -19,6 +19,6 @@ #include "quantum.h" -bool process_key_lock(uint16_t keycode, keyrecord_t *record); +bool process_key_lock(uint16_t *keycode, keyrecord_t *record); #endif // PROCESS_KEY_LOCK_H diff --git a/quantum/quantum.c b/quantum/quantum.c index c71a97bf2..0243a7e01 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -195,7 +195,7 @@ bool process_record_quantum(keyrecord_t *record) { if (!( #if defined(KEY_LOCK_ENABLE) // Must run first to be able to mask key_up events. - process_key_lock(keycode, record) && + process_key_lock(&keycode, record) && #endif process_record_kb(keycode, record) && #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) -- cgit v1.2.3 From e9d755b6f46d76f2697d59f1a56fd3536729a7e7 Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Mon, 7 Aug 2017 22:02:57 -0700 Subject: Small gaming layer update --- keyboards/nyquist/keymaps/333fred/README.md | 2 +- keyboards/nyquist/keymaps/333fred/keymap.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/keymaps/333fred/README.md b/keyboards/nyquist/keymaps/333fred/README.md index 96a03ea9b..f9f7dc027 100644 --- a/keyboards/nyquist/keymaps/333fred/README.md +++ b/keyboards/nyquist/keymaps/333fred/README.md @@ -70,6 +70,6 @@ Gaming mode (Raise) |------+------+------+------+------+------+------+------+------+------+------+------| | Shift| Z | | | | | | | | | | | |------+------+------+------+------+------+------+------+------+------+------+------| -| Enter| | Lock | | Alt | Spc | Left | Up | Down | Right| | | +| Enter| | Lock | | Alt | Spc | Lower| Left | Up | Down | Right| | `-----------------------------------------------------------------------------------' ``` diff --git a/keyboards/nyquist/keymaps/333fred/keymap.c b/keyboards/nyquist/keymaps/333fred/keymap.c index 5d68a2de2..a2f2e9439 100644 --- a/keyboards/nyquist/keymaps/333fred/keymap.c +++ b/keyboards/nyquist/keymaps/333fred/keymap.c @@ -95,15 +95,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | Shift| Z | | | | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Enter| | Lock | | Alt | Spc | Left | Up | Down | Right| | | + * | Enter| | Lock | | Alt | Spc | Lower| Left | Up | Down | Right| | * `-----------------------------------------------------------------------------------' */ [_GAME] = KEYMAP( \ - KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - KC_LCTL, _______, _______, _______, KC_F, _______, _______, _______, _______, _______, _______, _______, \ - KC_LSFT, KC_Z, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - KC_ENT, _______, KC_LOCK, _______, KC_LALT, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______ \ + KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + KC_LCTL, _______, _______, _______, KC_F, _______, _______, _______, _______, _______, _______, _______, \ + KC_LSFT, KC_Z, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + KC_ENT, _______, KC_LOCK, _______, KC_LALT, OSL(_LOWER), KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______ \ ) }; -- cgit v1.2.3 From 381506737727ecb5f903ee391dffe51d95281f4b Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Mon, 7 Aug 2017 22:19:13 -0700 Subject: Fixed gaming layer --- keyboards/nyquist/keymaps/333fred/README.md | 2 +- keyboards/nyquist/keymaps/333fred/keymap.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/keymaps/333fred/README.md b/keyboards/nyquist/keymaps/333fred/README.md index f9f7dc027..427659141 100644 --- a/keyboards/nyquist/keymaps/333fred/README.md +++ b/keyboards/nyquist/keymaps/333fred/README.md @@ -70,6 +70,6 @@ Gaming mode (Raise) |------+------+------+------+------+------+------+------+------+------+------+------| | Shift| Z | | | | | | | | | | | |------+------+------+------+------+------+------+------+------+------+------+------| -| Enter| | Lock | | Alt | Spc | Lower| Left | Up | Down | Right| | +| Enter| | Lock | | Alt | Spc | Lower| Left | Up | Down | Right|QWERTY| `-----------------------------------------------------------------------------------' ``` diff --git a/keyboards/nyquist/keymaps/333fred/keymap.c b/keyboards/nyquist/keymaps/333fred/keymap.c index a2f2e9439..2edfeefe7 100644 --- a/keyboards/nyquist/keymaps/333fred/keymap.c +++ b/keyboards/nyquist/keymaps/333fred/keymap.c @@ -95,15 +95,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------+------+------+------+------+------+------| * | Shift| Z | | | | | | | | | | | * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Enter| | Lock | | Alt | Spc | Lower| Left | Up | Down | Right| | + * | Enter| | Lock | | Alt | Spc | Lower| Left | Up | Down | Right|QWERTY| * `-----------------------------------------------------------------------------------' */ [_GAME] = KEYMAP( \ - KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - KC_LCTL, _______, _______, _______, KC_F, _______, _______, _______, _______, _______, _______, _______, \ - KC_LSFT, KC_Z, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - KC_ENT, _______, KC_LOCK, _______, KC_LALT, OSL(_LOWER), KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______ \ + KC_ESC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + KC_LCTL, _______, _______, _______, KC_F, _______, _______, _______, _______, _______, _______, _______, \ + KC_LSFT, KC_Z, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + KC_ENT, _______, KC_LOCK, _______, KC_LALT, KC_SPC, OSL(_LOWER), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, TO(_QWERTY) \ ) }; -- cgit v1.2.3 From 7277f09bbadcce120f819132dec8ff7172caacc4 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Fri, 18 Aug 2017 15:36:49 -0400 Subject: Update Nyquist readme file to new format --- keyboards/nyquist/readme.md | 173 +++----------------------------------------- 1 file changed, 12 insertions(+), 161 deletions(-) (limited to 'keyboards/nyquist') diff --git a/keyboards/nyquist/readme.md b/keyboards/nyquist/readme.md index 61b9317d5..16debb987 100644 --- a/keyboards/nyquist/readme.md +++ b/keyboards/nyquist/readme.md @@ -1,169 +1,20 @@ -The Nyquist Keyboard -==================== +Nyquist +======= -The Nyquist is a 60% split ortholinear board by [Keebio](https://keeb.io). It has been designed in a similar manner to the Let's Split v2 by /u/wootpatoot. Each half of the keyboard is arranged in a 5x6 grid. There is an option to use a 2u key with PCB mounted MX stablizers, in place of the two innermost 1u keys on the bottom row. +A split 60% split 5x12 ortholinear keyboard made and sold by Keebio. [More info at Keebio](https://keeb.io). +Keyboard Maintainer: [Bakingpy/nooges](https://github.com/nooges) +Hardware Supported: Pro Micro +Hardware Availability: [Keebio](https://keeb.io) -## Build Guide +Make example for this keyboard (after setting up your build environment): -A build log of the Nyquist can be found here: [Nyquist Build Log](http://imgur.com/a/dD4sX). + make nyquist-rev1-default -Since the design is very similar to the Let's Split v2, the build guide for that can be used while the build guide for the Nyquist is being fully developed. A build guide for putting together the Let's Split v2 can be found here: [An Overly Verbose Guide to Building a Let's Split Keyboard](https://github.com/nicinabox/lets-split-guide) +Example of flashing this keyboard: -There is additional information there about flashing and adding RGB underglow. + make nyquist-rev1-default-avrdude -## First Time Setup +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. -Download or clone the whole firmware and navigate to the keyboards/nyquist directory. Once your development environment is setup, you'll be able to generate the default .hex using: - -``` -$ make serial -``` - -You will see a lot of output and if everything worked correctly you will see the built hex file: - -``` -nyquist_rev1_serial.hex -``` - -If you would like to use one of the alternative keymaps, or create your own, copy one of the existing [keymaps](keymaps/) and run make like so: - - -``` -$ make YOUR_KEYMAP_NAME -``` - -If everything worked correctly you will see a file: - -``` -nyquist_rev1_YOUR_KEYMAP_NAME.hex -``` - -For more information on customizing keymaps, take a look at the primary documentation for [Customizing Your Keymap](/readme.md##customizing-your-keymap) in the main readme.md. - -Features --------- - -For the full Quantum Mechanical Keyboard feature list, see [the parent readme.md](/readme.md). - -Some features supported by the firmware: - -* Either half can connect to the computer via USB, or both halves can be used - independently. -* You only need 3 wires to connect the two halves. Two for VCC and GND and one - for serial communication. -* Optional support for I2C connection between the two halves if for some - reason you require a faster connection between the two halves. Note this - requires an extra wire between halves and pull-up resistors on the data lines. - -### 2u Support -In place of the two innermost 1u keys on the bottom row, a single 2u key can be used. If you choose to use this option, then in your keymap, set the innermost key on the bottom row to what you want the 2u key to be. For example, if using the 2u key on the left half of the board, set the keycode for the lower right key. - -Required Hardware ------------------ - -Apart from diodes and key switches for the keyboard matrix in each half, you -will need: - -* 2 Arduino Pro Micro's. You can find theses on aliexpress for ≈3.50USD each. -* 2 TRRS sockets and 1 TRRS cable, or 2 TRS sockets and 1 TRS cable - -Alternatively, you can use any sort of cable and socket that has at least 3 -wires. If you want to use I2C to communicate between halves, you will need a -cable with at least 4 wires and 2x 4.7kΩ pull-up resistors - -Optional Hardware ------------------ - -A speaker can be hooked-up to either side to the `5` (`C6`) pin and `GND`, and turned on via `AUDIO_ENABLE`. - -Wiring ------- - -The 3 wires of the TRS/TRRS cable need to connect GND, VCC, and digital pin 3 (i.e. -PD0 on the ATmega32u4) between the two Pro Micros. - -Then wire your key matrix to any of the remaining 17 IO pins of the pro micro -and modify the `matrix.c` accordingly. - -The wiring for serial: - -![serial wiring](http://imgur.com/BnCGU1Y) - -The wiring for i2c: - -![i2c wiring](http://imgur.com/5eiArDA) - -The pull-up resistors may be placed on either half. It is also possible -to use 4 resistors and have the pull-ups in both halves, but this is -unnecessary in simple use cases. - -Flashing -------- -From the `nyquist` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. -Example: `make rev1-serial-avrdude` - - -Choosing which board to plug the USB cable into (choosing Master) --------- -Because the two boards are identical, the firmware has logic to differentiate the left and right board. - -It uses two strategies to figure things out: look at the EEPROM (memory on the chip) or looks if the current board has the usb cable. - -The EEPROM approach requires additional setup (flashing the eeeprom) but allows you to swap the usb cable to either side. - -The USB cable approach is easier to setup and if you just want the usb cable on the left board, you do not need to do anything extra. - -### Setting the left hand as master -If you always plug the usb cable into the left board, nothing extra is needed as this is the default. Comment out `EE_HANDS` and comment out `I2C_MASTER_RIGHT` or `MASTER_RIGHT` if for some reason it was set. - -### Setting the right hand as master -If you always plug the usb cable into the right board, add an extra flag to your `config.h` -``` - #define MASTER_RIGHT -``` - -### Setting EE_hands to use either hands as master -If you define `EE_HANDS` in your `config.h`, you will need to set the -EEPROM for the left and right halves. - -The EEPROM is used to store whether the -half is left handed or right handed. This makes it so that the same firmware -file will run on both hands instead of having to flash left and right handed -versions of the firmware to each half. To flash the EEPROM file for the left -half run: -``` -avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-lefthand.eep -// or the equivalent in dfu-programmer - -``` -and similarly for right half -``` -avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-righhand.eep -// or the equivalent in dfu-programmer -``` - -NOTE: replace `$(COM_PORT)` with the port of your device (e.g. `/dev/ttyACM0`) - -After you have flashed the EEPROM, you then need to set `EE_HANDS` in your config.h, rebuild the hex files and reflash. - -Note that you need to program both halves, but you have the option of using -different keymaps for each half. You could program the left half with a QWERTY -layout and the right half with a Colemak layout using bootmagic's default layout option. -Then if you connect the left half to a computer by USB the keyboard will use QWERTY and Colemak when the -right half is connected. - - -Notes on Using Pro Micro 3.3V ------------------------------ - -Do update the `F_CPU` parameter in `rules.mk` to `8000000` which reflects -the frequency on the 3.3V board. - -Also, if the slave board is producing weird characters in certain columns, -update the following line in `matrix.c` to the following: - -``` -// _delay_us(30); // without this wait read unstable value. -_delay_us(300); // without this wait read unstable value. -``` +A build guide for this keyboard can be found here: [Nyquist Build Guide](https://docs.keeb.io) -- cgit v1.2.3