Merge branch 'master' into minidox
commit
6c9b69a4b6
@ -0,0 +1,5 @@
|
|||||||
|
SUBPROJECT_DEFAULT = ver2
|
||||||
|
|
||||||
|
ifndef MAKEFILE_INCLUDED
|
||||||
|
include ../../Makefile
|
||||||
|
endif
|
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define VENDOR_ID 0xFEED
|
||||||
|
#define PRODUCT_ID 0x6060
|
||||||
|
#define MANUFACTURER ishtob
|
||||||
|
#define PRODUCT Hadron Keyboard
|
||||||
|
#define DESCRIPTION A cherry ML ortholinear keyboard
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//#define AUDIO_VOICES
|
||||||
|
|
||||||
|
//#define BACKLIGHT_PIN B7
|
||||||
|
|
||||||
|
/* COL2ROW or ROW2COL */
|
||||||
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
|
||||||
|
/* define if matrix has ghost */
|
||||||
|
//#define MATRIX_HAS_GHOST
|
||||||
|
|
||||||
|
/* number of backlight levels */
|
||||||
|
//#define BACKLIGHT_LEVELS 3
|
||||||
|
|
||||||
|
/* Set 0 if debouncing isn't needed */
|
||||||
|
#define DEBOUNCING_DELAY 5
|
||||||
|
|
||||||
|
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||||
|
#define LOCKING_SUPPORT_ENABLE
|
||||||
|
/* Locking resynchronize hack */
|
||||||
|
#define LOCKING_RESYNC_ENABLE
|
||||||
|
|
||||||
|
/* key combination for command */
|
||||||
|
#define IS_COMMAND() ( \
|
||||||
|
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Feature disable options
|
||||||
|
* These options are also useful to firmware size reduction.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* disable debug print */
|
||||||
|
//#define NO_DEBUG
|
||||||
|
|
||||||
|
/* disable print */
|
||||||
|
//#define NO_PRINT
|
||||||
|
|
||||||
|
/* disable action features */
|
||||||
|
//#define NO_ACTION_LAYER
|
||||||
|
//#define NO_ACTION_TAPPING
|
||||||
|
//#define NO_ACTION_ONESHOT
|
||||||
|
//#define NO_ACTION_MACRO
|
||||||
|
//#define NO_ACTION_FUNCTION
|
||||||
|
#ifdef SUBPROJECT_ver0
|
||||||
|
#include "ver0/config.h"
|
||||||
|
#endif
|
||||||
|
#ifdef SUBPROJECT_ver2
|
||||||
|
#include "ver2/config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,26 @@
|
|||||||
|
#include "hadron.h"
|
||||||
|
|
||||||
|
|
||||||
|
void matrix_init_kb(void) {
|
||||||
|
|
||||||
|
matrix_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_scan_kb(void) {
|
||||||
|
// put your looping keyboard code here
|
||||||
|
// runs every cycle (a lot)
|
||||||
|
matrix_scan_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
// put your per-action keyboard code here
|
||||||
|
// runs for every action, just before processing by the firmware
|
||||||
|
|
||||||
|
return process_record_user(keycode, record);
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_set_kb(uint8_t usb_led) {
|
||||||
|
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
||||||
|
|
||||||
|
led_set_user(usb_led);
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
#ifndef HADRON_H
|
||||||
|
#define HADRON_H
|
||||||
|
|
||||||
|
#ifdef SUBPROJECT_ver0
|
||||||
|
#include "ver0.h"
|
||||||
|
#endif
|
||||||
|
#ifdef SUBPROJECT_ver2
|
||||||
|
#include "ver2.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define KEYMAP( \
|
||||||
|
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
|
||||||
|
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
|
||||||
|
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \
|
||||||
|
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
|
||||||
|
K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, KC_NO, KC_NO, KC_NO }, \
|
||||||
|
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
|
||||||
|
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
|
||||||
|
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
|
||||||
|
{ K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E } \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,166 @@
|
|||||||
|
#include <util/twi.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <util/twi.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "i2c.h"
|
||||||
|
|
||||||
|
#ifdef USE_I2C
|
||||||
|
|
||||||
|
// Limits the amount of we wait for any one i2c transaction.
|
||||||
|
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
|
||||||
|
// 9 bits, a single transaction will take around 90μs to complete.
|
||||||
|
//
|
||||||
|
// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
|
||||||
|
// poll loop takes at least 8 clock cycles to execute
|
||||||
|
#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
|
||||||
|
|
||||||
|
#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
|
||||||
|
|
||||||
|
volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||||
|
|
||||||
|
static volatile uint8_t slave_buffer_pos;
|
||||||
|
static volatile bool slave_has_register_set = false;
|
||||||
|
|
||||||
|
// Wait for an i2c operation to finish
|
||||||
|
inline static
|
||||||
|
void i2c_delay(void) {
|
||||||
|
uint16_t lim = 0;
|
||||||
|
while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
|
||||||
|
lim++;
|
||||||
|
|
||||||
|
// easier way, but will wait slightly longer
|
||||||
|
// _delay_us(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup twi to run at 100kHz
|
||||||
|
void i2c_master_init(void) {
|
||||||
|
// no prescaler
|
||||||
|
TWSR = 0;
|
||||||
|
// Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
|
||||||
|
// Check datasheets for more info.
|
||||||
|
TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start a transaction with the given i2c slave address. The direction of the
|
||||||
|
// transfer is set with I2C_READ and I2C_WRITE.
|
||||||
|
// returns: 0 => success
|
||||||
|
// 1 => error
|
||||||
|
uint8_t i2c_master_start(uint8_t address) {
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
|
||||||
|
|
||||||
|
i2c_delay();
|
||||||
|
|
||||||
|
// check that we started successfully
|
||||||
|
if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
// send device address
|
||||||
|
TWDR = address;
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||||
|
|
||||||
|
i2c_delay();
|
||||||
|
|
||||||
|
if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
|
||||||
|
return 1; // slave did not acknowledge
|
||||||
|
else
|
||||||
|
return 0; // success
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Finish the i2c transaction.
|
||||||
|
void i2c_master_stop(void) {
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||||
|
|
||||||
|
uint16_t lim = 0;
|
||||||
|
while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
|
||||||
|
lim++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write one byte to the i2c slave.
|
||||||
|
// returns 0 => slave ACK
|
||||||
|
// 1 => slave NACK
|
||||||
|
uint8_t i2c_master_write(uint8_t data) {
|
||||||
|
TWDR = data;
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||||
|
|
||||||
|
i2c_delay();
|
||||||
|
|
||||||
|
// check if the slave acknowledged us
|
||||||
|
return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
|
||||||
|
// if ack=0 the acknowledge bit is not set.
|
||||||
|
// returns: byte read from i2c device
|
||||||
|
uint8_t i2c_master_read(int ack) {
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
|
||||||
|
|
||||||
|
i2c_delay();
|
||||||
|
return TWDR;
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_reset_state(void) {
|
||||||
|
TWCR = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_slave_init(uint8_t address) {
|
||||||
|
TWAR = address << 0; // slave i2c address
|
||||||
|
// TWEN - twi enable
|
||||||
|
// TWEA - enable address acknowledgement
|
||||||
|
// TWINT - twi interrupt flag
|
||||||
|
// TWIE - enable the twi interrupt
|
||||||
|
TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR(TWI_vect);
|
||||||
|
|
||||||
|
ISR(TWI_vect) {
|
||||||
|
uint8_t ack = 1;
|
||||||
|
switch(TW_STATUS) {
|
||||||
|
case TW_SR_SLA_ACK:
|
||||||
|
// this device has been addressed as a slave receiver
|
||||||
|
slave_has_register_set = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TW_SR_DATA_ACK:
|
||||||
|
// this device has received data as a slave receiver
|
||||||
|
// The first byte that we receive in this transaction sets the location
|
||||||
|
// of the read/write location of the slaves memory that it exposes over
|
||||||
|
// i2c. After that, bytes will be written at slave_buffer_pos, incrementing
|
||||||
|
// slave_buffer_pos after each write.
|
||||||
|
if(!slave_has_register_set) {
|
||||||
|
slave_buffer_pos = TWDR;
|
||||||
|
// don't acknowledge the master if this memory loctaion is out of bounds
|
||||||
|
if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
|
||||||
|
ack = 0;
|
||||||
|
slave_buffer_pos = 0;
|
||||||
|
}
|
||||||
|
slave_has_register_set = true;
|
||||||
|
} else {
|
||||||
|
i2c_slave_buffer[slave_buffer_pos] = TWDR;
|
||||||
|
BUFFER_POS_INC();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TW_ST_SLA_ACK:
|
||||||
|
case TW_ST_DATA_ACK:
|
||||||
|
// master has addressed this device as a slave transmitter and is
|
||||||
|
// requesting data.
|
||||||
|
TWDR = i2c_slave_buffer[slave_buffer_pos];
|
||||||
|
BUFFER_POS_INC();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TW_BUS_ERROR: // something went wrong, reset twi state
|
||||||
|
TWCR = 0;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Reset everything, so we are ready for the next TWI interrupt
|
||||||
|
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef I2C_H
|
||||||
|
#define I2C_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifndef F_CPU
|
||||||
|
#define F_CPU 16000000UL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define I2C_READ 1
|
||||||
|
#define I2C_WRITE 0
|
||||||
|
|
||||||
|
#define I2C_ACK 1
|
||||||
|
#define I2C_NACK 0
|
||||||
|
|
||||||
|
#define SLAVE_BUFFER_SIZE 0x10
|
||||||
|
|
||||||
|
// i2c SCL clock frequency
|
||||||
|
#define SCL_CLOCK 800000L
|
||||||
|
|
||||||
|
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||||
|
|
||||||
|
void i2c_master_init(void);
|
||||||
|
uint8_t i2c_master_start(uint8_t address);
|
||||||
|
void i2c_master_stop(void);
|
||||||
|
uint8_t i2c_master_write(uint8_t data);
|
||||||
|
uint8_t i2c_master_read(int);
|
||||||
|
void i2c_reset_state(void);
|
||||||
|
void i2c_slave_init(uint8_t address);
|
||||||
|
|
||||||
|
|
||||||
|
static inline unsigned char i2c_start_read(unsigned char addr) {
|
||||||
|
return i2c_master_start((addr << 1) | I2C_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned char i2c_start_write(unsigned char addr) {
|
||||||
|
return i2c_master_start((addr << 1) | I2C_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// from SSD1306 scrips
|
||||||
|
extern unsigned char i2c_rep_start(unsigned char addr);
|
||||||
|
extern void i2c_start_wait(unsigned char addr);
|
||||||
|
extern unsigned char i2c_readAck(void);
|
||||||
|
extern unsigned char i2c_readNak(void);
|
||||||
|
extern unsigned char i2c_read(unsigned char ack);
|
||||||
|
|
||||||
|
#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# change to "no" to disable the options, or define them in the Makefile in
|
||||||
|
# the appropriate keymap folder that will get included automatically
|
||||||
|
#
|
||||||
|
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||||
|
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||||
|
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||||
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
|
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
|
MIDI_ENABLE = no # MIDI controls
|
||||||
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
|
UNICODE_ENABLE = no # Unicode
|
||||||
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
|
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
||||||
|
ONEHAND_ENABLE = no # Enable one-hand typing
|
||||||
|
|
||||||
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
|
ifndef QUANTUM_DIR
|
||||||
|
include ../../../../Makefile
|
||||||
|
endif
|
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include "../../config.h"
|
||||||
|
|
||||||
|
#define LEADER_TIMEOUT 300
|
||||||
|
//#define BACKLIGHT_BREATHING
|
||||||
|
#define PREVENT_STUCK_MODIFIERS
|
||||||
|
|
||||||
|
#define USE_I2C
|
||||||
|
#define SSD1306OLED
|
||||||
|
#define OLED_ROTATE180
|
||||||
|
|
||||||
|
/* ws2812 RGB LED*/
|
||||||
|
#define RGB_DI_PIN D4
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLED_NUM 14 // Number of LEDs
|
||||||
|
#define RGBLIGHT_HUE_STEP 10
|
||||||
|
#define RGBLIGHT_SAT_STEP 17
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,496 @@
|
|||||||
|
#include "hadron.h"
|
||||||
|
#include "bootloader.h"
|
||||||
|
#include "action_layer.h"
|
||||||
|
#include "eeconfig.h"
|
||||||
|
#include "LUFA/Drivers/Peripheral/TWI.h"
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
#include "audio.h"
|
||||||
|
#endif
|
||||||
|
#ifdef USE_I2C
|
||||||
|
#include "i2c.h"
|
||||||
|
#endif
|
||||||
|
#ifdef SSD1306OLED
|
||||||
|
#include "ssd1306.h"
|
||||||
|
#endif
|
||||||
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
|
//Following line allows macro to read current RGB settings
|
||||||
|
extern rgblight_config_t rgblight_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 _MOUSECURSOR 8
|
||||||
|
#define _ADJUST 16
|
||||||
|
|
||||||
|
enum preonic_keycodes {
|
||||||
|
QWERTY = SAFE_RANGE,
|
||||||
|
COLEMAK,
|
||||||
|
DVORAK,
|
||||||
|
LOWER,
|
||||||
|
RAISE,
|
||||||
|
BACKLIT,
|
||||||
|
RGBLED_TOGGLE,
|
||||||
|
RGBLED_STEP_MODE,
|
||||||
|
RGBLED_INCREASE_HUE,
|
||||||
|
RGBLED_DECREASE_HUE,
|
||||||
|
RGBLED_INCREASE_SAT,
|
||||||
|
RGBLED_DECREASE_SAT,
|
||||||
|
RGBLED_INCREASE_VAL,
|
||||||
|
RGBLED_DECREASE_VAL,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum macro_keycodes {
|
||||||
|
KC_DEMOMACRO,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Fillers to make layering more clear
|
||||||
|
#define _______ KC_TRNS
|
||||||
|
#define XXXXXXX KC_NO
|
||||||
|
// Custom macros
|
||||||
|
#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl
|
||||||
|
#define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl
|
||||||
|
#define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl
|
||||||
|
#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift
|
||||||
|
// Requires KC_TRNS/_______ for the trigger key in the destination layer
|
||||||
|
#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor
|
||||||
|
#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise
|
||||||
|
#define DEMOMACRO M(KC_DEMOMACRO) // Sample for macros
|
||||||
|
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
/* Qwerty
|
||||||
|
* ,------+------+------+------+------+------------------------------------------------.
|
||||||
|
* | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | DEL |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | Tab | Q | W | E | R | T | 7 | 8 | 9 | Y | U | I | O | P | Bksp |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | CAPS | A | S | D | F | G | 4 | 5 | 6 | H | J | K | L | ;/Nav| ' |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | Shift| Z | X | C | V | B | 1 | 2 | 3 | N | M | , | . | / |Ctl/Et|
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_QWERTY] = KEYMAP(
|
||||||
|
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\
|
||||||
|
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, \
|
||||||
|
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, \
|
||||||
|
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, \
|
||||||
|
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 \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Colemak
|
||||||
|
* ,------+------+------+------+------+------------------------------------------------.
|
||||||
|
* | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | 0 | - |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | Tab | Q | W | F | P | G | 7 | 8 | 9 | J | L | U | Y | ; | Bksp |
|
||||||
|
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||||
|
* | CAPS | A | R | S | T | D | 4 | 5 | 6 | H | N | E | I | O | ' |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | Shift| Z | X | C | V | B | 1 | 2 | 3 | K | M | , | . | / |Ctl/Et|
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_COLEMAK] = KEYMAP(
|
||||||
|
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\
|
||||||
|
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, \
|
||||||
|
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, \
|
||||||
|
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, \
|
||||||
|
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 \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Dvorak
|
||||||
|
* ,------+------+------+------+------+------------------------------------------------.
|
||||||
|
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | Tab | " | , | . | P | Y | 7 | 8 | 9 | F | G | C | R | L | Bksp |
|
||||||
|
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||||
|
* | Esc | A | O | E | U | I | 4 | 5 | 6 | D | H | T | N | S | / |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | Shift| ; | Q | J | K | X | 1 | 2 | 3 | B | M | W | V | Z |Ctl/Et|
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_DVORAK] = KEYMAP(
|
||||||
|
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\
|
||||||
|
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, \
|
||||||
|
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, \
|
||||||
|
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, \
|
||||||
|
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 \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Lower
|
||||||
|
* ,------+------+------+------+------+------------------------------------------------.
|
||||||
|
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | ~ | ! | @ | # | $ | % | | | | ^ | & | * | ( | ) | Del |
|
||||||
|
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | F1 | F2 | F3 | F4 | F5 | | | | F6 | _ | + | { | } | | |
|
||||||
|
* |------+------+------+------+------+------|------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO ~ |ISO | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | | | Next | Vol- | Vol+ | Play |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_LOWER] = KEYMAP(
|
||||||
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
|
||||||
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
|
||||||
|
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_PIPE, \
|
||||||
|
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12,S(KC_NUHS),S(KC_NUBS),_______,_______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Raise
|
||||||
|
* ,------+------+------+------+------+------------------------------------------------.
|
||||||
|
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | ` | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | Del |
|
||||||
|
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||||
|
* | Del | F1 | F2 | F3 | F4 | F5 | | | | F6 | - | = | [ | ] | \ |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO # |ISO / | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | | | 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_F3, KC_F4, 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_SPC, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Mouse Layer (semi-col)
|
||||||
|
* ,------+------+------+------+------+------------------------------------------------.
|
||||||
|
* | ACCL0| ACCL1| ACCL2| | | | | | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | | | | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| Macro| |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | BTN1 | | | | BTN1 | | | | | |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
|
||||||
|
[_MOUSECURSOR] = KEYMAP(
|
||||||
|
KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R,DEMOMACRO,_______, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, KC_BTN1, _______, _______, _______, KC_BTN1, _______, _______, _______, _______, _______ \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Adjust (Lower + Raise)
|
||||||
|
* ,------+------+------+------+------+------------------------------------------------.
|
||||||
|
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | Reset|RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | |Voice-|Voice+|Mus on|Musoff| | | | | | | | BL + |BL ST |BL TG |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | | | | | | |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_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, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
|
||||||
|
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \
|
||||||
|
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______\
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
|
||||||
|
float tone_startup[][2] = SONG(STARTUP_SOUND);
|
||||||
|
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
||||||
|
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
|
||||||
|
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
|
||||||
|
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
|
||||||
|
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// define variables for reactive RGB
|
||||||
|
bool RGB_INIT = false;
|
||||||
|
bool TOG_STATUS = false;
|
||||||
|
int RGB_current_mode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void persistant_default_layer_set(uint16_t default_layer) {
|
||||||
|
eeconfig_update_default_layer(default_layer);
|
||||||
|
default_layer_set(default_layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
|
||||||
|
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
|
||||||
|
rgblight_mode(RGB_current_mode);
|
||||||
|
layer_on(layer3);
|
||||||
|
} else {
|
||||||
|
layer_off(layer3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
persistant_default_layer_set(1UL<<_QWERTY);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case COLEMAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
|
||||||
|
#endif
|
||||||
|
persistant_default_layer_set(1UL<<_COLEMAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case LOWER:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||||
|
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||||
|
if (RGB_INIT) {} else {
|
||||||
|
RGB_current_mode = rgblight_config.mode;
|
||||||
|
RGB_INIT = true;
|
||||||
|
}
|
||||||
|
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||||
|
} else {
|
||||||
|
TOG_STATUS = !TOG_STATUS;
|
||||||
|
rgblight_mode(16);
|
||||||
|
}
|
||||||
|
layer_on(_LOWER);
|
||||||
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||||
|
} else {
|
||||||
|
rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||||
|
TOG_STATUS = false;
|
||||||
|
layer_off(_LOWER);
|
||||||
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case RAISE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||||
|
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||||
|
if (RGB_INIT) {} else {
|
||||||
|
RGB_current_mode = rgblight_config.mode;
|
||||||
|
RGB_INIT = true;
|
||||||
|
}
|
||||||
|
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||||
|
} else {
|
||||||
|
TOG_STATUS = !TOG_STATUS;
|
||||||
|
rgblight_mode(15);
|
||||||
|
}
|
||||||
|
layer_on(_RAISE);
|
||||||
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||||
|
} else {
|
||||||
|
rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||||
|
layer_off(_RAISE);
|
||||||
|
TOG_STATUS = false;
|
||||||
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case BACKLIT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_RSFT);
|
||||||
|
#ifdef BACKLIGHT_ENABLE
|
||||||
|
backlight_step();
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
unregister_code(KC_RSFT);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case RGB_MOD:
|
||||||
|
//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
|
||||||
|
if (record->event.pressed) {
|
||||||
|
rgblight_mode(RGB_current_mode);
|
||||||
|
rgblight_step();
|
||||||
|
RGB_current_mode = rgblight_config.mode;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
#ifdef USE_I2C
|
||||||
|
i2c_master_init();
|
||||||
|
#ifdef SSD1306OLED
|
||||||
|
// calls code for the SSD1306 OLED
|
||||||
|
_delay_ms(400);
|
||||||
|
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
|
||||||
|
iota_gfx_init(); // turns on the display
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
startup_user();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_scan_user(void) {
|
||||||
|
#ifdef SSD1306OLED
|
||||||
|
iota_gfx_task(); // this is what updates the display continuously
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
|
||||||
|
void startup_user()
|
||||||
|
{
|
||||||
|
_delay_ms(20); // gets rid of tick
|
||||||
|
PLAY_NOTE_ARRAY(tone_startup, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void shutdown_user()
|
||||||
|
{cc
|
||||||
|
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
|
||||||
|
_delay_ms(150);
|
||||||
|
stop_all_notes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void music_on_user(void)
|
||||||
|
{
|
||||||
|
music_scale_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
void music_scale_user(void)
|
||||||
|
{
|
||||||
|
PLAY_NOTE_ARRAY(music_scale, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro definition
|
||||||
|
*/
|
||||||
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||||
|
{
|
||||||
|
if (!eeconfig_is_enabled()) {
|
||||||
|
eeconfig_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case KC_DEMOMACRO:
|
||||||
|
if (record->event.pressed){
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return MACRO_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_update(struct CharacterMatrix *dest,
|
||||||
|
const struct CharacterMatrix *source) {
|
||||||
|
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
||||||
|
memcpy(dest->display, source->display, sizeof(dest->display));
|
||||||
|
dest->dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//assign the right code to your layers for OLED display
|
||||||
|
#define L_BASE 0
|
||||||
|
#define L_LOWER 8
|
||||||
|
#define L_RAISE 16
|
||||||
|
#define L_FNLAYER 64
|
||||||
|
#define L_NUMLAY 128
|
||||||
|
#define L_NLOWER 136
|
||||||
|
#define L_NFNLAYER 192
|
||||||
|
#define L_MOUSECURSOR 256
|
||||||
|
#define L_ADJUST 65560
|
||||||
|
|
||||||
|
void iota_gfx_task_user(void) {
|
||||||
|
#if DEBUG_TO_SCREEN
|
||||||
|
if (debug_enable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct CharacterMatrix matrix;
|
||||||
|
|
||||||
|
matrix_clear(&matrix);
|
||||||
|
matrix_write_P(&matrix, PSTR("USB: "));
|
||||||
|
#ifdef PROTOCOL_LUFA
|
||||||
|
switch (USB_DeviceState) {
|
||||||
|
case DEVICE_STATE_Unattached:
|
||||||
|
matrix_write_P(&matrix, PSTR("Unattached"));
|
||||||
|
break;
|
||||||
|
case DEVICE_STATE_Suspended:
|
||||||
|
matrix_write_P(&matrix, PSTR("Suspended"));
|
||||||
|
break;
|
||||||
|
case DEVICE_STATE_Configured:
|
||||||
|
matrix_write_P(&matrix, PSTR("Connected"));
|
||||||
|
break;
|
||||||
|
case DEVICE_STATE_Powered:
|
||||||
|
matrix_write_P(&matrix, PSTR("Powered"));
|
||||||
|
break;
|
||||||
|
case DEVICE_STATE_Default:
|
||||||
|
matrix_write_P(&matrix, PSTR("Default"));
|
||||||
|
break;
|
||||||
|
case DEVICE_STATE_Addressed:
|
||||||
|
matrix_write_P(&matrix, PSTR("Addressed"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
matrix_write_P(&matrix, PSTR("Invalid"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
|
||||||
|
|
||||||
|
char buf[40];
|
||||||
|
snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
|
||||||
|
matrix_write_P(&matrix, PSTR("\n\nLayer: "));
|
||||||
|
switch (layer_state) {
|
||||||
|
case L_BASE:
|
||||||
|
matrix_write_P(&matrix, PSTR("Default"));
|
||||||
|
break;
|
||||||
|
case L_RAISE:
|
||||||
|
matrix_write_P(&matrix, PSTR("Raise"));
|
||||||
|
break;
|
||||||
|
case L_LOWER:
|
||||||
|
matrix_write_P(&matrix, PSTR("Lower"));
|
||||||
|
break;
|
||||||
|
case L_ADJUST:
|
||||||
|
matrix_write_P(&matrix, PSTR("ADJUST"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
matrix_write(&matrix, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Host Keyboard LED Status
|
||||||
|
char led[40];
|
||||||
|
snprintf(led, sizeof(led), "\n%s %s %s",
|
||||||
|
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
|
||||||
|
(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
|
||||||
|
(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
|
||||||
|
matrix_write(&matrix, led);
|
||||||
|
matrix_update(&display, &matrix);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
|||||||
|
# The Default Planck Layout
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
# How to add your own keymap
|
||||||
|
|
||||||
|
Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`:
|
||||||
|
|
||||||
|
_[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author]
|
||||||
|
|
||||||
|
\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements
|
||||||
|
|
||||||
|
and contain the following files:
|
||||||
|
|
||||||
|
* `keymap.c`
|
||||||
|
* `readme.md` *recommended*
|
||||||
|
* `config.h` *optional*, found automatically when compiling
|
||||||
|
* `Makefile` *optional*, found automatically when compling
|
||||||
|
|
||||||
|
When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format:
|
||||||
|
|
||||||
|
* **folder_name** description
|
||||||
|
|
||||||
|
# List of Planck keymaps
|
||||||
|
|
||||||
|
* **default** default Planck layout
|
||||||
|
* **cbbrowne** cbbrowne's Planck layout
|
@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# change to "no" to disable the options, or define them in the Makefile in
|
||||||
|
# the appropriate keymap folder that will get included automatically
|
||||||
|
#
|
||||||
|
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||||
|
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||||
|
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||||
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
|
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
|
MIDI_ENABLE = yes # MIDI controls
|
||||||
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
|
UNICODE_ENABLE = no # Unicode
|
||||||
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
|
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
||||||
|
ONEHAND_ENABLE = no # Enable one-hand typing
|
||||||
|
|
||||||
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
|
ifndef QUANTUM_DIR
|
||||||
|
include ../../../../Makefile
|
||||||
|
endif
|
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include "../../config.h"
|
||||||
|
|
||||||
|
#define LEADER_TIMEOUT 300
|
||||||
|
//#define BACKLIGHT_BREATHING
|
||||||
|
#define PREVENT_STUCK_MODIFIERS
|
||||||
|
|
||||||
|
#define USE_I2C
|
||||||
|
#define SSD1306OLED
|
||||||
|
#define OLED_ROTATE180
|
||||||
|
|
||||||
|
/* ws2812 RGB LED*/
|
||||||
|
#define RGB_DI_PIN D4
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLED_NUM 14 // Number of LEDs
|
||||||
|
#define RGBLIGHT_HUE_STEP 10
|
||||||
|
#define RGBLIGHT_SAT_STEP 17
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,505 @@
|
|||||||
|
#include "hadron.h"
|
||||||
|
#include "bootloader.h"
|
||||||
|
#include "action_layer.h"
|
||||||
|
#include "eeconfig.h"
|
||||||
|
#include "LUFA/Drivers/Peripheral/TWI.h"
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
#include "audio.h"
|
||||||
|
#endif
|
||||||
|
#ifdef USE_I2C
|
||||||
|
#include "i2c.h"
|
||||||
|
#endif
|
||||||
|
#ifdef SSD1306OLED
|
||||||
|
#include "ssd1306.h"
|
||||||
|
#endif
|
||||||
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
|
//Following line allows macro to read current RGB settings
|
||||||
|
extern rgblight_config_t rgblight_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 3
|
||||||
|
#define _RAISE 4
|
||||||
|
#define _FNLAYER 6
|
||||||
|
#define _NUMLAY 7
|
||||||
|
#define _MOUSECURSOR 8
|
||||||
|
#define _ADJUST 16
|
||||||
|
|
||||||
|
enum preonic_keycodes {
|
||||||
|
QWERTY = SAFE_RANGE,
|
||||||
|
COLEMAK,
|
||||||
|
DVORAK,
|
||||||
|
LOWER,
|
||||||
|
RAISE,
|
||||||
|
BACKLIT,
|
||||||
|
RGBLED_TOGGLE,
|
||||||
|
RGBLED_STEP_MODE,
|
||||||
|
RGBLED_INCREASE_HUE,
|
||||||
|
RGBLED_DECREASE_HUE,
|
||||||
|
RGBLED_INCREASE_SAT,
|
||||||
|
RGBLED_DECREASE_SAT,
|
||||||
|
RGBLED_INCREASE_VAL,
|
||||||
|
RGBLED_DECREASE_VAL,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum macro_keycodes {
|
||||||
|
KC_DEMOMACRO,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Fillers to make layering more clear
|
||||||
|
#define _______ KC_TRNS
|
||||||
|
#define XXXXXXX KC_NO
|
||||||
|
// Custom macros
|
||||||
|
#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl
|
||||||
|
#define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl
|
||||||
|
#define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl
|
||||||
|
#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift
|
||||||
|
// Requires KC_TRNS/_______ for the trigger key in the destination layer
|
||||||
|
#define LT_FN(kc) LT(_FNLAYER, kc) // L-ayer T-ap Function Layer
|
||||||
|
#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor
|
||||||
|
#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise
|
||||||
|
#define TG_NUMLAY TG(_NUMLAY) //Toggle for layer _NUMLAY
|
||||||
|
#define DEMOMACRO M(KC_DEMOMACRO) // My login macros
|
||||||
|
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
/* Qwerty
|
||||||
|
* ,------+------+------+------+------+------------------------------------------------.
|
||||||
|
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | 7 | 8 | 9 |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | CAPS | A | S | D | F | G | H | J | K | L | ; |Enter | 4 | 5 | 6 |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | Shift| Z | X | C | V | B | N | M | , | . | / | = | 1 | 2 | 3 |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | ~ | Ctrl | Alt | GUI |Lower |Space |Space |Raise | RAlt | Ins | Del |NumLay| 0 | . | ENT |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_QWERTY] = KEYMAP(
|
||||||
|
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,\
|
||||||
|
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, \
|
||||||
|
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, \
|
||||||
|
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, \
|
||||||
|
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 \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Lower
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | | | | | | | | | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | |
|
||||||
|
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||||
|
* | CAPS | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | [ | ] | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | Next | Vol- | Vol+ | Play | | | |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_LOWER] = KEYMAP(
|
||||||
|
KC_ESC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
|
||||||
|
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, KC_BSLS, _______, _______, _______, \
|
||||||
|
KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_PIPE, _______, _______, _______, \
|
||||||
|
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______\
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Raise
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | |
|
||||||
|
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | A | Up | D | PrSc | | 4 | 5 | 6 | * | : | ' | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | Lt | Dn | Rt | Mute | | 1 | 2 | 3 | Up | / | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | |Space | 0 | | Left | Down | Right| | | | |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_RAISE] = 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, \
|
||||||
|
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_PLUS, KC_BSLS, _______, _______, _______, \
|
||||||
|
_______, KC_A, KC_UP, KC_D, KC_PSCR, _______, KC_4, KC_5, KC_6, KC_PAST, KC_COLN, KC_QUOT, _______, _______, _______, \
|
||||||
|
_______, KC_LEFT, KC_DOWN, KC_RIGHT, KC__MUTE, _______, KC_1, KC_2, KC_3, KC_UP, KC_SLSH, _______, _______, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, KC_SPC, KC_0, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______ \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* FN layer on Esc key
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | | | | | | | | | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | | ! | @ | # | $ | % | ^ | & | * | ( | ) | + | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | F1 | F2 | F3 | F4 | F5 | F6 | _ | = | [ | ] | ' | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | { | } | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | Next | Vol- | Vol+ | Play | | | |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_FNLAYER] = KEYMAP(
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\
|
||||||
|
_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PLUS, _______, _______, _______, \
|
||||||
|
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_QUOT, _______, _______, _______, \
|
||||||
|
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______ \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Num Layer
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | | | | | | | | | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | | | | | | | | | | | | | F7 | F8 | F9 |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | | | | F4 | F5 | F6 |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | | | | | Up | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | | | Exit | Left | Down | Rght |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_NUMLAY] = KEYMAP(
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PMNS, KC_UP, KC_PPLS, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Mouse Layer (semi-col)
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | |ACCL0| ACCL1| ACCL2 | | | | | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | BTN1 | | | | BTN1 | | | | | |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
|
||||||
|
[_MOUSECURSOR] = KEYMAP(
|
||||||
|
_______, KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______,\
|
||||||
|
_______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R, DEMOMACRO, _______, _______, _______, _______, \
|
||||||
|
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, _______, _______, _______, \
|
||||||
|
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, _______, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Adjust (Lower + Raise)
|
||||||
|
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | Reset| | | | | | | | | VolD | VolU | Mute |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||||
|
* | |RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | Del | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | BL + |BL ST |BLSTEP| BL TG| | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | | | | | | |
|
||||||
|
* `--------------------------------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_ADJUST] = KEYMAP(
|
||||||
|
RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLD, KC_VOLU, KC_MUTE, \
|
||||||
|
_______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, KC_DEL, _______, _______, _______, \
|
||||||
|
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, _______, _______, _______, \
|
||||||
|
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, _______, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
|
||||||
|
float tone_startup[][2] = SONG(STARTUP_SOUND);
|
||||||
|
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
||||||
|
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
|
||||||
|
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// define variables for reactive RGB
|
||||||
|
bool RGB_INIT = false;
|
||||||
|
bool TOG_STATUS = false;
|
||||||
|
bool NUMLAY_STATUS = false;
|
||||||
|
int RGB_current_mode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void persistant_default_layer_set(uint16_t default_layer) {
|
||||||
|
eeconfig_update_default_layer(default_layer);
|
||||||
|
default_layer_set(default_layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
|
||||||
|
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
|
||||||
|
rgblight_mode(RGB_current_mode);
|
||||||
|
layer_on(layer3);
|
||||||
|
} else {
|
||||||
|
layer_off(layer3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
persistant_default_layer_set(1UL<<_QWERTY);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case LOWER:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||||
|
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||||
|
if (RGB_INIT) {} else {
|
||||||
|
RGB_current_mode = rgblight_config.mode;
|
||||||
|
RGB_INIT = true;
|
||||||
|
}
|
||||||
|
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||||
|
} else {
|
||||||
|
TOG_STATUS = !TOG_STATUS;
|
||||||
|
rgblight_mode(16);
|
||||||
|
}
|
||||||
|
layer_on(_LOWER);
|
||||||
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||||
|
} else {
|
||||||
|
rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||||
|
TOG_STATUS = false;
|
||||||
|
layer_off(_LOWER);
|
||||||
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case RAISE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||||
|
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||||
|
if (RGB_INIT) {} else {
|
||||||
|
RGB_current_mode = rgblight_config.mode;
|
||||||
|
RGB_INIT = true;
|
||||||
|
}
|
||||||
|
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||||
|
} else {
|
||||||
|
TOG_STATUS = !TOG_STATUS;
|
||||||
|
rgblight_mode(15);
|
||||||
|
}
|
||||||
|
layer_on(_RAISE);
|
||||||
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||||
|
} else {
|
||||||
|
rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||||
|
layer_off(_RAISE);
|
||||||
|
TOG_STATUS = false;
|
||||||
|
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case BACKLIT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_RSFT);
|
||||||
|
#ifdef BACKLIGHT_ENABLE
|
||||||
|
backlight_step();
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
unregister_code(KC_RSFT);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
//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
|
||||||
|
case TG_NUMLAY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
if (RGB_INIT) {} else {
|
||||||
|
RGB_current_mode = rgblight_config.mode;
|
||||||
|
RGB_INIT = true;
|
||||||
|
}
|
||||||
|
NUMLAY_STATUS = !NUMLAY_STATUS;
|
||||||
|
if (NUMLAY_STATUS) {
|
||||||
|
rgblight_mode(4);
|
||||||
|
layer_on(_NUMLAY);
|
||||||
|
} else {
|
||||||
|
rgblight_mode(RGB_current_mode);
|
||||||
|
layer_off(_NUMLAY); }
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case RGB_MOD:
|
||||||
|
//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
|
||||||
|
if (record->event.pressed) {
|
||||||
|
rgblight_mode(RGB_current_mode);
|
||||||
|
rgblight_step();
|
||||||
|
RGB_current_mode = rgblight_config.mode;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
#ifdef USE_I2C
|
||||||
|
i2c_master_init();
|
||||||
|
#ifdef SSD1306OLED
|
||||||
|
// calls code for the SSD1306 OLED
|
||||||
|
_delay_ms(400);
|
||||||
|
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
|
||||||
|
iota_gfx_init(); // turns on the display
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
startup_user();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_scan_user(void) {
|
||||||
|
#ifdef SSD1306OLED
|
||||||
|
iota_gfx_task(); // this is what updates the display continuously
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
|
||||||
|
void startup_user()
|
||||||
|
{
|
||||||
|
_delay_ms(20); // gets rid of tick
|
||||||
|
PLAY_NOTE_ARRAY(tone_startup, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void shutdown_user()
|
||||||
|
{cc
|
||||||
|
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
|
||||||
|
_delay_ms(150);
|
||||||
|
stop_all_notes();
|
||||||
|
}
|
||||||
|
|
||||||
|
void music_on_user(void)
|
||||||
|
{
|
||||||
|
music_scale_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
void music_scale_user(void)
|
||||||
|
{
|
||||||
|
PLAY_NOTE_ARRAY(music_scale, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro definition
|
||||||
|
*/
|
||||||
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||||
|
{
|
||||||
|
if (!eeconfig_is_enabled()) {
|
||||||
|
eeconfig_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case KC_DEMOMACRO:
|
||||||
|
if (record->event.pressed){
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return MACRO_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_update(struct CharacterMatrix *dest,
|
||||||
|
const struct CharacterMatrix *source) {
|
||||||
|
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
||||||
|
memcpy(dest->display, source->display, sizeof(dest->display));
|
||||||
|
dest->dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//assign the right code to your layers for OLED display
|
||||||
|
#define L_BASE 0
|
||||||
|
#define L_LOWER 8
|
||||||
|
#define L_RAISE 16
|
||||||
|
#define L_FNLAYER 64
|
||||||
|
#define L_NUMLAY 128
|
||||||
|
#define L_NLOWER 136
|
||||||
|
#define L_NFNLAYER 192
|
||||||
|
#define L_MOUSECURSOR 256
|
||||||
|
#define L_ADJUST 65560
|
||||||
|
|
||||||
|
void iota_gfx_task_user(void) {
|
||||||
|
#if DEBUG_TO_SCREEN
|
||||||
|
if (debug_enable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct CharacterMatrix matrix;
|
||||||
|
|
||||||
|
matrix_clear(&matrix);
|
||||||
|
matrix_write_P(&matrix, PSTR("USB: "));
|
||||||
|
#ifdef PROTOCOL_LUFA
|
||||||
|
switch (USB_DeviceState) {
|
||||||
|
case DEVICE_STATE_Unattached:
|
||||||
|
matrix_write_P(&matrix, PSTR("Unattached"));
|
||||||
|
break;
|
||||||
|
case DEVICE_STATE_Suspended:
|
||||||
|
matrix_write_P(&matrix, PSTR("Suspended"));
|
||||||
|
break;
|
||||||
|
case DEVICE_STATE_Configured:
|
||||||
|
matrix_write_P(&matrix, PSTR("Connected"));
|
||||||
|
break;
|
||||||
|
case DEVICE_STATE_Powered:
|
||||||
|
matrix_write_P(&matrix, PSTR("Powered"));
|
||||||
|
break;
|
||||||
|
case DEVICE_STATE_Default:
|
||||||
|
matrix_write_P(&matrix, PSTR("Default"));
|
||||||
|
break;
|
||||||
|
case DEVICE_STATE_Addressed:
|
||||||
|
matrix_write_P(&matrix, PSTR("Addressed"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
matrix_write_P(&matrix, PSTR("Invalid"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
|
||||||
|
|
||||||
|
char buf[40];
|
||||||
|
snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
|
||||||
|
matrix_write_P(&matrix, PSTR("\n\nLayer: "));
|
||||||
|
switch (layer_state) {
|
||||||
|
case L_BASE:
|
||||||
|
matrix_write_P(&matrix, PSTR("Default"));
|
||||||
|
break;
|
||||||
|
case L_RAISE:
|
||||||
|
matrix_write_P(&matrix, PSTR("Raise"));
|
||||||
|
break;
|
||||||
|
case L_LOWER:
|
||||||
|
matrix_write_P(&matrix, PSTR("Lower"));
|
||||||
|
break;
|
||||||
|
case L_ADJUST:
|
||||||
|
matrix_write_P(&matrix, PSTR("ADJUST"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
matrix_write(&matrix, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Host Keyboard LED Status
|
||||||
|
char led[40];
|
||||||
|
snprintf(led, sizeof(led), "\n%s %s %s",
|
||||||
|
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
|
||||||
|
(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
|
||||||
|
(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
|
||||||
|
matrix_write(&matrix, led);
|
||||||
|
matrix_update(&display, &matrix);
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
# The Default Planck Layout
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
|
@ -0,0 +1,72 @@
|
|||||||
|
# MCU name
|
||||||
|
#MCU = at90usb1287
|
||||||
|
MCU = atmega32u4
|
||||||
|
|
||||||
|
# Processor frequency.
|
||||||
|
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||||
|
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||||
|
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||||
|
# automatically to create a 32-bit value in your source code.
|
||||||
|
#
|
||||||
|
# This will be an integer division of F_USB below, as it is sourced by
|
||||||
|
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||||
|
# does not *change* the processor frequency - it should merely be updated to
|
||||||
|
# reflect the processor speed set externally so that the code can use accurate
|
||||||
|
# software delays.
|
||||||
|
F_CPU = 16000000
|
||||||
|
|
||||||
|
#
|
||||||
|
# LUFA specific
|
||||||
|
#
|
||||||
|
# Target architecture (see library "Board Types" documentation).
|
||||||
|
ARCH = AVR8
|
||||||
|
|
||||||
|
# Input clock frequency.
|
||||||
|
# This will define a symbol, F_USB, in all source code files equal to the
|
||||||
|
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||||
|
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||||
|
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||||
|
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||||
|
# at the end, this will be done automatically to create a 32-bit value in your
|
||||||
|
# source code.
|
||||||
|
#
|
||||||
|
# If no clock division is performed on the input clock inside the AVR (via the
|
||||||
|
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||||
|
F_USB = $(F_CPU)
|
||||||
|
|
||||||
|
# Interrupt driven control endpoint task(+60)
|
||||||
|
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||||
|
|
||||||
|
|
||||||
|
# Boot Section Size in *bytes*
|
||||||
|
# Teensy halfKay 512
|
||||||
|
# Teensy++ halfKay 1024
|
||||||
|
# Atmel DFU loader 4096
|
||||||
|
# LUFA bootloader 4096
|
||||||
|
# USBaspLoader 2048
|
||||||
|
OPT_DEFS += -DBOOTLOADER_SIZE=512
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# change to "no" to disable the options, or define them in the Makefile in
|
||||||
|
# the appropriate keymap folder that will get included automatically
|
||||||
|
#
|
||||||
|
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
|
||||||
|
MOUSEKEY_ENABLE ?= no # Mouse keys(+4700)
|
||||||
|
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
|
||||||
|
CONSOLE_ENABLE ?= no # Console for debug(+400)
|
||||||
|
COMMAND_ENABLE ?= no # Commands for debug and configuration
|
||||||
|
NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
|
||||||
|
MIDI_ENABLE ?= no # MIDI controls
|
||||||
|
AUDIO_ENABLE ?= no # Audio output on port C6
|
||||||
|
UNICODE_ENABLE ?= no # Unicode
|
||||||
|
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
|
RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight.
|
||||||
|
API_SYSEX_ENABLE = yes
|
||||||
|
|
||||||
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
|
SRC = i2c.c \
|
||||||
|
ssd1306.c
|
||||||
|
|
@ -0,0 +1,3 @@
|
|||||||
|
ifndef MAKEFILE_INCLUDED
|
||||||
|
include ../../../Makefile
|
||||||
|
endif
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef VER0_CONFIG_H
|
||||||
|
#define VER0_CONFIG_H
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define DEVICE_VER 0x0001
|
||||||
|
|
||||||
|
/* key matrix size */
|
||||||
|
#define MATRIX_ROWS 5
|
||||||
|
#define MATRIX_COLS 15
|
||||||
|
|
||||||
|
/* Hadron Ver0 PCB default pin-out */
|
||||||
|
#define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 }
|
||||||
|
#define MATRIX_COL_PINS { F6, F7, C6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 }
|
||||||
|
#define UNUSED_PINS
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,5 @@
|
|||||||
|
#AUDIO_ENABLE ?= yes # Audio output on port C6
|
||||||
|
|
||||||
|
ifndef QUANTUM_DIR
|
||||||
|
include ../../../Makefile
|
||||||
|
endif
|
@ -0,0 +1 @@
|
|||||||
|
#include "ver0.h"
|
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef VER0_H
|
||||||
|
#define VER0_H
|
||||||
|
|
||||||
|
#include "../hadron.h"
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,3 @@
|
|||||||
|
ifndef MAKEFILE_INCLUDED
|
||||||
|
include ../../../Makefile
|
||||||
|
endif
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#ifndef VER2_CONFIG_H
|
||||||
|
#define VER2_CONFIG_H
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define DEVICE_VER 0x0002
|
||||||
|
|
||||||
|
/* key matrix size */
|
||||||
|
#define MATRIX_ROWS 5
|
||||||
|
#define MATRIX_COLS 15
|
||||||
|
|
||||||
|
/* Hadron Ver0 PCB default pin-out */
|
||||||
|
#define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 }
|
||||||
|
#define MATRIX_COL_PINS { F6, F7, D6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 }
|
||||||
|
#define UNUSED_PINS
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,5 @@
|
|||||||
|
#AUDIO_ENABLE ?= yes # Audio output on port C6
|
||||||
|
|
||||||
|
ifndef QUANTUM_DIR
|
||||||
|
include ../../../Makefile
|
||||||
|
endif
|
@ -0,0 +1 @@
|
|||||||
|
#include "ver2.h"
|
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef VER2_H
|
||||||
|
#define VER2_H
|
||||||
|
|
||||||
|
#include "../hadron.h"
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,3 @@
|
|||||||
|
#include "../../config.h"
|
||||||
|
|
||||||
|
#define BACKLIGHT_BREATHING
|
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function export_variables {
|
||||||
|
local util_dir=~/qmk_utils
|
||||||
|
export PATH=$PATH:$util_dir/dfu-programmer
|
||||||
|
export PATH=$PATH:$util_dir/dfu-util-0.9-win64
|
||||||
|
export PATH=$PATH:$util_dir/flip/bin
|
||||||
|
export PATH=$PATH:$util_dir/avr8-gnu-toolchain/bin
|
||||||
|
export PATH=$PATH:$util_dir/gcc-arm-none-eabi/bin
|
||||||
|
}
|
||||||
|
|
||||||
|
export_variables
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,117 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||||
|
download_dir=~/qmk_utils
|
||||||
|
avrtools=avr8-gnu-toolchain
|
||||||
|
armtools=gcc-arm-none-eabi
|
||||||
|
installflip=false
|
||||||
|
|
||||||
|
echo "Installing dependencies needed for the installation (quazip)"
|
||||||
|
pacman --needed -S msys/unzip msys/p7zip base-devel msys/git mingw-w64-x86_64-toolchain
|
||||||
|
|
||||||
|
source "$dir/win_shared_install.sh"
|
||||||
|
|
||||||
|
function install_avr {
|
||||||
|
rm -f -r "$avrtools"
|
||||||
|
wget "http://www.atmel.com/images/avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe"
|
||||||
|
7z x avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
|
||||||
|
rm avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_arm {
|
||||||
|
wget -O gcc-arm-none-eabi.zip "https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-win32.zip?product=GNU%20ARM%20Embedded%20Toolchain,ZIP,,Windows,6-2017-q2-update"
|
||||||
|
unzip -d gcc-arm-none-eabi gcc-arm-none-eabi.zip
|
||||||
|
rm gcc-arm-none-eabi.zip
|
||||||
|
}
|
||||||
|
|
||||||
|
function extract_flip {
|
||||||
|
rm -f -r flip
|
||||||
|
7z -oflip x FlipInstaller.exe
|
||||||
|
}
|
||||||
|
|
||||||
|
pushd "$download_dir"
|
||||||
|
|
||||||
|
if [ -f "FlipInstaller.exe" ]; then
|
||||||
|
echo
|
||||||
|
echo "Extracting flip"
|
||||||
|
extract_flip
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$avrtools" ]; then
|
||||||
|
while true; do
|
||||||
|
echo
|
||||||
|
echo "The AVR toolchain is not installed."
|
||||||
|
echo "This is needed for building AVR based keboards."
|
||||||
|
read -p "Do you want to install it? (Y/N) " res
|
||||||
|
case $res in
|
||||||
|
[Yy]* ) install_avr; break;;
|
||||||
|
[Nn]* ) break;;
|
||||||
|
* ) echo "Invalid answer";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
else
|
||||||
|
while true; do
|
||||||
|
echo
|
||||||
|
echo "The AVR toolchain is already installed"
|
||||||
|
read -p "Do you want to reinstall? (Y/N) " res
|
||||||
|
case $res in
|
||||||
|
[Yy]* ) install_avr; break;;
|
||||||
|
[Nn]* ) break;;
|
||||||
|
* ) echo "Invalid answer";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$armtools" ]; then
|
||||||
|
while true; do
|
||||||
|
echo
|
||||||
|
echo "The ARM toolchain is not installed."
|
||||||
|
echo "This is needed for building ARM based keboards."
|
||||||
|
read -p "Do you want to install it? (Y/N) " res
|
||||||
|
case $res in
|
||||||
|
[Yy]* ) install_arm; break;;
|
||||||
|
[Nn]* ) break;;
|
||||||
|
* ) echo "Invalid answer";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
else
|
||||||
|
while true; do
|
||||||
|
echo
|
||||||
|
echo "The ARM toolchain is already installed"
|
||||||
|
read -p "Do you want to reinstall? (Y/N) " res
|
||||||
|
case $res in
|
||||||
|
[Yy]* ) install_arm; break;;
|
||||||
|
[Nn]* ) break;;
|
||||||
|
* ) echo "Invalid answer";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
|
||||||
|
cp -f "$dir/activate_msys2.sh" "$download_dir/"
|
||||||
|
|
||||||
|
if grep "^source ~/qmk_utils/activate_msys2.sh$" ~/.bashrc
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "The line source ~/qmk_utils/activate_msys2.sh is already added to your /.bashrc"
|
||||||
|
echo "Not adding it twice!"
|
||||||
|
else
|
||||||
|
while true; do
|
||||||
|
echo
|
||||||
|
echo "Do you want to add 'source ~/qmk_utils/activate_msys2.sh' to the end of your"
|
||||||
|
echo ".bashrc file? Without this make won't find the needed utils, so if you don't"
|
||||||
|
echo "want to do it automatically, then you have to do it manually later."
|
||||||
|
read -p "(Y/N)? " res
|
||||||
|
case $res in
|
||||||
|
[Yy]* ) echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc; break;;
|
||||||
|
[Nn]* ) break;;
|
||||||
|
* ) echo "Invalid answer";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "******************************************************************************"
|
||||||
|
echo "Installation completed!"
|
||||||
|
echo "Please close this Window and restart MSYS2 MinGW"
|
||||||
|
echo "******************************************************************************"
|
@ -0,0 +1,80 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function install_utils {
|
||||||
|
rm -f -r "$download_dir"
|
||||||
|
mkdir "$download_dir"
|
||||||
|
|
||||||
|
pushd "$download_dir"
|
||||||
|
|
||||||
|
echo "Installing dfu-programmer"
|
||||||
|
wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip'
|
||||||
|
unzip -d dfu-programmer dfu-programmer-win-0.7.2.zip
|
||||||
|
|
||||||
|
echo "Installing dfu-util"
|
||||||
|
wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip'
|
||||||
|
unzip dfu-util-0.9-win64.zip
|
||||||
|
|
||||||
|
echo "Installing teensy_loader_cli"
|
||||||
|
wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip'
|
||||||
|
unzip teensy_loader_cli_windows.zip
|
||||||
|
|
||||||
|
echo "Installing Atmel Flip"
|
||||||
|
wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe'
|
||||||
|
mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe
|
||||||
|
|
||||||
|
echo "Downloading the QMK driver installer"
|
||||||
|
wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i -
|
||||||
|
|
||||||
|
rm -f *.zip
|
||||||
|
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_drivers {
|
||||||
|
pushd "$download_dir"
|
||||||
|
cp -f "$dir/drivers.txt" .
|
||||||
|
echo
|
||||||
|
cmd.exe /c "qmk_driver_installer.exe $1 $2 drivers.txt"
|
||||||
|
popd > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
pushd "$dir"
|
||||||
|
|
||||||
|
if [ ! -d "$download_dir" ]; then
|
||||||
|
install_utils
|
||||||
|
else
|
||||||
|
while true; do
|
||||||
|
echo
|
||||||
|
echo "The utils seem to already be downloaded."
|
||||||
|
read -p "Do you want to re-download them and update to the newest version (Y/N) " res
|
||||||
|
case $res in
|
||||||
|
[Yy]* ) install_utils; break;;
|
||||||
|
[Nn]* ) break;;
|
||||||
|
* ) echo "Invalid answer";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
echo
|
||||||
|
echo "Which USB drivers do you want to install?"
|
||||||
|
echo "(A)all - All supported drivers will be installed"
|
||||||
|
echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode)"
|
||||||
|
echo " will be installed"
|
||||||
|
echo "(F)force - Like all, but will also override existing drivers for connected"
|
||||||
|
echo " keyboards"
|
||||||
|
echo "(N)one - No drivers will be installed,"
|
||||||
|
echo " flashing your keyboard will most likely not work"
|
||||||
|
read -p "(A/C/F/N)? " res
|
||||||
|
case $res in
|
||||||
|
[Aa]* ) install_drivers --all; break;;
|
||||||
|
[Cc]* ) install_drivers; break;;
|
||||||
|
[Ff]* ) install_drivers --all --force; break;;
|
||||||
|
[Nn]* ) break;;
|
||||||
|
* ) echo "Invalid answer";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
popd > /dev/null
|
||||||
|
|
Loading…
Reference in New Issue