Merge branch 'master' of github.com:qmk/qmk_firmware into planck_rev6

This commit is contained in:
Jack Humbert 2018-05-30 15:24:45 -04:00
commit 4fdc9badd3
504 changed files with 16974 additions and 3495 deletions

View file

@ -18,6 +18,10 @@
#include "process_leader.h"
#ifndef LEADER_TIMEOUT
#define LEADER_TIMEOUT 300
#endif
__attribute__ ((weak))
void leader_start(void) {}

View file

@ -19,14 +19,13 @@
#include "quantum.h"
bool process_leader(uint16_t keycode, keyrecord_t *record);
void leader_start(void);
void leader_end(void);
#ifndef LEADER_TIMEOUT
#define LEADER_TIMEOUT 200
#endif
#define SEQ_ONE_KEY(key) if (leader_sequence[0] == (key) && leader_sequence[1] == 0 && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
#define SEQ_TWO_KEYS(key1, key2) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
#define SEQ_THREE_KEYS(key1, key2, key3) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == 0 && leader_sequence[4] == 0)

View file

@ -158,7 +158,7 @@ void terminal_keymap(void) {
for (int c = 0; c < MATRIX_COLS; c++) {
uint16_t keycode = pgm_read_word(&keymaps[layer][r][c]);
char keycode_s[8];
sprintf(keycode_s, "0x%04x, ", keycode);
sprintf(keycode_s, "0x%04x,", keycode);
send_string(keycode_s);
}
send_string(newline);

View file

@ -18,7 +18,7 @@
#include "rgb_matrix.h"
#include <avr/io.h>
#include "TWIlib.h"
#include "i2c_master.h"
#include <util/delay.h>
#include <avr/interrupt.h>
#include "progmem.h"
@ -722,10 +722,8 @@ void rgb_matrix_indicators_user(void) {}
// }
void rgb_matrix_init_drivers(void) {
//sei();
// Initialize TWI
TWIInit();
i2c_init();
IS31FL3731_init( DRIVER_ADDR_1 );
IS31FL3731_init( DRIVER_ADDR_2 );

View file

@ -46,7 +46,6 @@ __attribute__ ((weak))
const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
rgblight_config_t rgblight_config;
rgblight_config_t inmem_config;
LED_TYPE led[RGBLED_NUM];
uint8_t rgblight_inited = 0;
@ -169,7 +168,7 @@ void rgblight_init(void) {
#endif
if (rgblight_config.enable) {
rgblight_mode(rgblight_config.mode);
rgblight_mode_noeeprom(rgblight_config.mode);
}
}
@ -226,7 +225,7 @@ uint32_t rgblight_get_mode(void) {
return rgblight_config.mode;
}
void rgblight_mode(uint8_t mode) {
void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
if (!rgblight_config.enable) {
return;
}
@ -237,8 +236,12 @@ void rgblight_mode(uint8_t mode) {
} else {
rgblight_config.mode = mode;
}
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight mode: %u\n", rgblight_config.mode);
if (write_to_eeprom) {
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight mode [EEPROM]: %u\n", rgblight_config.mode);
} else {
xprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode);
}
if (rgblight_config.mode == 1) {
#ifdef RGBLIGHT_ANIMATIONS
rgblight_timer_disable();
@ -262,11 +265,20 @@ void rgblight_mode(uint8_t mode) {
rgblight_timer_disable();
#endif
}
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
}
void rgblight_mode(uint8_t mode) {
rgblight_mode_eeprom_helper(mode, true);
}
void rgblight_mode_noeeprom(uint8_t mode) {
rgblight_mode_eeprom_helper(mode, false);
}
void rgblight_toggle(void) {
xprintf("rgblight toggle: rgblight_config.enable = %u\n", !rgblight_config.enable);
xprintf("rgblight toggle [EEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable);
if (rgblight_config.enable) {
rgblight_disable();
}
@ -275,17 +287,34 @@ void rgblight_toggle(void) {
}
}
void rgblight_toggle_noeeprom(void) {
xprintf("rgblight toggle [NOEEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable);
if (rgblight_config.enable) {
rgblight_disable_noeeprom();
}
else {
rgblight_enable_noeeprom();
}
}
void rgblight_enable(void) {
rgblight_config.enable = 1;
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight enable: rgblight_config.enable = %u\n", rgblight_config.enable);
// No need to update EEPROM here. rgblight_mode() will do that, actually
//eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight enable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
rgblight_mode(rgblight_config.mode);
}
void rgblight_enable_noeeprom(void) {
rgblight_config.enable = 1;
xprintf("rgblight enable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
rgblight_mode_noeeprom(rgblight_config.mode);
}
void rgblight_disable(void) {
rgblight_config.enable = 0;
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight disable: rgblight_config.enable = %u\n", rgblight_config.enable);
xprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
#ifdef RGBLIGHT_ANIMATIONS
rgblight_timer_disable();
#endif
@ -293,6 +322,17 @@ void rgblight_disable(void) {
rgblight_set();
}
void rgblight_disable_noeeprom(void) {
rgblight_config.enable = 0;
xprintf("rgblight disable [noEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
#ifdef RGBLIGHT_ANIMATIONS
rgblight_timer_disable();
#endif
_delay_ms(50);
rgblight_set();
}
// Deals with the messy details of incrementing an integer
uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
int16_t new_value = value;
@ -366,23 +406,22 @@ void rgblight_decrease_speed(void) {
eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this
}
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
inmem_config.raw = rgblight_config.raw;
void rgblight_sethsv_noeeprom_old(uint16_t hue, uint8_t sat, uint8_t val) {
if (rgblight_config.enable) {
LED_TYPE tmp_led;
sethsv(hue, sat, val, &tmp_led);
inmem_config.hue = hue;
inmem_config.sat = sat;
inmem_config.val = val;
// dprintf("rgblight set hue [MEMORY]: %u,%u,%u\n", inmem_config.hue, inmem_config.sat, inmem_config.val);
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
}
}
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) {
if (rgblight_config.enable) {
if (rgblight_config.mode == 1) {
// same static color
rgblight_sethsv_noeeprom(hue, sat, val);
LED_TYPE tmp_led;
sethsv(hue, sat, val, &tmp_led);
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
} else {
// all LEDs in same color
if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
@ -407,11 +446,23 @@ void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
rgblight_config.hue = hue;
rgblight_config.sat = sat;
rgblight_config.val = val;
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
if (write_to_eeprom) {
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
} else {
xprintf("rgblight set hsv [NOEEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
}
}
}
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
rgblight_sethsv_eeprom_helper(hue, sat, val, true);
}
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
rgblight_sethsv_eeprom_helper(hue, sat, val, false);
}
uint16_t rgblight_get_hue(void) {
return rgblight_config.hue;
}
@ -554,7 +605,7 @@ void rgblight_effect_breathing(uint8_t interval) {
// http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/
val = (exp(sin((pos/255.0)*M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)*(RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E));
rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, val);
rgblight_sethsv_noeeprom_old(rgblight_config.hue, rgblight_config.sat, val);
pos = (pos + 1) % 256;
}
void rgblight_effect_rainbow_mood(uint8_t interval) {
@ -565,7 +616,7 @@ void rgblight_effect_rainbow_mood(uint8_t interval) {
return;
}
last_timer = timer_read();
rgblight_sethsv_noeeprom(current_hue, rgblight_config.sat, rgblight_config.val);
rgblight_sethsv_noeeprom_old(current_hue, rgblight_config.sat, rgblight_config.val);
current_hue = (current_hue + 1) % 360;
}
void rgblight_effect_rainbow_swirl(uint8_t interval) {

View file

@ -134,7 +134,16 @@ void rgb_matrix_decrease(void);
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1);
void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1);
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
void rgblight_mode_noeeprom(uint8_t mode);
void rgblight_toggle_noeeprom(void);
void rgblight_enable_noeeprom(void);
void rgblight_disable_noeeprom(void);
void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom);
void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom);
#define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF)
void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b);

View file

@ -36,6 +36,26 @@
#define rgblight_setrgb_magenta() rgblight_setrgb (0xFF, 0x00, 0xFF)
#define rgblight_setrgb_pink() rgblight_setrgb (0xFF, 0x80, 0xBF)
/* SET RGB List */
#define rgblight_setrgb_white_at(at) rgblight_setrgb_at (0xFF, 0xFF, 0xFF, at)
#define rgblight_setrgb_red_at(at) rgblight_setrgb_at (0xFF, 0x00, 0x00, at)
#define rgblight_setrgb_coral_at(at) rgblight_setrgb_at (0xFF, 0x7C, 0x4D, at)
#define rgblight_setrgb_orange_at(at) rgblight_setrgb_at (0xFF, 0x80, 0x00, at)
#define rgblight_setrgb_goldenrod_at(at) rgblight_setrgb_at (0xD9, 0xA5, 0x21, at)
#define rgblight_setrgb_gold_at(at) rgblight_setrgb_at (0xFF, 0xD9, 0x00, at)
#define rgblight_setrgb_yellow_at(at) rgblight_setrgb_at (0xFF, 0xFF, 0x00, at)
#define rgblight_setrgb_chartreuse_at(at) rgblight_setrgb_at (0x80, 0xFF, 0x00, at)
#define rgblight_setrgb_green_at(at) rgblight_setrgb_at (0x00, 0xFF, 0x00, at)
#define rgblight_setrgb_springgreen_at(at) rgblight_setrgb_at (0x00, 0xFF, 0x80, at)
#define rgblight_setrgb_turquoise_at(at) rgblight_setrgb_at (0x47, 0x6E, 0x6A, at)
#define rgblight_setrgb_teal_at(at) rgblight_setrgb_at (0x00, 0x80, 0x80, at)
#define rgblight_setrgb_cyan_at(at) rgblight_setrgb_at (0x00, 0xFF, 0xFF, at)
#define rgblight_setrgb_azure_at(at) rgblight_setrgb_at (0x99, 0xf5, 0xFF, at)
#define rgblight_setrgb_blue_at(at) rgblight_setrgb_at (0x00, 0x00, 0xFF, at)
#define rgblight_setrgb_purple_at(at) rgblight_setrgb_at (0x7A, 0x00, 0xFF, at)
#define rgblight_setrgb_magenta_at(at) rgblight_setrgb_at (0xFF, 0x00, 0xFF, at)
#define rgblight_setrgb_pink_at(at) rgblight_setrgb_at (0xFF, 0x80, 0xBF, at)
/* SET HSV List */
#define rgblight_sethsv_white() rgblight_sethsv ( 0, 0, 255)
#define rgblight_sethsv_red() rgblight_sethsv ( 0, 255, 255)
@ -56,4 +76,48 @@
#define rgblight_sethsv_magenta() rgblight_sethsv (300, 255, 255)
#define rgblight_sethsv_pink() rgblight_sethsv (330, 128, 255)
/* SET HSV List */
/* If you're doing layer indication, this is best, as it won't */
/* write to the eeprom, since it's limited (very high value). */
/* If you want to use modes with this (since you can), then you */
/* want to use rgblight_mode_noeeprom(x) instead. */
#define rgblight_sethsv_noeeprom_white() rgblight_sethsv_noeeprom ( 0, 0, 255)
#define rgblight_sethsv_noeeprom_red() rgblight_sethsv_noeeprom ( 0, 255, 255)
#define rgblight_sethsv_noeeprom_coral() rgblight_sethsv_noeeprom ( 16, 176, 255)
#define rgblight_sethsv_noeeprom_orange() rgblight_sethsv_noeeprom ( 39, 255, 255)
#define rgblight_sethsv_noeeprom_goldenrod() rgblight_sethsv_noeeprom ( 43, 218, 218)
#define rgblight_sethsv_noeeprom_gold() rgblight_sethsv_noeeprom ( 51, 255, 255)
#define rgblight_sethsv_noeeprom_yellow() rgblight_sethsv_noeeprom ( 60, 255, 255)
#define rgblight_sethsv_noeeprom_chartreuse() rgblight_sethsv_noeeprom ( 90, 255, 255)
#define rgblight_sethsv_noeeprom_green() rgblight_sethsv_noeeprom (120, 255, 255)
#define rgblight_sethsv_noeeprom_springgreen() rgblight_sethsv_noeeprom (150, 255, 255)
#define rgblight_sethsv_noeeprom_turquoise() rgblight_sethsv_noeeprom (174, 90, 112)
#define rgblight_sethsv_noeeprom_teal() rgblight_sethsv_noeeprom (180, 255, 128)
#define rgblight_sethsv_noeeprom_cyan() rgblight_sethsv_noeeprom (180, 255, 255)
#define rgblight_sethsv_noeeprom_azure() rgblight_sethsv_noeeprom (186, 102, 255)
#define rgblight_sethsv_noeeprom_blue() rgblight_sethsv_noeeprom (240, 255, 255)
#define rgblight_sethsv_noeeprom_purple() rgblight_sethsv_noeeprom (270, 255, 255)
#define rgblight_sethsv_noeeprom_magenta() rgblight_sethsv_noeeprom (300, 255, 255)
#define rgblight_sethsv_noeeprom_pink() rgblight_sethsv_noeeprom (330, 128, 255)
/* SET HSV List */
#define rgblight_sethsv_white_at(at) rgblight_sethsv_at ( 0, 0, 255, at)
#define rgblight_sethsv_red_at(at) rgblight_sethsv_at ( 0, 255, 255, at)
#define rgblight_sethsv_coral_at(at) rgblight_sethsv_at ( 16, 176, 255, at)
#define rgblight_sethsv_orange_at(at) rgblight_sethsv_at ( 39, 255, 255, at)
#define rgblight_sethsv_goldenrod_at(at) rgblight_sethsv_at ( 43, 218, 218, at)
#define rgblight_sethsv_gold_at(at) rgblight_sethsv_at ( 51, 255, 255, at)
#define rgblight_sethsv_yellow_at(at) rgblight_sethsv_at ( 60, 255, 255, at)
#define rgblight_sethsv_chartreuse_at(at) rgblight_sethsv_at ( 90, 255, 255, at)
#define rgblight_sethsv_green_at(at) rgblight_sethsv_at (120, 255, 255, at)
#define rgblight_sethsv_springgreen_at(at) rgblight_sethsv_at (150, 255, 255, at)
#define rgblight_sethsv_turquoise_at(at) rgblight_sethsv_at (174, 90, 112, at)
#define rgblight_sethsv_teal_at(at) rgblight_sethsv_at (180, 255, 128, at)
#define rgblight_sethsv_cyan_at(at) rgblight_sethsv_at (180, 255, 255, at)
#define rgblight_sethsv_azure_at(at) rgblight_sethsv_at (186, 102, 255, at)
#define rgblight_sethsv_blue_at(at) rgblight_sethsv_at (240, 255, 255, at)
#define rgblight_sethsv_purple_at(at) rgblight_sethsv_at (270, 255, 255, at)
#define rgblight_sethsv_magenta_at(at) rgblight_sethsv_at (300, 255, 255, at)
#define rgblight_sethsv_pink_at(at) rgblight_sethsv_at (330, 128, 255, at)
#endif

View file

@ -1,5 +1,5 @@
/*
Copyright 2017 REPLACE_WITH_YOUR_NAME
Copyright 2018 REPLACE_WITH_YOUR_NAME
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
@ -48,7 +48,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
#define DIODE_DIRECTION COL2ROW
// #define BACKLIGHT_PIN B7
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3

View file

@ -1,4 +1,4 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
/* Copyright 2018 REPLACE_WITH_YOUR_NAME
*
* 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

View file

@ -1,4 +1,4 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
/* Copyright 2018 REPLACE_WITH_YOUR_NAME
*
* 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

View file

@ -1,4 +1,4 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
/* Copyright 2018 REPLACE_WITH_YOUR_NAME
*
* 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

View file

@ -1,4 +1,4 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
/* Copyright 2018 REPLACE_WITH_YOUR_NAME
*
* 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

View file

@ -1,4 +1,4 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
/* Copyright 2018 REPLACE_WITH_YOUR_NAME
*
* 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

View file

@ -1,4 +1,4 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
/* Copyright 2018 REPLACE_WITH_YOUR_NAME
*
* 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