merge
This commit is contained in:
commit
f39a21cae1
1377 changed files with 42701 additions and 8075 deletions
|
|
@ -17,7 +17,9 @@
|
|||
#ifndef _API_H_
|
||||
#define _API_H_
|
||||
|
||||
#ifdef __AVR__
|
||||
#include "lufa.h"
|
||||
#endif
|
||||
|
||||
enum MESSAGE_TYPE {
|
||||
MT_GET_DATA = 0x10, // Get data from keyboard
|
||||
|
|
@ -28,7 +30,7 @@ enum MESSAGE_TYPE {
|
|||
MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK)
|
||||
MT_EXE_ACTION = 0x40, // executing actions on keyboard
|
||||
MT_EXE_ACTION_ACK =0x41, // return confirmation/value (ACK)
|
||||
MT_TYPE_ERROR = 0x80 // type not recofgnised (ACK)
|
||||
MT_TYPE_ERROR = 0x80 // type not recognised (ACK)
|
||||
};
|
||||
|
||||
enum DATA_TYPE {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ typedef union {
|
|||
uint8_t raw;
|
||||
struct {
|
||||
bool enable :1;
|
||||
uint8_t level :7;
|
||||
bool clicky_enable :1;
|
||||
uint8_t level :6;
|
||||
};
|
||||
} audio_config_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,57 +23,154 @@
|
|||
#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
|
||||
#endif
|
||||
/* 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
|
||||
#endif
|
||||
#elif defined(PROTOCOL_CHIBIOS)
|
||||
#define A0 PAL_LINE(GPIOA, 0)
|
||||
#define A1 PAL_LINE(GPIOA, 1)
|
||||
#define A2 PAL_LINE(GPIOA, 2)
|
||||
#define A3 PAL_LINE(GPIOA, 3)
|
||||
#define A4 PAL_LINE(GPIOA, 4)
|
||||
#define A5 PAL_LINE(GPIOA, 5)
|
||||
#define A6 PAL_LINE(GPIOA, 6)
|
||||
#define A7 PAL_LINE(GPIOA, 7)
|
||||
#define A8 PAL_LINE(GPIOA, 8)
|
||||
#define A9 PAL_LINE(GPIOA, 9)
|
||||
#define A10 PAL_LINE(GPIOA, 10)
|
||||
#define A11 PAL_LINE(GPIOA, 11)
|
||||
#define A12 PAL_LINE(GPIOA, 12)
|
||||
#define A13 PAL_LINE(GPIOA, 13)
|
||||
#define A14 PAL_LINE(GPIOA, 14)
|
||||
#define A15 PAL_LINE(GPIOA, 15)
|
||||
#define B0 PAL_LINE(GPIOB, 0)
|
||||
#define B1 PAL_LINE(GPIOB, 1)
|
||||
#define B2 PAL_LINE(GPIOB, 2)
|
||||
#define B3 PAL_LINE(GPIOB, 3)
|
||||
#define B4 PAL_LINE(GPIOB, 4)
|
||||
#define B5 PAL_LINE(GPIOB, 5)
|
||||
#define B6 PAL_LINE(GPIOB, 6)
|
||||
#define B7 PAL_LINE(GPIOB, 7)
|
||||
#define B8 PAL_LINE(GPIOB, 8)
|
||||
#define B9 PAL_LINE(GPIOB, 9)
|
||||
#define B10 PAL_LINE(GPIOB, 10)
|
||||
#define B11 PAL_LINE(GPIOB, 11)
|
||||
#define B12 PAL_LINE(GPIOB, 12)
|
||||
#define B13 PAL_LINE(GPIOB, 13)
|
||||
#define B14 PAL_LINE(GPIOB, 14)
|
||||
#define B15 PAL_LINE(GPIOB, 15)
|
||||
#define C0 PAL_LINE(GPIOC, 0)
|
||||
#define C1 PAL_LINE(GPIOC, 1)
|
||||
#define C2 PAL_LINE(GPIOC, 2)
|
||||
#define C3 PAL_LINE(GPIOC, 3)
|
||||
#define C4 PAL_LINE(GPIOC, 4)
|
||||
#define C5 PAL_LINE(GPIOC, 5)
|
||||
#define C6 PAL_LINE(GPIOC, 6)
|
||||
#define C7 PAL_LINE(GPIOC, 7)
|
||||
#define C8 PAL_LINE(GPIOC, 8)
|
||||
#define C9 PAL_LINE(GPIOC, 9)
|
||||
#define C10 PAL_LINE(GPIOC, 10)
|
||||
#define C11 PAL_LINE(GPIOC, 11)
|
||||
#define C12 PAL_LINE(GPIOC, 12)
|
||||
#define C13 PAL_LINE(GPIOC, 13)
|
||||
#define C14 PAL_LINE(GPIOC, 14)
|
||||
#define C15 PAL_LINE(GPIOC, 15)
|
||||
#define D0 PAL_LINE(GPIOD, 0)
|
||||
#define D1 PAL_LINE(GPIOD, 1)
|
||||
#define D2 PAL_LINE(GPIOD, 2)
|
||||
#define D3 PAL_LINE(GPIOD, 3)
|
||||
#define D4 PAL_LINE(GPIOD, 4)
|
||||
#define D5 PAL_LINE(GPIOD, 5)
|
||||
#define D6 PAL_LINE(GPIOD, 6)
|
||||
#define D7 PAL_LINE(GPIOD, 7)
|
||||
#define D8 PAL_LINE(GPIOD, 8)
|
||||
#define D9 PAL_LINE(GPIOD, 9)
|
||||
#define D10 PAL_LINE(GPIOD, 10)
|
||||
#define D11 PAL_LINE(GPIOD, 11)
|
||||
#define D12 PAL_LINE(GPIOD, 12)
|
||||
#define D13 PAL_LINE(GPIOD, 13)
|
||||
#define D14 PAL_LINE(GPIOD, 14)
|
||||
#define D15 PAL_LINE(GPIOD, 15)
|
||||
#define E0 PAL_LINE(GPIOE, 0)
|
||||
#define E1 PAL_LINE(GPIOE, 1)
|
||||
#define E2 PAL_LINE(GPIOE, 2)
|
||||
#define E3 PAL_LINE(GPIOE, 3)
|
||||
#define E4 PAL_LINE(GPIOE, 4)
|
||||
#define E5 PAL_LINE(GPIOE, 5)
|
||||
#define E6 PAL_LINE(GPIOE, 6)
|
||||
#define E7 PAL_LINE(GPIOE, 7)
|
||||
#define E8 PAL_LINE(GPIOE, 8)
|
||||
#define E9 PAL_LINE(GPIOE, 9)
|
||||
#define E10 PAL_LINE(GPIOE, 10)
|
||||
#define E11 PAL_LINE(GPIOE, 11)
|
||||
#define E12 PAL_LINE(GPIOE, 12)
|
||||
#define E13 PAL_LINE(GPIOE, 13)
|
||||
#define E14 PAL_LINE(GPIOE, 14)
|
||||
#define E15 PAL_LINE(GPIOE, 15)
|
||||
#define F0 PAL_LINE(GPIOF, 0)
|
||||
#define F1 PAL_LINE(GPIOF, 1)
|
||||
#define F2 PAL_LINE(GPIOF, 2)
|
||||
#define F3 PAL_LINE(GPIOF, 3)
|
||||
#define F4 PAL_LINE(GPIOF, 4)
|
||||
#define F5 PAL_LINE(GPIOF, 5)
|
||||
#define F6 PAL_LINE(GPIOF, 6)
|
||||
#define F7 PAL_LINE(GPIOF, 7)
|
||||
#define F8 PAL_LINE(GPIOF, 8)
|
||||
#define F9 PAL_LINE(GPIOF, 9)
|
||||
#define F10 PAL_LINE(GPIOF, 10)
|
||||
#define F11 PAL_LINE(GPIOF, 11)
|
||||
#define F12 PAL_LINE(GPIOF, 12)
|
||||
#define F13 PAL_LINE(GPIOF, 13)
|
||||
#define F14 PAL_LINE(GPIOF, 14)
|
||||
#define F15 PAL_LINE(GPIOF, 15)
|
||||
#endif
|
||||
|
||||
/* USART configuration */
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "keymap.h" // to get keymaps[][][]
|
||||
#include "tmk_core/common/eeprom.h"
|
||||
#include "progmem.h" // to read default from flash
|
||||
|
||||
#include "dynamic_keymap.h"
|
||||
|
||||
|
|
@ -29,8 +31,6 @@
|
|||
#error DYNAMIC_KEYMAP_LAYER_COUNT not defined
|
||||
#endif
|
||||
|
||||
#define KC_EENULL 0xFFFF // TODO: move to enum quantum_keycodes
|
||||
|
||||
void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column)
|
||||
{
|
||||
// TODO: optimize this with some left shifts
|
||||
|
|
@ -55,16 +55,15 @@ void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint
|
|||
eeprom_update_byte(address+1, (uint8_t)(keycode & 0xFF));
|
||||
}
|
||||
|
||||
void dynamic_keymap_clear_all(void)
|
||||
void dynamic_keymap_reset(void)
|
||||
{
|
||||
// Save "empty" keymaps.
|
||||
for ( int layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++ )
|
||||
{
|
||||
for ( int row = 0; row < MATRIX_ROWS; row++ )
|
||||
{
|
||||
for ( int column = 0; column < MATRIX_COLS; column++ )
|
||||
{
|
||||
dynamic_keymap_set_keycode(layer, row, column, KC_EENULL);
|
||||
// Reset the keymaps in EEPROM to what is in flash.
|
||||
// All keyboards using dynamic keymaps should define a layout
|
||||
// for the same number of layers as DYNAMIC_KEYMAP_LAYER_COUNT.
|
||||
for ( int layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++ ) {
|
||||
for ( int row = 0; row < MATRIX_ROWS; row++ ) {
|
||||
for ( int column = 0; column < MATRIX_COLS; column++ ) {
|
||||
dynamic_keymap_set_keycode(layer, row, column, pgm_read_word(&keymaps[layer][row][column]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,24 +72,13 @@ void dynamic_keymap_clear_all(void)
|
|||
// This overrides the one in quantum/keymap_common.c
|
||||
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
||||
{
|
||||
// This used to test EEPROM for magic bytes, but it was redundant.
|
||||
// Test for EEPROM usage change (fresh install, address change, etc.)
|
||||
// externally and call dynamic_keymap_default_save()
|
||||
if ( layer < DYNAMIC_KEYMAP_LAYER_COUNT &&
|
||||
key.row < MATRIX_ROWS && // possibly redundant
|
||||
key.col < MATRIX_COLS ) // possibly redundant
|
||||
{
|
||||
uint16_t keycode = dynamic_keymap_get_keycode(layer, key.row, key.col);
|
||||
|
||||
// If keycode is not "empty", return it, otherwise
|
||||
// drop down to return the one in flash
|
||||
if ( keycode != KC_EENULL)
|
||||
{
|
||||
return keycode;
|
||||
}
|
||||
key.row < MATRIX_ROWS &&
|
||||
key.col < MATRIX_COLS ) {
|
||||
return dynamic_keymap_get_keycode(layer, key.row, key.col);
|
||||
} else {
|
||||
return KC_NO;
|
||||
}
|
||||
|
||||
return pgm_read_word(&keymaps[layer][key.row][key.col]);
|
||||
}
|
||||
|
||||
#endif // DYNAMIC_KEYMAP_ENABLE
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@
|
|||
* 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 DYNAMIC_KEYMAP_H
|
||||
#define DYNAMIC_KEYMAP_H
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
|
@ -23,9 +21,8 @@
|
|||
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_clear_all(void);
|
||||
void dynamic_keymap_reset(void);
|
||||
|
||||
// This overrides the one in quantum/keymap_common.c
|
||||
// uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
|
||||
|
||||
#endif //DYNAMIC_KEYMAP_H
|
||||
|
|
|
|||
70
quantum/encoder.c
Normal file
70
quantum/encoder.c
Normal 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
29
quantum/encoder.h
Normal 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);
|
||||
|
|
@ -40,6 +40,9 @@
|
|||
#define JP_HENK KC_INT4 // henkan
|
||||
#define JP_KANA KC_INT2 // katakana/hiragana|ro-mazi
|
||||
|
||||
#define JP_MKANA KC_LANG1 //kana on MacOSX
|
||||
#define JP_MEISU KC_LANG2 //eisu on MacOSX
|
||||
|
||||
|
||||
//Aliases for shifted symbols
|
||||
#define JP_DQT LSFT(KC_2) // "
|
||||
|
|
|
|||
107
quantum/keymap_extras/keymap_slovenian.h
Normal file
107
quantum/keymap_extras/keymap_slovenian.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/* 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
|
||||
* 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_SLOVENIAN
|
||||
#define KEYMAP_SLOVENIAN
|
||||
#include "keymap.h"
|
||||
|
||||
|
||||
//Swapped Z and Y
|
||||
#define SI_Z KC_Y
|
||||
#define SI_Y KC_Z
|
||||
|
||||
//Special characters
|
||||
#define SI_CV KC_SCLN
|
||||
#define SI_SV KC_LBRC
|
||||
#define SI_ZV KC_BSLS
|
||||
|
||||
#define SI_A KC_A
|
||||
#define SI_B KC_B
|
||||
#define SI_C KC_C
|
||||
#define SI_D KC_D
|
||||
#define SI_E KC_E
|
||||
#define SI_F KC_F
|
||||
#define SI_G KC_G
|
||||
#define SI_H KC_H
|
||||
#define SI_I KC_I
|
||||
#define SI_J KC_J
|
||||
#define SI_K KC_K
|
||||
#define SI_L KC_L
|
||||
#define SI_M KC_M
|
||||
#define SI_N KC_N
|
||||
#define SI_O KC_O
|
||||
#define SI_P KC_P
|
||||
#define SI_Q KC_Q
|
||||
#define SI_R KC_R
|
||||
#define SI_S KC_S
|
||||
#define SI_T KC_T
|
||||
#define SI_U KC_U
|
||||
#define SI_V KC_V
|
||||
#define SI_W KC_W
|
||||
#define SI_X KC_X
|
||||
|
||||
#define SI_0 KC_0
|
||||
#define SI_1 KC_1
|
||||
#define SI_2 KC_2
|
||||
#define SI_3 KC_3
|
||||
#define SI_4 KC_4
|
||||
#define SI_5 KC_5
|
||||
#define SI_6 KC_6
|
||||
#define SI_7 KC_7
|
||||
#define SI_8 KC_8
|
||||
#define SI_9 KC_9
|
||||
|
||||
#define SI_DOT KC_DOT
|
||||
#define SI_COMM KC_COMM
|
||||
|
||||
#define SI_PLUS KC_EQL // + and * and ~
|
||||
#define SI_QOT KC_MINS // Single quote
|
||||
#define SI_MINS KC_SLSH // - and _
|
||||
|
||||
// shifted characters
|
||||
#define SI_EXLM LSFT(KC_1) // !
|
||||
#define SI_DQOT LSFT(KC_2) // "
|
||||
#define SI_HASH LSFT(KC_3) // #
|
||||
#define SI_DLR LSFT(KC_4) // $
|
||||
#define SI_PERC LSFT(KC_5) // %
|
||||
#define SI_AMPR LSFT(KC_6) // &
|
||||
#define SI_SLSH LSFT(KC_7) // /
|
||||
#define SI_LPRN LSFT(KC_8) // (
|
||||
#define SI_RPRN LSFT(KC_9) // )
|
||||
#define SI_EQL LSFT(KC_0) // =
|
||||
#define SI_QST LSFT(SI_QOT) // ?
|
||||
#define SI_ASTR LSFT(SI_PLUS) // *
|
||||
#define SI_COLN LSFT(KC_DOT) // :
|
||||
#define SI_SCLN LSFT(KC_COMM) // ;
|
||||
#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) // |
|
||||
|
||||
#endif
|
||||
81
quantum/keymap_extras/sendstring_german.h
Normal file
81
quantum/keymap_extras/sendstring_german.h
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/* Copyright 2018 Patrick Hener
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
/* Sendstring definitions for the German layout */
|
||||
#ifndef SENDSTRING_GERMAN
|
||||
#define SENDSTRING_GERMAN
|
||||
|
||||
#include "keymap_german.h"
|
||||
|
||||
const bool ascii_to_shift_lut[0x80] PROGMEM = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 1, 1, 0, 1, 1, 1, 1,
|
||||
1, 1, 1, 0, 0, 0, 0, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 1, 0, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 1, 1, 1, 1, 0
|
||||
};
|
||||
|
||||
/* Until an ALT table/functionality is added, the following symbols will not work:
|
||||
* § @ [ ] { } \ ~ äA öÖ ß ´
|
||||
* Following characters can be printed using other characters like so:
|
||||
* [ in makro will be ü
|
||||
* { in makro will be Ü
|
||||
* ~ in makro will be °
|
||||
*/
|
||||
const uint8_t ascii_to_keycode_lut[0x80] PROGMEM = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
KC_BSPC, KC_TAB, KC_ENT, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, KC_ESC, 0, 0, 0, 0,
|
||||
|
||||
/* SPACE ! " # $ % & ' */
|
||||
KC_SPC, KC_1, KC_2, DE_HASH, KC_4, KC_5, KC_6, DE_HASH,
|
||||
/* ( ) * + , - . / */
|
||||
KC_8, KC_9, DE_PLUS, DE_PLUS, KC_COMM, DE_MINS, KC_DOT, KC_7,
|
||||
/* 0 1 2 3 4 5 6 7 */
|
||||
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
|
||||
/* 8 9 : ; < = > ? */
|
||||
KC_8, KC_9, KC_DOT, KC_COMM, DE_LESS, KC_0, DE_LESS, KC_MINS,
|
||||
/* @ A B C D E F G */
|
||||
KC_2, KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, KC_G,
|
||||
/* H I J K L M N O */
|
||||
KC_H, KC_I, KC_J, KC_K, KC_L, KC_M, KC_N, KC_O,
|
||||
/* P Q R S T U V W */
|
||||
KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W,
|
||||
/* X Y Z [ \ ] ^ _ */
|
||||
KC_X, KC_Y, KC_Z, KC_LBRC, KC_BSLS, KC_RBRC, DE_CIRC, DE_MINS,
|
||||
/* ` a b c d e f g */
|
||||
DE_ACUT, KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, KC_G,
|
||||
/* h i j k l m n o */
|
||||
KC_H, KC_I, KC_J, KC_K, KC_L, KC_M, KC_N, KC_O,
|
||||
/* p q r s t u v w */
|
||||
KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W,
|
||||
/* x y z { | } ~ DELETE */
|
||||
KC_X, KC_Y, KC_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2012-2017 Jun Wako, Jack Humbert
|
||||
Copyright 2012-2018 Jun Wako, Jack Humbert, Yiancar
|
||||
|
||||
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,15 +16,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#if defined(__AVR__)
|
||||
#include <avr/io.h>
|
||||
#endif
|
||||
#include "wait.h"
|
||||
#include "print.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
#include "timer.h"
|
||||
#include "quantum.h"
|
||||
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
|
|
@ -60,8 +58,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#endif
|
||||
|
||||
#if (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
|
||||
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
#endif
|
||||
|
||||
/* matrix state(1:on, 0:off) */
|
||||
|
|
@ -271,9 +269,7 @@ uint8_t matrix_key_count(void)
|
|||
static void init_cols(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
uint8_t pin = col_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
setPinInputHigh(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -293,8 +289,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
|
||||
// Select the col pin to read (active low)
|
||||
uint8_t pin = col_pins[col_index];
|
||||
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
|
||||
uint8_t pin_state = readPin(col_pins[col_index]);
|
||||
|
||||
// Populate the matrix row with the state of the col pin
|
||||
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
|
||||
|
|
@ -308,24 +303,19 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
uint8_t pin = row_pins[row];
|
||||
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
|
||||
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
|
||||
setPinOutput(row_pins[row]);
|
||||
writePinLow(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_row(uint8_t row)
|
||||
{
|
||||
uint8_t pin = row_pins[row];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
setPinInputHigh(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
uint8_t pin = row_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
setPinInput(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -334,9 +324,7 @@ static void unselect_rows(void)
|
|||
static void init_rows(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
uint8_t pin = row_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
setPinInputHigh(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -356,7 +344,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
matrix_row_t last_row_value = current_matrix[row_index];
|
||||
|
||||
// Check row pin state
|
||||
if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0)
|
||||
if (readPin(row_pins[row_index]) == 0)
|
||||
{
|
||||
// Pin LO, set col bit
|
||||
current_matrix[row_index] |= (ROW_SHIFTER << current_col);
|
||||
|
|
@ -382,24 +370,19 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
|
||||
static void select_col(uint8_t col)
|
||||
{
|
||||
uint8_t pin = col_pins[col];
|
||||
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
|
||||
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
|
||||
setPinOutput(col_pins[col]);
|
||||
writePinLow(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col)
|
||||
{
|
||||
uint8_t pin = col_pins[col];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
setPinInputHigh(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_cols(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
uint8_t pin = col_pins[x];
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||
setPinInputHigh(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
|
|||
case KC_DOT:
|
||||
case KC_SLSH:
|
||||
case KC_GRAVE:
|
||||
case KC_NONUS_BSLASH:
|
||||
case KC_NONUS_HASH:
|
||||
#endif
|
||||
|
||||
autoshift_flush();
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@
|
|||
|
||||
#ifdef AUDIO_CLICKY
|
||||
|
||||
#ifdef AUDIO_CLICKY_ON
|
||||
bool clicky_enable = true;
|
||||
#else // AUDIO_CLICKY_ON
|
||||
bool clicky_enable = false;
|
||||
#endif // AUDIO_CLICKY_ON
|
||||
#ifndef AUDIO_CLICKY_FREQ_DEFAULT
|
||||
#define AUDIO_CLICKY_FREQ_DEFAULT 440.0f
|
||||
#endif // !AUDIO_CLICKY_FREQ_DEFAULT
|
||||
|
|
@ -25,8 +20,11 @@ bool clicky_enable = false;
|
|||
#endif // !AUDIO_CLICKY_FREQ_RANDOMNESS
|
||||
|
||||
float clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
|
||||
float clicky_rand = AUDIO_CLICKY_FREQ_RANDOMNESS;
|
||||
float clicky_song[][2] = {{AUDIO_CLICKY_FREQ_DEFAULT, 3}, {AUDIO_CLICKY_FREQ_DEFAULT, 1}}; // 3 and 1 --> durations
|
||||
|
||||
extern audio_config_t audio_config;
|
||||
|
||||
#ifndef NO_MUSIC_MODE
|
||||
extern bool music_activated;
|
||||
extern bool midi_activated;
|
||||
|
|
@ -36,31 +34,61 @@ void clicky_play(void) {
|
|||
#ifndef NO_MUSIC_MODE
|
||||
if (music_activated || midi_activated) return;
|
||||
#endif // !NO_MUSIC_MODE
|
||||
clicky_song[0][0] = 2.0f * clicky_freq * (1.0f + AUDIO_CLICKY_FREQ_RANDOMNESS * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
|
||||
clicky_song[1][0] = clicky_freq * (1.0f + AUDIO_CLICKY_FREQ_RANDOMNESS * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
|
||||
clicky_song[0][0] = 2.0f * clicky_freq * (1.0f + clicky_rand * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
|
||||
clicky_song[1][0] = clicky_freq * (1.0f + clicky_rand * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
|
||||
PLAY_SONG(clicky_song);
|
||||
}
|
||||
|
||||
void clicky_freq_up(void) {
|
||||
float new_freq = clicky_freq * AUDIO_CLICKY_FREQ_FACTOR;
|
||||
if (new_freq < AUDIO_CLICKY_FREQ_MAX) {
|
||||
clicky_freq = new_freq;
|
||||
}
|
||||
}
|
||||
|
||||
void clicky_freq_down(void) {
|
||||
float new_freq = clicky_freq / AUDIO_CLICKY_FREQ_FACTOR;
|
||||
if (new_freq > AUDIO_CLICKY_FREQ_MIN) {
|
||||
clicky_freq = new_freq;
|
||||
}
|
||||
}
|
||||
|
||||
void clicky_freq_reset(void) {
|
||||
clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
|
||||
}
|
||||
|
||||
void clicky_toggle(void) {
|
||||
audio_config.clicky_enable ^= 1;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
}
|
||||
|
||||
void clicky_on(void) {
|
||||
audio_config.clicky_enable = 1;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
}
|
||||
|
||||
void clicky_off(void) {
|
||||
audio_config.clicky_enable = 0;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
}
|
||||
|
||||
bool is_clicky_on(void) {
|
||||
return (audio_config.clicky_enable != 0);
|
||||
}
|
||||
|
||||
bool process_clicky(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode == CLICKY_TOGGLE && record->event.pressed) { clicky_enable = !clicky_enable; }
|
||||
if (keycode == CLICKY_TOGGLE && record->event.pressed) { clicky_toggle(); }
|
||||
|
||||
if (keycode == CLICKY_RESET && record->event.pressed) { clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT; }
|
||||
if (keycode == CLICKY_ENABLE && record->event.pressed) { clicky_on(); }
|
||||
if (keycode == CLICKY_DISABLE && record->event.pressed) { clicky_off(); }
|
||||
|
||||
if (keycode == CLICKY_UP && record->event.pressed) {
|
||||
float new_freq = clicky_freq * AUDIO_CLICKY_FREQ_FACTOR;
|
||||
if (new_freq < AUDIO_CLICKY_FREQ_MAX) {
|
||||
clicky_freq = new_freq;
|
||||
}
|
||||
}
|
||||
if (keycode == CLICKY_DOWN && record->event.pressed) {
|
||||
float new_freq = clicky_freq / AUDIO_CLICKY_FREQ_FACTOR;
|
||||
if (new_freq > AUDIO_CLICKY_FREQ_MIN) {
|
||||
clicky_freq = new_freq;
|
||||
}
|
||||
}
|
||||
if (keycode == CLICKY_RESET && record->event.pressed) { clicky_freq_reset(); }
|
||||
|
||||
if (keycode == CLICKY_UP && record->event.pressed) { clicky_freq_up(); }
|
||||
if (keycode == CLICKY_DOWN && record->event.pressed) { clicky_freq_down(); }
|
||||
|
||||
|
||||
if ( clicky_enable ) {
|
||||
if ( audio_config.clicky_enable ) {
|
||||
if (record->event.pressed) {
|
||||
clicky_play();;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,14 @@
|
|||
void clicky_play(void);
|
||||
bool process_clicky(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
void clicky_freq_up(void);
|
||||
void clicky_freq_down(void);
|
||||
void clicky_freq_reset(void);
|
||||
|
||||
void clicky_toggle(void);
|
||||
void clicky_on(void);
|
||||
void clicky_off(void);
|
||||
|
||||
bool is_clicky_on(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
#include "quantum.h"
|
||||
#include "action_tapping.h"
|
||||
|
||||
#ifndef TAPPING_TERM
|
||||
#define TAPPING_TERM 200
|
||||
#endif
|
||||
|
||||
#ifndef NO_ACTION_ONESHOT
|
||||
uint8_t get_oneshot_mods(void);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ void qk_ucis_start_user(void) {
|
|||
unicode_input_finish();
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void qk_ucis_success(uint8_t symbol_index) {
|
||||
}
|
||||
|
||||
static bool is_uni_seq(char *seq) {
|
||||
uint8_t i;
|
||||
|
||||
|
|
@ -89,7 +93,7 @@ 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)
|
||||
return true;
|
||||
|
|
@ -118,7 +122,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 (i = qk_ucis_state.count; i > 0; i--) {
|
||||
for (uint8_t i = qk_ucis_state.count; i > 0; i--) {
|
||||
register_code (KC_BSPC);
|
||||
unregister_code (KC_BSPC);
|
||||
wait_ms(UNICODE_TYPE_DELAY);
|
||||
|
|
@ -130,7 +134,7 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
unicode_input_start();
|
||||
for (i = 0; ucis_symbol_table[i].symbol; i++) {
|
||||
for (uint8_t 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);
|
||||
|
|
@ -142,6 +146,10 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
unicode_input_finish();
|
||||
|
||||
if (symbol_found) {
|
||||
qk_ucis_success(i);
|
||||
}
|
||||
|
||||
qk_ucis_state.in_progress = false;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ extern const qk_ucis_symbol_t ucis_symbol_table[];
|
|||
void qk_ucis_start(void);
|
||||
void qk_ucis_start_user(void);
|
||||
void qk_ucis_symbol_fallback (void);
|
||||
void qk_ucis_success(uint8_t symbol_index);
|
||||
void register_ucis(const char *hex);
|
||||
bool process_ucis (uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,15 +17,10 @@
|
|||
#include "action_util.h"
|
||||
#include "eeprom.h"
|
||||
|
||||
static uint8_t first_flag = 0;
|
||||
|
||||
bool process_unicode(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode > QK_UNICODE && record->event.pressed) {
|
||||
if (first_flag == 0) {
|
||||
set_unicode_input_mode(eeprom_read_byte(EECONFIG_UNICODEMODE));
|
||||
first_flag = 1;
|
||||
}
|
||||
uint16_t unicode = keycode & 0x7FFF;
|
||||
unicode_input_mode_init();
|
||||
unicode_input_start();
|
||||
register_hex(unicode);
|
||||
unicode_input_finish();
|
||||
|
|
|
|||
|
|
@ -16,12 +16,13 @@
|
|||
|
||||
#include "process_unicode_common.h"
|
||||
#include "eeprom.h"
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static uint8_t input_mode;
|
||||
uint8_t mods;
|
||||
|
||||
void set_unicode_input_mode(uint8_t os_target)
|
||||
{
|
||||
void set_unicode_input_mode(uint8_t os_target) {
|
||||
input_mode = os_target;
|
||||
eeprom_update_byte(EECONFIG_UNICODEMODE, os_target);
|
||||
}
|
||||
|
|
@ -30,6 +31,14 @@ uint8_t get_unicode_input_mode(void) {
|
|||
return input_mode;
|
||||
}
|
||||
|
||||
void unicode_input_mode_init(void) {
|
||||
static bool first_flag = false;
|
||||
if (!first_flag) {
|
||||
input_mode = eeprom_read_byte(EECONFIG_UNICODEMODE);
|
||||
first_flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void unicode_input_start (void) {
|
||||
// save current mods
|
||||
|
|
@ -102,8 +111,7 @@ void unicode_input_finish (void) {
|
|||
}
|
||||
|
||||
__attribute__((weak))
|
||||
uint16_t hex_to_keycode(uint8_t hex)
|
||||
{
|
||||
uint16_t hex_to_keycode(uint8_t hex) {
|
||||
if (hex == 0x0) {
|
||||
return KC_0;
|
||||
} else if (hex < 0xA) {
|
||||
|
|
@ -120,3 +128,28 @@ void register_hex(uint16_t hex) {
|
|||
unregister_code(hex_to_keycode(digit));
|
||||
}
|
||||
}
|
||||
|
||||
void send_unicode_hex_string(const char *str) {
|
||||
if (!str) { return; } // Safety net
|
||||
|
||||
while (*str) {
|
||||
// Find the next code point (token) in the string
|
||||
for (; *str == ' '; str++);
|
||||
size_t n = strcspn(str, " "); // Length of the current token
|
||||
char code_point[n+1];
|
||||
strncpy(code_point, str, n);
|
||||
code_point[n] = '\0'; // Make sure it's null-terminated
|
||||
|
||||
// Normalize the code point: make all hex digits lowercase
|
||||
for (char *p = code_point; *p; p++) {
|
||||
*p = tolower((unsigned char)*p);
|
||||
}
|
||||
|
||||
// Send the code point as a Unicode input string
|
||||
unicode_input_start();
|
||||
send_string(code_point);
|
||||
unicode_input_finish();
|
||||
|
||||
str += n; // Move to the first ' ' (or '\0') after the current token
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@ static uint8_t input_mode;
|
|||
|
||||
void set_unicode_input_mode(uint8_t os_target);
|
||||
uint8_t get_unicode_input_mode(void);
|
||||
void unicode_input_mode_init(void);
|
||||
void unicode_input_start(void);
|
||||
void unicode_input_finish(void);
|
||||
void register_hex(uint16_t hex);
|
||||
void send_unicode_hex_string(const char *str);
|
||||
|
||||
#define UC_OSX 0 // Mac OS X
|
||||
#define UC_LNX 1 // Linux
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ __attribute__((weak))
|
|||
void unicode_map_input_error() {}
|
||||
|
||||
bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
|
||||
unicode_input_mode_init();
|
||||
uint8_t input_mode = get_unicode_input_mode();
|
||||
if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) {
|
||||
const uint32_t* map = unicode_map;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -945,6 +950,9 @@ void tap_random_base64(void) {
|
|||
}
|
||||
|
||||
void matrix_init_quantum() {
|
||||
if (!eeconfig_is_enabled() && !eeconfig_is_disabled()) {
|
||||
eeconfig_init();
|
||||
}
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
backlight_init_ports();
|
||||
#endif
|
||||
|
|
@ -954,6 +962,9 @@ void matrix_init_quantum() {
|
|||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_matrix_init();
|
||||
#endif
|
||||
#ifdef ENCODER_ENABLE
|
||||
encoder_init();
|
||||
#endif
|
||||
matrix_init_kb();
|
||||
}
|
||||
|
||||
|
|
@ -988,6 +999,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)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2016-2017 Erez Zukerman, Jack Humbert
|
||||
/* Copyright 2016-2018 Erez Zukerman, Jack Humbert, Yiancar
|
||||
*
|
||||
* 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
|
||||
|
|
@ -17,9 +17,12 @@
|
|||
#define QUANTUM_H
|
||||
|
||||
#if defined(__AVR__)
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#endif
|
||||
#if defined(PROTOCOL_CHIBIOS)
|
||||
#include "hal.h"
|
||||
#endif
|
||||
#include "wait.h"
|
||||
#include "matrix.h"
|
||||
|
|
@ -28,16 +31,16 @@
|
|||
#include "backlight.h"
|
||||
#endif
|
||||
#if !defined(RGBLIGHT_ENABLE) && !defined(RGB_MATRIX_ENABLE)
|
||||
#include "rgb.h"
|
||||
#include "rgb.h"
|
||||
#endif
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
#include "rgblight.h"
|
||||
#else
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
/* dummy define RGBLIGHT_MODE_xxxx */
|
||||
#define RGBLIGHT_H_DUMMY_DEFINE
|
||||
#include "rgblight.h"
|
||||
#endif
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
/* dummy define RGBLIGHT_MODE_xxxx */
|
||||
#define RGBLIGHT_H_DUMMY_DEFINE
|
||||
#include "rgblight.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
|
|
@ -76,9 +79,9 @@ extern uint32_t default_layer_state;
|
|||
#ifdef AUDIO_ENABLE
|
||||
#include "audio.h"
|
||||
#include "process_audio.h"
|
||||
#ifdef AUDIO_CLICKY
|
||||
#include "process_clicky.h"
|
||||
#endif // AUDIO_CLICKY
|
||||
#ifdef AUDIO_CLICKY
|
||||
#include "process_clicky.h"
|
||||
#endif // AUDIO_CLICKY
|
||||
#endif
|
||||
|
||||
#ifdef STENO_ENABLE
|
||||
|
|
@ -105,7 +108,9 @@ extern uint32_t default_layer_state;
|
|||
#include "process_unicodemap.h"
|
||||
#endif
|
||||
|
||||
#include "process_tap_dance.h"
|
||||
#ifdef TAP_DANCE_ENABLE
|
||||
#include "process_tap_dance.h"
|
||||
#endif
|
||||
|
||||
#ifdef PRINTING_ENABLE
|
||||
#include "process_printer.h"
|
||||
|
|
@ -133,6 +138,48 @@ extern uint32_t default_layer_state;
|
|||
#include "hd44780.h"
|
||||
#endif
|
||||
|
||||
//Function substitutions to ease GPIO manipulation
|
||||
#ifdef __AVR__
|
||||
#define pin_t uint8_t
|
||||
#define setPinInput(pin) _SFR_IO8((pin >> 4) + 1) &= ~ _BV(pin & 0xF)
|
||||
#define setPinInputHigh(pin) ({\
|
||||
_SFR_IO8((pin >> 4) + 1) &= ~ _BV(pin & 0xF);\
|
||||
_SFR_IO8((pin >> 4) + 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 writePinHigh(pin) _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF)
|
||||
#define writePinLow(pin) _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF)
|
||||
static inline void writePin(pin_t pin, uint8_t level){
|
||||
if (level){
|
||||
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF);
|
||||
} else {
|
||||
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF);
|
||||
}
|
||||
}
|
||||
|
||||
#define readPin(pin) (_SFR_IO8(pin >> 4) & _BV(pin & 0xF))
|
||||
#elif defined(PROTOCOL_CHIBIOS)
|
||||
#define pin_t ioline_t
|
||||
#define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT)
|
||||
#define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP)
|
||||
#define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN)
|
||||
#define setPinOutput(pin) palSetLineMode(pin, PAL_MODE_OUTPUT_PUSHPULL)
|
||||
|
||||
#define writePinHigh(pin) palSetLine(pin)
|
||||
#define writePinLow(pin) palClearLine(pin)
|
||||
static inline void writePin(pin_t pin, uint8_t level){
|
||||
if (level){
|
||||
palSetLine(pin);
|
||||
} else {
|
||||
palClearLine(pin);
|
||||
}
|
||||
}
|
||||
|
||||
#define readPin(pin) palReadLine(pin)
|
||||
#endif
|
||||
|
||||
#define STRINGIZE(z) #z
|
||||
#define ADD_SLASH_X(y) STRINGIZE(\x ## y)
|
||||
#define SYMBOL_STR(x) ADD_SLASH_X(x)
|
||||
|
|
|
|||
|
|
@ -139,10 +139,13 @@ enum quantum_keycodes {
|
|||
|
||||
// Faux clicky as part of main audio feature
|
||||
CLICKY_TOGGLE,
|
||||
CLICKY_ENABLE,
|
||||
CLICKY_DISABLE,
|
||||
CLICKY_UP,
|
||||
CLICKY_DOWN,
|
||||
CLICKY_RESET,
|
||||
|
||||
|
||||
#ifdef FAUXCLICKY_ENABLE
|
||||
// Faux clicky
|
||||
FC_ON,
|
||||
|
|
@ -571,6 +574,8 @@ enum quantum_keycodes {
|
|||
#define CK_RST CLICKY_RESET
|
||||
#define CK_UP CLICKY_UP
|
||||
#define CK_DOWN CLICKY_DOWN
|
||||
#define CK_ON CLICKY_ENABLE
|
||||
#define CK_OFF CLICKY_DISABLE
|
||||
|
||||
#define RGB_MOD RGB_MODE_FORWARD
|
||||
#define RGB_SMOD RGB_MODE_FORWARD
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@
|
|||
|
||||
|
||||
#include "rgb_matrix.h"
|
||||
#include "i2c_master.h"
|
||||
#include "progmem.h"
|
||||
#include "config.h"
|
||||
#include "eeprom.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
rgb_config_t rgb_matrix_config;
|
||||
|
|
@ -50,6 +50,11 @@ rgb_config_t rgb_matrix_config;
|
|||
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255
|
||||
#endif
|
||||
|
||||
#ifndef RGB_DIGITAL_RAIN_DROPS
|
||||
// lower the number for denser effect/wider keyboard
|
||||
#define RGB_DIGITAL_RAIN_DROPS 24
|
||||
#endif
|
||||
|
||||
bool g_suspend_state = false;
|
||||
|
||||
// Global tick at 20 Hz
|
||||
|
|
@ -111,29 +116,15 @@ void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led_i, uint8_t
|
|||
}
|
||||
|
||||
void rgb_matrix_update_pwm_buffers(void) {
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_update_pwm_buffers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
|
||||
IS31FL3731_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
|
||||
#elif defined(IS31FL3733)
|
||||
IS31FL3733_update_pwm_buffers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
|
||||
IS31FL3733_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
|
||||
#endif
|
||||
rgb_matrix_driver.flush();
|
||||
}
|
||||
|
||||
void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) {
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_set_color( index, red, green, blue );
|
||||
#elif defined(IS31FL3733)
|
||||
IS31FL3733_set_color( index, red, green, blue );
|
||||
#endif
|
||||
rgb_matrix_driver.set_color(index, red, green, blue);
|
||||
}
|
||||
|
||||
void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) {
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_set_color_all( red, green, blue );
|
||||
#elif defined(IS31FL3733)
|
||||
IS31FL3733_set_color_all( red, green, blue );
|
||||
#endif
|
||||
rgb_matrix_driver.set_color_all(red, green, blue);
|
||||
}
|
||||
|
||||
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
|
||||
|
|
@ -196,47 +187,6 @@ void rgb_matrix_test(void) {
|
|||
}
|
||||
}
|
||||
|
||||
// This tests the LEDs
|
||||
// Note that it will change the LED control registers
|
||||
// in the LED drivers, and leave them in an invalid
|
||||
// state for other backlight effects.
|
||||
// ONLY USE THIS FOR TESTING LEDS!
|
||||
void rgb_matrix_single_LED_test(void) {
|
||||
static uint8_t color = 0; // 0,1,2 for R,G,B
|
||||
static uint8_t row = 0;
|
||||
static uint8_t column = 0;
|
||||
|
||||
static uint8_t tick = 0;
|
||||
tick++;
|
||||
|
||||
if ( tick > 2 )
|
||||
{
|
||||
tick = 0;
|
||||
column++;
|
||||
}
|
||||
if ( column > MATRIX_COLS )
|
||||
{
|
||||
column = 0;
|
||||
row++;
|
||||
}
|
||||
if ( row > MATRIX_ROWS )
|
||||
{
|
||||
row = 0;
|
||||
color++;
|
||||
}
|
||||
if ( color > 2 )
|
||||
{
|
||||
color = 0;
|
||||
}
|
||||
|
||||
uint8_t led[8], led_count;
|
||||
map_row_column_to_led(row,column,led,&led_count);
|
||||
for(uint8_t i = 0; i < led_count; i++) {
|
||||
rgb_matrix_set_color_all( 40, 40, 40 );
|
||||
rgb_matrix_test_led( led[i], color==0, color==1, color==2 );
|
||||
}
|
||||
}
|
||||
|
||||
// All LEDs off
|
||||
void rgb_matrix_all_off(void) {
|
||||
rgb_matrix_set_color_all( 0, 0, 0 );
|
||||
|
|
@ -438,10 +388,12 @@ void rgb_matrix_cycle_up_down(void) {
|
|||
void rgb_matrix_dual_beacon(void) {
|
||||
HSV hsv = { .h = rgb_matrix_config.hue, .s = rgb_matrix_config.sat, .v = rgb_matrix_config.val };
|
||||
RGB rgb;
|
||||
rgb_led led;
|
||||
Point point;
|
||||
double cos_value = cos(g_tick * PI / 128) / 32;
|
||||
double sin_value = sin(g_tick * PI / 128) / 112;
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
led = g_rgb_leds[i];
|
||||
hsv.h = ((led.point.y - 32.0)* cos(g_tick * PI / 128) / 32 + (led.point.x - 112.0) * sin(g_tick * PI / 128) / (112)) * (180) + rgb_matrix_config.hue;
|
||||
point = g_rgb_leds[i].point;
|
||||
hsv.h = ((point.y - 32.0)* cos_value + (point.x - 112.0) * sin_value) * (180) + rgb_matrix_config.hue;
|
||||
rgb = hsv_to_rgb( hsv );
|
||||
rgb_matrix_set_color( i, rgb.r, rgb.g, rgb.b );
|
||||
}
|
||||
|
|
@ -450,10 +402,12 @@ void rgb_matrix_dual_beacon(void) {
|
|||
void rgb_matrix_rainbow_beacon(void) {
|
||||
HSV hsv = { .h = rgb_matrix_config.hue, .s = rgb_matrix_config.sat, .v = rgb_matrix_config.val };
|
||||
RGB rgb;
|
||||
rgb_led led;
|
||||
Point point;
|
||||
double cos_value = cos(g_tick * PI / 128);
|
||||
double sin_value = sin(g_tick * PI / 128);
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
led = g_rgb_leds[i];
|
||||
hsv.h = (1.5 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * (led.point.y - 32.0)* cos(g_tick * PI / 128) + (1.5 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * (led.point.x - 112.0) * sin(g_tick * PI / 128) + rgb_matrix_config.hue;
|
||||
point = g_rgb_leds[i].point;
|
||||
hsv.h = (1.5 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * (point.y - 32.0)* cos_value + (1.5 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * (point.x - 112.0) * sin_value + rgb_matrix_config.hue;
|
||||
rgb = hsv_to_rgb( hsv );
|
||||
rgb_matrix_set_color( i, rgb.r, rgb.g, rgb.b );
|
||||
}
|
||||
|
|
@ -462,10 +416,12 @@ void rgb_matrix_rainbow_beacon(void) {
|
|||
void rgb_matrix_rainbow_pinwheels(void) {
|
||||
HSV hsv = { .h = rgb_matrix_config.hue, .s = rgb_matrix_config.sat, .v = rgb_matrix_config.val };
|
||||
RGB rgb;
|
||||
rgb_led led;
|
||||
Point point;
|
||||
double cos_value = cos(g_tick * PI / 128);
|
||||
double sin_value = sin(g_tick * PI / 128);
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
led = g_rgb_leds[i];
|
||||
hsv.h = (2 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * (led.point.y - 32.0)* cos(g_tick * PI / 128) + (2 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * (66 - abs(led.point.x - 112.0)) * sin(g_tick * PI / 128) + rgb_matrix_config.hue;
|
||||
point = g_rgb_leds[i].point;
|
||||
hsv.h = (2 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * (point.y - 32.0)* cos_value + (2 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * (66 - abs(point.x - 112.0)) * sin_value + rgb_matrix_config.hue;
|
||||
rgb = hsv_to_rgb( hsv );
|
||||
rgb_matrix_set_color( i, rgb.r, rgb.g, rgb.b );
|
||||
}
|
||||
|
|
@ -474,12 +430,14 @@ void rgb_matrix_rainbow_pinwheels(void) {
|
|||
void rgb_matrix_rainbow_moving_chevron(void) {
|
||||
HSV hsv = { .h = rgb_matrix_config.hue, .s = rgb_matrix_config.sat, .v = rgb_matrix_config.val };
|
||||
RGB rgb;
|
||||
rgb_led led;
|
||||
Point point;
|
||||
uint8_t r = 128;
|
||||
double cos_value = cos(r * PI / 128);
|
||||
double sin_value = sin(r * PI / 128);
|
||||
double multiplier = (g_tick / 256.0 * 224);
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
led = g_rgb_leds[i];
|
||||
// uint8_t r = g_tick;
|
||||
uint8_t r = 128;
|
||||
hsv.h = (1.5 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * abs(led.point.y - 32.0)* sin(r * PI / 128) + (1.5 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * (led.point.x - (g_tick / 256.0 * 224)) * cos(r * PI / 128) + rgb_matrix_config.hue;
|
||||
point = g_rgb_leds[i].point;
|
||||
hsv.h = (1.5 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * abs(point.y - 32.0)* sin_value + (1.5 * (rgb_matrix_config.speed == 0 ? 1 : rgb_matrix_config.speed)) * (point.x - multiplier) * cos_value + rgb_matrix_config.hue;
|
||||
rgb = hsv_to_rgb( hsv );
|
||||
rgb_matrix_set_color( i, rgb.r, rgb.g, rgb.b );
|
||||
}
|
||||
|
|
@ -510,6 +468,68 @@ void rgb_matrix_jellybean_raindrops( bool initialize ) {
|
|||
}
|
||||
}
|
||||
|
||||
void rgb_matrix_digital_rain( const bool initialize ) {
|
||||
// algorithm ported from https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain
|
||||
const uint8_t drop_ticks = 28;
|
||||
const uint8_t pure_green_intensity = 0xd0;
|
||||
const uint8_t max_brightness_boost = 0xc0;
|
||||
const uint8_t max_intensity = 0xff;
|
||||
|
||||
static uint8_t map[MATRIX_COLS][MATRIX_ROWS] = {{0}};
|
||||
static uint8_t drop = 0;
|
||||
|
||||
if (initialize) {
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
memset(map, 0, sizeof map);
|
||||
drop = 0;
|
||||
}
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) {
|
||||
// top row, pixels have just fallen and we're
|
||||
// making a new rain drop in this column
|
||||
map[col][row] = max_intensity;
|
||||
}
|
||||
else if (map[col][row] > 0 && map[col][row] < max_intensity) {
|
||||
// neither fully bright nor dark, decay it
|
||||
map[col][row]--;
|
||||
}
|
||||
// set the pixel colour
|
||||
uint8_t led, led_count;
|
||||
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
|
||||
* (map[col][row] - pure_green_intensity) / (max_intensity - pure_green_intensity));
|
||||
rgb_matrix_set_color(led, boost, max_intensity, boost);
|
||||
}
|
||||
else {
|
||||
const uint8_t green = (uint8_t) ((uint16_t) max_intensity * map[col][row] / pure_green_intensity);
|
||||
rgb_matrix_set_color(led, 0, green, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (++drop > drop_ticks) {
|
||||
// reset drop timer
|
||||
drop = 0;
|
||||
for (uint8_t row = MATRIX_ROWS - 1; row > 0; row--) {
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
// if ths is on the bottom row and bright allow decay
|
||||
if (row == MATRIX_ROWS - 1 && map[col][row] == max_intensity) {
|
||||
map[col][row]--;
|
||||
}
|
||||
// check if the pixel above is bright
|
||||
if (map[col][row - 1] == max_intensity) {
|
||||
// allow old bright pixel to decay
|
||||
map[col][row - 1]--;
|
||||
// make this pixel bright
|
||||
map[col][row] = max_intensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_matrix_multisplash(void) {
|
||||
// if (g_any_key_hit < 0xFF) {
|
||||
HSV hsv = { .h = rgb_matrix_config.hue, .s = rgb_matrix_config.sat, .v = rgb_matrix_config.val };
|
||||
|
|
@ -600,7 +620,8 @@ void rgb_matrix_custom(void) {
|
|||
void rgb_matrix_task(void) {
|
||||
static uint8_t toggle_enable_last = 255;
|
||||
if (!rgb_matrix_config.enable) {
|
||||
rgb_matrix_all_off();
|
||||
rgb_matrix_all_off();
|
||||
rgb_matrix_indicators();
|
||||
toggle_enable_last = rgb_matrix_config.enable;
|
||||
return;
|
||||
}
|
||||
|
|
@ -685,6 +706,9 @@ void rgb_matrix_task(void) {
|
|||
case RGB_MATRIX_JELLYBEAN_RAINDROPS:
|
||||
rgb_matrix_jellybean_raindrops( initialize );
|
||||
break;
|
||||
case RGB_MATRIX_DIGITAL_RAIN:
|
||||
rgb_matrix_digital_rain( initialize );
|
||||
break;
|
||||
#ifdef RGB_MATRIX_KEYPRESSES
|
||||
case RGB_MATRIX_SOLID_REACTIVE:
|
||||
rgb_matrix_solid_reactive();
|
||||
|
|
@ -743,7 +767,7 @@ void rgb_matrix_indicators_user(void) {}
|
|||
// }
|
||||
|
||||
void rgb_matrix_init(void) {
|
||||
rgb_matrix_setup_drivers();
|
||||
rgb_matrix_driver.init();
|
||||
|
||||
// TODO: put the 1 second startup delay here?
|
||||
|
||||
|
|
@ -767,33 +791,6 @@ void rgb_matrix_init(void) {
|
|||
eeconfig_debug_rgb_matrix(); // display current eeprom values
|
||||
}
|
||||
|
||||
void rgb_matrix_setup_drivers(void) {
|
||||
// Initialize TWI
|
||||
i2c_init();
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_init( DRIVER_ADDR_1 );
|
||||
IS31FL3731_init( DRIVER_ADDR_2 );
|
||||
#elif defined (IS31FL3733)
|
||||
IS31FL3733_init( DRIVER_ADDR_1 );
|
||||
#endif
|
||||
|
||||
for ( int index = 0; index < DRIVER_LED_TOTAL; index++ ) {
|
||||
bool enabled = true;
|
||||
// This only caches it for later
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_set_led_control_register( index, enabled, enabled, enabled );
|
||||
#elif defined (IS31FL3733)
|
||||
IS31FL3733_set_led_control_register( index, enabled, enabled, enabled );
|
||||
#endif
|
||||
}
|
||||
// This actually updates the LED drivers
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
|
||||
#elif defined (IS31FL3733)
|
||||
IS31FL3733_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
|
||||
#endif
|
||||
}
|
||||
|
||||
// Deals with the messy details of incrementing an integer
|
||||
uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
|
||||
int16_t new_value = value;
|
||||
|
|
@ -836,28 +833,6 @@ uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
|
|||
// }
|
||||
// }
|
||||
|
||||
void rgb_matrix_test_led( uint8_t index, bool red, bool green, bool blue ) {
|
||||
for ( int i=0; i<DRIVER_LED_TOTAL; i++ )
|
||||
{
|
||||
if ( i == index )
|
||||
{
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_set_led_control_register( i, red, green, blue );
|
||||
#elif defined (IS31FL3733)
|
||||
IS31FL3733_set_led_control_register( i, red, green, blue );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_set_led_control_register( i, false, false, false );
|
||||
#elif defined (IS31FL3733)
|
||||
IS31FL3733_set_led_control_register( i, false, false, false );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t rgb_matrix_get_tick(void) {
|
||||
return g_tick;
|
||||
}
|
||||
|
|
@ -929,3 +904,10 @@ void rgblight_mode(uint8_t mode) {
|
|||
uint32_t rgblight_get_mode(void) {
|
||||
return rgb_matrix_config.mode;
|
||||
}
|
||||
|
||||
void rgblight_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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ enum rgb_matrix_effects {
|
|||
RGB_MATRIX_RAINBOW_PINWHEELS,
|
||||
RGB_MATRIX_RAINBOW_MOVING_CHEVRON,
|
||||
RGB_MATRIX_JELLYBEAN_RAINDROPS,
|
||||
RGB_MATRIX_DIGITAL_RAIN,
|
||||
#ifdef RGB_MATRIX_KEYPRESSES
|
||||
RGB_MATRIX_SOLID_REACTIVE,
|
||||
RGB_MATRIX_SPLASH,
|
||||
|
|
@ -99,8 +100,6 @@ void rgb_matrix_indicators(void);
|
|||
void rgb_matrix_indicators_kb(void);
|
||||
void rgb_matrix_indicators_user(void);
|
||||
|
||||
void rgb_matrix_single_LED_test(void);
|
||||
|
||||
void rgb_matrix_init(void);
|
||||
void rgb_matrix_setup_drivers(void);
|
||||
|
||||
|
|
@ -125,11 +124,11 @@ void rgb_matrix_decrease(void);
|
|||
// void backlight_get_key_color( uint8_t led, HSV *hsv );
|
||||
// void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv );
|
||||
|
||||
void rgb_matrix_test_led( uint8_t index, bool red, bool green, bool blue );
|
||||
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);
|
||||
|
|
@ -142,4 +141,18 @@ void rgblight_decrease_speed(void);
|
|||
void rgblight_mode(uint8_t mode);
|
||||
uint32_t rgblight_get_mode(void);
|
||||
|
||||
typedef struct {
|
||||
/* Perform any initialisation required for the other driver functions to work. */
|
||||
void (*init)(void);
|
||||
|
||||
/* Set the colour of a single LED in the buffer. */
|
||||
void (*set_color)(int index, uint8_t r, uint8_t g, uint8_t b);
|
||||
/* Set the colour of all LEDS on the keyboard in the buffer. */
|
||||
void (*set_color_all)(uint8_t r, uint8_t g, uint8_t b);
|
||||
/* Flush any buffered changes to the hardware. */
|
||||
void (*flush)(void);
|
||||
} rgb_matrix_driver_t;
|
||||
|
||||
extern const rgb_matrix_driver_t rgb_matrix_driver;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
82
quantum/rgb_matrix_drivers.c
Normal file
82
quantum/rgb_matrix_drivers.c
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/* Copyright 2018 James Laird-Wah
|
||||
*
|
||||
* 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 "rgb_matrix.h"
|
||||
|
||||
/* Each driver needs to define the struct
|
||||
* const rgb_matrix_driver_t rgb_matrix_driver;
|
||||
* All members must be provided.
|
||||
* Keyboard custom drivers can define this in their own files, it should only
|
||||
* be here if shared between boards.
|
||||
*/
|
||||
|
||||
#if defined(IS31FL3731) || defined(IS31FL3733)
|
||||
|
||||
#include "i2c_master.h"
|
||||
|
||||
static void init( void )
|
||||
{
|
||||
i2c_init();
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_init( DRIVER_ADDR_1 );
|
||||
IS31FL3731_init( DRIVER_ADDR_2 );
|
||||
#else
|
||||
IS31FL3733_init( DRIVER_ADDR_1 );
|
||||
#endif
|
||||
for ( int index = 0; index < DRIVER_LED_TOTAL; index++ ) {
|
||||
bool enabled = true;
|
||||
// This only caches it for later
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_set_led_control_register( index, enabled, enabled, enabled );
|
||||
#else
|
||||
IS31FL3733_set_led_control_register( index, enabled, enabled, enabled );
|
||||
#endif
|
||||
}
|
||||
// This actually updates the LED drivers
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
|
||||
#else
|
||||
IS31FL3733_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef IS31FL3731
|
||||
static void flush( void )
|
||||
{
|
||||
IS31FL3731_update_pwm_buffers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
|
||||
}
|
||||
|
||||
const rgb_matrix_driver_t rgb_matrix_driver = {
|
||||
.init = init,
|
||||
.flush = flush,
|
||||
.set_color = IS31FL3731_set_color,
|
||||
.set_color_all = IS31FL3731_set_color_all,
|
||||
};
|
||||
#else
|
||||
static void flush( void )
|
||||
{
|
||||
IS31FL3733_update_pwm_buffers( DRIVER_ADDR_1, DRIVER_ADDR_2 );
|
||||
}
|
||||
|
||||
const rgb_matrix_driver_t rgb_matrix_driver = {
|
||||
.init = init,
|
||||
.flush = flush,
|
||||
.set_color = IS31FL3733_set_color,
|
||||
.set_color_all = IS31FL3733_set_color_all,
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -860,13 +860,13 @@ void rgblight_effect_alternating(void){
|
|||
last_timer = timer_read();
|
||||
|
||||
for(int i = 0; i<RGBLED_NUM; i++){
|
||||
if(i<RGBLED_NUM/2 && pos){
|
||||
rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, i);
|
||||
}else if (i>=RGBLED_NUM/2 && !pos){
|
||||
rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, i);
|
||||
}else{
|
||||
rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, 0, i);
|
||||
}
|
||||
if(i<RGBLED_NUM/2 && pos){
|
||||
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
|
||||
}else if (i>=RGBLED_NUM/2 && !pos){
|
||||
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]);
|
||||
}else{
|
||||
sethsv(rgblight_config.hue, rgblight_config.sat, 0, (LED_TYPE *)&led[i]);
|
||||
}
|
||||
}
|
||||
rgblight_set();
|
||||
pos = (pos + 1) % 2;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,52 @@
|
|||
|
||||
#include "rgblight_reconfig.h"
|
||||
|
||||
/***** rgblight_mode(mode)/rgblight_mode_noeeprom(mode) ****
|
||||
|
||||
old mode number (before 0.6.117) to new mode name table
|
||||
|
||||
|-----------------|-----------------------------------|
|
||||
| old mode number | new mode name |
|
||||
|-----------------|-----------------------------------|
|
||||
| 1 | RGBLIGHT_MODE_STATIC_LIGHT |
|
||||
| 2 | RGBLIGHT_MODE_BREATHING |
|
||||
| 3 | RGBLIGHT_MODE_BREATHING + 1 |
|
||||
| 4 | RGBLIGHT_MODE_BREATHING + 2 |
|
||||
| 5 | RGBLIGHT_MODE_BREATHING + 3 |
|
||||
| 6 | RGBLIGHT_MODE_RAINBOW_MOOD |
|
||||
| 7 | RGBLIGHT_MODE_RAINBOW_MOOD + 1 |
|
||||
| 8 | RGBLIGHT_MODE_RAINBOW_MOOD + 2 |
|
||||
| 9 | RGBLIGHT_MODE_RAINBOW_SWIRL |
|
||||
| 10 | RGBLIGHT_MODE_RAINBOW_SWIRL + 1 |
|
||||
| 11 | RGBLIGHT_MODE_RAINBOW_SWIRL + 2 |
|
||||
| 12 | RGBLIGHT_MODE_RAINBOW_SWIRL + 3 |
|
||||
| 13 | RGBLIGHT_MODE_RAINBOW_SWIRL + 4 |
|
||||
| 14 | RGBLIGHT_MODE_RAINBOW_SWIRL + 5 |
|
||||
| 15 | RGBLIGHT_MODE_SNAKE |
|
||||
| 16 | RGBLIGHT_MODE_SNAKE + 1 |
|
||||
| 17 | RGBLIGHT_MODE_SNAKE + 2 |
|
||||
| 18 | RGBLIGHT_MODE_SNAKE + 3 |
|
||||
| 19 | RGBLIGHT_MODE_SNAKE + 4 |
|
||||
| 20 | RGBLIGHT_MODE_SNAKE + 5 |
|
||||
| 21 | RGBLIGHT_MODE_KNIGHT |
|
||||
| 22 | RGBLIGHT_MODE_KNIGHT + 1 |
|
||||
| 23 | RGBLIGHT_MODE_KNIGHT + 2 |
|
||||
| 24 | RGBLIGHT_MODE_CHRISTMAS |
|
||||
| 25 | RGBLIGHT_MODE_STATIC_GRADIENT |
|
||||
| 26 | RGBLIGHT_MODE_STATIC_GRADIENT + 1 |
|
||||
| 27 | RGBLIGHT_MODE_STATIC_GRADIENT + 2 |
|
||||
| 28 | RGBLIGHT_MODE_STATIC_GRADIENT + 3 |
|
||||
| 29 | RGBLIGHT_MODE_STATIC_GRADIENT + 4 |
|
||||
| 30 | RGBLIGHT_MODE_STATIC_GRADIENT + 5 |
|
||||
| 31 | RGBLIGHT_MODE_STATIC_GRADIENT + 6 |
|
||||
| 32 | RGBLIGHT_MODE_STATIC_GRADIENT + 7 |
|
||||
| 33 | RGBLIGHT_MODE_STATIC_GRADIENT + 8 |
|
||||
| 34 | RGBLIGHT_MODE_STATIC_GRADIENT + 9 |
|
||||
| 35 | RGBLIGHT_MODE_RGB_TEST |
|
||||
| 36 | RGBLIGHT_MODE_ALTERNATING |
|
||||
|-----------------|-----------------------------------|
|
||||
*****/
|
||||
|
||||
#define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_ ## sym,
|
||||
#define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym,
|
||||
#define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_ ## sym,
|
||||
|
|
@ -238,6 +284,10 @@ void rgblight_effect_alternating(void);
|
|||
#ifdef RGBLIGHT_EFFECT_ALTERNATING
|
||||
_RGBM_SINGLE_DYNAMIC( ALTERNATING )
|
||||
#endif
|
||||
//// Add a new mode here.
|
||||
// #ifdef RGBLIGHT_EFFECT_<name>
|
||||
// _RGBM_<SINGLE|MULTI>_<STATIC|DYNAMIC>( <name> )
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
#undef _RGBM_SINGLE_STATIC
|
||||
|
|
|
|||
|
|
@ -355,24 +355,6 @@ void matrix_slave_scan(void) {
|
|||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
serial_slave_buffer[i] = matrix[offset+i];
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_I2C
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
// Read backlight level sent from master and update level on slave
|
||||
backlight_set(i2c_slave_buffer[0]);
|
||||
#endif
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
i2c_slave_buffer[i+1] = matrix[offset+i];
|
||||
}
|
||||
#else // USE_SERIAL
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
serial_slave_buffer[i] = matrix[offset+i];
|
||||
}
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
// Read backlight level sent from master and update level on slave
|
||||
backlight_set(serial_master_buffer[SERIAL_BACKLIT_START]);
|
||||
#endif
|
||||
#endif
|
||||
matrix_slave_scan_user();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,14 +106,14 @@ void keyboard_slave_loop(void) {
|
|||
|
||||
// Read Backlight Info
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
if (BACKLIT_DIRTY) {
|
||||
#ifdef USE_I2C
|
||||
#ifdef USE_I2C
|
||||
if (BACKLIT_DIRTY) {
|
||||
backlight_set(i2c_slave_buffer[I2C_BACKLIT_START]);
|
||||
#else // USE_SERIAL
|
||||
backlight_set(serial_master_buffer[SERIAL_BACKLIT_START]);
|
||||
#endif
|
||||
BACKLIT_DIRTY = false;
|
||||
}
|
||||
BACKLIT_DIRTY = false;
|
||||
}
|
||||
#else // USE_SERIAL
|
||||
backlight_set(serial_master_buffer[SERIAL_BACKLIT_START]);
|
||||
#endif
|
||||
#endif
|
||||
// Read RGB Info
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue