This commit is contained in:
Jack Humbert 2018-12-13 12:52:36 -05:00
commit 255173f379
1749 changed files with 72396 additions and 12880 deletions

View file

@ -80,6 +80,9 @@ float startup_song[][2] = STARTUP_SONG;
static void gpt_cb8(GPTDriver *gptp);
#define DAC_BUFFER_SIZE 720
#ifndef DAC_SAMPLE_MAX
#define DAC_SAMPLE_MAX 65535U
#endif
#define START_CHANNEL_1() gptStart(&GPTD6, &gpt6cfg1); \
gptStartContinuous(&GPTD6, 2U)
@ -202,132 +205,16 @@ GPTConfig gpt8cfg1 = {
// squarewave
static const dacsample_t dac_buffer[DAC_BUFFER_SIZE] = {
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
// First half is max, second half is 0
[0 ... DAC_BUFFER_SIZE/2-1] = DAC_SAMPLE_MAX,
[DAC_BUFFER_SIZE/2 ... DAC_BUFFER_SIZE -1] = 0,
};
// squarewave
static const dacsample_t dac_buffer_2[DAC_BUFFER_SIZE] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047
// opposite of dac_buffer above
[0 ... DAC_BUFFER_SIZE/2-1] = 0,
[DAC_BUFFER_SIZE/2 ... DAC_BUFFER_SIZE -1] = DAC_SAMPLE_MAX,
};
/*
@ -363,7 +250,7 @@ static void error_cb1(DACDriver *dacp, dacerror_t err) {
}
static const DACConfig dac1cfg1 = {
.init = 2047U,
.init = DAC_SAMPLE_MAX,
.datamode = DAC_DHRM_12BIT_RIGHT
};
@ -375,7 +262,7 @@ static const DACConversionGroup dacgrpcfg1 = {
};
static const DACConfig dac1cfg2 = {
.init = 2047U,
.init = DAC_SAMPLE_MAX,
.datamode = DAC_DHRM_12BIT_RIGHT
};

View file

@ -472,4 +472,34 @@
H__NOTE(_AS4), W__NOTE(_GS4), W__NOTE(_GS4), W__NOTE(_FS4), W__NOTE(_GS4), \
H__NOTE(_AS4), WD_NOTE(_DS4)
#define RICK_ROLL \
Q__NOTE(_F4), \
Q__NOTE(_G4), \
Q__NOTE(_BF4), \
Q__NOTE(_G4), \
HD_NOTE(_D5), \
HD_NOTE(_D5), \
W__NOTE(_C5), \
S__NOTE(_REST), \
Q__NOTE(_F4), \
Q__NOTE(_G4), \
Q__NOTE(_BF4), \
Q__NOTE(_G4), \
HD_NOTE(_C5), \
HD_NOTE(_C5), \
W__NOTE(_BF4), \
S__NOTE(_REST), \
Q__NOTE(_F4), \
Q__NOTE(_G4), \
Q__NOTE(_BF4), \
Q__NOTE(_G4), \
W__NOTE(_BF4), \
H__NOTE(_C5), \
H__NOTE(_A4), \
H__NOTE(_A4), \
H__NOTE(_G4), \
H__NOTE(_F4), \
H__NOTE(_F4), \
W__NOTE(_C5), \
W__NOTE(_BF4),
#endif

View file

@ -1,4 +1,4 @@
/* Copyright 2015-2017 Jack Humbert
/* Copyright 2015-2018 Jack Humbert
*
* 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
@ -14,8 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONFIG_DEFINITIONS_H
#define CONFIG_DEFINITIONS_H
#pragma once
/* diode directions */
#define COL2ROW 0
@ -23,57 +22,108 @@
#define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */
#ifdef __AVR__
/* I/O pins */
#ifndef F0
#define B0 0x30
#define B1 0x31
#define B2 0x32
#define B3 0x33
#define B4 0x34
#define B5 0x35
#define B6 0x36
#define B7 0x37
#define C0 0x60
#define C1 0x61
#define C2 0x62
#define C3 0x63
#define C4 0x64
#define C5 0x65
#define C6 0x66
#define C7 0x67
#define D0 0x90
#define D1 0x91
#define D2 0x92
#define D3 0x93
#define D4 0x94
#define D5 0x95
#define D6 0x96
#define D7 0x97
#define E0 0xC0
#define E1 0xC1
#define E2 0xC2
#define E3 0xC3
#define E4 0xC4
#define E5 0xC5
#define E6 0xC6
#define E7 0xC7
#define F0 0xF0
#define F1 0xF1
#define F2 0xF2
#define F3 0xF3
#define F4 0xF4
#define F5 0xF5
#define F6 0xF6
#define F7 0xF7
#define A0 0x00
#define A1 0x01
#define A2 0x02
#define A3 0x03
#define A4 0x04
#define A5 0x05
#define A6 0x06
#define A7 0x07
#ifndef __ASSEMBLER__
#include <avr/io.h>
#endif
#define PORT_SHIFTER 4 // this may be 4 for all AVR chips
// If you want to add more to this list, reference the PINx definitions in these header
// files: https://github.com/vancegroup-mirrors/avr-libc/tree/master/avr-libc/include/avr
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
#define ADDRESS_BASE 0x00
#define PINB_ADDRESS 0x3
#define PINC_ADDRESS 0x6
#define PIND_ADDRESS 0x9
#define PINE_ADDRESS 0xC
#define PINF_ADDRESS 0xF
#elif defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__)
#define ADDRESS_BASE 0x00
#define PINB_ADDRESS 0x3
#define PINC_ADDRESS 0x6
#define PIND_ADDRESS 0x9
#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__)
#define ADDRESS_BASE 0x00
#define PINA_ADDRESS 0x0
#define PINB_ADDRESS 0x3
#define PINC_ADDRESS 0x6
#define PIND_ADDRESS 0x9
#define PINE_ADDRESS 0xC
#define PINF_ADDRESS 0xF
#elif defined(__AVR_ATmega32A__)
#define ADDRESS_BASE 0x10
#define PIND_ADDRESS 0x0
#define PINC_ADDRESS 0x3
#define PINB_ADDRESS 0x6
#define PINA_ADDRESS 0x9
#else
#error "Pins are not defined"
#endif
/* I/O pins */
#define PINDEF(port, pin) ((PIN##port##_ADDRESS << PORT_SHIFTER) | pin)
#ifdef PORTA
#define A0 PINDEF(A, 0)
#define A1 PINDEF(A, 1)
#define A2 PINDEF(A, 2)
#define A3 PINDEF(A, 3)
#define A4 PINDEF(A, 4)
#define A5 PINDEF(A, 5)
#define A6 PINDEF(A, 6)
#define A7 PINDEF(A, 7)
#endif
#ifdef PORTB
#define B0 PINDEF(B, 0)
#define B1 PINDEF(B, 1)
#define B2 PINDEF(B, 2)
#define B3 PINDEF(B, 3)
#define B4 PINDEF(B, 4)
#define B5 PINDEF(B, 5)
#define B6 PINDEF(B, 6)
#define B7 PINDEF(B, 7)
#endif
#ifdef PORTC
#define C0 PINDEF(C, 0)
#define C1 PINDEF(C, 1)
#define C2 PINDEF(C, 2)
#define C3 PINDEF(C, 3)
#define C4 PINDEF(C, 4)
#define C5 PINDEF(C, 5)
#define C6 PINDEF(C, 6)
#define C7 PINDEF(C, 7)
#endif
#ifdef PORTD
#define D0 PINDEF(D, 0)
#define D1 PINDEF(D, 1)
#define D2 PINDEF(D, 2)
#define D3 PINDEF(D, 3)
#define D4 PINDEF(D, 4)
#define D5 PINDEF(D, 5)
#define D6 PINDEF(D, 6)
#define D7 PINDEF(D, 7)
#endif
#ifdef PORTE
#define E0 PINDEF(E, 0)
#define E1 PINDEF(E, 1)
#define E2 PINDEF(E, 2)
#define E3 PINDEF(E, 3)
#define E4 PINDEF(E, 4)
#define E5 PINDEF(E, 5)
#define E6 PINDEF(E, 6)
#define E7 PINDEF(E, 7)
#endif
#ifdef PORTF
#define F0 PINDEF(F, 0)
#define F1 PINDEF(F, 1)
#define F2 PINDEF(F, 2)
#define F3 PINDEF(F, 3)
#define F4 PINDEF(F, 4)
#define F5 PINDEF(F, 5)
#define F6 PINDEF(F, 6)
#define F7 PINDEF(F, 7)
#endif
#elif defined(PROTOCOL_CHIBIOS)
#define A0 PAL_LINE(GPIOA, 0)
#define A1 PAL_LINE(GPIOA, 1)
@ -200,5 +250,3 @@
#define API_SYSEX_MAX_SIZE 32
#include "song_list.h"
#endif

