diff options
28 files changed, 1543 insertions, 0 deletions
diff --git a/keyboards/hadron/Makefile b/keyboards/hadron/Makefile new file mode 100644 index 000000000..e0e1cc6fb --- /dev/null +++ b/keyboards/hadron/Makefile | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | SUBPROJECT_DEFAULT = ver2 | ||
| 2 | |||
| 3 | ifndef MAKEFILE_INCLUDED | ||
| 4 | include ../../Makefile | ||
| 5 | endif \ No newline at end of file | ||
diff --git a/keyboards/hadron/config.h b/keyboards/hadron/config.h new file mode 100644 index 000000000..0c19d6c79 --- /dev/null +++ b/keyboards/hadron/config.h | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_H | ||
| 19 | #define CONFIG_H | ||
| 20 | |||
| 21 | #include "config_common.h" | ||
| 22 | |||
| 23 | /* USB Device descriptor parameter */ | ||
| 24 | #define VENDOR_ID 0xFEED | ||
| 25 | #define PRODUCT_ID 0x6060 | ||
| 26 | #define MANUFACTURER ishtob | ||
| 27 | #define PRODUCT Hadron Keyboard | ||
| 28 | #define DESCRIPTION A cherry ML ortholinear keyboard | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | //#define AUDIO_VOICES | ||
| 34 | |||
| 35 | //#define BACKLIGHT_PIN B7 | ||
| 36 | |||
| 37 | /* COL2ROW or ROW2COL */ | ||
| 38 | #define DIODE_DIRECTION COL2ROW | ||
| 39 | |||
| 40 | /* define if matrix has ghost */ | ||
| 41 | //#define MATRIX_HAS_GHOST | ||
| 42 | |||
| 43 | /* number of backlight levels */ | ||
| 44 | //#define BACKLIGHT_LEVELS 3 | ||
| 45 | |||
| 46 | /* Set 0 if debouncing isn't needed */ | ||
| 47 | #define DEBOUNCING_DELAY 5 | ||
| 48 | |||
| 49 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 50 | #define LOCKING_SUPPORT_ENABLE | ||
| 51 | /* Locking resynchronize hack */ | ||
| 52 | #define LOCKING_RESYNC_ENABLE | ||
| 53 | |||
| 54 | /* key combination for command */ | ||
| 55 | #define IS_COMMAND() ( \ | ||
| 56 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 57 | ) | ||
| 58 | |||
| 59 | /* | ||
| 60 | * Feature disable options | ||
| 61 | * These options are also useful to firmware size reduction. | ||
| 62 | */ | ||
| 63 | |||
| 64 | /* disable debug print */ | ||
| 65 | //#define NO_DEBUG | ||
| 66 | |||
| 67 | /* disable print */ | ||
| 68 | //#define NO_PRINT | ||
| 69 | |||
| 70 | /* disable action features */ | ||
| 71 | //#define NO_ACTION_LAYER | ||
| 72 | //#define NO_ACTION_TAPPING | ||
| 73 | //#define NO_ACTION_ONESHOT | ||
| 74 | //#define NO_ACTION_MACRO | ||
| 75 | //#define NO_ACTION_FUNCTION | ||
| 76 | #ifdef SUBPROJECT_ver0 | ||
| 77 | #include "ver0/config.h" | ||
| 78 | #endif | ||
| 79 | #ifdef SUBPROJECT_ver2 | ||
| 80 | #include "ver2/config.h" | ||
| 81 | #endif | ||
| 82 | |||
| 83 | #endif | ||
diff --git a/keyboards/hadron/hadron.c b/keyboards/hadron/hadron.c new file mode 100644 index 000000000..ca5b20e89 --- /dev/null +++ b/keyboards/hadron/hadron.c | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #include "hadron.h" | ||
| 2 | |||
| 3 | |||
| 4 | void matrix_init_kb(void) { | ||
| 5 | |||
| 6 | matrix_init_user(); | ||
| 7 | } | ||
| 8 | |||
| 9 | void matrix_scan_kb(void) { | ||
| 10 | // put your looping keyboard code here | ||
| 11 | // runs every cycle (a lot) | ||
| 12 | matrix_scan_user(); | ||
| 13 | } | ||
| 14 | |||
| 15 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 16 | // put your per-action keyboard code here | ||
| 17 | // runs for every action, just before processing by the firmware | ||
| 18 | |||
| 19 | return process_record_user(keycode, record); | ||
| 20 | } | ||
| 21 | |||
| 22 | void led_set_kb(uint8_t usb_led) { | ||
| 23 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 24 | |||
| 25 | led_set_user(usb_led); | ||
| 26 | } \ No newline at end of file | ||
diff --git a/keyboards/hadron/hadron.h b/keyboards/hadron/hadron.h new file mode 100644 index 000000000..fceae50d9 --- /dev/null +++ b/keyboards/hadron/hadron.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | #ifndef HADRON_H | ||
| 2 | #define HADRON_H | ||
| 3 | |||
| 4 | #ifdef SUBPROJECT_ver0 | ||
| 5 | #include "ver0.h" | ||
| 6 | #endif | ||
| 7 | #ifdef SUBPROJECT_ver2 | ||
| 8 | #include "ver2.h" | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #include "quantum.h" | ||
| 12 | |||
| 13 | |||
| 14 | #define KEYMAP( \ | ||
| 15 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ | ||
| 16 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ | ||
| 17 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \ | ||
| 18 | K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ | ||
| 19 | K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E \ | ||
| 20 | ) \ | ||
| 21 | { \ | ||
| 22 | { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, KC_NO, KC_NO, KC_NO }, \ | ||
| 23 | { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \ | ||
| 24 | { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \ | ||
| 25 | { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ | ||
| 26 | { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E } \ | ||
| 27 | } | ||
| 28 | |||
| 29 | |||
| 30 | #endif | ||
diff --git a/keyboards/hadron/i2c.c b/keyboards/hadron/i2c.c new file mode 100644 index 000000000..cd2b835d5 --- /dev/null +++ b/keyboards/hadron/i2c.c | |||
| @@ -0,0 +1,166 @@ | |||
| 1 | #include <util/twi.h> | ||
| 2 | #include <avr/io.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <avr/interrupt.h> | ||
| 5 | #include <util/twi.h> | ||
| 6 | #include <stdbool.h> | ||
| 7 | #include "i2c.h" | ||
| 8 | |||
| 9 | #ifdef USE_I2C | ||
| 10 | |||
| 11 | // Limits the amount of we wait for any one i2c transaction. | ||
| 12 | // Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is | ||
| 13 | // 9 bits, a single transaction will take around 90μs to complete. | ||
| 14 | // | ||
| 15 | // (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit | ||
| 16 | // poll loop takes at least 8 clock cycles to execute | ||
| 17 | #define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 | ||
| 18 | |||
| 19 | #define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) | ||
| 20 | |||
| 21 | volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 22 | |||
| 23 | static volatile uint8_t slave_buffer_pos; | ||
| 24 | static volatile bool slave_has_register_set = false; | ||
| 25 | |||
| 26 | // Wait for an i2c operation to finish | ||
| 27 | inline static | ||
| 28 | void i2c_delay(void) { | ||
| 29 | uint16_t lim = 0; | ||
| 30 | while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) | ||
| 31 | lim++; | ||
| 32 | |||
| 33 | // easier way, but will wait slightly longer | ||
| 34 | // _delay_us(100); | ||
| 35 | } | ||
| 36 | |||
| 37 | // Setup twi to run at 100kHz | ||
| 38 | void i2c_master_init(void) { | ||
| 39 | // no prescaler | ||
| 40 | TWSR = 0; | ||
| 41 | // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10. | ||
| 42 | // Check datasheets for more info. | ||
| 43 | TWBR = ((F_CPU/SCL_CLOCK)-16)/2; | ||
| 44 | } | ||
| 45 | |||
| 46 | // Start a transaction with the given i2c slave address. The direction of the | ||
| 47 | // transfer is set with I2C_READ and I2C_WRITE. | ||
| 48 | // returns: 0 => success | ||
| 49 | // 1 => error | ||
| 50 | uint8_t i2c_master_start(uint8_t address) { | ||
| 51 | TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); | ||
| 52 | |||
| 53 | i2c_delay(); | ||
| 54 | |||
| 55 | // check that we started successfully | ||
| 56 | if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) | ||
| 57 | return 1; | ||
| 58 | |||
| 59 | // send device address | ||
| 60 | TWDR = address; | ||
| 61 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 62 | |||
| 63 | i2c_delay(); | ||
| 64 | |||
| 65 | if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) | ||
| 66 | return 1; // slave did not acknowledge | ||
| 67 | else | ||
| 68 | return 0; // success | ||
| 69 | } | ||
| 70 | |||
| 71 | |||
| 72 | // Finish the i2c transaction. | ||
| 73 | void i2c_master_stop(void) { | ||
| 74 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); | ||
| 75 | |||
| 76 | uint16_t lim = 0; | ||
| 77 | while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) | ||
| 78 | lim++; | ||
| 79 | } | ||
| 80 | |||
| 81 | // Write one byte to the i2c slave. | ||
| 82 | // returns 0 => slave ACK | ||
| 83 | // 1 => slave NACK | ||
| 84 | uint8_t i2c_master_write(uint8_t data) { | ||
| 85 | TWDR = data; | ||
| 86 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 87 | |||
| 88 | i2c_delay(); | ||
| 89 | |||
| 90 | // check if the slave acknowledged us | ||
| 91 | return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; | ||
| 92 | } | ||
| 93 | |||
| 94 | // Read one byte from the i2c slave. If ack=1 the slave is acknowledged, | ||
| 95 | // if ack=0 the acknowledge bit is not set. | ||
| 96 | // returns: byte read from i2c device | ||
| 97 | uint8_t i2c_master_read(int ack) { | ||
| 98 | TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); | ||
| 99 | |||
| 100 | i2c_delay(); | ||
| 101 | return TWDR; | ||
| 102 | } | ||
| 103 | |||
| 104 | void i2c_reset_state(void) { | ||
| 105 | TWCR = 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | void i2c_slave_init(uint8_t address) { | ||
| 109 | TWAR = address << 0; // slave i2c address | ||
| 110 | // TWEN - twi enable | ||
| 111 | // TWEA - enable address acknowledgement | ||
| 112 | // TWINT - twi interrupt flag | ||
| 113 | // TWIE - enable the twi interrupt | ||
| 114 | TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); | ||
| 115 | } | ||
| 116 | |||
| 117 | ISR(TWI_vect); | ||
| 118 | |||
| 119 | ISR(TWI_vect) { | ||
| 120 | uint8_t ack = 1; | ||
| 121 | switch(TW_STATUS) { | ||
| 122 | case TW_SR_SLA_ACK: | ||
| 123 | // this device has been addressed as a slave receiver | ||
| 124 | slave_has_register_set = false; | ||
| 125 | break; | ||
| 126 | |||
| 127 | case TW_SR_DATA_ACK: | ||
| 128 | // this device has received data as a slave receiver | ||
| 129 | // The first byte that we receive in this transaction sets the location | ||
| 130 | // of the read/write location of the slaves memory that it exposes over | ||
| 131 | // i2c. After that, bytes will be written at slave_buffer_pos, incrementing | ||
| 132 | // slave_buffer_pos after each write. | ||
| 133 | if(!slave_has_register_set) { | ||
| 134 | slave_buffer_pos = TWDR; | ||
| 135 | // don't acknowledge the master if this memory loctaion is out of bounds | ||
| 136 | if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { | ||
| 137 | ack = 0; | ||
| 138 | slave_buffer_pos = 0; | ||
| 139 | } | ||
| 140 | slave_has_register_set = true; | ||
| 141 | } else { | ||
| 142 | i2c_slave_buffer[slave_buffer_pos] = TWDR; | ||
| 143 | BUFFER_POS_INC(); | ||
| 144 | } | ||
| 145 | break; | ||
| 146 | |||
| 147 | case TW_ST_SLA_ACK: | ||
| 148 | case TW_ST_DATA_ACK: | ||
| 149 | // master has addressed this device as a slave transmitter and is | ||
| 150 | // requesting data. | ||
| 151 | TWDR = i2c_slave_buffer[slave_buffer_pos]; | ||
| 152 | BUFFER_POS_INC(); | ||
| 153 | break; | ||
| 154 | |||
| 155 | case TW_BUS_ERROR: // something went wrong, reset twi state | ||
| 156 | TWCR = 0; | ||
| 157 | default: | ||
| 158 | break; | ||
| 159 | } | ||
| 160 | // Reset everything, so we are ready for the next TWI interrupt | ||
| 161 | TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); | ||
| 162 | } | ||
| 163 | |||
| 164 | |||
| 165 | |||
| 166 | #endif | ||
diff --git a/keyboards/hadron/i2c.h b/keyboards/hadron/i2c.h new file mode 100644 index 000000000..2bd7f4096 --- /dev/null +++ b/keyboards/hadron/i2c.h | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | #ifndef I2C_H | ||
| 2 | #define I2C_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | |||
| 6 | #ifndef F_CPU | ||
| 7 | #define F_CPU 16000000UL | ||
| 8 | #endif | ||
| 9 | |||
| 10 | #define I2C_READ 1 | ||
| 11 | #define I2C_WRITE 0 | ||
| 12 | |||
| 13 | #define I2C_ACK 1 | ||
| 14 | #define I2C_NACK 0 | ||
| 15 | |||
| 16 | #define SLAVE_BUFFER_SIZE 0x10 | ||
| 17 | |||
| 18 | // i2c SCL clock frequency | ||
| 19 | #define SCL_CLOCK 800000L | ||
| 20 | |||
| 21 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 22 | |||
| 23 | void i2c_master_init(void); | ||
| 24 | uint8_t i2c_master_start(uint8_t address); | ||
| 25 | void i2c_master_stop(void); | ||
| 26 | uint8_t i2c_master_write(uint8_t data); | ||
| 27 | uint8_t i2c_master_read(int); | ||
| 28 | void i2c_reset_state(void); | ||
| 29 | void i2c_slave_init(uint8_t address); | ||
| 30 | |||
| 31 | |||
| 32 | static inline unsigned char i2c_start_read(unsigned char addr) { | ||
| 33 | return i2c_master_start((addr << 1) | I2C_READ); | ||
| 34 | } | ||
| 35 | |||
| 36 | static inline unsigned char i2c_start_write(unsigned char addr) { | ||
| 37 | return i2c_master_start((addr << 1) | I2C_WRITE); | ||
| 38 | } | ||
| 39 | |||
| 40 | // from SSD1306 scrips | ||
| 41 | extern unsigned char i2c_rep_start(unsigned char addr); | ||
| 42 | extern void i2c_start_wait(unsigned char addr); | ||
| 43 | extern unsigned char i2c_readAck(void); | ||
| 44 | extern unsigned char i2c_readNak(void); | ||
| 45 | extern unsigned char i2c_read(unsigned char ack); | ||
| 46 | |||
| 47 | #define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); | ||
| 48 | |||
| 49 | #endif | ||
diff --git a/keyboards/hadron/keymaps/default/Makefile b/keyboards/hadron/keymaps/default/Makefile new file mode 100644 index 000000000..e24ba04b5 --- /dev/null +++ b/keyboards/hadron/keymaps/default/Makefile | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | |||
| 2 | |||
| 3 | # Build Options | ||
| 4 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 5 | # the appropriate keymap folder that will get included automatically | ||
| 6 | # | ||
| 7 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 8 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
| 9 | EXTRAKEY_ENABLE = no # Audio control and System control(+450) | ||
| 10 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 11 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 12 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 13 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 14 | MIDI_ENABLE = no # MIDI controls | ||
| 15 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 16 | UNICODE_ENABLE = no # Unicode | ||
| 17 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 18 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 19 | ONEHAND_ENABLE = no # Enable one-hand typing | ||
| 20 | |||
| 21 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 22 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 23 | |||
| 24 | ifndef QUANTUM_DIR | ||
| 25 | include ../../../../Makefile | ||
| 26 | endif \ No newline at end of file | ||
diff --git a/keyboards/hadron/keymaps/default/config.h b/keyboards/hadron/keymaps/default/config.h new file mode 100644 index 000000000..4a5a8fad3 --- /dev/null +++ b/keyboards/hadron/keymaps/default/config.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | #define LEADER_TIMEOUT 300 | ||
| 7 | //#define BACKLIGHT_BREATHING | ||
| 8 | #define PREVENT_STUCK_MODIFIERS | ||
| 9 | |||
| 10 | #define USE_I2C | ||
| 11 | #define SSD1306OLED | ||
| 12 | |||
| 13 | /* ws2812 RGB LED*/ | ||
| 14 | #define RGB_DI_PIN D4 | ||
| 15 | #define RGBLIGHT_ANIMATIONS | ||
| 16 | #define RGBLED_NUM 14 // Number of LEDs | ||
| 17 | #define RGBLIGHT_HUE_STEP 10 | ||
| 18 | #define RGBLIGHT_SAT_STEP 17 | ||
| 19 | |||
| 20 | #endif | ||
diff --git a/keyboards/hadron/keymaps/default/keymap.c b/keyboards/hadron/keymaps/default/keymap.c new file mode 100644 index 000000000..24fa0b27f --- /dev/null +++ b/keyboards/hadron/keymaps/default/keymap.c | |||
| @@ -0,0 +1,408 @@ | |||
| 1 | #include "hadron.h" | ||
| 2 | #include "bootloader.h" | ||
| 3 | #include "action_layer.h" | ||
| 4 | #include "eeconfig.h" | ||
| 5 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 6 | #ifdef AUDIO_ENABLE | ||
| 7 | #include "audio.h" | ||
| 8 | #endif | ||
| 9 | #ifdef USE_I2C | ||
| 10 | #include "i2c.h" | ||
| 11 | #endif | ||
| 12 | #ifdef SSD1306OLED | ||
| 13 | #include "ssd1306.h" | ||
| 14 | #endif | ||
| 15 | extern keymap_config_t keymap_config; | ||
| 16 | |||
| 17 | //Following line allows macro to read current RGB settings | ||
| 18 | extern rgblight_config_t rgblight_config; | ||
| 19 | |||
| 20 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 21 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 22 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 23 | // entirely and just use numbers. | ||
| 24 | #define _QWERTY 0 | ||
| 25 | #define _COLEMAK 1 | ||
| 26 | #define _DVORAK 2 | ||
| 27 | #define _LOWER 3 | ||
| 28 | #define _RAISE 4 | ||
| 29 | #define _MOUSECURSOR 8 | ||
| 30 | #define _ADJUST 16 | ||
| 31 | |||
| 32 | enum preonic_keycodes { | ||
| 33 | QWERTY = SAFE_RANGE, | ||
| 34 | COLEMAK, | ||
| 35 | DVORAK, | ||
| 36 | LOWER, | ||
| 37 | RAISE, | ||
| 38 | BACKLIT, | ||
| 39 | RGBLED_TOGGLE, | ||
| 40 | RGBLED_STEP_MODE, | ||
| 41 | RGBLED_INCREASE_HUE, | ||
| 42 | RGBLED_DECREASE_HUE, | ||
| 43 | RGBLED_INCREASE_SAT, | ||
| 44 | RGBLED_DECREASE_SAT, | ||
| 45 | RGBLED_INCREASE_VAL, | ||
| 46 | RGBLED_DECREASE_VAL, | ||
| 47 | }; | ||
| 48 | |||
| 49 | enum macro_keycodes { | ||
| 50 | KC_DEMOMACRO, | ||
| 51 | }; | ||
| 52 | |||
| 53 | // Fillers to make layering more clear | ||
| 54 | #define _______ KC_TRNS | ||
| 55 | #define XXXXXXX KC_NO | ||
| 56 | // Custom macros | ||
| 57 | #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl | ||
| 58 | #define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl | ||
| 59 | #define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl | ||
| 60 | #define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift | ||
| 61 | // Requires KC_TRNS/_______ for the trigger key in the destination layer | ||
| 62 | #define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor | ||
| 63 | #define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise | ||
| 64 | #define DEMOMACRO M(KC_DEMOMACRO) // Sample for macros | ||
| 65 | |||
| 66 | |||
| 67 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 68 | |||
| 69 | /* Qwerty | ||
| 70 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 71 | * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | DEL | | ||
| 72 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 73 | * | Tab | Q | W | E | R | T | 7 | 8 | 9 | Y | U | I | O | P | Bksp | | ||
| 74 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 75 | * | CAPS | A | S | D | F | G | 4 | 5 | 6 | H | J | K | L | ;/Nav| ' | | ||
| 76 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 77 | * | Shift| Z | X | C | V | B | 1 | 2 | 3 | N | M | , | . | / |Ctl/Et| | ||
| 78 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 79 | * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | | ||
| 80 | * `--------------------------------------------------------------------------------------------------------' | ||
| 81 | */ | ||
| 82 | [_QWERTY] = KEYMAP( | ||
| 83 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ | ||
| 84 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_P7, KC_P8, KC_P9, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ | ||
| 85 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_P4, KC_P5, KC_P6, KC_H, KC_J, KC_K, KC_L,LT_MC(KC_SCLN), KC_QUOT, \ | ||
| 86 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, CTL_ENT, \ | ||
| 87 | KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT,KC_DOWN, KC_UP, KC_RGHT \ | ||
| 88 | ), | ||
| 89 | |||
| 90 | /* Colemak | ||
| 91 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 92 | * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | 0 | - | | ||
| 93 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 94 | * | Tab | Q | W | F | P | G | 7 | 8 | 9 | J | L | U | Y | ; | Bksp | | ||
| 95 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 96 | * | CAPS | A | R | S | T | D | 4 | 5 | 6 | H | N | E | I | O | ' | | ||
| 97 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 98 | * | Shift| Z | X | C | V | B | 1 | 2 | 3 | K | M | , | . | / |Ctl/Et| | ||
| 99 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 100 | * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | | ||
| 101 | * `--------------------------------------------------------------------------------------------------------' | ||
| 102 | */ | ||
| 103 | [_COLEMAK] = KEYMAP( | ||
| 104 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ | ||
| 105 | KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_P7, KC_P8, KC_P9, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ | ||
| 106 | KC_LCTRL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_P4, KC_P5, KC_P6, KC_H, KC_N, KC_E, KC_I, LT_MC(KC_O), KC_QUOT, \ | ||
| 107 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, CTL_ENT, \ | ||
| 108 | KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
| 109 | ), | ||
| 110 | |||
| 111 | /* Dvorak | ||
| 112 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 113 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 114 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 115 | * | Tab | " | , | . | P | Y | 7 | 8 | 9 | F | G | C | R | L | Bksp | | ||
| 116 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 117 | * | Esc | A | O | E | U | I | 4 | 5 | 6 | D | H | T | N | S | / | | ||
| 118 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 119 | * | Shift| ; | Q | J | K | X | 1 | 2 | 3 | B | M | W | V | Z |Ctl/Et| | ||
| 120 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 121 | * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | | ||
| 122 | * `--------------------------------------------------------------------------------------------------------' | ||
| 123 | */ | ||
| 124 | [_DVORAK] = KEYMAP( | ||
| 125 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ | ||
| 126 | KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_P7, KC_P8, KC_P9, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ | ||
| 127 | KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_P4, KC_P5, KC_P6, KC_D, KC_H, KC_T, KC_N, LT_MC(KC_S), KC_SLSH, \ | ||
| 128 | KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_P1, KC_P2, KC_P3, KC_B, KC_M, KC_W, KC_V, KC_Z, CTL_ENT, \ | ||
| 129 | KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ | ||
| 130 | ), | ||
| 131 | |||
| 132 | /* Lower | ||
| 133 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 134 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
| 135 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 136 | * | ~ | ! | @ | # | $ | % | | | | ^ | & | * | ( | ) | Del | | ||
| 137 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 138 | * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | _ | + | { | } | | | | ||
| 139 | * |------+------+------+------+------+------|------+------+------+------+------+------+------+------+------| | ||
| 140 | * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO ~ |ISO | | | | | | ||
| 141 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 142 | * | | | | | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 143 | * `--------------------------------------------------------------------------------------------------------' | ||
| 144 | */ | ||
| 145 | [_LOWER] = KEYMAP( | ||
| 146 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ | ||
| 147 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ | ||
| 148 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_PIPE, \ | ||
| 149 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12,S(KC_NUHS),S(KC_NUBS),_______,_______, _______, \ | ||
| 150 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | ||
| 151 | ), | ||
| 152 | |||
| 153 | /* Raise | ||
| 154 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 155 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 156 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 157 | * | ` | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | Del | | ||
| 158 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 159 | * | Del | F1 | F2 | F3 | F4 | F5 | | | | F6 | - | = | [ | ] | \ | | ||
| 160 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 161 | * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO # |ISO / | | | | | ||
| 162 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 163 | * | | | | | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 164 | * `--------------------------------------------------------------------------------------------------------' | ||
| 165 | */ | ||
| 166 | [_RAISE] = KEYMAP( | ||
| 167 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ | ||
| 168 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ | ||
| 169 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ | ||
| 170 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ | ||
| 171 | _______, _______, _______, _______, _______, KC_SPC, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | ||
| 172 | ), | ||
| 173 | |||
| 174 | /* Mouse Layer (semi-col) | ||
| 175 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 176 | * | ACCL0| ACCL1| ACCL2| | | | | | | | | | | ||
| 177 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 178 | * | | | | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| Macro| | | ||
| 179 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 180 | * | | | | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | | | ||
| 181 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 182 | * | | | | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | | | ||
| 183 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 184 | * | | | | | | BTN1 | | | | BTN1 | | | | | | | ||
| 185 | * `--------------------------------------------------------------------------------------------------------' | ||
| 186 | */ | ||
| 187 | |||
| 188 | [_MOUSECURSOR] = KEYMAP( | ||
| 189 | KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 190 | _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R,DEMOMACRO,_______, \ | ||
| 191 | _______, _______, _______, _______, _______, _______, _______, _______, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, \ | ||
| 192 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, \ | ||
| 193 | _______, _______, _______, _______, _______, KC_BTN1, _______, _______, _______, KC_BTN1, _______, _______, _______, _______, _______ \ | ||
| 194 | ), | ||
| 195 | |||
| 196 | /* Adjust (Lower + Raise) | ||
| 197 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 198 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 199 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 200 | * | Reset|RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del | | ||
| 201 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 202 | * | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | | | ||
| 203 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 204 | * | |Voice-|Voice+|Mus on|Musoff| | | | | | | | BL + |BL ST |BL TG | | ||
| 205 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 206 | * | | | | | | | | | | | | | | | | | ||
| 207 | * `--------------------------------------------------------------------------------------------------------' | ||
| 208 | */ | ||
| 209 | [_ADJUST] = KEYMAP( | ||
| 210 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | ||
| 211 | RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \ | ||
| 212 | _______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \ | ||
| 213 | _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \ | ||
| 214 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______\ | ||
| 215 | ) | ||
| 216 | |||
| 217 | |||
| 218 | |||
| 219 | }; | ||
| 220 | |||
| 221 | |||
| 222 | #ifdef AUDIO_ENABLE | ||
| 223 | |||
| 224 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
| 225 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 226 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
| 227 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
| 228 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
| 229 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
| 230 | #endif | ||
| 231 | |||
| 232 | // define variables for reactive RGB | ||
| 233 | bool RGB_INIT = false; | ||
| 234 | bool TOG_STATUS = false; | ||
| 235 | int RGB_current_mode; | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 240 | eeconfig_update_default_layer(default_layer); | ||
| 241 | default_layer_set(default_layer); | ||
| 242 | } | ||
| 243 | |||
| 244 | void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | ||
| 245 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | ||
| 246 | rgblight_mode(RGB_current_mode); | ||
| 247 | layer_on(layer3); | ||
| 248 | } else { | ||
| 249 | layer_off(layer3); | ||
| 250 | } | ||
| 251 | } | ||
| 252 | |||
| 253 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 254 | switch (keycode) { | ||
| 255 | case QWERTY: | ||
| 256 | if (record->event.pressed) { | ||
| 257 | #ifdef AUDIO_ENABLE | ||
| 258 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
| 259 | #endif | ||
| 260 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 261 | } | ||
| 262 | return false; | ||
| 263 | break; | ||
| 264 | case COLEMAK: | ||
| 265 | if (record->event.pressed) { | ||
| 266 | #ifdef AUDIO_ENABLE | ||
| 267 | PLAY_NOTE_ARRAY(tone_colemak, false, 0); | ||
| 268 | #endif | ||
| 269 | persistant_default_layer_set(1UL<<_COLEMAK); | ||
| 270 | } | ||
| 271 | return false; | ||
| 272 | break; | ||
| 273 | case LOWER: | ||
| 274 | if (record->event.pressed) { | ||
| 275 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 276 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 277 | if (RGB_INIT) {} else { | ||
| 278 | RGB_current_mode = rgblight_config.mode; | ||
| 279 | RGB_INIT = true; | ||
| 280 | } | ||
| 281 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
| 282 | } else { | ||
| 283 | TOG_STATUS = !TOG_STATUS; | ||
| 284 | rgblight_mode(16); | ||
| 285 | } | ||
| 286 | layer_on(_LOWER); | ||
| 287 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 288 | } else { | ||
| 289 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
| 290 | TOG_STATUS = false; | ||
| 291 | layer_off(_LOWER); | ||
| 292 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 293 | } | ||
| 294 | return false; | ||
| 295 | break; | ||
| 296 | case RAISE: | ||
| 297 | if (record->event.pressed) { | ||
| 298 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 299 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 300 | if (RGB_INIT) {} else { | ||
| 301 | RGB_current_mode = rgblight_config.mode; | ||
| 302 | RGB_INIT = true; | ||
| 303 | } | ||
| 304 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
| 305 | } else { | ||
| 306 | TOG_STATUS = !TOG_STATUS; | ||
| 307 | rgblight_mode(15); | ||
| 308 | } | ||
| 309 | layer_on(_RAISE); | ||
| 310 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 311 | } else { | ||
| 312 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
| 313 | layer_off(_RAISE); | ||
| 314 | TOG_STATUS = false; | ||
| 315 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 316 | } | ||
| 317 | return false; | ||
| 318 | break; | ||
| 319 | case BACKLIT: | ||
| 320 | if (record->event.pressed) { | ||
| 321 | register_code(KC_RSFT); | ||
| 322 | #ifdef BACKLIGHT_ENABLE | ||
| 323 | backlight_step(); | ||
| 324 | #endif | ||
| 325 | } else { | ||
| 326 | unregister_code(KC_RSFT); | ||
| 327 | } | ||
| 328 | return false; | ||
| 329 | break; | ||
| 330 | case RGB_MOD: | ||
| 331 | //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released | ||
| 332 | if (record->event.pressed) { | ||
| 333 | rgblight_mode(RGB_current_mode); | ||
| 334 | rgblight_step(); | ||
| 335 | RGB_current_mode = rgblight_config.mode; | ||
| 336 | } | ||
| 337 | return false; | ||
| 338 | break; | ||
| 339 | } | ||
| 340 | return true; | ||
| 341 | } | ||
| 342 | |||
| 343 | void matrix_init_user(void) { | ||
| 344 | #ifdef USE_I2C | ||
| 345 | i2c_master_init(); | ||
| 346 | #ifdef SSD1306OLED | ||
| 347 | // calls code for the SSD1306 OLED | ||
| 348 | _delay_ms(400); | ||
| 349 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | ||
| 350 | iota_gfx_init(); // turns on the display | ||
| 351 | #endif | ||
| 352 | #endif | ||
| 353 | #ifdef AUDIO_ENABLE | ||
| 354 | startup_user(); | ||
| 355 | #endif | ||
| 356 | } | ||
| 357 | |||
| 358 | void matrix_scan_user(void) { | ||
| 359 | #ifdef SSD1306OLED | ||
| 360 | iota_gfx_task(); // this is what updates the display continuously | ||
| 361 | #endif | ||
| 362 | } | ||
| 363 | |||
| 364 | #ifdef AUDIO_ENABLE | ||
| 365 | |||
| 366 | void startup_user() | ||
| 367 | { | ||
| 368 | _delay_ms(20); // gets rid of tick | ||
| 369 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
| 370 | } | ||
| 371 | |||
| 372 | void shutdown_user() | ||
| 373 | {cc | ||
| 374 | PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||
| 375 | _delay_ms(150); | ||
| 376 | stop_all_notes(); | ||
| 377 | } | ||
| 378 | |||
| 379 | void music_on_user(void) | ||
| 380 | { | ||
| 381 | music_scale_user(); | ||
| 382 | } | ||
| 383 | |||
| 384 | void music_scale_user(void) | ||
| 385 | { | ||
| 386 | PLAY_NOTE_ARRAY(music_scale, false, 0); | ||
| 387 | } | ||
| 388 | |||
| 389 | #endif | ||
| 390 | |||
| 391 | /* | ||
| 392 | * Macro definition | ||
| 393 | */ | ||
| 394 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 395 | { | ||
| 396 | if (!eeconfig_is_enabled()) { | ||
| 397 | eeconfig_init(); | ||
| 398 | } | ||
| 399 | |||
| 400 | switch (id) { | ||
| 401 | case KC_DEMOMACRO: | ||
| 402 | if (record->event.pressed){ | ||
| 403 | return MACRO (I(1), T(H),T(E),T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END); | ||
| 404 | } | ||
| 405 | } | ||
| 406 | |||
| 407 | return MACRO_NONE; | ||
| 408 | } | ||
diff --git a/keyboards/hadron/keymaps/default/readme.md b/keyboards/hadron/keymaps/default/readme.md new file mode 100644 index 000000000..de9680b49 --- /dev/null +++ b/keyboards/hadron/keymaps/default/readme.md | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | # The Default Planck Layout | ||
| 2 | |||
diff --git a/keyboards/hadron/keymaps/readme.md b/keyboards/hadron/keymaps/readme.md new file mode 100644 index 000000000..54fb5f6d9 --- /dev/null +++ b/keyboards/hadron/keymaps/readme.md | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | # How to add your own keymap | ||
| 2 | |||
| 3 | Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`: | ||
| 4 | |||
| 5 | _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author] | ||
| 6 | |||
| 7 | \* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements | ||
| 8 | |||
| 9 | and contain the following files: | ||
| 10 | |||
| 11 | * `keymap.c` | ||
| 12 | * `readme.md` *recommended* | ||
| 13 | * `config.h` *optional*, found automatically when compiling | ||
| 14 | * `Makefile` *optional*, found automatically when compling | ||
| 15 | |||
| 16 | When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format: | ||
| 17 | |||
| 18 | * **folder_name** description | ||
| 19 | |||
| 20 | # List of Planck keymaps | ||
| 21 | |||
| 22 | * **default** default Planck layout | ||
| 23 | * **cbbrowne** cbbrowne's Planck layout \ No newline at end of file | ||
diff --git a/keyboards/hadron/keymaps/side_numpad/Makefile b/keyboards/hadron/keymaps/side_numpad/Makefile new file mode 100644 index 000000000..5cdc186cd --- /dev/null +++ b/keyboards/hadron/keymaps/side_numpad/Makefile | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | |||
| 2 | |||
| 3 | # Build Options | ||
| 4 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 5 | # the appropriate keymap folder that will get included automatically | ||
| 6 | # | ||
| 7 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 8 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
| 9 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 10 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 11 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 12 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 13 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 14 | MIDI_ENABLE = yes # MIDI controls | ||
| 15 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 16 | UNICODE_ENABLE = no # Unicode | ||
| 17 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 18 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 19 | ONEHAND_ENABLE = no # Enable one-hand typing | ||
| 20 | |||
| 21 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 22 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 23 | |||
| 24 | ifndef QUANTUM_DIR | ||
| 25 | include ../../../../Makefile | ||
| 26 | endif \ No newline at end of file | ||
diff --git a/keyboards/hadron/keymaps/side_numpad/config.h b/keyboards/hadron/keymaps/side_numpad/config.h new file mode 100644 index 000000000..4a5a8fad3 --- /dev/null +++ b/keyboards/hadron/keymaps/side_numpad/config.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | #define LEADER_TIMEOUT 300 | ||
| 7 | //#define BACKLIGHT_BREATHING | ||
| 8 | #define PREVENT_STUCK_MODIFIERS | ||
| 9 | |||
| 10 | #define USE_I2C | ||
| 11 | #define SSD1306OLED | ||
| 12 | |||
| 13 | /* ws2812 RGB LED*/ | ||
| 14 | #define RGB_DI_PIN D4 | ||
| 15 | #define RGBLIGHT_ANIMATIONS | ||
| 16 | #define RGBLED_NUM 14 // Number of LEDs | ||
| 17 | #define RGBLIGHT_HUE_STEP 10 | ||
| 18 | #define RGBLIGHT_SAT_STEP 17 | ||
| 19 | |||
| 20 | #endif | ||
diff --git a/keyboards/hadron/keymaps/side_numpad/keymap.c b/keyboards/hadron/keymaps/side_numpad/keymap.c new file mode 100644 index 000000000..cfe6cc539 --- /dev/null +++ b/keyboards/hadron/keymaps/side_numpad/keymap.c | |||
| @@ -0,0 +1,418 @@ | |||
| 1 | #include "hadron.h" | ||
| 2 | #include "bootloader.h" | ||
| 3 | #include "action_layer.h" | ||
| 4 | #include "eeconfig.h" | ||
| 5 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 6 | #ifdef AUDIO_ENABLE | ||
| 7 | #include "audio.h" | ||
| 8 | #endif | ||
| 9 | #ifdef USE_I2C | ||
| 10 | #include "i2c.h" | ||
| 11 | #endif | ||
| 12 | #ifdef SSD1306OLED | ||
| 13 | #include "ssd1306.h" | ||
| 14 | #endif | ||
| 15 | extern keymap_config_t keymap_config; | ||
| 16 | |||
| 17 | //Following line allows macro to read current RGB settings | ||
| 18 | extern rgblight_config_t rgblight_config; | ||
| 19 | |||
| 20 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 21 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 22 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 23 | // entirely and just use numbers. | ||
| 24 | #define _QWERTY 0 | ||
| 25 | #define _LOWER 3 | ||
| 26 | #define _RAISE 4 | ||
| 27 | #define _FNLAYER 6 | ||
| 28 | #define _NUMLAY 7 | ||
| 29 | #define _MOUSECURSOR 8 | ||
| 30 | #define _ADJUST 16 | ||
| 31 | |||
| 32 | enum preonic_keycodes { | ||
| 33 | QWERTY = SAFE_RANGE, | ||
| 34 | COLEMAK, | ||
| 35 | DVORAK, | ||
| 36 | LOWER, | ||
| 37 | RAISE, | ||
| 38 | BACKLIT, | ||
| 39 | RGBLED_TOGGLE, | ||
| 40 | RGBLED_STEP_MODE, | ||
| 41 | RGBLED_INCREASE_HUE, | ||
| 42 | RGBLED_DECREASE_HUE, | ||
| 43 | RGBLED_INCREASE_SAT, | ||
| 44 | RGBLED_DECREASE_SAT, | ||
| 45 | RGBLED_INCREASE_VAL, | ||
| 46 | RGBLED_DECREASE_VAL, | ||
| 47 | }; | ||
| 48 | |||
| 49 | enum macro_keycodes { | ||
| 50 | KC_DEMOMACRO, | ||
| 51 | }; | ||
| 52 | |||
| 53 | // Fillers to make layering more clear | ||
| 54 | #define _______ KC_TRNS | ||
| 55 | #define XXXXXXX KC_NO | ||
| 56 | // Custom macros | ||
| 57 | #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl | ||
| 58 | #define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl | ||
| 59 | #define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl | ||
| 60 | #define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift | ||
| 61 | // Requires KC_TRNS/_______ for the trigger key in the destination layer | ||
| 62 | #define LT_FN(kc) LT(_FNLAYER, kc) // L-ayer T-ap Function Layer | ||
| 63 | #define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor | ||
| 64 | #define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise | ||
| 65 | #define TG_NUMLAY TG(_NUMLAY) //Toggle for layer _NUMLAY | ||
| 66 | #define DEMOMACRO M(KC_DEMOMACRO) // My login macros | ||
| 67 | |||
| 68 | |||
| 69 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 70 | |||
| 71 | /* Qwerty | ||
| 72 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 73 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 74 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 75 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | 7 | 8 | 9 | | ||
| 76 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 77 | * | CAPS | A | S | D | F | G | H | J | K | L | ; |Enter | 4 | 5 | 6 | | ||
| 78 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 79 | * | Shift| Z | X | C | V | B | N | M | , | . | / | = | 1 | 2 | 3 | | ||
| 80 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 81 | * | ~ | Ctrl | Alt | GUI |Lower |Space |Space |Raise | RAlt | Ins | Del |NumLay| 0 | . | ENT | | ||
| 82 | * `--------------------------------------------------------------------------------------------------------' | ||
| 83 | */ | ||
| 84 | [_QWERTY] = KEYMAP( | ||
| 85 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,\ | ||
| 86 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_P7, KC_P8, KC_P9, \ | ||
| 87 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT_MC(KC_SCLN), CTL_ENT, KC_P4, KC_P5, KC_P6, \ | ||
| 88 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_EQL, KC_P1, KC_P2, KC_P3, \ | ||
| 89 | KC_GRV, KC_RCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_RALT, KC_INS, KC_DEL, TG_NUMLAY, KC_P0, KC_PDOT, KC_PENT \ | ||
| 90 | ), | ||
| 91 | |||
| 92 | /* Lower | ||
| 93 | * ,-----------------------------------------------------------------------------------. | ||
| 94 | * | | | | | | | | | | | | | | ||
| 95 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 96 | * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | | | ||
| 97 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 98 | * | CAPS | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | | | | ||
| 99 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 100 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | [ | ] | | | | | | ||
| 101 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 102 | * | | | | | | | | | Next | Vol- | Vol+ | Play | | | | | ||
| 103 | * `--------------------------------------------------------------------------------------------------------' | ||
| 104 | */ | ||
| 105 | [_LOWER] = KEYMAP( | ||
| 106 | KC_ESC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ | ||
| 107 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, KC_BSLS, _______, _______, _______, \ | ||
| 108 | KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_PIPE, _______, _______, _______, \ | ||
| 109 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \ | ||
| 110 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______\ | ||
| 111 | ), | ||
| 112 | |||
| 113 | /* Raise | ||
| 114 | * ,-----------------------------------------------------------------------------------. | ||
| 115 | * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | ||
| 116 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 117 | * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | | | ||
| 118 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 119 | * | | A | Up | D | PrSc | | 4 | 5 | 6 | * | : | ' | | | | | ||
| 120 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 121 | * | | Lt | Dn | Rt | Mute | | 1 | 2 | 3 | Up | / | | | | | | ||
| 122 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 123 | * | | | | | |Space | 0 | | Left | Down | Right| | | | | | ||
| 124 | * `--------------------------------------------------------------------------------------------------------' | ||
| 125 | */ | ||
| 126 | [_RAISE] = KEYMAP( | ||
| 127 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | ||
| 128 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_PLUS, KC_BSLS, _______, _______, _______, \ | ||
| 129 | _______, KC_A, KC_UP, KC_D, KC_PSCR, _______, KC_4, KC_5, KC_6, KC_PAST, KC_COLN, KC_QUOT, _______, _______, _______, \ | ||
| 130 | _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC__MUTE, _______, KC_1, KC_2, KC_3, KC_UP, KC_SLSH, _______, _______, _______, _______, \ | ||
| 131 | _______, _______, _______, _______, _______, KC_SPC, KC_0, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______ \ | ||
| 132 | ), | ||
| 133 | |||
| 134 | /* FN layer on Esc key | ||
| 135 | * ,-----------------------------------------------------------------------------------. | ||
| 136 | * | | | | | | | | | | | | | | ||
| 137 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 138 | * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | + | | | | | ||
| 139 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 140 | * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | = | [ | ] | ' | | | | | ||
| 141 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 142 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | { | } | | | | | | ||
| 143 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 144 | * | | | | | | | | | Next | Vol- | Vol+ | Play | | | | | ||
| 145 | * `--------------------------------------------------------------------------------------------------------' | ||
| 146 | */ | ||
| 147 | [_FNLAYER] = KEYMAP( | ||
| 148 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\ | ||
| 149 | _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PLUS, _______, _______, _______, \ | ||
| 150 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_QUOT, _______, _______, _______, \ | ||
| 151 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \ | ||
| 152 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______ \ | ||
| 153 | ), | ||
| 154 | |||
| 155 | /* Num Layer | ||
| 156 | * ,-----------------------------------------------------------------------------------. | ||
| 157 | * | | | | | | | | | | | | | | ||
| 158 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 159 | * | | | | | | | | | | | | | F7 | F8 | F9 | | ||
| 160 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 161 | * | | | | | | | | | | | | | F4 | F5 | F6 | | ||
| 162 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 163 | * | | | | | | | | | | | | | | Up | | | ||
| 164 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 165 | * | | | | | | | | | | | | Exit | Left | Down | Rght | | ||
| 166 | * `--------------------------------------------------------------------------------------------------------' | ||
| 167 | */ | ||
| 168 | [_NUMLAY] = KEYMAP( | ||
| 169 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\ | ||
| 170 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, \ | ||
| 171 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, \ | ||
| 172 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PMNS, KC_UP, KC_PPLS, \ | ||
| 173 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT \ | ||
| 174 | ), | ||
| 175 | |||
| 176 | /* Mouse Layer (semi-col) | ||
| 177 | * ,-----------------------------------------------------------------------------------. | ||
| 178 | * | |ACCL0| ACCL1| ACCL2 | | | | | | | | | | ||
| 179 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 180 | * | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| | | | | | | ||
| 181 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 182 | * | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | | | | | | ||
| 183 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 184 | * | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | | | | | | ||
| 185 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 186 | * | | | | | | BTN1 | | | | BTN1 | | | | | | | ||
| 187 | * `--------------------------------------------------------------------------------------------------------' | ||
| 188 | */ | ||
| 189 | |||
| 190 | [_MOUSECURSOR] = KEYMAP( | ||
| 191 | _______, KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______,\ | ||
| 192 | _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R, DEMOMACRO, _______, _______, _______, _______, \ | ||
| 193 | _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, _______, _______, _______, \ | ||
| 194 | _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, _______, _______, _______, \ | ||
| 195 | _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, _______, _______, _______ \ | ||
| 196 | ), | ||
| 197 | |||
| 198 | /* Adjust (Lower + Raise) | ||
| 199 | |||
| 200 | * ,-----------------------------------------------------------------------------------. | ||
| 201 | * | Reset| | | | | | | | | VolD | VolU | Mute | | ||
| 202 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 203 | * | |RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | Del | | | | | ||
| 204 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 205 | * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | | | | | | ||
| 206 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 207 | * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | BL + |BL ST |BLSTEP| BL TG| | | | | ||
| 208 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 209 | * | | | | | | | | | | | | | | | | | ||
| 210 | * `--------------------------------------------------------------------------------------------------------' | ||
| 211 | */ | ||
| 212 | [_ADJUST] = KEYMAP( | ||
| 213 | RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLD, KC_VOLU, KC_MUTE, \ | ||
| 214 | _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, KC_DEL, _______, _______, _______, \ | ||
| 215 | _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 216 | _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, _______, _______, _______, \ | ||
| 217 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ | ||
| 218 | ) | ||
| 219 | |||
| 220 | |||
| 221 | |||
| 222 | }; | ||
| 223 | |||
| 224 | |||
| 225 | #ifdef AUDIO_ENABLE | ||
| 226 | |||
| 227 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
| 228 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 229 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
| 230 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
| 231 | #endif | ||
| 232 | |||
| 233 | // define variables for reactive RGB | ||
| 234 | bool RGB_INIT = false; | ||
| 235 | bool TOG_STATUS = false; | ||
| 236 | bool NUMLAY_STATUS = false; | ||
| 237 | int RGB_current_mode; | ||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 242 | eeconfig_update_default_layer(default_layer); | ||
| 243 | default_layer_set(default_layer); | ||
| 244 | } | ||
| 245 | |||
| 246 | void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | ||
| 247 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | ||
| 248 | rgblight_mode(RGB_current_mode); | ||
| 249 | layer_on(layer3); | ||
| 250 | } else { | ||
| 251 | layer_off(layer3); | ||
| 252 | } | ||
| 253 | } | ||
| 254 | |||
| 255 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 256 | switch (keycode) { | ||
| 257 | case QWERTY: | ||
| 258 | if (record->event.pressed) { | ||
| 259 | #ifdef AUDIO_ENABLE | ||
| 260 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
| 261 | #endif | ||
| 262 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 263 | } | ||
| 264 | return false; | ||
| 265 | break; | ||
| 266 | case LOWER: | ||
| 267 | if (record->event.pressed) { | ||
| 268 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 269 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 270 | if (RGB_INIT) {} else { | ||
| 271 | RGB_current_mode = rgblight_config.mode; | ||
| 272 | RGB_INIT = true; | ||
| 273 | } | ||
| 274 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
| 275 | } else { | ||
| 276 | TOG_STATUS = !TOG_STATUS; | ||
| 277 | rgblight_mode(16); | ||
| 278 | } | ||
| 279 | layer_on(_LOWER); | ||
| 280 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 281 | } else { | ||
| 282 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
| 283 | TOG_STATUS = false; | ||
| 284 | layer_off(_LOWER); | ||
| 285 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 286 | } | ||
| 287 | return false; | ||
| 288 | break; | ||
| 289 | case RAISE: | ||
| 290 | if (record->event.pressed) { | ||
| 291 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 292 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 293 | if (RGB_INIT) {} else { | ||
| 294 | RGB_current_mode = rgblight_config.mode; | ||
| 295 | RGB_INIT = true; | ||
| 296 | } | ||
| 297 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
| 298 | } else { | ||
| 299 | TOG_STATUS = !TOG_STATUS; | ||
| 300 | rgblight_mode(15); | ||
| 301 | } | ||
| 302 | layer_on(_RAISE); | ||
| 303 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 304 | } else { | ||
| 305 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
| 306 | layer_off(_RAISE); | ||
| 307 | TOG_STATUS = false; | ||
| 308 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 309 | } | ||
| 310 | return false; | ||
| 311 | break; | ||
| 312 | case BACKLIT: | ||
| 313 | if (record->event.pressed) { | ||
| 314 | register_code(KC_RSFT); | ||
| 315 | #ifdef BACKLIGHT_ENABLE | ||
| 316 | backlight_step(); | ||
| 317 | #endif | ||
| 318 | } else { | ||
| 319 | unregister_code(KC_RSFT); | ||
| 320 | } | ||
| 321 | return false; | ||
| 322 | break; | ||
| 323 | //my attempt for RGB layer lock indication via changing the mode, still have to figure out how to not have other keypress not override this mode | ||
| 324 | case TG_NUMLAY: | ||
| 325 | if (record->event.pressed) { | ||
| 326 | if (RGB_INIT) {} else { | ||
| 327 | RGB_current_mode = rgblight_config.mode; | ||
| 328 | RGB_INIT = true; | ||
| 329 | } | ||
| 330 | NUMLAY_STATUS = !NUMLAY_STATUS; | ||
| 331 | if (NUMLAY_STATUS) { | ||
| 332 | rgblight_mode(4); | ||
| 333 | layer_on(_NUMLAY); | ||
| 334 | } else { | ||
| 335 | rgblight_mode(RGB_current_mode); | ||
| 336 | layer_off(_NUMLAY); } | ||
| 337 | } | ||
| 338 | return false; | ||
| 339 | break; | ||
| 340 | case RGB_MOD: | ||
| 341 | //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released | ||
| 342 | if (record->event.pressed) { | ||
| 343 | rgblight_mode(RGB_current_mode); | ||
| 344 | rgblight_step(); | ||
| 345 | RGB_current_mode = rgblight_config.mode; | ||
| 346 | } | ||
| 347 | return false; | ||
| 348 | break; | ||
| 349 | } | ||
| 350 | return true; | ||
| 351 | } | ||
| 352 | |||
| 353 | void matrix_init_user(void) { | ||
| 354 | #ifdef USE_I2C | ||
| 355 | i2c_master_init(); | ||
| 356 | #ifdef SSD1306OLED | ||
| 357 | // calls code for the SSD1306 OLED | ||
| 358 | _delay_ms(400); | ||
| 359 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | ||
| 360 | iota_gfx_init(); // turns on the display | ||
| 361 | #endif | ||
| 362 | #endif | ||
| 363 | #ifdef AUDIO_ENABLE | ||
| 364 | startup_user(); | ||
| 365 | #endif | ||
| 366 | } | ||
| 367 | |||
| 368 | void matrix_scan_user(void) { | ||
| 369 | #ifdef SSD1306OLED | ||
| 370 | iota_gfx_task(); // this is what updates the display continuously | ||
| 371 | #endif | ||
| 372 | } | ||
| 373 | |||
| 374 | #ifdef AUDIO_ENABLE | ||
| 375 | |||
| 376 | void startup_user() | ||
| 377 | { | ||
| 378 | _delay_ms(20); // gets rid of tick | ||
| 379 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
| 380 | } | ||
| 381 | |||
| 382 | void shutdown_user() | ||
| 383 | {cc | ||
| 384 | PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||
| 385 | _delay_ms(150); | ||
| 386 | stop_all_notes(); | ||
| 387 | } | ||
| 388 | |||
| 389 | void music_on_user(void) | ||
| 390 | { | ||
| 391 | music_scale_user(); | ||
| 392 | } | ||
| 393 | |||
| 394 | void music_scale_user(void) | ||
| 395 | { | ||
| 396 | PLAY_NOTE_ARRAY(music_scale, false, 0); | ||
| 397 | } | ||
| 398 | |||
| 399 | #endif | ||
| 400 | |||
| 401 | /* | ||
| 402 | * Macro definition | ||
| 403 | */ | ||
| 404 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 405 | { | ||
| 406 | if (!eeconfig_is_enabled()) { | ||
| 407 | eeconfig_init(); | ||
| 408 | } | ||
| 409 | |||
| 410 | switch (id) { | ||
| 411 | case KC_DEMOMACRO: | ||
| 412 | if (record->event.pressed){ | ||
| 413 | return MACRO (I(1), T(H),T(E),T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END); | ||
| 414 | } | ||
| 415 | } | ||
| 416 | |||
| 417 | return MACRO_NONE; | ||
| 418 | } | ||
diff --git a/keyboards/hadron/keymaps/side_numpad/readme.md b/keyboards/hadron/keymaps/side_numpad/readme.md new file mode 100644 index 000000000..de9680b49 --- /dev/null +++ b/keyboards/hadron/keymaps/side_numpad/readme.md | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | # The Default Planck Layout | ||
| 2 | |||
diff --git a/keyboards/hadron/out.txt b/keyboards/hadron/out.txt new file mode 100644 index 000000000..644a6a777 --- /dev/null +++ b/keyboards/hadron/out.txt | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | -------- begin -------- | ||
| 2 | avr-gcc.exe (AVR_8_bit_GNU_Toolchain_3.5.0_1662) 4.9.2 | ||
| 3 | Copyright (C) 2014 Free Software Foundation, Inc. | ||
| 4 | This is free software; see the source for copying conditions. There is NO | ||
| 5 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 6 | |||
| 7 | Compiling: ../../keyboards/planck/planck.c [32;01m[OK][0m | ||
| 8 | Compiling: ../../keyboards/planck/keymaps/experimental/keymap.c [33;01m[WARNINGS][0m | ||
| 9 | | | ||
| 10 | | ../../keyboards/planck/keymaps/experimental/keymap.c: In function 'action_get_macro': | ||
| 11 | | ../../keyboards/planck/keymaps/experimental/keymap.c:227:17: warning: implicit declaration of function 'breathing_speed_set' [-Wimplicit-function-declaration] | ||
| 12 | | breathing_speed_set(2); | ||
| 13 | | ^ | ||
| 14 | | ../../keyboards/planck/keymaps/experimental/keymap.c:228:17: warning: implicit declaration of function 'breathing_pulse' [-Wimplicit-function-declaration] | ||
| 15 | | breathing_pulse(); | ||
| 16 | | ^ | ||
| 17 | | | ||
| 18 | Compiling: ../../quantum/quantum.c [32;01m[OK][0m | ||
| 19 | Compiling: ../../quantum/keymap.c [32;01m[OK][0m | ||
| 20 | Compiling: ../../quantum/keycode_config.c [32;01m[OK][0m | ||
| 21 | Compiling: ../../quantum/matrix.c [32;01m[OK][0m | ||
| 22 | Compiling: ../../quantum/audio/audio.c [32;01m[OK][0m | ||
| 23 | Compiling: ../../quantum/audio/voices.c [32;01m[OK][0m | ||
| 24 | Compiling: ../../quantum/audio/luts.c [32;01m[OK][0m | ||
| 25 | Compiling: ../../tmk_core/protocol/lufa/lufa.c [32;01m[OK][0m | ||
| 26 | Compiling: ../../tmk_core/protocol/lufa/descriptor.c [32;01m[OK][0m | ||
| 27 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Class/Common/HIDParser.c [32;01m[OK][0m | ||
| 28 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c [32;01m[OK][0m | ||
| 29 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c [32;01m[OK][0m | ||
| 30 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c [32;01m[OK][0m | ||
| 31 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c [32;01m[OK][0m | ||
| 32 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c [32;01m[OK][0m | ||
| 33 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c [32;01m[OK][0m | ||
| 34 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c [32;01m[OK][0m | ||
| 35 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c [32;01m[OK][0m | ||
| 36 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/ConfigDescriptors.c [32;01m[OK][0m | ||
| 37 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/DeviceStandardReq.c [32;01m[OK][0m | ||
| 38 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/Events.c [32;01m[OK][0m | ||
| 39 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/HostStandardReq.c [32;01m[OK][0m | ||
| 40 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/USBTask.c [32;01m[OK][0m | ||
| 41 | Compiling: ../../tmk_core/common/host.c [32;01m[OK][0m | ||
| 42 | Compiling: ../../tmk_core/common/keyboard.c [32;01m[OK][0m | ||
| 43 | Compiling: ../../tmk_core/common/action.c [32;01m[OK][0m | ||
| 44 | Compiling: ../../tmk_core/common/action_tapping.c [32;01m[OK][0m | ||
| 45 | Compiling: ../../tmk_core/common/action_macro.c [32;01m[OK][0m | ||
| 46 | Compiling: ../../tmk_core/common/action_layer.c [32;01m[OK][0m | ||
| 47 | Compiling: ../../tmk_core/common/action_util.c [32;01m[OK][0m | ||
| 48 | Compiling: ../../tmk_core/common/print.c [32;01m[OK][0m | ||
| 49 | Compiling: ../../tmk_core/common/debug.c [32;01m[OK][0m | ||
| 50 | Compiling: ../../tmk_core/common/util.c [32;01m[OK][0m | ||
| 51 | Compiling: ../../tmk_core/common/avr/suspend.c [32;01m[OK][0m | ||
| 52 | Assembling: ../../tmk_core/common/avr/xprintf.S [32;01m[OK][0m | ||
| 53 | Compiling: ../../tmk_core/common/avr/timer.c [32;01m[OK][0m | ||
| 54 | Compiling: ../../tmk_core/common/avr/bootloader.c [32;01m[OK][0m | ||
| 55 | Compiling: ../../tmk_core/common/magic.c [32;01m[OK][0m | ||
| 56 | Compiling: ../../tmk_core/common/avr/eeconfig.c [32;01m[OK][0m | ||
| 57 | Compiling: ../../tmk_core/common/mousekey.c [32;01m[OK][0m | ||
| 58 | Compiling: ../../tmk_core/common/command.c [32;01m[OK][0m | ||
| 59 | Compiling: ../../tmk_core/common/backlight.c [32;01m[OK][0m | ||
| 60 | Linking: .build/planck_experimental.elf [31;01m[ERRORS][0m | ||
| 61 | | | ||
| 62 | | .build/obj_planck_experimental/keyboards/planck/keymaps/experimental/keymap.o: In function `action_get_macro': | ||
| 63 | | C:\Users\Fred Wales\Documents\Programming\qmk_firmware\keyboards\planck/../../keyboards/planck/keymaps/experimental/keymap.c:240: undefined reference to `breathing_speed_set' | ||
| 64 | | C:\Users\Fred Wales\Documents\Programming\qmk_firmware\keyboards\planck/../../keyboards/planck/keymaps/experimental/keymap.c:241: undefined reference to `breathing_pulse' | ||
| 65 | | collect2.exe: error: ld returned 1 exit status | ||
| 66 | | | ||
diff --git a/keyboards/hadron/readme.md b/keyboards/hadron/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/keyboards/hadron/readme.md | |||
| @@ -0,0 +1 @@ | |||
diff --git a/keyboards/hadron/rules.mk b/keyboards/hadron/rules.mk new file mode 100644 index 000000000..78f86f982 --- /dev/null +++ b/keyboards/hadron/rules.mk | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | # MCU name | ||
| 2 | #MCU = at90usb1287 | ||
| 3 | MCU = atmega32u4 | ||
| 4 | |||
| 5 | # Processor frequency. | ||
| 6 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 7 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 8 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 9 | # automatically to create a 32-bit value in your source code. | ||
| 10 | # | ||
| 11 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 12 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 13 | # does not *change* the processor frequency - it should merely be updated to | ||
| 14 | # reflect the processor speed set externally so that the code can use accurate | ||
| 15 | # software delays. | ||
| 16 | F_CPU = 16000000 | ||
| 17 | |||
| 18 | # | ||
| 19 | # LUFA specific | ||
| 20 | # | ||
| 21 | # Target architecture (see library "Board Types" documentation). | ||
| 22 | ARCH = AVR8 | ||
| 23 | |||
| 24 | # Input clock frequency. | ||
| 25 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 26 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 27 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 28 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 29 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 30 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 31 | # source code. | ||
| 32 | # | ||
| 33 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 34 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 35 | F_USB = $(F_CPU) | ||
| 36 | |||
| 37 | # Interrupt driven control endpoint task(+60) | ||
| 38 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 39 | |||
| 40 | |||
| 41 | # Boot Section Size in *bytes* | ||
| 42 | # Teensy halfKay 512 | ||
| 43 | # Teensy++ halfKay 1024 | ||
| 44 | # Atmel DFU loader 4096 | ||
| 45 | # LUFA bootloader 4096 | ||
| 46 | # USBaspLoader 2048 | ||
| 47 | OPT_DEFS += -DBOOTLOADER_SIZE=512 | ||
| 48 | |||
| 49 | # Build Options | ||
| 50 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 51 | # the appropriate keymap folder that will get included automatically | ||
| 52 | # | ||
| 53 | BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) | ||
| 54 | MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) | ||
| 55 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
| 56 | CONSOLE_ENABLE ?= no # Console for debug(+400) | ||
| 57 | COMMAND_ENABLE ?= no # Commands for debug and configuration | ||
| 58 | NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 59 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality | ||
| 60 | MIDI_ENABLE ?= no # MIDI controls | ||
| 61 | AUDIO_ENABLE ?= no # Audio output on port C6 | ||
| 62 | UNICODE_ENABLE ?= no # Unicode | ||
| 63 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 64 | RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. | ||
| 65 | API_SYSEX_ENABLE = yes | ||
| 66 | |||
| 67 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 68 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | ||
| 69 | |||
| 70 | SRC = i2c.c \ | ||
| 71 | ssd1306.c | ||
| 72 | |||
diff --git a/keyboards/hadron/ver0/Makefile b/keyboards/hadron/ver0/Makefile new file mode 100644 index 000000000..191c6bb66 --- /dev/null +++ b/keyboards/hadron/ver0/Makefile | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | ifndef MAKEFILE_INCLUDED | ||
| 2 | include ../../../Makefile | ||
| 3 | endif \ No newline at end of file | ||
diff --git a/keyboards/hadron/ver0/config.h b/keyboards/hadron/ver0/config.h new file mode 100644 index 000000000..039d4f1c7 --- /dev/null +++ b/keyboards/hadron/ver0/config.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #ifndef VER0_CONFIG_H | ||
| 18 | #define VER0_CONFIG_H | ||
| 19 | |||
| 20 | #include "../config.h" | ||
| 21 | |||
| 22 | /* USB Device descriptor parameter */ | ||
| 23 | #define DEVICE_VER 0x0001 | ||
| 24 | |||
| 25 | /* key matrix size */ | ||
| 26 | #define MATRIX_ROWS 5 | ||
| 27 | #define MATRIX_COLS 15 | ||
| 28 | |||
| 29 | /* Hadron Ver0 PCB default pin-out */ | ||
| 30 | #define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 } | ||
| 31 | #define MATRIX_COL_PINS { F6, F7, C6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 } | ||
| 32 | #define UNUSED_PINS | ||
| 33 | |||
| 34 | |||
| 35 | #endif | ||
diff --git a/keyboards/hadron/ver0/rules.mk b/keyboards/hadron/ver0/rules.mk new file mode 100644 index 000000000..0f9667a8a --- /dev/null +++ b/keyboards/hadron/ver0/rules.mk | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #AUDIO_ENABLE ?= yes # Audio output on port C6 | ||
| 2 | |||
| 3 | ifndef QUANTUM_DIR | ||
| 4 | include ../../../Makefile | ||
| 5 | endif \ No newline at end of file | ||
diff --git a/keyboards/hadron/ver0/ver0.c b/keyboards/hadron/ver0/ver0.c new file mode 100644 index 000000000..acb3a9105 --- /dev/null +++ b/keyboards/hadron/ver0/ver0.c | |||
| @@ -0,0 +1 @@ | |||
| #include "ver0.h" \ No newline at end of file | |||
diff --git a/keyboards/hadron/ver0/ver0.h b/keyboards/hadron/ver0/ver0.h new file mode 100644 index 000000000..5710af322 --- /dev/null +++ b/keyboards/hadron/ver0/ver0.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #ifndef VER0_H | ||
| 2 | #define VER0_H | ||
| 3 | |||
| 4 | #include "../hadron.h" | ||
| 5 | |||
| 6 | #endif \ No newline at end of file | ||
diff --git a/keyboards/hadron/ver2/Makefile b/keyboards/hadron/ver2/Makefile new file mode 100644 index 000000000..191c6bb66 --- /dev/null +++ b/keyboards/hadron/ver2/Makefile | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | ifndef MAKEFILE_INCLUDED | ||
| 2 | include ../../../Makefile | ||
| 3 | endif \ No newline at end of file | ||
diff --git a/keyboards/hadron/ver2/config.h b/keyboards/hadron/ver2/config.h new file mode 100644 index 000000000..71a0ab5b3 --- /dev/null +++ b/keyboards/hadron/ver2/config.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #ifndef VER2_CONFIG_H | ||
| 18 | #define VER2_CONFIG_H | ||
| 19 | |||
| 20 | #include "../config.h" | ||
| 21 | |||
| 22 | /* USB Device descriptor parameter */ | ||
| 23 | #define DEVICE_VER 0x0002 | ||
| 24 | |||
| 25 | /* key matrix size */ | ||
| 26 | #define MATRIX_ROWS 5 | ||
| 27 | #define MATRIX_COLS 15 | ||
| 28 | |||
| 29 | /* Hadron Ver0 PCB default pin-out */ | ||
| 30 | #define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 } | ||
| 31 | #define MATRIX_COL_PINS { F6, F7, D6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 } | ||
| 32 | #define UNUSED_PINS | ||
| 33 | |||
| 34 | |||
| 35 | #endif | ||
diff --git a/keyboards/hadron/ver2/rules.mk b/keyboards/hadron/ver2/rules.mk new file mode 100644 index 000000000..0f9667a8a --- /dev/null +++ b/keyboards/hadron/ver2/rules.mk | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #AUDIO_ENABLE ?= yes # Audio output on port C6 | ||
| 2 | |||
| 3 | ifndef QUANTUM_DIR | ||
| 4 | include ../../../Makefile | ||
| 5 | endif \ No newline at end of file | ||
diff --git a/keyboards/hadron/ver2/ver2.c b/keyboards/hadron/ver2/ver2.c new file mode 100644 index 000000000..bc0917746 --- /dev/null +++ b/keyboards/hadron/ver2/ver2.c | |||
| @@ -0,0 +1 @@ | |||
| #include "ver2.h" \ No newline at end of file | |||
diff --git a/keyboards/hadron/ver2/ver2.h b/keyboards/hadron/ver2/ver2.h new file mode 100644 index 000000000..54e141ffa --- /dev/null +++ b/keyboards/hadron/ver2/ver2.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #ifndef VER2_H | ||
| 2 | #define VER2_H | ||
| 3 | |||
| 4 | #include "../hadron.h" | ||
| 5 | |||
| 6 | #endif \ No newline at end of file | ||
