mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-30 13:58:57 +02:00
merge
This commit is contained in:
+9
-124
@@ -80,6 +80,7 @@ float startup_song[][2] = STARTUP_SONG;
|
||||
static void gpt_cb8(GPTDriver *gptp);
|
||||
|
||||
#define DAC_BUFFER_SIZE 720
|
||||
#define DAC_SAMPLE_MAX 65535U
|
||||
|
||||
#define START_CHANNEL_1() gptStart(&GPTD6, &gpt6cfg1); \
|
||||
gptStartContinuous(&GPTD6, 2U)
|
||||
@@ -202,132 +203,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 +248,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 +260,7 @@ static const DACConversionGroup dacgrpcfg1 = {
|
||||
};
|
||||
|
||||
static const DACConfig dac1cfg2 = {
|
||||
.init = 2047U,
|
||||
.init = DAC_SAMPLE_MAX,
|
||||
.datamode = DAC_DHRM_12BIT_RIGHT
|
||||
};
|
||||
|
||||
|
||||
+103
-55
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
@@ -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,12 @@
|
||||
|
||||
#ifndef KEYMAP_SLOVENIAN
|
||||
#define KEYMAP_SLOVENIAN
|
||||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#define SI_ALGR KC_RALT
|
||||
|
||||
//Swapped Z and Y
|
||||
#define SI_Z KC_Y
|
||||
@@ -89,18 +94,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
|
||||
|
||||
@@ -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);
|
||||
|
||||
+50
-1
@@ -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)
|
||||
|
||||
+20
-9
@@ -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)
|
||||
@@ -224,6 +226,15 @@ 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);
|
||||
|
||||
@@ -454,6 +454,8 @@ enum quantum_keycodes {
|
||||
TERM_OFF,
|
||||
#endif
|
||||
|
||||
EEPROM_RESET,
|
||||
|
||||
// always leave at the end
|
||||
SAFE_RANGE
|
||||
};
|
||||
@@ -475,7 +477,6 @@ 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)
|
||||
@@ -570,6 +571,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
|
||||
|
||||
+114
-64
@@ -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();
|
||||
|
||||
+39
-5
@@ -70,24 +70,58 @@ 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
|
||||
};
|
||||
|
||||
+5
-1
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user