View file

@ -18,7 +18,7 @@
#include "keymap.h" // to get keymaps[][][]
#include "tmk_core/common/eeprom.h"
#include "progmem.h" // to read default from flash
#include "quantum.h" // for send_string()
#include "dynamic_keymap.h"
#ifdef DYNAMIC_KEYMAP_ENABLE
@ -31,6 +31,23 @@
#error DYNAMIC_KEYMAP_LAYER_COUNT not defined
#endif
#ifndef DYNAMIC_KEYMAP_MACRO_COUNT
#error DYNAMIC_KEYMAP_MACRO_COUNT not defined
#endif
#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
#error DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR not defined
#endif
#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE
#error DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE not defined
#endif
uint8_t dynamic_keymap_get_layer_count(void)
{
return DYNAMIC_KEYMAP_LAYER_COUNT;
}
void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column)
{
// TODO: optimize this with some left shifts
@ -69,6 +86,36 @@ void dynamic_keymap_reset(void)
}
}
void dynamic_keymap_get_buffer( uint16_t offset, uint16_t size, uint8_t *data )
{
uint16_t dynamic_keymap_eeprom_size = DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2;
void *source = (void*)(DYNAMIC_KEYMAP_EEPROM_ADDR+offset);
uint8_t *target = data;
for ( uint16_t i = 0; i < size; i++ ) {
if ( offset + i < dynamic_keymap_eeprom_size ) {
*target = eeprom_read_byte(source);
} else {
*target = 0x00;
}
source++;
target++;
}
}
void dynamic_keymap_set_buffer( uint16_t offset, uint16_t size, uint8_t *data )
{
uint16_t dynamic_keymap_eeprom_size = DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2;
void *target = (void*)(DYNAMIC_KEYMAP_EEPROM_ADDR+offset);
uint8_t *source = data;
for ( uint16_t i = 0; i < size; i++ ) {
if ( offset + i < dynamic_keymap_eeprom_size ) {
eeprom_update_byte(target, *source);
}
source++;
target++;
}
}
// This overrides the one in quantum/keymap_common.c
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
@ -81,5 +128,103 @@ uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
}
}
uint8_t dynamic_keymap_macro_get_count(void)
{
return DYNAMIC_KEYMAP_MACRO_COUNT;
}
uint16_t dynamic_keymap_macro_get_buffer_size(void)
{
return DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE;
}
void dynamic_keymap_macro_get_buffer( uint16_t offset, uint16_t size, uint8_t *data )
{
void *source = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR+offset);
uint8_t *target = data;
for ( uint16_t i = 0; i < size; i++ ) {
if ( offset + i < DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE ) {
*target = eeprom_read_byte(source);
} else {
*target = 0x00;
}
source++;
target++;
}
}
void dynamic_keymap_macro_set_buffer( uint16_t offset, uint16_t size, uint8_t *data )
{
void *target = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR+offset);
uint8_t *source = data;
for ( uint16_t i = 0; i < size; i++ ) {
if ( offset + i < DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE ) {
eeprom_update_byte(target, *source);
}
source++;
target++;
}
}
void dynamic_keymap_macro_reset(void)
{
void *p = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR);
void *end = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR+DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE);
while ( p != end ) {
eeprom_update_byte(p, 0);
++p;
}
}
void dynamic_keymap_macro_send( uint8_t id )
{
if ( id >= DYNAMIC_KEYMAP_MACRO_COUNT ) {
return;
}
// Check the last byte of the buffer.
// If it's not zero, then we are in the middle
// of buffer writing, possibly an aborted buffer
// write. So do nothing.
void *p = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR+DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE-1);
if ( eeprom_read_byte(p) != 0 ) {
return;
}
// Skip N null characters
// p will then point to the Nth macro
p = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR);
void *end = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR+DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE);
while ( id > 0 ) {
// If we are past the end of the buffer, then the buffer
// contents are garbage, i.e. there were not DYNAMIC_KEYMAP_MACRO_COUNT
// nulls in the buffer.
if ( p == end ) {
return;
}
if ( eeprom_read_byte(p) == 0 ) {
--id;
}
++p;
}
// Send the macro string one char at a time
// by making temporary 1 char strings
char data[2] = { 0, 0 };
// We already checked there was a null at the end of
// the buffer, so this cannot go past the end
while ( 1 ) {
data[0] = eeprom_read_byte(p);
// Stop at the null terminator of this macro string
if ( data[0] == 0 ) {
break;
}
send_string(data);
++p;
}
}
#endif // DYNAMIC_KEYMAP_ENABLE

View file

@ -18,11 +18,46 @@
#include <stdint.h>
#include <stdbool.h>
uint8_t dynamic_keymap_get_layer_count(void);
void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column);
uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column);
void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode);
void dynamic_keymap_reset(void);
// These get/set the keycodes as stored in the EEPROM buffer
// Data is big-endian 16-bit values (the keycodes)
// Order is by layer/row/column
// Thus offset 0 = 0,0,0, offset MATRIX_COLS*2 = 0,1,0, offset MATRIX_ROWS*MATRIX_COLS*2 = 1,0,0
// Note the *2, because offset is in bytes and keycodes are two bytes
// This is only really useful for host applications that want to get a whole keymap fast,
// by reading 14 keycodes (28 bytes) at a time, reducing the number of raw HID transfers by
// a factor of 14.
void dynamic_keymap_get_buffer( uint16_t offset, uint16_t size, uint8_t *data );
void dynamic_keymap_set_buffer( uint16_t offset, uint16_t size, uint8_t *data );
// This overrides the one in quantum/keymap_common.c
// uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
// Note regarding dynamic_keymap_macro_set_buffer():
// The last byte of the buffer is used as a valid flag,
// so macro sending is disabled during writing a new buffer,
// should it happen during, or after an interrupted transfer.
//
// Users writing to the buffer must first set the last byte of the buffer
// to non-zero (i.e. 0xFF). After (or during) the final write, set the
// last byte of the buffer to zero.
//
// Since the contents of the buffer must be a list of null terminated
// strings, the last byte must be a null when at maximum capacity,
// and it not being null means the buffer can be considered in an
// invalid state.
uint8_t dynamic_keymap_macro_get_count(void);
uint16_t dynamic_keymap_macro_get_buffer_size(void);
void dynamic_keymap_macro_get_buffer( uint16_t offset, uint16_t size, uint8_t *data );
void dynamic_keymap_macro_set_buffer( uint16_t offset, uint16_t size, uint8_t *data );
void dynamic_keymap_macro_reset(void);
void dynamic_keymap_macro_send( uint8_t id );

70
quantum/encoder.c Normal file
View file

@ -0,0 +1,70 @@
/*
* Copyright 2018 Jack Humbert <jack.humb@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/>.
*/
#include "encoder.h"
#ifndef ENCODER_RESOLUTION
#define ENCODER_RESOLUTION 4
#endif
#ifndef NUMBER_OF_ENCODERS
#error "Number of encoders not defined by NUMBER_OF_ENCODERS"
#endif
#if !defined(ENCODERS_PAD_A) || !defined(ENCODERS_PAD_B)
#error "No encoder pads defined by ENCODERS_PAD_A and ENCODERS_PAD_B"
#endif
static pin_t encoders_pad_a[NUMBER_OF_ENCODERS] = ENCODERS_PAD_A;
static pin_t encoders_pad_b[NUMBER_OF_ENCODERS] = ENCODERS_PAD_B;
static int8_t encoder_LUT[] = { 0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0 };
static uint8_t encoder_state[NUMBER_OF_ENCODERS] = {0};
static int8_t encoder_value[NUMBER_OF_ENCODERS] = {0};
__attribute__ ((weak))
void encoder_update_user(int8_t index, bool clockwise) { }
__attribute__ ((weak))
void encoder_update_kb(int8_t index, bool clockwise) {
encoder_update_user(index, clockwise);
}
void encoder_init(void) {
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
setPinInputHigh(encoders_pad_a[i]);
setPinInputHigh(encoders_pad_b[i]);
encoder_state[i] = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
}
}
void encoder_read(void) {
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
encoder_state[i] <<= 2;
encoder_state[i] |= (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
encoder_value[i] += encoder_LUT[encoder_state[i] & 0xF];
if (encoder_value[i] >= ENCODER_RESOLUTION) {
encoder_update_kb(i, COUNTRECLOCKWISE);
}
if (encoder_value[i] <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise
encoder_update_kb(i, CLOCKWISE);
}
encoder_value[i] %= ENCODER_RESOLUTION;
}
}

29
quantum/encoder.h Normal file
View file

@ -0,0 +1,29 @@
/*
* Copyright 2018 Jack Humbert <jack.humb@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/>.
*/
#pragma once
#include "quantum.h"
#define COUNTRECLOCKWISE 0
#define CLOCKWISE 1
void encoder_init(void);
void encoder_read(void);
void encoder_update_kb(int8_t index, bool clockwise);
void encoder_update_user(int8_t index, bool clockwise);

View file

@ -64,7 +64,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode));
break;
case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
case KC_AUDIO_MUTE ... KC_BRIGHTNESS_DOWN:
action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
break;
case KC_MS_UP ... KC_MS_ACCEL2:

View file

@ -22,10 +22,7 @@
#define BE_LALT KC_LGUI
// Alt gr
#ifndef ALGR
#define ALGR(kc) RALT(kc)
#endif
#define NO_ALGR KC_RALT
#define BE_ALGR KC_RALT
// Normal characters
// Line 1

View file

@ -21,10 +21,7 @@
// Alt gr
#ifndef ALTGR
#define ALTGR(kc) RALT(kc)
#endif
#ifndef ALGR
#define ALGR(kc) ALTGR(kc)
#define ALTGR(kc) ALGR(kc)
#endif
#define BP_ALGR KC_RALT

View file

@ -20,10 +20,7 @@
// Alt gr
#ifndef ALTGR
#define ALTGR(kc) RALT(kc)
#endif
#ifndef ALGR
#define ALGR(kc) ALTGR(kc)
#define ALTGR(kc) ALGR(kc)
#endif
#define CSA_ALTGR KC_RALT

View file

@ -19,7 +19,6 @@
#include "keymap.h"
// Alt gr
#define ALGR(kc) RALT(kc)
#define FR_CH_ALGR KC_RALT
// normal characters

View file

@ -19,10 +19,7 @@
#include "keymap.h"
// Alt gr
#ifndef ALGR
#define ALGR(kc) RALT(kc)
#endif
#define NO_ALGR KC_RALT
#define FR_ALGR KC_RALT
// Normal characters
#define FR_SUP2 KC_GRV

View file

@ -20,7 +20,6 @@
#include "keymap.h"
// Alt gr
#define ALGR(kc) RALT(kc)
#define DE_ALGR KC_RALT
// normal characters

View file

@ -19,7 +19,6 @@
#include "keymap.h"
// Alt gr
#define ALGR(kc) RALT(kc)
#define CH_ALGR KC_RALT
// normal characters

View file

@ -20,7 +20,6 @@
#include "keymap.h"
// Alt gr
#define ALGR(kc) RALT(kc)
#define HU_ALGR KC_RALT
// basic letters

View file

@ -20,7 +20,6 @@
#include "keymap.h"
// Alt gr
#define ALGR(kc) RALT(kc)
#define IT_ALGR KC_RALT
// normal characters

View file

@ -19,7 +19,6 @@
#include "keymap.h"
// Alt gr
#define ALGR(kc) RALT(kc)
#define NO_ALGR KC_RALT
// Normal characters

View file

@ -0,0 +1,47 @@
/* Copyright 2016 James Kay
*
* 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 KEYMAP_PLOVER_DVORAK_H
#define KEYMAP_PLOVER_DVORAK_H
#include "keymap_dvorak.h"
#define PD_NUM DV_1
#define PD_LS DV_Q
#define PD_LT DV_W
#define PD_LP DV_E
#define PD_LH DV_R
#define PD_LK DV_S
#define PD_LW DV_D
#define PD_LR DV_F
#define PD_STAR DV_Y
#define PD_RF DV_U
#define PD_RP DV_I
#define PD_RL DV_O
#define PD_RT DV_P
#define PD_RD DV_LBRC
#define PD_RR DV_J
#define PD_RB DV_K
#define PD_RG DV_L
#define PD_RS DV_SCLN
#define PD_RZ DV_QUOT
#define PD_A DV_C
#define PD_O DV_V
#define PD_E DV_N
#define PD_U DV_M
#endif

View file

@ -1,4 +1,5 @@
/* Copyright 2018 Žan Pevec
*
* 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
@ -16,8 +17,11 @@
#ifndef KEYMAP_SLOVENIAN
#define KEYMAP_SLOVENIAN
#include "keymap.h"
// Alt gr
#define SI_ALGR KC_RALT
//Swapped Z and Y
#define SI_Z KC_Y
@ -89,18 +93,18 @@
#define SI_UNDS LSFT(SI_MINS) // _
// Alt Gr-ed characters
#define SI_CIRC ALTG(KC_3) // ^
#define SI_DEG ALTG(KC_5) // °
#define SI_GRV ALTG(KC_7) // `
#define SI_ACCU ALTG(KC_9) // ´
#define SI_LCBR ALTG(KC_B) // {
#define SI_RCBR ALTG(KC_N) // }
#define SI_LBRC ALTG(KC_F) // [
#define SI_RBRC ALTG(KC_G) // ]
#define SI_BSLS ALTG(KC_Q) // backslash
#define SI_AT ALTG(KC_V) // @
#define SI_EURO ALTG(KC_E) // €
#define SI_TILD ALTG(KC_1) // ~
#define SI_PIPE ALTG(KC_W) // |
#define SI_CIRC ALGR(KC_3) // ^
#define SI_DEG ALGR(KC_5) // °
#define SI_GRV ALGR(KC_7) // `
#define SI_ACCU ALGR(KC_9) // ´
#define SI_LCBR ALGR(KC_B) // {
#define SI_RCBR ALGR(KC_N) // }
#define SI_LBRC ALGR(KC_F) // [
#define SI_RBRC ALGR(KC_G) // ]
#define SI_BSLS ALGR(KC_Q) // backslash
#define SI_AT ALGR(KC_V) // @
#define SI_EURO ALGR(KC_E) // €
#define SI_TILD ALGR(KC_1) // ~
#define SI_PIPE ALGR(KC_W) // |
#endif

View file

@ -19,8 +19,7 @@
#include "keymap.h"
// Alt gr
#define ALGR(kc) RALT(kc)
#define NO_ALGR KC_RALT
#define ES_ALGR KC_RALT
// Normal characters
#define ES_OVRR KC_GRV

View file

@ -19,8 +19,7 @@
#include "keymap.h"
// Alt gr
#define ALGR(kc) RALT(kc)
#define NO_ALGR KC_RALT
#define UK_ALGR KC_RALT
// Normal characters
#define UK_HASH KC_NUHS

View file

@ -93,6 +93,8 @@ void register_ucis(const char *hex) {
}
bool process_ucis (uint16_t keycode, keyrecord_t *record) {
uint8_t i;
unicode_input_mode_init();
if (!qk_ucis_state.in_progress)
@ -122,7 +124,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) {
if (keycode == KC_ENT || keycode == KC_SPC || keycode == KC_ESC) {
bool symbol_found = false;
for (uint8_t i = qk_ucis_state.count; i > 0; i--) {
for (i = qk_ucis_state.count; i > 0; i--) {
register_code (KC_BSPC);
unregister_code (KC_BSPC);
wait_ms(UNICODE_TYPE_DELAY);
@ -134,7 +136,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) {
}
unicode_input_start();
for (uint8_t i = 0; ucis_symbol_table[i].symbol; i++) {
for (i = 0; ucis_symbol_table[i].symbol; i++) {
if (is_uni_seq (ucis_symbol_table[i].symbol)) {
symbol_found = true;
register_ucis(ucis_symbol_table[i].code + 2);

View file

@ -42,6 +42,11 @@ extern backlight_config_t backlight_config;
#include "process_midi.h"
#endif
#ifdef ENCODER_ENABLE
#include "encoder.h"
#endif
#ifdef AUDIO_ENABLE
#ifndef GOODBYE_SONG
#define GOODBYE_SONG SONG(GOODBYE_SOUND)
@ -293,6 +298,11 @@ bool process_record_quantum(keyrecord_t *record) {
print("DEBUG: enabled.\n");
}
return false;
case EEPROM_RESET:
if (record->event.pressed) {
eeconfig_init();
}
return false;
#ifdef FAUXCLICKY_ENABLE
case FC_TOG:
if (record->event.pressed) {
@ -944,8 +954,40 @@ void tap_random_base64(void) {
}
}
__attribute__((weak))
void bootmagic_lite(void) {
// The lite version of TMK's bootmagic based on Wilba.
// 100% less potential for accidentally making the
// keyboard do stupid things.
// We need multiple scans because debouncing can't be turned off.
matrix_scan();
#if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0
wait_ms(DEBOUNCING_DELAY * 2);
#elif defined(DEBOUNCE) && DEBOUNCE > 0
wait_ms(DEBOUNCE * 2);
#else
wait_ms(30);
#endif
matrix_scan();
// If the Esc and space bar are held down on power up,
// reset the EEPROM valid state and jump to bootloader.
// Assumes Esc is at [0,0].
// This isn't very generalized, but we need something that doesn't
// rely on user's keymaps in firmware or EEPROM.
if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
eeconfig_disable();
// Jump to bootloader.
bootloader_jump();
}
}
void matrix_init_quantum() {
if (!eeconfig_is_enabled() && !eeconfig_is_disabled()) {
#ifdef BOOTMAGIC_LITE
bootmagic_lite();
#endif
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
#ifdef BACKLIGHT_ENABLE
@ -957,6 +999,9 @@ void matrix_init_quantum() {
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_init();
#endif
#ifdef ENCODER_ENABLE
encoder_init();
#endif
matrix_init_kb();
}
@ -991,6 +1036,10 @@ void matrix_scan_quantum() {
rgb_matrix_task_counter = ((rgb_matrix_task_counter + 1) % (RGB_MATRIX_SKIP_FRAMES + 1));
#endif
#ifdef ENCODER_ENABLE
encoder_read();
#endif
matrix_scan_kb();
}
#if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN)

View file

@ -140,26 +140,28 @@ extern uint32_t default_layer_state;
//Function substitutions to ease GPIO manipulation
#ifdef __AVR__
#define PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset)
#define pin_t uint8_t
#define setPinInput(pin) _SFR_IO8((pin >> 4) + 1) &= ~ _BV(pin & 0xF)
#define setPinInput(pin) PIN_ADDRESS(pin, 1) &= ~ _BV(pin & 0xF)
#define setPinInputHigh(pin) ({\
_SFR_IO8((pin >> 4) + 1) &= ~ _BV(pin & 0xF);\
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF);\
PIN_ADDRESS(pin, 1) &= ~ _BV(pin & 0xF);\
PIN_ADDRESS(pin, 2) |= _BV(pin & 0xF);\
})
#define setPinInputLow(pin) _Static_assert(0, "AVR Processors cannot impliment an input as pull low")
#define setPinOutput(pin) _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF)
#define setPinOutput(pin) PIN_ADDRESS(pin, 1) |= _BV(pin & 0xF)
#define writePinHigh(pin) _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF)
#define writePinLow(pin) _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF)
#define writePinHigh(pin) PIN_ADDRESS(pin, 2) |= _BV(pin & 0xF)
#define writePinLow(pin) PIN_ADDRESS(pin, 2) &= ~_BV(pin & 0xF)
static inline void writePin(pin_t pin, uint8_t level){
if (level){
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF);
PIN_ADDRESS(pin, 2) |= _BV(pin & 0xF);
} else {
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF);
PIN_ADDRESS(pin, 2) &= ~_BV(pin & 0xF);
}
}
#define readPin(pin) (_SFR_IO8(pin >> 4) & _BV(pin & 0xF))
#define readPin(pin) (PIN_ADDRESS(pin, 0) & _BV(pin & 0xF))
#elif defined(PROTOCOL_CHIBIOS)
#define pin_t ioline_t
#define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT)
@ -195,6 +197,7 @@ extern uint32_t default_layer_state;
#define SS_LALT(string) SS_DOWN(X_LALT) string SS_UP(X_LALT)
#define SS_LSFT(string) SS_DOWN(X_LSHIFT) string SS_UP(X_LSHIFT)
#define SS_RALT(string) SS_DOWN(X_RALT) string SS_UP(X_RALT)
#define SS_ALGR(string) SS_RALT(string)
#define SEND_STRING(str) send_string_P(PSTR(str))
extern const bool ascii_to_shift_lut[0x80];
@ -224,13 +227,23 @@ bool process_action_kb(keyrecord_t *record);
bool process_record_kb(uint16_t keycode, keyrecord_t *record);
bool process_record_user(uint16_t keycode, keyrecord_t *record);
#ifndef BOOTMAGIC_LITE_COLUMN
#define BOOTMAGIC_LITE_COLUMN 0
#endif
#ifndef BOOTMAGIC_LITE_ROW
#define BOOTMAGIC_LITE_ROW 0
#endif
void bootmagic_lite(void);
void reset_keyboard(void);
void startup_user(void);
void shutdown_user(void);
void register_code16 (uint16_t code);
void unregister_code16 (uint16_t code);
void register_code16(uint16_t code);
void unregister_code16(uint16_t code);
inline void tap_code16(uint16_t code) { register_code16(code); unregister_code16(code); }
#ifdef BACKLIGHT_ENABLE
void backlight_init_ports(void);

View file

@ -454,6 +454,8 @@ enum quantum_keycodes {
TERM_OFF,
#endif
EEPROM_RESET,
// always leave at the end
SAFE_RANGE
};
@ -468,6 +470,7 @@ enum quantum_keycodes {
#define RCTL(kc) (QK_RCTL | (kc))
#define RSFT(kc) (QK_RSFT | (kc))
#define RALT(kc) (QK_RALT | (kc))
#define ALGR(kc) RALT(kc)
#define RGUI(kc) (QK_RGUI | (kc))
#define RCMD(kc) RGUI(kc)
#define RWIN(kc) RGUI(kc)
@ -475,11 +478,10 @@ enum quantum_keycodes {
#define HYPR(kc) (QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI | (kc))
#define MEH(kc) (QK_LCTL | QK_LSFT | QK_LALT | (kc))
#define LCAG(kc) (QK_LCTL | QK_LALT | QK_LGUI | (kc))
#define ALTG(kc) (QK_RCTL | QK_RALT | (kc))
#define SGUI(kc) (QK_LGUI | QK_LSFT | (kc))
#define SCMD(kc) SGUI(kc)
#define SWIN(kc) SGUI(kc)
#define LCA(kc) (QK_LCTL | QK_LALT | (kc))
#define LCA(kc) (QK_LCTL | QK_LALT | (kc))
#define MOD_HYPR 0xf
#define MOD_MEH 0x7
@ -570,6 +572,8 @@ enum quantum_keycodes {
#define KC_GESC GRAVE_ESC
#define EEP_RST EEPROM_RESET
#define CK_TOGG CLICKY_TOGGLE
#define CK_RST CLICKY_RESET
#define CK_UP CLICKY_UP
@ -578,7 +582,6 @@ enum quantum_keycodes {
#define CK_OFF CLICKY_DISABLE
#define RGB_MOD RGB_MODE_FORWARD
#define RGB_SMOD RGB_MODE_FORWARD
#define RGB_RMOD RGB_MODE_REVERSE
#define RGB_M_P RGB_MODE_PLAIN
@ -643,7 +646,7 @@ enum quantum_keycodes {
#define ALT_T(kc) MT(MOD_LALT, kc)
#define LALT_T(kc) MT(MOD_LALT, kc)
#define RALT_T(kc) MT(MOD_RALT, kc)
#define ALGR_T(kc) MT(MOD_RALT, kc) // dual-function AltGR
#define ALGR_T(kc) RALT_T(kc)
#define GUI_T(kc) MT(MOD_LGUI, kc)
#define CMD_T(kc) GUI_T(kc)

View file

@ -55,6 +55,10 @@ rgb_config_t rgb_matrix_config;
#define RGB_DIGITAL_RAIN_DROPS 24
#endif
#if !defined(DISABLE_RGB_MATRIX_RAINDROPS) || !defined(DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS) || !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN)
#define TRACK_PREVIOUS_EFFECT
#endif
bool g_suspend_state = false;
// Global tick at 20 Hz
@ -79,7 +83,12 @@ void eeconfig_update_rgb_matrix(uint32_t val) {
void eeconfig_update_rgb_matrix_default(void) {
dprintf("eeconfig_update_rgb_matrix_default\n");
rgb_matrix_config.enable = 1;
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
rgb_matrix_config.mode = RGB_MATRIX_CYCLE_LEFT_RIGHT;
#else
// fallback to solid colors if RGB_MATRIX_CYCLE_LEFT_RIGHT is disabled in userspace
rgb_matrix_config.mode = RGB_MATRIX_SOLID_COLOR;
#endif
rgb_matrix_config.hue = 0;
rgb_matrix_config.sat = 255;
rgb_matrix_config.val = RGB_MATRIX_MAXIMUM_BRIGHTNESS;
@ -499,7 +508,7 @@ void rgb_matrix_digital_rain( const bool initialize ) {
map_row_column_to_led(row, col, &led, &led_count);
if (map[col][row] > pure_green_intensity) {
const uint8_t boost = (uint8_t) ((uint16_t) max_brightness_boost
const uint8_t boost = (uint8_t) ((uint16_t) max_brightness_boost
* (map[col][row] - pure_green_intensity) / (max_intensity - pure_green_intensity));
rgb_matrix_set_color(led, boost, max_intensity, boost);
}
@ -618,12 +627,16 @@ void rgb_matrix_custom(void) {
}
void rgb_matrix_task(void) {
static uint8_t toggle_enable_last = 255;
#ifdef TRACK_PREVIOUS_EFFECT
static uint8_t toggle_enable_last = 255;
#endif
if (!rgb_matrix_config.enable) {
rgb_matrix_all_off();
rgb_matrix_indicators();
toggle_enable_last = rgb_matrix_config.enable;
return;
rgb_matrix_all_off();
rgb_matrix_indicators();
#ifdef TRACK_PREVIOUS_EFFECT
toggle_enable_last = rgb_matrix_config.enable;
#endif
return;
}
// delay 1 second before driving LEDs or doing anything else
static uint8_t startup_tick = 0;
@ -658,13 +671,16 @@ void rgb_matrix_task(void) {
(RGB_DISABLE_AFTER_TIMEOUT > 0 && g_any_key_hit > RGB_DISABLE_AFTER_TIMEOUT * 60 * 20));
uint8_t effect = suspend_backlight ? 0 : rgb_matrix_config.mode;
// Keep track of the effect used last time,
// detect change in effect, so each effect can
// have an optional initialization.
static uint8_t effect_last = 255;
bool initialize = (effect != effect_last) || (rgb_matrix_config.enable != toggle_enable_last);
effect_last = effect;
toggle_enable_last = rgb_matrix_config.enable;
#ifdef TRACK_PREVIOUS_EFFECT
// Keep track of the effect used last time,
// detect change in effect, so each effect can
// have an optional initialization.
static uint8_t effect_last = 255;
bool initialize = (effect != effect_last) || (rgb_matrix_config.enable != toggle_enable_last);
effect_last = effect;
toggle_enable_last = rgb_matrix_config.enable;
#endif
// this gets ticked at 20 Hz.
// each effect can opt to do calculations
@ -673,58 +689,92 @@ void rgb_matrix_task(void) {
case RGB_MATRIX_SOLID_COLOR:
rgb_matrix_solid_color();
break;
case RGB_MATRIX_ALPHAS_MODS:
rgb_matrix_alphas_mods();
break;
case RGB_MATRIX_DUAL_BEACON:
rgb_matrix_dual_beacon();
break;
case RGB_MATRIX_GRADIENT_UP_DOWN:
rgb_matrix_gradient_up_down();
break;
case RGB_MATRIX_RAINDROPS:
rgb_matrix_raindrops( initialize );
break;
case RGB_MATRIX_CYCLE_ALL:
rgb_matrix_cycle_all();
break;
case RGB_MATRIX_CYCLE_LEFT_RIGHT:
rgb_matrix_cycle_left_right();
break;
case RGB_MATRIX_CYCLE_UP_DOWN:
rgb_matrix_cycle_up_down();
break;
case RGB_MATRIX_RAINBOW_BEACON:
rgb_matrix_rainbow_beacon();
break;
case RGB_MATRIX_RAINBOW_PINWHEELS:
rgb_matrix_rainbow_pinwheels();
break;
case RGB_MATRIX_RAINBOW_MOVING_CHEVRON:
rgb_matrix_rainbow_moving_chevron();
break;
case RGB_MATRIX_JELLYBEAN_RAINDROPS:
rgb_matrix_jellybean_raindrops( initialize );
break;
case RGB_MATRIX_DIGITAL_RAIN:
rgb_matrix_digital_rain( initialize );
break;
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
case RGB_MATRIX_ALPHAS_MODS:
rgb_matrix_alphas_mods();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
case RGB_MATRIX_DUAL_BEACON:
rgb_matrix_dual_beacon();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
case RGB_MATRIX_GRADIENT_UP_DOWN:
rgb_matrix_gradient_up_down();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_RAINDROPS
case RGB_MATRIX_RAINDROPS:
rgb_matrix_raindrops( initialize );
break;
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
case RGB_MATRIX_CYCLE_ALL:
rgb_matrix_cycle_all();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
case RGB_MATRIX_CYCLE_LEFT_RIGHT:
rgb_matrix_cycle_left_right();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
case RGB_MATRIX_CYCLE_UP_DOWN:
rgb_matrix_cycle_up_down();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
case RGB_MATRIX_RAINBOW_BEACON:
rgb_matrix_rainbow_beacon();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
case RGB_MATRIX_RAINBOW_PINWHEELS:
rgb_matrix_rainbow_pinwheels();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
case RGB_MATRIX_RAINBOW_MOVING_CHEVRON:
rgb_matrix_rainbow_moving_chevron();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
case RGB_MATRIX_JELLYBEAN_RAINDROPS:
rgb_matrix_jellybean_raindrops( initialize );
break;
#endif
#ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
case RGB_MATRIX_DIGITAL_RAIN:
rgb_matrix_digital_rain( initialize );
break;
#endif
#ifdef RGB_MATRIX_KEYPRESSES
case RGB_MATRIX_SOLID_REACTIVE:
rgb_matrix_solid_reactive();
break;
case RGB_MATRIX_SPLASH:
rgb_matrix_splash();
break;
case RGB_MATRIX_MULTISPLASH:
rgb_matrix_multisplash();
break;
case RGB_MATRIX_SOLID_SPLASH:
rgb_matrix_solid_splash();
break;
case RGB_MATRIX_SOLID_MULTISPLASH:
rgb_matrix_solid_multisplash();
break;
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
case RGB_MATRIX_SOLID_REACTIVE:
rgb_matrix_solid_reactive();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_SPLASH
case RGB_MATRIX_SPLASH:
rgb_matrix_splash();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_MULTISPLASH
case RGB_MATRIX_MULTISPLASH:
rgb_matrix_multisplash();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
case RGB_MATRIX_SOLID_SPLASH:
rgb_matrix_solid_splash();
break;
#endif
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
case RGB_MATRIX_SOLID_MULTISPLASH:
rgb_matrix_solid_multisplash();
break;
#endif
#endif
default:
rgb_matrix_custom();
@ -792,13 +842,13 @@ void rgb_matrix_init(void) {
}
// Deals with the messy details of incrementing an integer
uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
static uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
int16_t new_value = value;
new_value += step;
return MIN( MAX( new_value, min ), max );
}
uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
static uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
int16_t new_value = value;
new_value -= step;
return MIN( MAX( new_value, min ), max );
@ -837,77 +887,105 @@ uint32_t rgb_matrix_get_tick(void) {
return g_tick;
}
void rgblight_toggle(void) {
void rgb_matrix_toggle(void) {
rgb_matrix_config.enable ^= 1;
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgblight_step(void) {
void rgb_matrix_enable(void) {
rgb_matrix_config.enable = 1;
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgb_matrix_enable_noeeprom(void) {
rgb_matrix_config.enable = 1;
}
void rgb_matrix_disable(void) {
rgb_matrix_config.enable = 0;
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgb_matrix_disable_noeeprom(void) {
rgb_matrix_config.enable = 0;
}
void rgb_matrix_step(void) {
rgb_matrix_config.mode++;
if (rgb_matrix_config.mode >= RGB_MATRIX_EFFECT_MAX)
rgb_matrix_config.mode = 1;
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgblight_step_reverse(void) {
void rgb_matrix_step_reverse(void) {
rgb_matrix_config.mode--;
if (rgb_matrix_config.mode < 1)
rgb_matrix_config.mode = RGB_MATRIX_EFFECT_MAX - 1;
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgblight_increase_hue(void) {
void rgb_matrix_increase_hue(void) {
rgb_matrix_config.hue = increment( rgb_matrix_config.hue, 8, 0, 255 );
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgblight_decrease_hue(void) {
void rgb_matrix_decrease_hue(void) {
rgb_matrix_config.hue = decrement( rgb_matrix_config.hue, 8, 0, 255 );
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgblight_increase_sat(void) {
void rgb_matrix_increase_sat(void) {
rgb_matrix_config.sat = increment( rgb_matrix_config.sat, 8, 0, 255 );
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgblight_decrease_sat(void) {
void rgb_matrix_decrease_sat(void) {
rgb_matrix_config.sat = decrement( rgb_matrix_config.sat, 8, 0, 255 );
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgblight_increase_val(void) {
void rgb_matrix_increase_val(void) {
rgb_matrix_config.val = increment( rgb_matrix_config.val, 8, 0, RGB_MATRIX_MAXIMUM_BRIGHTNESS );
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgblight_decrease_val(void) {
void rgb_matrix_decrease_val(void) {
rgb_matrix_config.val = decrement( rgb_matrix_config.val, 8, 0, RGB_MATRIX_MAXIMUM_BRIGHTNESS );
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgblight_increase_speed(void) {
void rgb_matrix_increase_speed(void) {
rgb_matrix_config.speed = increment( rgb_matrix_config.speed, 1, 0, 3 );
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this
}
void rgblight_decrease_speed(void) {
void rgb_matrix_decrease_speed(void) {
rgb_matrix_config.speed = decrement( rgb_matrix_config.speed, 1, 0, 3 );
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this
}
void rgblight_mode(uint8_t mode) {
void rgb_matrix_mode(uint8_t mode) {
rgb_matrix_config.mode = mode;
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
uint32_t rgblight_get_mode(void) {
void rgb_matrix_mode_noeeprom(uint8_t mode) {
rgb_matrix_config.mode = mode;
}
uint32_t rgb_matrix_get_mode(void) {
return rgb_matrix_config.mode;
}
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
rgb_matrix_config.hue = hue;
rgb_matrix_config.sat = sat;
rgb_matrix_config.val = val;
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
rgb_matrix_config.hue = hue;
rgb_matrix_config.sat = sat;
rgb_matrix_config.val = val;
}

View file

@ -70,29 +70,64 @@ typedef union {
enum rgb_matrix_effects {
RGB_MATRIX_SOLID_COLOR = 1,
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
RGB_MATRIX_ALPHAS_MODS,
#endif
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
RGB_MATRIX_DUAL_BEACON,
#endif
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
RGB_MATRIX_GRADIENT_UP_DOWN,
#endif
#ifndef DISABLE_RGB_MATRIX_RAINDROPS
RGB_MATRIX_RAINDROPS,
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
RGB_MATRIX_CYCLE_ALL,
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
RGB_MATRIX_CYCLE_LEFT_RIGHT,
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
RGB_MATRIX_CYCLE_UP_DOWN,
#endif
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
RGB_MATRIX_RAINBOW_BEACON,
#endif
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
RGB_MATRIX_RAINBOW_PINWHEELS,
#endif
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
RGB_MATRIX_RAINBOW_MOVING_CHEVRON,
#endif
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
RGB_MATRIX_JELLYBEAN_RAINDROPS,
#endif
#ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
RGB_MATRIX_DIGITAL_RAIN,
#endif
#ifdef RGB_MATRIX_KEYPRESSES
RGB_MATRIX_SOLID_REACTIVE,
RGB_MATRIX_SPLASH,
RGB_MATRIX_MULTISPLASH,
RGB_MATRIX_SOLID_SPLASH,
RGB_MATRIX_SOLID_MULTISPLASH,
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
RGB_MATRIX_SOLID_REACTIVE,
#endif
#ifndef DISABLE_RGB_MATRIX_SPLASH
RGB_MATRIX_SPLASH,
#endif
#ifndef DISABLE_RGB_MATRIX_MULTISPLASH
RGB_MATRIX_MULTISPLASH,
#endif
#ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
RGB_MATRIX_SOLID_SPLASH,
#endif
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
RGB_MATRIX_SOLID_MULTISPLASH,
#endif
#endif
RGB_MATRIX_EFFECT_MAX
};
void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
// This runs after another backlight effect and replaces
// colors already set
@ -126,20 +161,50 @@ void rgb_matrix_decrease(void);
uint32_t rgb_matrix_get_tick(void);
void rgblight_toggle(void);
void rgblight_step(void);
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
void rgblight_step_reverse(void);
void rgblight_increase_hue(void);
void rgblight_decrease_hue(void);
void rgblight_increase_sat(void);
void rgblight_decrease_sat(void);
void rgblight_increase_val(void);
void rgblight_decrease_val(void);
void rgblight_increase_speed(void);
void rgblight_decrease_speed(void);
void rgblight_mode(uint8_t mode);
uint32_t rgblight_get_mode(void);
void rgb_matrix_toggle(void);
void rgb_matrix_enable(void);
void rgb_matrix_enable_noeeprom(void);
void rgb_matrix_disable(void);
void rgb_matrix_disable_noeeprom(void);
void rgb_matrix_step(void);
void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
void rgb_matrix_step_reverse(void);
void rgb_matrix_increase_hue(void);
void rgb_matrix_decrease_hue(void);
void rgb_matrix_increase_sat(void);
void rgb_matrix_decrease_sat(void);
void rgb_matrix_increase_val(void);
void rgb_matrix_decrease_val(void);
void rgb_matrix_increase_speed(void);
void rgb_matrix_decrease_speed(void);
void rgb_matrix_mode(uint8_t mode);
void rgb_matrix_mode_noeeprom(uint8_t mode);
uint32_t rgb_matrix_get_mode(void);
#ifndef RGBLIGHT_ENABLE
#define rgblight_toggle() rgb_matrix_toggle()
#define rgblight_enable() rgb_matrix_enable()
#define rgblight_enable_noeeprom() rgb_matrix_enable_noeeprom()
#define rgblight_disable() rgb_matrix_disable()
#define rgblight_disable_noeeprom() rgb_matrix_disable_noeeprom()
#define rgblight_step() rgb_matrix_step()
#define rgblight_sethsv(hue, sat, val) rgb_matrix_sethsv(hue, sat, val)
#define rgblight_sethsv_noeeprom(hue, sat, val) rgb_matrix_sethsv_noeeprom(hue, sat, val)
#define rgblight_step_reverse() rgb_matrix_step_reverse()
#define rgblight_increase_hue() rgb_matrix_increase_hue()
#define rgblight_decrease_hue() rgb_matrix_decrease_hue()
#define rgblight_increase_sat() rgb_matrix_increase_sat()
#define rgblight_decrease_sat() rgb_matrix_decrease_sat()
#define rgblight_increase_val() rgb_matrix_increase_val()
#define rgblight_decrease_val() rgb_matrix_decrease_val()
#define rgblight_increase_speed() rgb_matrix_increase_speed()
#define rgblight_decrease_speed() rgb_matrix_decrease_speed()
#define rgblight_mode(mode) rgb_matrix_mode(mode)
#define rgblight_mode_noeeprom(mode) rgb_matrix_mode_noeeprom(mode)
#define rgblight_get_mode() rgb_matrix_get_mode()
#endif
typedef struct {
/* Perform any initialisation required for the other driver functions to work. */

View file

@ -325,13 +325,13 @@ void rgblight_disable_noeeprom(void) {
// Deals with the messy details of incrementing an integer
uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
static uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
int16_t new_value = value;
new_value += step;
return MIN( MAX( new_value, min ), max );
}
uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
static uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
int16_t new_value = value;
new_value -= step;
return MIN( MAX( new_value, min ), max );
@ -679,6 +679,10 @@ void rgblight_effect_rainbow_mood(uint8_t interval) {
#endif
#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL
#ifndef RGBLIGHT_RAINBOW_SWIRL_RANGE
#define RGBLIGHT_RAINBOW_SWIRL_RANGE 360
#endif
__attribute__ ((weak))
const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20};
@ -692,7 +696,7 @@ void rgblight_effect_rainbow_swirl(uint8_t interval) {
}
last_timer = timer_read();
for (i = 0; i < RGBLED_NUM; i++) {
hue = (360 / RGBLED_NUM * i + current_hue) % 360;
hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / RGBLED_NUM * i + current_hue) % 360;
sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
}
rgblight_set();

View file

@ -128,12 +128,6 @@ uint8_t matrix_cols(void)
void matrix_init(void)
{
#ifdef DISABLE_JTAG
// JTAG disable for PORT F. write JTD bit twice within four cycles.
MCUCR |= (1<<JTD);
MCUCR |= (1<<JTD);
#endif
debug_enable = true;
debug_matrix = true;
debug_mouse = true;

View file

@ -94,7 +94,7 @@ void split_keyboard_setup(void) {
void keyboard_slave_loop(void) {
matrix_init();
//Init RGB
#ifdef RGBLIGHT_ENABLE
rgblight_init();
@ -103,7 +103,7 @@ void keyboard_slave_loop(void) {
while (1) {
// Matrix Slave Scan
matrix_slave_scan();
// Read Backlight Info
#ifdef BACKLIGHT_ENABLE
#ifdef USE_I2C
@ -122,14 +122,14 @@ void keyboard_slave_loop(void) {
// Disable interupts (RGB data is big)
cli();
// Create new DWORD for RGB data
uint32_t dword;
uint32_t dword;
// Fill the new DWORD with the data that was sent over
uint8_t *dword_dat = (uint8_t *)(&dword);
for (int i = 0; i < 4; i++) {
dword_dat[i] = i2c_slave_buffer[I2C_RGB_START+i];
}
// Update the RGB now with the new data and set RGB_DIRTY to false
rgblight_update_dword(dword);
RGB_DIRTY = false;

View file

@ -54,11 +54,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define RGB_DI_PIN E2
// #ifdef RGB_DI_PIN
// #define RGBLIGHT_ANIMATIONS
// #define RGBLED_NUM 16
// #define RGBLIGHT_HUE_STEP 8
// #define RGBLIGHT_SAT_STEP 8
// #define RGBLIGHT_VAL_STEP 8
// #define RGBLED_NUM 16
// #define RGBLIGHT_HUE_STEP 8
// #define RGBLIGHT_SAT_STEP 8
// #define RGBLIGHT_VAL_STEP 8
// #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
// /*== all animations enable ==*/
// #define RGBLIGHT_ANIMATIONS
// /*== or choose animations ==*/
// #define RGBLIGHT_EFFECT_BREATHING
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
// #define RGBLIGHT_EFFECT_SNAKE
// #define RGBLIGHT_EFFECT_KNIGHT
// #define RGBLIGHT_EFFECT_CHRISTMAS
// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
// #define RGBLIGHT_EFFECT_RGB_TEST
// #define RGBLIGHT_EFFECT_ALTERNATING
// #endif
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
@ -222,3 +235,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
*/
/* Bootmagic Lite key configuration */
// #define BOOTMAGIC_LITE_ROW 0
// #define BOOTMAGIC_LITE_COLUMN 0

View file

@ -44,3 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
/* Bootmagic Lite key configuration */
// #define BOOTMAGIC_LITE_ROW 0
// #define BOOTMAGIC_LITE_COLUMN 0

View file

@ -31,8 +31,8 @@ F_CPU = 12000000
BOOTLOADER = bootloadHID
# build options
BOOTMAGIC_ENABLE = yes
MOUSEKEY_ENABLE = yes
BOOTMAGIC_ENABLE = full
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = yes
COMMAND_ENABLE = yes