Merge branch 'master' into planck_thk
This commit is contained in:
commit
21c2324c3e
8128 changed files with 356427 additions and 96548 deletions
|
|
@ -67,7 +67,7 @@ void process_api(uint16_t length, uint8_t * data) {
|
|||
case DT_RGBLIGHT: {
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
uint32_t rgblight = bytes_to_dword(data, 2);
|
||||
rgblight_update_dword(rgblight);
|
||||
eeconfig_update_rgblight(rgblight);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ uint16_t notes_count;
|
|||
bool notes_repeat;
|
||||
bool note_resting = false;
|
||||
|
||||
uint8_t current_note = 0;
|
||||
uint16_t current_note = 0;
|
||||
uint8_t rest_counter = 0;
|
||||
|
||||
#ifdef VIBRATO_ENABLE
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ uint16_t notes_count;
|
|||
bool notes_repeat;
|
||||
bool note_resting = false;
|
||||
|
||||
uint8_t current_note = 0;
|
||||
uint16_t current_note = 0;
|
||||
uint8_t rest_counter = 0;
|
||||
|
||||
#ifdef VIBRATO_ENABLE
|
||||
|
|
@ -79,7 +79,10 @@ float startup_song[][2] = STARTUP_SONG;
|
|||
|
||||
static void gpt_cb8(GPTDriver *gptp);
|
||||
|
||||
#define DAC_BUFFER_SIZE 720
|
||||
#define DAC_BUFFER_SIZE 100
|
||||
#ifndef DAC_SAMPLE_MAX
|
||||
#define DAC_SAMPLE_MAX 65535U
|
||||
#endif
|
||||
|
||||
#define START_CHANNEL_1() gptStart(&GPTD6, &gpt6cfg1); \
|
||||
gptStartContinuous(&GPTD6, 2U)
|
||||
|
|
@ -95,8 +98,8 @@ static void gpt_cb8(GPTDriver *gptp);
|
|||
RESTART_CHANNEL_1()
|
||||
#define UPDATE_CHANNEL_2_FREQ(freq) gpt7cfg1.frequency = freq * DAC_BUFFER_SIZE; \
|
||||
RESTART_CHANNEL_2()
|
||||
#define GET_CHANNEL_1_FREQ gpt6cfg1.frequency
|
||||
#define GET_CHANNEL_2_FREQ gpt7cfg1.frequency
|
||||
#define GET_CHANNEL_1_FREQ (uint16_t)(gpt6cfg1.frequency * DAC_BUFFER_SIZE)
|
||||
#define GET_CHANNEL_2_FREQ (uint16_t)(gpt7cfg1.frequency * DAC_BUFFER_SIZE)
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -202,132 +205,16 @@ GPTConfig gpt8cfg1 = {
|
|||
|
||||
// squarewave
|
||||
static const dacsample_t dac_buffer[DAC_BUFFER_SIZE] = {
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
// First half is max, second half is 0
|
||||
[0 ... DAC_BUFFER_SIZE/2-1] = DAC_SAMPLE_MAX,
|
||||
[DAC_BUFFER_SIZE/2 ... DAC_BUFFER_SIZE -1] = 0,
|
||||
};
|
||||
|
||||
// squarewave
|
||||
static const dacsample_t dac_buffer_2[DAC_BUFFER_SIZE] = {
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047,
|
||||
2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047
|
||||
// opposite of dac_buffer above
|
||||
[0 ... DAC_BUFFER_SIZE/2-1] = 0,
|
||||
[DAC_BUFFER_SIZE/2 ... DAC_BUFFER_SIZE -1] = DAC_SAMPLE_MAX,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -363,7 +250,7 @@ static void error_cb1(DACDriver *dacp, dacerror_t err) {
|
|||
}
|
||||
|
||||
static const DACConfig dac1cfg1 = {
|
||||
.init = 2047U,
|
||||
.init = DAC_SAMPLE_MAX,
|
||||
.datamode = DAC_DHRM_12BIT_RIGHT
|
||||
};
|
||||
|
||||
|
|
@ -375,7 +262,7 @@ static const DACConversionGroup dacgrpcfg1 = {
|
|||
};
|
||||
|
||||
static const DACConfig dac1cfg2 = {
|
||||
.init = 2047U,
|
||||
.init = DAC_SAMPLE_MAX,
|
||||
.datamode = DAC_DHRM_12BIT_RIGHT
|
||||
};
|
||||
|
||||
|
|
@ -386,19 +273,24 @@ static const DACConversionGroup dacgrpcfg2 = {
|
|||
.trigger = DAC_TRG(0)
|
||||
};
|
||||
|
||||
void audio_init()
|
||||
{
|
||||
void audio_init() {
|
||||
|
||||
if (audio_initialized)
|
||||
return;
|
||||
if (audio_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check EEPROM
|
||||
// if (!eeconfig_is_enabled())
|
||||
// {
|
||||
// eeconfig_init();
|
||||
// }
|
||||
// audio_config.raw = eeconfig_read_audio();
|
||||
// Check EEPROM
|
||||
#if defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE)
|
||||
if (!eeconfig_is_enabled()) {
|
||||
eeconfig_init();
|
||||
}
|
||||
audio_config.raw = eeconfig_read_audio();
|
||||
#else // ARM EEPROM
|
||||
audio_config.enable = true;
|
||||
#ifdef AUDIO_CLICKY_ON
|
||||
audio_config.clicky_enable = true;
|
||||
#endif
|
||||
#endif // ARM EEPROM
|
||||
|
||||
/*
|
||||
* Starting DAC1 driver, setting up the output pin as analog as suggested
|
||||
|
|
@ -421,16 +313,17 @@ void audio_init()
|
|||
dacStartConversion(&DACD1, &dacgrpcfg1, (dacsample_t *)dac_buffer, DAC_BUFFER_SIZE);
|
||||
dacStartConversion(&DACD2, &dacgrpcfg2, (dacsample_t *)dac_buffer_2, DAC_BUFFER_SIZE);
|
||||
|
||||
audio_initialized = true;
|
||||
audio_initialized = true;
|
||||
|
||||
if (audio_config.enable) {
|
||||
PLAY_SONG(startup_song);
|
||||
}
|
||||
if (audio_config.enable) {
|
||||
PLAY_SONG(startup_song);
|
||||
} else {
|
||||
stop_all_notes();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void stop_all_notes()
|
||||
{
|
||||
void stop_all_notes() {
|
||||
dprintf("audio stop all notes");
|
||||
|
||||
if (!audio_initialized) {
|
||||
|
|
@ -455,347 +348,347 @@ void stop_all_notes()
|
|||
}
|
||||
}
|
||||
|
||||
void stop_note(float freq)
|
||||
{
|
||||
dprintf("audio stop note freq=%d", (int)freq);
|
||||
void stop_note(float freq) {
|
||||
dprintf("audio stop note freq=%d", (int)freq);
|
||||
|
||||
if (playing_note) {
|
||||
if (!audio_initialized) {
|
||||
audio_init();
|
||||
}
|
||||
for (int i = 7; i >= 0; i--) {
|
||||
if (frequencies[i] == freq) {
|
||||
frequencies[i] = 0;
|
||||
volumes[i] = 0;
|
||||
for (int j = i; (j < 7); j++) {
|
||||
frequencies[j] = frequencies[j+1];
|
||||
frequencies[j+1] = 0;
|
||||
volumes[j] = volumes[j+1];
|
||||
volumes[j+1] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
voices--;
|
||||
if (voices < 0)
|
||||
voices = 0;
|
||||
if (voice_place >= voices) {
|
||||
voice_place = 0;
|
||||
}
|
||||
if (voices == 0) {
|
||||
STOP_CHANNEL_1();
|
||||
STOP_CHANNEL_2();
|
||||
gptStopTimer(&GPTD8);
|
||||
frequency = 0;
|
||||
frequency_alt = 0;
|
||||
volume = 0;
|
||||
playing_note = false;
|
||||
}
|
||||
if (playing_note) {
|
||||
if (!audio_initialized) {
|
||||
audio_init();
|
||||
}
|
||||
for (int i = 7; i >= 0; i--) {
|
||||
if (frequencies[i] == freq) {
|
||||
frequencies[i] = 0;
|
||||
volumes[i] = 0;
|
||||
for (int j = i; (j < 7); j++) {
|
||||
frequencies[j] = frequencies[j+1];
|
||||
frequencies[j+1] = 0;
|
||||
volumes[j] = volumes[j+1];
|
||||
volumes[j+1] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
voices--;
|
||||
if (voices < 0) {
|
||||
voices = 0;
|
||||
}
|
||||
if (voice_place >= voices) {
|
||||
voice_place = 0;
|
||||
}
|
||||
if (voices == 0) {
|
||||
STOP_CHANNEL_1();
|
||||
STOP_CHANNEL_2();
|
||||
gptStopTimer(&GPTD8);
|
||||
frequency = 0;
|
||||
frequency_alt = 0;
|
||||
volume = 0;
|
||||
playing_note = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VIBRATO_ENABLE
|
||||
|
||||
float mod(float a, int b)
|
||||
{
|
||||
float r = fmod(a, b);
|
||||
return r < 0 ? r + b : r;
|
||||
float mod(float a, int b) {
|
||||
float r = fmod(a, b);
|
||||
return r < 0 ? r + b : r;
|
||||
}
|
||||
|
||||
float vibrato(float average_freq) {
|
||||
#ifdef VIBRATO_STRENGTH_ENABLE
|
||||
float vibrated_freq = average_freq * pow(vibrato_lut[(int)vibrato_counter], vibrato_strength);
|
||||
#else
|
||||
float vibrated_freq = average_freq * vibrato_lut[(int)vibrato_counter];
|
||||
#endif
|
||||
vibrato_counter = mod((vibrato_counter + vibrato_rate * (1.0 + 440.0/average_freq)), VIBRATO_LUT_LENGTH);
|
||||
return vibrated_freq;
|
||||
#ifdef VIBRATO_STRENGTH_ENABLE
|
||||
float vibrated_freq = average_freq * pow(vibrato_lut[(int)vibrato_counter], vibrato_strength);
|
||||
#else
|
||||
float vibrated_freq = average_freq * vibrato_lut[(int)vibrato_counter];
|
||||
#endif
|
||||
vibrato_counter = mod((vibrato_counter + vibrato_rate * (1.0 + 440.0/average_freq)), VIBRATO_LUT_LENGTH);
|
||||
return vibrated_freq;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void gpt_cb8(GPTDriver *gptp) {
|
||||
float freq;
|
||||
float freq;
|
||||
|
||||
if (playing_note) {
|
||||
if (voices > 0) {
|
||||
if (playing_note) {
|
||||
if (voices > 0) {
|
||||
|
||||
float freq_alt = 0;
|
||||
if (voices > 1) {
|
||||
if (polyphony_rate == 0) {
|
||||
if (glissando) {
|
||||
if (frequency_alt != 0 && frequency_alt < frequencies[voices - 2] && frequency_alt < frequencies[voices - 2] * pow(2, -440/frequencies[voices - 2]/12/2)) {
|
||||
frequency_alt = frequency_alt * pow(2, 440/frequency_alt/12/2);
|
||||
} else if (frequency_alt != 0 && frequency_alt > frequencies[voices - 2] && frequency_alt > frequencies[voices - 2] * pow(2, 440/frequencies[voices - 2]/12/2)) {
|
||||
frequency_alt = frequency_alt * pow(2, -440/frequency_alt/12/2);
|
||||
} else {
|
||||
frequency_alt = frequencies[voices - 2];
|
||||
}
|
||||
} else {
|
||||
frequency_alt = frequencies[voices - 2];
|
||||
}
|
||||
|
||||
#ifdef VIBRATO_ENABLE
|
||||
if (vibrato_strength > 0) {
|
||||
freq_alt = vibrato(frequency_alt);
|
||||
} else {
|
||||
freq_alt = frequency_alt;
|
||||
}
|
||||
#else
|
||||
freq_alt = frequency_alt;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (envelope_index < 65535) {
|
||||
envelope_index++;
|
||||
}
|
||||
|
||||
freq_alt = voice_envelope(freq_alt);
|
||||
|
||||
if (freq_alt < 30.517578125) {
|
||||
freq_alt = 30.52;
|
||||
}
|
||||
|
||||
if (GET_CHANNEL_2_FREQ != (uint16_t)freq_alt) {
|
||||
UPDATE_CHANNEL_2_FREQ(freq_alt);
|
||||
} else {
|
||||
RESTART_CHANNEL_2();
|
||||
}
|
||||
//note_timbre;
|
||||
}
|
||||
|
||||
if (polyphony_rate > 0) {
|
||||
if (voices > 1) {
|
||||
voice_place %= voices;
|
||||
if (place++ > (frequencies[voice_place] / polyphony_rate)) {
|
||||
voice_place = (voice_place + 1) % voices;
|
||||
place = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VIBRATO_ENABLE
|
||||
if (vibrato_strength > 0) {
|
||||
freq = vibrato(frequencies[voice_place]);
|
||||
} else {
|
||||
freq = frequencies[voice_place];
|
||||
}
|
||||
#else
|
||||
freq = frequencies[voice_place];
|
||||
#endif
|
||||
float freq_alt = 0;
|
||||
if (voices > 1) {
|
||||
if (polyphony_rate == 0) {
|
||||
if (glissando) {
|
||||
if (frequency_alt != 0 && frequency_alt < frequencies[voices - 2] && frequency_alt < frequencies[voices - 2] * pow(2, -440/frequencies[voices - 2]/12/2)) {
|
||||
frequency_alt = frequency_alt * pow(2, 440/frequency_alt/12/2);
|
||||
} else if (frequency_alt != 0 && frequency_alt > frequencies[voices - 2] && frequency_alt > frequencies[voices - 2] * pow(2, 440/frequencies[voices - 2]/12/2)) {
|
||||
frequency_alt = frequency_alt * pow(2, -440/frequency_alt/12/2);
|
||||
} else {
|
||||
if (glissando) {
|
||||
if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) {
|
||||
frequency = frequency * pow(2, 440/frequency/12/2);
|
||||
} else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) {
|
||||
frequency = frequency * pow(2, -440/frequency/12/2);
|
||||
} else {
|
||||
frequency = frequencies[voices - 1];
|
||||
}
|
||||
} else {
|
||||
frequency = frequencies[voices - 1];
|
||||
}
|
||||
|
||||
#ifdef VIBRATO_ENABLE
|
||||
if (vibrato_strength > 0) {
|
||||
freq = vibrato(frequency);
|
||||
} else {
|
||||
freq = frequency;
|
||||
}
|
||||
#else
|
||||
freq = frequency;
|
||||
#endif
|
||||
frequency_alt = frequencies[voices - 2];
|
||||
}
|
||||
} else {
|
||||
frequency_alt = frequencies[voices - 2];
|
||||
}
|
||||
|
||||
if (envelope_index < 65535) {
|
||||
envelope_index++;
|
||||
}
|
||||
|
||||
freq = voice_envelope(freq);
|
||||
|
||||
if (freq < 30.517578125) {
|
||||
freq = 30.52;
|
||||
}
|
||||
|
||||
|
||||
if (GET_CHANNEL_1_FREQ != (uint16_t)freq) {
|
||||
UPDATE_CHANNEL_1_FREQ(freq);
|
||||
#ifdef VIBRATO_ENABLE
|
||||
if (vibrato_strength > 0) {
|
||||
freq_alt = vibrato(frequency_alt);
|
||||
} else {
|
||||
RESTART_CHANNEL_1();
|
||||
freq_alt = frequency_alt;
|
||||
}
|
||||
//note_timbre;
|
||||
#else
|
||||
freq_alt = frequency_alt;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (playing_notes) {
|
||||
if (note_frequency > 0) {
|
||||
#ifdef VIBRATO_ENABLE
|
||||
if (vibrato_strength > 0) {
|
||||
freq = vibrato(note_frequency);
|
||||
} else {
|
||||
freq = note_frequency;
|
||||
}
|
||||
#else
|
||||
freq = note_frequency;
|
||||
#endif
|
||||
if (envelope_index < 65535) {
|
||||
envelope_index++;
|
||||
}
|
||||
|
||||
if (envelope_index < 65535) {
|
||||
envelope_index++;
|
||||
}
|
||||
freq = voice_envelope(freq);
|
||||
freq_alt = voice_envelope(freq_alt);
|
||||
|
||||
if (freq_alt < 30.517578125) {
|
||||
freq_alt = 30.52;
|
||||
}
|
||||
|
||||
if (GET_CHANNEL_1_FREQ != (uint16_t)freq) {
|
||||
UPDATE_CHANNEL_1_FREQ(freq);
|
||||
UPDATE_CHANNEL_2_FREQ(freq);
|
||||
}
|
||||
//note_timbre;
|
||||
if (GET_CHANNEL_2_FREQ != (uint16_t)freq_alt) {
|
||||
UPDATE_CHANNEL_2_FREQ(freq_alt);
|
||||
} else {
|
||||
// gptStopTimer(&GPTD6);
|
||||
// gptStopTimer(&GPTD7);
|
||||
RESTART_CHANNEL_2();
|
||||
}
|
||||
//note_timbre;
|
||||
}
|
||||
|
||||
if (polyphony_rate > 0) {
|
||||
if (voices > 1) {
|
||||
voice_place %= voices;
|
||||
if (place++ > (frequencies[voice_place] / polyphony_rate)) {
|
||||
voice_place = (voice_place + 1) % voices;
|
||||
place = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
note_position++;
|
||||
bool end_of_note = false;
|
||||
if (GET_CHANNEL_1_FREQ > 0) {
|
||||
if (!note_resting)
|
||||
end_of_note = (note_position >= (note_length*8 - 1));
|
||||
else
|
||||
end_of_note = (note_position >= (note_length*8));
|
||||
#ifdef VIBRATO_ENABLE
|
||||
if (vibrato_strength > 0) {
|
||||
freq = vibrato(frequencies[voice_place]);
|
||||
} else {
|
||||
freq = frequencies[voice_place];
|
||||
}
|
||||
#else
|
||||
freq = frequencies[voice_place];
|
||||
#endif
|
||||
} else {
|
||||
if (glissando) {
|
||||
if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) {
|
||||
frequency = frequency * pow(2, 440/frequency/12/2);
|
||||
} else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) {
|
||||
frequency = frequency * pow(2, -440/frequency/12/2);
|
||||
} else {
|
||||
frequency = frequencies[voices - 1];
|
||||
}
|
||||
} else {
|
||||
end_of_note = (note_position >= (note_length*8));
|
||||
frequency = frequencies[voices - 1];
|
||||
}
|
||||
|
||||
if (end_of_note) {
|
||||
current_note++;
|
||||
if (current_note >= notes_count) {
|
||||
if (notes_repeat) {
|
||||
current_note = 0;
|
||||
} else {
|
||||
STOP_CHANNEL_1();
|
||||
STOP_CHANNEL_2();
|
||||
// gptStopTimer(&GPTD8);
|
||||
playing_notes = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!note_resting) {
|
||||
note_resting = true;
|
||||
current_note--;
|
||||
if ((*notes_pointer)[current_note][0] == (*notes_pointer)[current_note + 1][0]) {
|
||||
note_frequency = 0;
|
||||
note_length = 1;
|
||||
} else {
|
||||
note_frequency = (*notes_pointer)[current_note][0];
|
||||
note_length = 1;
|
||||
}
|
||||
} else {
|
||||
note_resting = false;
|
||||
envelope_index = 0;
|
||||
note_frequency = (*notes_pointer)[current_note][0];
|
||||
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
|
||||
}
|
||||
#ifdef VIBRATO_ENABLE
|
||||
if (vibrato_strength > 0) {
|
||||
freq = vibrato(frequency);
|
||||
} else {
|
||||
freq = frequency;
|
||||
}
|
||||
#else
|
||||
freq = frequency;
|
||||
#endif
|
||||
}
|
||||
|
||||
note_position = 0;
|
||||
if (envelope_index < 65535) {
|
||||
envelope_index++;
|
||||
}
|
||||
|
||||
freq = voice_envelope(freq);
|
||||
|
||||
if (freq < 30.517578125) {
|
||||
freq = 30.52;
|
||||
}
|
||||
|
||||
|
||||
if (GET_CHANNEL_1_FREQ != (uint16_t)freq) {
|
||||
UPDATE_CHANNEL_1_FREQ(freq);
|
||||
} else {
|
||||
RESTART_CHANNEL_1();
|
||||
}
|
||||
//note_timbre;
|
||||
}
|
||||
}
|
||||
|
||||
if (playing_notes) {
|
||||
if (note_frequency > 0) {
|
||||
#ifdef VIBRATO_ENABLE
|
||||
if (vibrato_strength > 0) {
|
||||
freq = vibrato(note_frequency);
|
||||
} else {
|
||||
freq = note_frequency;
|
||||
}
|
||||
#else
|
||||
freq = note_frequency;
|
||||
#endif
|
||||
|
||||
if (envelope_index < 65535) {
|
||||
envelope_index++;
|
||||
}
|
||||
freq = voice_envelope(freq);
|
||||
|
||||
|
||||
if (GET_CHANNEL_1_FREQ != (uint16_t)freq) {
|
||||
UPDATE_CHANNEL_1_FREQ(freq);
|
||||
UPDATE_CHANNEL_2_FREQ(freq);
|
||||
}
|
||||
//note_timbre;
|
||||
} else {
|
||||
// gptStopTimer(&GPTD6);
|
||||
// gptStopTimer(&GPTD7);
|
||||
}
|
||||
|
||||
if (!audio_config.enable) {
|
||||
playing_notes = false;
|
||||
playing_note = false;
|
||||
note_position++;
|
||||
bool end_of_note = false;
|
||||
if (GET_CHANNEL_1_FREQ > 0) {
|
||||
if (!note_resting)
|
||||
end_of_note = (note_position >= (note_length*8 - 1));
|
||||
else
|
||||
end_of_note = (note_position >= (note_length*8));
|
||||
} else {
|
||||
end_of_note = (note_position >= (note_length*8));
|
||||
}
|
||||
|
||||
if (end_of_note) {
|
||||
current_note++;
|
||||
if (current_note >= notes_count) {
|
||||
if (notes_repeat) {
|
||||
current_note = 0;
|
||||
} else {
|
||||
STOP_CHANNEL_1();
|
||||
STOP_CHANNEL_2();
|
||||
// gptStopTimer(&GPTD8);
|
||||
playing_notes = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!note_resting) {
|
||||
note_resting = true;
|
||||
current_note--;
|
||||
if ((*notes_pointer)[current_note][0] == (*notes_pointer)[current_note + 1][0]) {
|
||||
note_frequency = 0;
|
||||
note_length = 1;
|
||||
} else {
|
||||
note_frequency = (*notes_pointer)[current_note][0];
|
||||
note_length = 1;
|
||||
}
|
||||
} else {
|
||||
note_resting = false;
|
||||
envelope_index = 0;
|
||||
note_frequency = (*notes_pointer)[current_note][0];
|
||||
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
|
||||
}
|
||||
|
||||
note_position = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!audio_config.enable) {
|
||||
playing_notes = false;
|
||||
playing_note = false;
|
||||
}
|
||||
}
|
||||
|
||||
void play_note(float freq, int vol) {
|
||||
|
||||
dprintf("audio play note freq=%d vol=%d", (int)freq, vol);
|
||||
dprintf("audio play note freq=%d vol=%d", (int)freq, vol);
|
||||
|
||||
if (!audio_initialized) {
|
||||
audio_init();
|
||||
if (!audio_initialized) {
|
||||
audio_init();
|
||||
}
|
||||
|
||||
if (audio_config.enable && voices < 8) {
|
||||
|
||||
// Cancel notes if notes are playing
|
||||
if (playing_notes) {
|
||||
stop_all_notes();
|
||||
}
|
||||
|
||||
if (audio_config.enable && voices < 8) {
|
||||
playing_note = true;
|
||||
|
||||
envelope_index = 0;
|
||||
|
||||
// Cancel notes if notes are playing
|
||||
if (playing_notes)
|
||||
stop_all_notes();
|
||||
|
||||
playing_note = true;
|
||||
|
||||
envelope_index = 0;
|
||||
|
||||
if (freq > 0) {
|
||||
frequencies[voices] = freq;
|
||||
volumes[voices] = vol;
|
||||
voices++;
|
||||
}
|
||||
|
||||
gptStart(&GPTD8, &gpt8cfg1);
|
||||
gptStartContinuous(&GPTD8, 2U);
|
||||
RESTART_CHANNEL_1();
|
||||
RESTART_CHANNEL_2();
|
||||
if (freq > 0) {
|
||||
frequencies[voices] = freq;
|
||||
volumes[voices] = vol;
|
||||
voices++;
|
||||
}
|
||||
|
||||
gptStart(&GPTD8, &gpt8cfg1);
|
||||
gptStartContinuous(&GPTD8, 2U);
|
||||
RESTART_CHANNEL_1();
|
||||
RESTART_CHANNEL_2();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat)
|
||||
{
|
||||
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat) {
|
||||
|
||||
if (!audio_initialized) {
|
||||
audio_init();
|
||||
if (!audio_initialized) {
|
||||
audio_init();
|
||||
}
|
||||
|
||||
if (audio_config.enable) {
|
||||
|
||||
// Cancel note if a note is playing
|
||||
if (playing_note) {
|
||||
stop_all_notes();
|
||||
}
|
||||
|
||||
if (audio_config.enable) {
|
||||
playing_notes = true;
|
||||
|
||||
// Cancel note if a note is playing
|
||||
if (playing_note)
|
||||
stop_all_notes();
|
||||
notes_pointer = np;
|
||||
notes_count = n_count;
|
||||
notes_repeat = n_repeat;
|
||||
|
||||
playing_notes = true;
|
||||
place = 0;
|
||||
current_note = 0;
|
||||
|
||||
notes_pointer = np;
|
||||
notes_count = n_count;
|
||||
notes_repeat = n_repeat;
|
||||
|
||||
place = 0;
|
||||
current_note = 0;
|
||||
|
||||
note_frequency = (*notes_pointer)[current_note][0];
|
||||
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
|
||||
note_position = 0;
|
||||
|
||||
gptStart(&GPTD8, &gpt8cfg1);
|
||||
gptStartContinuous(&GPTD8, 2U);
|
||||
RESTART_CHANNEL_1();
|
||||
RESTART_CHANNEL_2();
|
||||
}
|
||||
note_frequency = (*notes_pointer)[current_note][0];
|
||||
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
|
||||
note_position = 0;
|
||||
|
||||
gptStart(&GPTD8, &gpt8cfg1);
|
||||
gptStartContinuous(&GPTD8, 2U);
|
||||
RESTART_CHANNEL_1();
|
||||
RESTART_CHANNEL_2();
|
||||
}
|
||||
}
|
||||
|
||||
bool is_playing_notes(void) {
|
||||
return playing_notes;
|
||||
return playing_notes;
|
||||
}
|
||||
|
||||
bool is_audio_on(void) {
|
||||
return (audio_config.enable != 0);
|
||||
return (audio_config.enable != 0);
|
||||
}
|
||||
|
||||
void audio_toggle(void) {
|
||||
audio_config.enable ^= 1;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
if (audio_config.enable)
|
||||
audio_on_user();
|
||||
audio_config.enable ^= 1;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
if (audio_config.enable) {
|
||||
audio_on_user();
|
||||
}
|
||||
}
|
||||
|
||||
void audio_on(void) {
|
||||
audio_config.enable = 1;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
audio_on_user();
|
||||
audio_config.enable = 1;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
audio_on_user();
|
||||
}
|
||||
|
||||
void audio_off(void) {
|
||||
audio_config.enable = 0;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
stop_all_notes();
|
||||
audio_config.enable = 0;
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
}
|
||||
|
||||
#ifdef VIBRATO_ENABLE
|
||||
|
|
@ -803,29 +696,29 @@ void audio_off(void) {
|
|||
// Vibrato rate functions
|
||||
|
||||
void set_vibrato_rate(float rate) {
|
||||
vibrato_rate = rate;
|
||||
vibrato_rate = rate;
|
||||
}
|
||||
|
||||
void increase_vibrato_rate(float change) {
|
||||
vibrato_rate *= change;
|
||||
vibrato_rate *= change;
|
||||
}
|
||||
|
||||
void decrease_vibrato_rate(float change) {
|
||||
vibrato_rate /= change;
|
||||
vibrato_rate /= change;
|
||||
}
|
||||
|
||||
#ifdef VIBRATO_STRENGTH_ENABLE
|
||||
|
||||
void set_vibrato_strength(float strength) {
|
||||
vibrato_strength = strength;
|
||||
vibrato_strength = strength;
|
||||
}
|
||||
|
||||
void increase_vibrato_strength(float change) {
|
||||
vibrato_strength *= change;
|
||||
vibrato_strength *= change;
|
||||
}
|
||||
|
||||
void decrease_vibrato_strength(float change) {
|
||||
vibrato_strength /= change;
|
||||
vibrato_strength /= change;
|
||||
}
|
||||
|
||||
#endif /* VIBRATO_STRENGTH_ENABLE */
|
||||
|
|
@ -835,45 +728,45 @@ void decrease_vibrato_strength(float change) {
|
|||
// Polyphony functions
|
||||
|
||||
void set_polyphony_rate(float rate) {
|
||||
polyphony_rate = rate;
|
||||
polyphony_rate = rate;
|
||||
}
|
||||
|
||||
void enable_polyphony() {
|
||||
polyphony_rate = 5;
|
||||
polyphony_rate = 5;
|
||||
}
|
||||
|
||||
void disable_polyphony() {
|
||||
polyphony_rate = 0;
|
||||
polyphony_rate = 0;
|
||||
}
|
||||
|
||||
void increase_polyphony_rate(float change) {
|
||||
polyphony_rate *= change;
|
||||
polyphony_rate *= change;
|
||||
}
|
||||
|
||||
void decrease_polyphony_rate(float change) {
|
||||
polyphony_rate /= change;
|
||||
polyphony_rate /= change;
|
||||
}
|
||||
|
||||
// Timbre function
|
||||
|
||||
void set_timbre(float timbre) {
|
||||
note_timbre = timbre;
|
||||
note_timbre = timbre;
|
||||
}
|
||||
|
||||
// Tempo functions
|
||||
|
||||
void set_tempo(uint8_t tempo) {
|
||||
note_tempo = tempo;
|
||||
note_tempo = tempo;
|
||||
}
|
||||
|
||||
void decrease_tempo(uint8_t tempo_change) {
|
||||
note_tempo += tempo_change;
|
||||
note_tempo += tempo_change;
|
||||
}
|
||||
|
||||
void increase_tempo(uint8_t tempo_change) {
|
||||
if (note_tempo - tempo_change < 10) {
|
||||
note_tempo = 10;
|
||||
} else {
|
||||
note_tempo -= tempo_change;
|
||||
}
|
||||
if (note_tempo - tempo_change < 10) {
|
||||
note_tempo = 10;
|
||||
} else {
|
||||
note_tempo -= tempo_change;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ bool notes_repeat;
|
|||
float notes_rest;
|
||||
bool note_resting = false;
|
||||
|
||||
uint8_t current_note = 0;
|
||||
uint16_t current_note = 0;
|
||||
uint8_t rest_counter = 0;
|
||||
|
||||
#ifdef VIBRATO_ENABLE
|
||||
|
|
|
|||
|
|
@ -26,12 +26,14 @@
|
|||
|
||||
// Note Types
|
||||
#define MUSICAL_NOTE(note, duration) {(NOTE##note), duration}
|
||||
#define BREVE_NOTE(note) MUSICAL_NOTE(note, 128)
|
||||
#define WHOLE_NOTE(note) MUSICAL_NOTE(note, 64)
|
||||
#define HALF_NOTE(note) MUSICAL_NOTE(note, 32)
|
||||
#define QUARTER_NOTE(note) MUSICAL_NOTE(note, 16)
|
||||
#define EIGHTH_NOTE(note) MUSICAL_NOTE(note, 8)
|
||||
#define SIXTEENTH_NOTE(note) MUSICAL_NOTE(note, 4)
|
||||
|
||||
#define BREVE_DOT_NOTE(note) MUSICAL_NOTE(note, 128+64)
|
||||
#define WHOLE_DOT_NOTE(note) MUSICAL_NOTE(note, 64+32)
|
||||
#define HALF_DOT_NOTE(note) MUSICAL_NOTE(note, 32+16)
|
||||
#define QUARTER_DOT_NOTE(note) MUSICAL_NOTE(note, 16+8)
|
||||
|
|
@ -40,11 +42,13 @@
|
|||
|
||||
// Note Type Shortcuts
|
||||
#define M__NOTE(note, duration) MUSICAL_NOTE(note, duration)
|
||||
#define B__NOTE(n) BREVE_NOTE(n)
|
||||
#define W__NOTE(n) WHOLE_NOTE(n)
|
||||
#define H__NOTE(n) HALF_NOTE(n)
|
||||
#define Q__NOTE(n) QUARTER_NOTE(n)
|
||||
#define E__NOTE(n) EIGHTH_NOTE(n)
|
||||
#define S__NOTE(n) SIXTEENTH_NOTE(n)
|
||||
#define BD_NOTE(n) BREVE_DOT_NOTE(n)
|
||||
#define WD_NOTE(n) WHOLE_DOT_NOTE(n)
|
||||
#define HD_NOTE(n) HALF_DOT_NOTE(n)
|
||||
#define QD_NOTE(n) QUARTER_DOT_NOTE(n)
|
||||
|
|
@ -61,7 +65,11 @@
|
|||
|
||||
// Notes - # = Octave
|
||||
|
||||
#ifdef __arm__
|
||||
#define NOTE_REST 1.00f
|
||||
#else
|
||||
#define NOTE_REST 0.00f
|
||||
#endif
|
||||
|
||||
/* These notes are currently bugged
|
||||
#define NOTE_C0 16.35f
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
/* Copyright 2016 Jack Humbert
|
||||
/* Any song or sound without a license explicitly stated is:
|
||||
*
|
||||
* Copyright 2016 Jack Humbert
|
||||
* Copyright 2017 Zach White
|
||||
*
|
||||
* 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
|
||||
|
|
@ -13,57 +16,32 @@
|
|||
* 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 "musical_notes.h"
|
||||
#pragma once
|
||||
|
||||
#ifndef SONG_LIST_H
|
||||
#define SONG_LIST_H
|
||||
#include "musical_notes.h"
|
||||
|
||||
#define NO_SOUND
|
||||
|
||||
#define LP_NUMB \
|
||||
H__NOTE(_CS5), H__NOTE(_E5), H__NOTE(_CS5), WD_NOTE(_FS5), \
|
||||
WD_NOTE(_A5), WD_NOTE(_GS5), WD_NOTE(_REST), H__NOTE(_CS5), H__NOTE(_E5), \
|
||||
H__NOTE(_CS5), WD_NOTE(_A5), WD_NOTE(_GS5), WD_NOTE(_E5),
|
||||
|
||||
|
||||
/* Ode to Joy
|
||||
* Author: Friedrich Schiller
|
||||
+ License: Public Domain
|
||||
*/
|
||||
#define ODE_TO_JOY \
|
||||
Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \
|
||||
Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \
|
||||
Q__NOTE(_C4), Q__NOTE(_C4), Q__NOTE(_D4), Q__NOTE(_E4), \
|
||||
QD_NOTE(_E4), E__NOTE(_D4), H__NOTE(_D4),
|
||||
|
||||
/* Rock-a-bye Baby
|
||||
* Author: Unknown
|
||||
+ License: Public Domain
|
||||
*/
|
||||
#define ROCK_A_BYE_BABY \
|
||||
QD_NOTE(_B4), E__NOTE(_D4), Q__NOTE(_B5), \
|
||||
H__NOTE(_A5), Q__NOTE(_G5), \
|
||||
QD_NOTE(_B4), E__NOTE(_D5), Q__NOTE(_G5), \
|
||||
H__NOTE(_FS5),
|
||||
|
||||
#define CLOSE_ENCOUNTERS_5_NOTE \
|
||||
Q__NOTE(_D5), \
|
||||
Q__NOTE(_E5), \
|
||||
Q__NOTE(_C5), \
|
||||
Q__NOTE(_C4), \
|
||||
Q__NOTE(_G4),
|
||||
|
||||
#define DOE_A_DEER \
|
||||
QD_NOTE(_C4), E__NOTE(_D4), \
|
||||
QD_NOTE(_E4), E__NOTE(_C4), \
|
||||
Q__NOTE(_E4), Q__NOTE(_C4), \
|
||||
Q__NOTE(_E4),
|
||||
|
||||
/* Requires: PLAY_NOTE_ARRAY(..., ..., STACCATO); */
|
||||
#define IN_LIKE_FLINT \
|
||||
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4), \
|
||||
E__NOTE(_AS4), E__NOTE(_B4), QD_NOTE(_CS4), \
|
||||
E__NOTE(_B4), E__NOTE(_CS4), QD_NOTE(_DS4), \
|
||||
E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \
|
||||
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4),
|
||||
|
||||
#define IMPERIAL_MARCH \
|
||||
HD_NOTE(_A4), HD_NOTE(_A4), HD_NOTE(_A4), QD_NOTE(_F4), QD_NOTE(_C5), \
|
||||
HD_NOTE(_A4), QD_NOTE(_F4), QD_NOTE(_C5), WD_NOTE(_A4), \
|
||||
HD_NOTE(_E5), HD_NOTE(_E5), HD_NOTE(_E5), QD_NOTE(_F5), QD_NOTE(_C5), \
|
||||
HD_NOTE(_A4), QD_NOTE(_F4), QD_NOTE(_C5), WD_NOTE(_A4)
|
||||
|
||||
#define CLUEBOARD_SOUND \
|
||||
HD_NOTE(_C3), HD_NOTE(_D3), HD_NOTE(_E3), HD_NOTE(_F3), HD_NOTE(_G3), HD_NOTE(_A4), HD_NOTE(_B4), HD_NOTE(_C4)
|
||||
|
|
@ -78,11 +56,6 @@
|
|||
Q__NOTE(_F3)
|
||||
*/
|
||||
|
||||
#define BASKET_CASE \
|
||||
QD_NOTE(_G3), E__NOTE(_F3), E__NOTE(_E3), Q__NOTE(_F3), M__NOTE(_G3, 8+32), Q__NOTE(_REST), \
|
||||
Q__NOTE(_B4), Q__NOTE(_C4), Q__NOTE(_B4), E__NOTE(_A4), Q__NOTE(_G3), M__NOTE(_G3, 8+32), Q__NOTE(_REST), \
|
||||
Q__NOTE(_B4), Q__NOTE(_C4), Q__NOTE(_B4), E__NOTE(_A4), Q__NOTE(_G3), Q__NOTE(_G3), Q__NOTE(_G3), Q__NOTE(_G3), E__NOTE(_A4), E__NOTE(_C4), QD_NOTE(_B4), HD_NOTE(_B4)
|
||||
|
||||
#define STARTUP_SOUND \
|
||||
E__NOTE(_E6), \
|
||||
E__NOTE(_A6), \
|
||||
|
|
@ -130,6 +103,17 @@
|
|||
S__NOTE(_REST), \
|
||||
E__NOTE(_E7 ),
|
||||
|
||||
#define WORKMAN_SOUND \
|
||||
E__NOTE(_GS6 ), \
|
||||
E__NOTE(_A6 ), \
|
||||
S__NOTE(_REST), \
|
||||
E__NOTE(_GS6 ), \
|
||||
E__NOTE(_A6 ), \
|
||||
S__NOTE(_REST), \
|
||||
ED_NOTE(_FS7 ), \
|
||||
S__NOTE(_REST), \
|
||||
ED_NOTE(_A7 ),
|
||||
|
||||
#define PLOVER_SOUND \
|
||||
E__NOTE(_GS6 ), \
|
||||
E__NOTE(_A6 ), \
|
||||
|
|
@ -257,219 +241,118 @@
|
|||
E__NOTE(_E6), \
|
||||
S__NOTE(_B5),
|
||||
|
||||
#define COIN_SOUND \
|
||||
E__NOTE(_A5 ), \
|
||||
HD_NOTE(_E6 ),
|
||||
|
||||
#define ONE_UP_SOUND \
|
||||
Q__NOTE(_E6 ), \
|
||||
Q__NOTE(_G6 ), \
|
||||
Q__NOTE(_E7 ), \
|
||||
Q__NOTE(_C7 ), \
|
||||
Q__NOTE(_D7 ), \
|
||||
Q__NOTE(_G7 ),
|
||||
|
||||
#define SONIC_RING \
|
||||
E__NOTE(_E6), \
|
||||
E__NOTE(_G6), \
|
||||
HD_NOTE(_C7),
|
||||
|
||||
#define ZELDA_PUZZLE \
|
||||
Q__NOTE(_G5), \
|
||||
Q__NOTE(_FS5), \
|
||||
Q__NOTE(_DS5), \
|
||||
Q__NOTE(_A4), \
|
||||
Q__NOTE(_GS4), \
|
||||
Q__NOTE(_E5), \
|
||||
Q__NOTE(_GS5), \
|
||||
HD_NOTE(_C6),
|
||||
|
||||
#define ZELDA_TREASURE \
|
||||
Q__NOTE(_A4 ), \
|
||||
Q__NOTE(_AS4), \
|
||||
Q__NOTE(_B4 ), \
|
||||
HD_NOTE(_C5 ), \
|
||||
|
||||
#define TERMINAL_SOUND \
|
||||
E__NOTE(_C5 )
|
||||
|
||||
#define OVERWATCH_THEME \
|
||||
HD_NOTE(_A4 ), \
|
||||
Q__NOTE(_E4 ), \
|
||||
Q__NOTE(_A4 ), \
|
||||
HD_NOTE(_B4 ), \
|
||||
Q__NOTE(_E4 ), \
|
||||
Q__NOTE(_B4 ), \
|
||||
W__NOTE(_CS5),
|
||||
|
||||
#define MARIO_THEME \
|
||||
Q__NOTE(_E5), \
|
||||
H__NOTE(_E5), \
|
||||
H__NOTE(_E5), \
|
||||
Q__NOTE(_C5), \
|
||||
H__NOTE(_E5), \
|
||||
W__NOTE(_G5), \
|
||||
Q__NOTE(_G4),
|
||||
/* Title: La Campanella
|
||||
* Author/Composer: Frank Lizst
|
||||
+ License: Public Domain
|
||||
*/
|
||||
#define CAMPANELLA \
|
||||
Q__NOTE(_DS4), E__NOTE(_DS4), E__NOTE(_DS5), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_DS5), E__NOTE(_DS5), \
|
||||
E__NOTE(_DS6), Q__NOTE(_CS5), E__NOTE(_CS5), E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), \
|
||||
Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_GS4), \
|
||||
E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_G4), E__NOTE(_G4), E__NOTE(_DS6), Q__NOTE(_GS4), E__NOTE(_GS4), \
|
||||
E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_DS4), E__NOTE(_DS4), E__NOTE(_DS6), \
|
||||
Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_E5), E__NOTE(_E5), E__NOTE(_DS6), Q__NOTE(_DS5), \
|
||||
E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_CS5), E__NOTE(_CS5), E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), \
|
||||
E__NOTE(_DS6), Q__NOTE(_B4), E__NOTE(_B4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), \
|
||||
Q__NOTE(_GS4), E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_G4), E__NOTE(_G4), E__NOTE(_DS6), Q__NOTE(_GS4), \
|
||||
E__NOTE(_GS4), E__NOTE(_DS6), Q__NOTE(_AS4), E__NOTE(_AS4), E__NOTE(_DS6), Q__NOTE(_DS4), E__NOTE(_DS4), \
|
||||
E__NOTE(_DS5), Q__NOTE(_DS5), E__NOTE(_DS5), E__NOTE(_DS6), Q__NOTE(_DS6), E__NOTE(_DS6), E__NOTE(_DS7), \
|
||||
Q__NOTE(_DS6), E__NOTE(_DS6), E__NOTE(_DS7), Q__NOTE(_CS6), E__NOTE(_CS6), E__NOTE(_DS7), Q__NOTE(_B5), \
|
||||
E__NOTE(_B5), E__NOTE(_DS7), Q__NOTE(_B5), E__NOTE(_B5), E__NOTE(_DS7), Q__NOTE(_AS5), E__NOTE(_AS5), \
|
||||
E__NOTE(_DS7), Q__NOTE(_GS5), E__NOTE(_GS5), E__NOTE(_DS7), Q__NOTE(_G5), E__NOTE(_G5), E__NOTE(_DS7), \
|
||||
Q__NOTE(_GS5), E__NOTE(_GS5), E__NOTE(_DS7), Q__NOTE(_AS5), E__NOTE(_AS5), E__NOTE(_DS7), Q__NOTE(_DS5), \
|
||||
E__NOTE(_DS5), E__NOTE(_DS7), W__NOTE(_DS6), W__NOTE(_GS5),
|
||||
|
||||
#define MARIO_GAMEOVER \
|
||||
HD_NOTE(_C5 ), \
|
||||
HD_NOTE(_G4 ), \
|
||||
H__NOTE(_E4 ), \
|
||||
H__NOTE(_A4 ), \
|
||||
H__NOTE(_B4 ), \
|
||||
H__NOTE(_A4 ), \
|
||||
H__NOTE(_AF4), \
|
||||
H__NOTE(_BF4), \
|
||||
H__NOTE(_AF4), \
|
||||
WD_NOTE(_G4 ),
|
||||
|
||||
#define MARIO_MUSHROOM \
|
||||
S__NOTE(_C5 ), \
|
||||
S__NOTE(_G4 ), \
|
||||
S__NOTE(_C5 ), \
|
||||
S__NOTE(_E5 ), \
|
||||
S__NOTE(_G5 ), \
|
||||
S__NOTE(_C6 ), \
|
||||
S__NOTE(_G5 ), \
|
||||
S__NOTE(_GS4), \
|
||||
S__NOTE(_C5 ), \
|
||||
S__NOTE(_DS5), \
|
||||
S__NOTE(_GS5), \
|
||||
S__NOTE(_DS5), \
|
||||
S__NOTE(_GS5), \
|
||||
S__NOTE(_C6 ), \
|
||||
S__NOTE(_DS6), \
|
||||
S__NOTE(_GS6), \
|
||||
S__NOTE(_DS6), \
|
||||
S__NOTE(_AS4), \
|
||||
S__NOTE(_D5 ), \
|
||||
S__NOTE(_F5 ), \
|
||||
S__NOTE(_AS5), \
|
||||
S__NOTE(_D6 ), \
|
||||
S__NOTE(_F6 ), \
|
||||
S__NOTE(_AS6), \
|
||||
S__NOTE(_F6 )
|
||||
|
||||
#define E1M1_DOOM \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E4 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_D4 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_C4 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_BF3), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_B3 ), \
|
||||
Q__NOTE(_C4 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E4 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_D4 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_C4 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
Q__NOTE(_E3 ), \
|
||||
H__NOTE(_BF3),
|
||||
|
||||
#define DISNEY_SONG \
|
||||
H__NOTE(_G3 ), \
|
||||
H__NOTE(_G4 ), \
|
||||
H__NOTE(_F4 ), \
|
||||
H__NOTE(_E4 ), \
|
||||
H__NOTE(_CS4), \
|
||||
H__NOTE(_D4 ), \
|
||||
W__NOTE(_A4 ), \
|
||||
H__NOTE(_B3 ), \
|
||||
H__NOTE(_B4 ), \
|
||||
H__NOTE(_A4 ), \
|
||||
H__NOTE(_G4 ), \
|
||||
H__NOTE(_FS4), \
|
||||
H__NOTE(_G4 ), \
|
||||
W__NOTE(_C5 ), \
|
||||
H__NOTE(_D5 ), \
|
||||
H__NOTE(_C5 ), \
|
||||
H__NOTE(_B4 ), \
|
||||
H__NOTE(_A4 ), \
|
||||
H__NOTE(_G4 ), \
|
||||
H__NOTE(_F4 ), \
|
||||
H__NOTE(_E4 ), \
|
||||
H__NOTE(_D4 ), \
|
||||
W__NOTE(_A4 ), \
|
||||
W__NOTE(_B3 ), \
|
||||
W__NOTE(_C4 ),
|
||||
/* Title: Fantaisie-Impromptu
|
||||
* Author/Composer: Chopin
|
||||
* License: Public Domain
|
||||
*/
|
||||
#define FANTASIE_IMPROMPTU \
|
||||
E__NOTE(_GS4), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), \
|
||||
E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_GS4), E__NOTE(_A4), \
|
||||
E__NOTE(_GS4), E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), \
|
||||
E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_A4), E__NOTE(_CS5), E__NOTE(_DS5), \
|
||||
E__NOTE(_FS5), E__NOTE(_A5), E__NOTE(_CS6), E__NOTE(_DS6), E__NOTE(_B6), E__NOTE(_A6), E__NOTE(_GS6), E__NOTE(_FS6), \
|
||||
E__NOTE(_E6), E__NOTE(_DS6), E__NOTE(_FS6), E__NOTE(_CS6), E__NOTE(_C5), E__NOTE(_DS6), E__NOTE(_A5), E__NOTE(_GS5), \
|
||||
E__NOTE(_FS5), E__NOTE(_A5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_FS5), E__NOTE(_CS5), E__NOTE(_C5), E__NOTE(_DS5), \
|
||||
E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_B4), E__NOTE(_A4), E__NOTE(_A4), E__NOTE(_GS4), E__NOTE(_A4), E__NOTE(_GS4), \
|
||||
E__NOTE(_REST), E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_CS5), \
|
||||
E__NOTE(_C5), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_GS4), E__NOTE(_AS4), E__NOTE(_GS4), E__NOTE(_REST), \
|
||||
E__NOTE(_GS4), E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_DS5), E__NOTE(_CS5), E__NOTE(_C5), \
|
||||
E__NOTE(_CS5), E__NOTE(_E5), E__NOTE(_GS5), E__NOTE(_DS5), E__NOTE(_E5), E__NOTE(_DS5), E__NOTE(_REST), E__NOTE(_DS5), \
|
||||
E__NOTE(_B5), E__NOTE(_AS5), E__NOTE(_GS5), E__NOTE(_REST), E__NOTE(_E6), E__NOTE(_DS6), E__NOTE(_CS6), E__NOTE(_B5), \
|
||||
E__NOTE(_AS5), E__NOTE(_GS5), E__NOTE(_REST), E__NOTE(_AS5), WD_NOTE(_GS5),
|
||||
|
||||
#define NUMBER_ONE \
|
||||
HD_NOTE(_F4 ), \
|
||||
Q__NOTE(_C5 ), \
|
||||
E__NOTE(_B4 ), \
|
||||
E__NOTE(_C5 ), \
|
||||
E__NOTE(_B4 ), \
|
||||
E__NOTE(_C5 ), \
|
||||
Q__NOTE(_B4 ), \
|
||||
Q__NOTE(_C5 ), \
|
||||
H__NOTE(_AF4), \
|
||||
HD_NOTE(_F4 ), \
|
||||
Q__NOTE(_F4 ), \
|
||||
Q__NOTE(_AF4), \
|
||||
Q__NOTE(_C5 ), \
|
||||
H__NOTE(_DF5), \
|
||||
H__NOTE(_AF4), \
|
||||
H__NOTE(_DF5), \
|
||||
H__NOTE(_EF5), \
|
||||
Q__NOTE(_C5 ), \
|
||||
Q__NOTE(_DF5), \
|
||||
Q__NOTE(_C5 ), \
|
||||
Q__NOTE(_DF5), \
|
||||
H__NOTE(_C5 ),
|
||||
|
||||
#define CABBAGE_SONG \
|
||||
H__NOTE(_C4), \
|
||||
H__NOTE(_A4), \
|
||||
H__NOTE(_B4), \
|
||||
H__NOTE(_B4), \
|
||||
H__NOTE(_A4), \
|
||||
H__NOTE(_G4), \
|
||||
H__NOTE(_E4),
|
||||
/* Title: Nocturne Op. 9 No. 1 in B flat minor
|
||||
* Author/Composer: Chopin
|
||||
License: Public Domain
|
||||
*/
|
||||
#define NOCTURNE_OP_9_NO_1 \
|
||||
H__NOTE(_BF5), H__NOTE(_C6), H__NOTE(_DF6), H__NOTE(_A5), H__NOTE(_BF5), H__NOTE(_GF5), W__NOTE(_F5), W__NOTE(_F5), W__NOTE(_F5), \
|
||||
W__NOTE(_F5), H__NOTE(_GF5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_C5), B__NOTE(_DF5), W__NOTE(_BF4), Q__NOTE(_BF5), \
|
||||
Q__NOTE(_C6), Q__NOTE(_DF6), Q__NOTE(_A5), Q__NOTE(_BF5), Q__NOTE(_A5), Q__NOTE(_GS5), Q__NOTE(_A5), Q__NOTE(_C6), \
|
||||
Q__NOTE(_BF5), Q__NOTE(_GF5), Q__NOTE(_F5), Q__NOTE(_GF5), Q__NOTE(_E5), Q__NOTE(_F5), Q__NOTE(_BF5), Q__NOTE(_A5), \
|
||||
Q__NOTE(_AF5), Q__NOTE(_G5), Q__NOTE(_GF5), Q__NOTE(_F5), Q__NOTE(_E5), Q__NOTE(_EF5), Q__NOTE(_D5), Q__NOTE(_DF5), \
|
||||
Q__NOTE(_C5), Q__NOTE(_DF5), Q__NOTE(_C5), Q__NOTE(_B4), Q__NOTE(_C5), Q__NOTE(_F5), Q__NOTE(_E5), Q__NOTE(_EF5), \
|
||||
B__NOTE(_DF5), W__NOTE(_BF4), W__NOTE(_BF5), W__NOTE(_BF5), W__NOTE(_BF5), BD_NOTE(_AF5), W__NOTE(_DF5), H__NOTE(_BF4), \
|
||||
H__NOTE(_C5), H__NOTE(_DF5), H__NOTE(_GF5), H__NOTE(_GF5), BD_NOTE(_F5), W__NOTE(_EF5), H__NOTE(_F5), H__NOTE(_EF5), \
|
||||
H__NOTE(_DF5), H__NOTE(_A4), B__NOTE(_AF4), W__NOTE(_DF5), W__NOTE(_EF5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_DF5), \
|
||||
H__NOTE(_EF5), BD_NOTE(_F5),
|
||||
|
||||
#define OLD_SPICE \
|
||||
Q__NOTE(_A4 ), \
|
||||
Q__NOTE(_A4 ), \
|
||||
H__NOTE(_B4 ), \
|
||||
H__NOTE(_D5 ), \
|
||||
H__NOTE(_CS5), \
|
||||
Q__NOTE(_E5 ), \
|
||||
H__NOTE(_FS5), \
|
||||
H__NOTE(_D5 ), \
|
||||
|
||||
#define VICTORY_FANFARE_SHORT \
|
||||
ED_NOTE(_C6), \
|
||||
ED_NOTE(_C6), \
|
||||
ED_NOTE(_C6), \
|
||||
ED_NOTE(_C6), \
|
||||
W__NOTE(_REST), \
|
||||
QD_NOTE(_GS5), \
|
||||
QD_NOTE(_AS5), \
|
||||
Q__NOTE(_C6), \
|
||||
Q__NOTE(_AS5), \
|
||||
Q__NOTE(_C6), \
|
||||
/* Removed sounds
|
||||
+ This list is here solely for compatibility, so that removed songs don't just break things
|
||||
* If you think that any of these songs were wrongfully removed, let us know and provide
|
||||
* proof of permission to use them, or public domain status.
|
||||
*/
|
||||
|
||||
#define ALL_STAR \
|
||||
H__NOTE(_AS4), W__NOTE(_FS4), Q__NOTE(_FS4), Q__NOTE(_DS4), H__NOTE(_FS4), W__NOTE(_FS4), Q__NOTE(_FS4), Q__NOTE(_DS4), \
|
||||
H__NOTE(_FS4), W__NOTE(_FS4), W__NOTE(_FS4), QD_NOTE(_AS4), \
|
||||
H__NOTE(_AS4), W__NOTE(_FS4), Q__NOTE(_FS4), Q__NOTE(_DS4), H__NOTE(_FS4), W__NOTE(_FS4), Q__NOTE(_FS4), Q__NOTE(_DS4), \
|
||||
H__NOTE(_FS4), W__NOTE(_FS4), W__NOTE(_FS4), W__NOTE(_AS4), H__NOTE(_REST),\
|
||||
W__NOTE(_AS4), W__NOTE(_CS5), H__NOTE(_B4), H__NOTE(_CS5), H__NOTE(_DS5), W__NOTE(_FS5), \
|
||||
H__NOTE(_GS5), W__NOTE(_GS5), H__NOTE(_FS4), H__NOTE(_FS4), H__NOTE(_GS4), H__NOTE(_FS4), \
|
||||
H__NOTE(_AS4), W__NOTE(_GS4), W__NOTE(_GS4), W__NOTE(_FS4), W__NOTE(_GS4), \
|
||||
H__NOTE(_AS4), WD_NOTE(_DS4)
|
||||
|
||||
#endif
|
||||
#define CLOSE_ENCOUNTERS_5_NOTE
|
||||
#define DOE_A_DEER
|
||||
#define IN_LIKE_FLINT
|
||||
#define IMPERIAL_MARCH
|
||||
#define BASKET_CASE
|
||||
#define COIN_SOUND
|
||||
#define ONE_UP_SOUND
|
||||
#define SONIC_RING
|
||||
#define ZELDA_PUZZLE
|
||||
#define ZELDA_TREASURE
|
||||
#define OVERWATCH_THEME
|
||||
#define MARIO_THEME
|
||||
#define MARIO_GAMEOVER
|
||||
#define MARIO_MUSHROOM
|
||||
#define E1M1_DOOM
|
||||
#define DISNEY_SONG
|
||||
#define NUMBER_ONE
|
||||
#define CABBAGE_SONG
|
||||
#define OLD_SPICE
|
||||
#define VICTORY_FANFARE_SHORT
|
||||
#define ALL_STAR
|
||||
#define RICK_ROLL
|
||||
#define FF_PRELUDE
|
||||
#define TO_BOLDLY_GO
|
||||
#define KATAWARE_DOKI
|
||||
#define MEGALOVANIA
|
||||
#define MICHISHIRUBE
|
||||
#define LIEBESLEID
|
||||
#define MELODIES_OF_LIFE
|
||||
#define EYES_ON_ME
|
||||
#define SONG_OF_THE_ANCIENTS
|
||||
#define NIER_AMUSEMENT_PARK
|
||||
#define COPIED_CITY
|
||||
#define VAGUE_HOPE_COLD_RAIN
|
||||
#define KAINE_SALVATION
|
||||
#define WEIGHT_OF_THE_WORLD
|
||||
#define ISABELLAS_LULLABY
|
||||
#define TERRAS_THEME
|
||||
#define RENAI_CIRCULATION
|
||||
#define PLATINUM_DISCO
|
||||
#define LP_NUMB
|
||||
|
|
|
|||
|
|
@ -22,14 +22,18 @@
|
|||
RGB hsv_to_rgb( HSV hsv )
|
||||
{
|
||||
RGB rgb;
|
||||
uint8_t region, p, q, t;
|
||||
uint16_t h, s, v, remainder;
|
||||
uint8_t region, remainder, p, q, t;
|
||||
uint16_t h, s, v;
|
||||
|
||||
if ( hsv.s == 0 )
|
||||
{
|
||||
#ifdef USE_CIE1931_CURVE
|
||||
rgb.r = rgb.g = rgb.b = pgm_read_byte( &CIE1931_CURVE[hsv.v] );
|
||||
#else
|
||||
rgb.r = hsv.v;
|
||||
rgb.g = hsv.v;
|
||||
rgb.b = hsv.v;
|
||||
#endif
|
||||
return rgb;
|
||||
}
|
||||
|
||||
|
|
@ -37,8 +41,8 @@ RGB hsv_to_rgb( HSV hsv )
|
|||
s = hsv.s;
|
||||
v = hsv.v;
|
||||
|
||||
region = h / 43;
|
||||
remainder = (h - (region * 43)) * 6;
|
||||
region = h * 6 / 255;
|
||||
remainder = (h * 2 - region * 85) * 3;
|
||||
|
||||
p = (v * (255 - s)) >> 8;
|
||||
q = (v * (255 - ((s * remainder) >> 8))) >> 8;
|
||||
|
|
@ -46,6 +50,7 @@ RGB hsv_to_rgb( HSV hsv )
|
|||
|
||||
switch ( region )
|
||||
{
|
||||
case 6:
|
||||
case 0:
|
||||
rgb.r = v;
|
||||
rgb.g = t;
|
||||
|
|
@ -78,9 +83,11 @@ RGB hsv_to_rgb( HSV hsv )
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef USE_CIE1931_CURVE
|
||||
rgb.r = pgm_read_byte( &CIE1931_CURVE[rgb.r] );
|
||||
rgb.g = pgm_read_byte( &CIE1931_CURVE[rgb.g] );
|
||||
rgb.b = pgm_read_byte( &CIE1931_CURVE[rgb.b] );
|
||||
#endif
|
||||
|
||||
return rgb;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,12 +32,30 @@
|
|||
#pragma pack( push, 1 )
|
||||
#endif
|
||||
|
||||
#ifdef RGBW
|
||||
#define LED_TYPE cRGBW
|
||||
#else
|
||||
#define LED_TYPE RGB
|
||||
#endif
|
||||
|
||||
// WS2812 specific layout
|
||||
typedef struct PACKED
|
||||
{
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
uint8_t b;
|
||||
} RGB;
|
||||
} cRGB;
|
||||
|
||||
typedef cRGB RGB;
|
||||
|
||||
// WS2812 specific layout
|
||||
typedef struct PACKED
|
||||
{
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
uint8_t b;
|
||||
uint8_t w;
|
||||
} cRGBW;
|
||||
|
||||
typedef struct PACKED
|
||||
{
|
||||
|
|
@ -50,6 +68,6 @@ typedef struct PACKED
|
|||
#pragma pack( pop )
|
||||
#endif
|
||||
|
||||
RGB hsv_to_rgb( HSV hsv );
|
||||
RGB hsv_to_rgb(HSV hsv);
|
||||
|
||||
#endif // COLOR_H
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@
|
|||
#define ROW2COL 1
|
||||
#define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */
|
||||
|
||||
// useful for direct pin mapping
|
||||
#define NO_PIN (~0)
|
||||
|
||||
#ifdef __AVR__
|
||||
#ifndef __ASSEMBLER__
|
||||
#include <avr/io.h>
|
||||
|
|
@ -56,6 +59,11 @@
|
|||
#define PINC_ADDRESS 0x3
|
||||
#define PINB_ADDRESS 0x6
|
||||
#define PINA_ADDRESS 0x9
|
||||
#elif defined(__AVR_ATmega328P__)
|
||||
#define ADDRESS_BASE 0x00
|
||||
#define PINB_ADDRESS 0x3
|
||||
#define PINC_ADDRESS 0x6
|
||||
#define PIND_ADDRESS 0x9
|
||||
#else
|
||||
#error "Pins are not defined"
|
||||
#endif
|
||||
|
|
@ -125,6 +133,45 @@
|
|||
#endif
|
||||
|
||||
#elif defined(PROTOCOL_CHIBIOS)
|
||||
// Defines mapping for Proton C replacement
|
||||
#ifdef CONVERT_TO_PROTON_C
|
||||
// Left side (front)
|
||||
#define D3 PAL_LINE(GPIOA, 9)
|
||||
#define D2 PAL_LINE(GPIOA, 10)
|
||||
// GND
|
||||
// GND
|
||||
#define D1 PAL_LINE(GPIOB, 7)
|
||||
#define D0 PAL_LINE(GPIOB, 6)
|
||||
#define D4 PAL_LINE(GPIOB, 5)
|
||||
#define C6 PAL_LINE(GPIOB, 4)
|
||||
#define D7 PAL_LINE(GPIOB, 3)
|
||||
#define E6 PAL_LINE(GPIOB, 2)
|
||||
#define B4 PAL_LINE(GPIOB, 1)
|
||||
#define B5 PAL_LINE(GPIOB, 0)
|
||||
|
||||
// Right side (front)
|
||||
// RAW
|
||||
// GND
|
||||
// RESET
|
||||
// VCC
|
||||
#define F4 PAL_LINE(GPIOA, 2)
|
||||
#define F5 PAL_LINE(GPIOA, 1)
|
||||
#define F6 PAL_LINE(GPIOA, 0)
|
||||
#define F7 PAL_LINE(GPIOB, 8)
|
||||
#define B1 PAL_LINE(GPIOB, 13)
|
||||
#define B3 PAL_LINE(GPIOB, 14)
|
||||
#define B2 PAL_LINE(GPIOB, 15)
|
||||
#define B6 PAL_LINE(GPIOB, 9)
|
||||
|
||||
// LEDs (only D5/C13 uses an actual LED)
|
||||
#ifdef CONVERT_TO_PROTON_C_RXLED
|
||||
#define D5 PAL_LINE(GPIOC, 13)
|
||||
#define B0 PAL_LINE(GPIOC, 13)
|
||||
#else
|
||||
#define D5 PAL_LINE(GPIOC, 13)
|
||||
#define B0 PAL_LINE(GPIOC, 14)
|
||||
#endif
|
||||
#else
|
||||
#define A0 PAL_LINE(GPIOA, 0)
|
||||
#define A1 PAL_LINE(GPIOA, 1)
|
||||
#define A2 PAL_LINE(GPIOA, 2)
|
||||
|
|
@ -157,6 +204,8 @@
|
|||
#define B13 PAL_LINE(GPIOB, 13)
|
||||
#define B14 PAL_LINE(GPIOB, 14)
|
||||
#define B15 PAL_LINE(GPIOB, 15)
|
||||
#define B16 PAL_LINE(GPIOB, 16)
|
||||
#define B17 PAL_LINE(GPIOB, 17)
|
||||
#define C0 PAL_LINE(GPIOC, 0)
|
||||
#define C1 PAL_LINE(GPIOC, 1)
|
||||
#define C2 PAL_LINE(GPIOC, 2)
|
||||
|
|
@ -221,6 +270,7 @@
|
|||
#define F13 PAL_LINE(GPIOF, 13)
|
||||
#define F14 PAL_LINE(GPIOF, 14)
|
||||
#define F15 PAL_LINE(GPIOF, 15)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* USART configuration */
|
||||
|
|
|
|||
11
quantum/debounce.h
Normal file
11
quantum/debounce.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
// raw is the current key state
|
||||
// on entry cooked is the previous debounced state
|
||||
// on exit cooked is the current debounced state
|
||||
// changed is true if raw has changed since the last call
|
||||
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed);
|
||||
|
||||
bool debounce_active(void);
|
||||
|
||||
void debounce_init(uint8_t num_rows);
|
||||
114
quantum/debounce/eager_pk.c
Normal file
114
quantum/debounce/eager_pk.c
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
Copyright 2017 Alex Ong<the.onga@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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
Basic per-key algorithm. Uses an 8-bit counter per key.
|
||||
After pressing a key, it immediately changes state, and sets a counter.
|
||||
No further inputs are accepted until DEBOUNCE milliseconds have occurred.
|
||||
*/
|
||||
|
||||
#include "matrix.h"
|
||||
#include "timer.h"
|
||||
#include "quantum.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
# define DEBOUNCE 5
|
||||
#endif
|
||||
|
||||
#if (MATRIX_COLS <= 8)
|
||||
# define ROW_SHIFTER ((uint8_t)1)
|
||||
#elif (MATRIX_COLS <= 16)
|
||||
# define ROW_SHIFTER ((uint16_t)1)
|
||||
#elif (MATRIX_COLS <= 32)
|
||||
# define ROW_SHIFTER ((uint32_t)1)
|
||||
#endif
|
||||
|
||||
#define debounce_counter_t uint8_t
|
||||
|
||||
static debounce_counter_t *debounce_counters;
|
||||
static bool counters_need_update;
|
||||
static bool matrix_need_update;
|
||||
|
||||
#define DEBOUNCE_ELAPSED 251
|
||||
#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1)
|
||||
|
||||
void update_debounce_counters(uint8_t num_rows, uint8_t current_time);
|
||||
void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time);
|
||||
|
||||
// we use num_rows rather than MATRIX_ROWS to support split keyboards
|
||||
void debounce_init(uint8_t num_rows) {
|
||||
debounce_counters = (debounce_counter_t *)malloc(num_rows * MATRIX_COLS * sizeof(debounce_counter_t));
|
||||
int i = 0;
|
||||
for (uint8_t r = 0; r < num_rows; r++) {
|
||||
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
|
||||
debounce_counters[i++] = DEBOUNCE_ELAPSED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
|
||||
uint8_t current_time = timer_read() % MAX_DEBOUNCE;
|
||||
if (counters_need_update) {
|
||||
update_debounce_counters(num_rows, current_time);
|
||||
}
|
||||
|
||||
if (changed || matrix_need_update) {
|
||||
transfer_matrix_values(raw, cooked, num_rows, current_time);
|
||||
}
|
||||
}
|
||||
|
||||
// If the current time is > debounce counter, set the counter to enable input.
|
||||
void update_debounce_counters(uint8_t num_rows, uint8_t current_time) {
|
||||
counters_need_update = false;
|
||||
debounce_counter_t *debounce_pointer = debounce_counters;
|
||||
for (uint8_t row = 0; row < num_rows; row++) {
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
if (*debounce_pointer != DEBOUNCE_ELAPSED) {
|
||||
if (TIMER_DIFF(current_time, *debounce_pointer, MAX_DEBOUNCE) >= DEBOUNCE) {
|
||||
*debounce_pointer = DEBOUNCE_ELAPSED;
|
||||
} else {
|
||||
counters_need_update = true;
|
||||
}
|
||||
}
|
||||
debounce_pointer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// upload from raw_matrix to final matrix;
|
||||
void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time) {
|
||||
matrix_need_update = false;
|
||||
debounce_counter_t *debounce_pointer = debounce_counters;
|
||||
for (uint8_t row = 0; row < num_rows; row++) {
|
||||
matrix_row_t delta = raw[row] ^ cooked[row];
|
||||
matrix_row_t existing_row = cooked[row];
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
matrix_row_t col_mask = (ROW_SHIFTER << col);
|
||||
if (delta & col_mask) {
|
||||
if (*debounce_pointer == DEBOUNCE_ELAPSED) {
|
||||
*debounce_pointer = current_time;
|
||||
counters_need_update = true;
|
||||
existing_row ^= col_mask; // flip the bit.
|
||||
} else {
|
||||
matrix_need_update = true;
|
||||
}
|
||||
}
|
||||
debounce_pointer++;
|
||||
}
|
||||
cooked[row] = existing_row;
|
||||
}
|
||||
}
|
||||
|
||||
bool debounce_active(void) { return true; }
|
||||
100
quantum/debounce/eager_pr.c
Normal file
100
quantum/debounce/eager_pr.c
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
Copyright 2019 Alex Ong<the.onga@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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
Basic per-row algorithm. Uses an 8-bit counter per row.
|
||||
After pressing a key, it immediately changes state, and sets a counter.
|
||||
No further inputs are accepted until DEBOUNCE milliseconds have occurred.
|
||||
*/
|
||||
|
||||
#include "matrix.h"
|
||||
#include "timer.h"
|
||||
#include "quantum.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
# define DEBOUNCE 5
|
||||
#endif
|
||||
|
||||
#define debounce_counter_t uint8_t
|
||||
static bool matrix_need_update;
|
||||
|
||||
static debounce_counter_t *debounce_counters;
|
||||
static bool counters_need_update;
|
||||
|
||||
#define DEBOUNCE_ELAPSED 251
|
||||
#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1)
|
||||
|
||||
void update_debounce_counters(uint8_t num_rows, uint8_t current_time);
|
||||
void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time);
|
||||
|
||||
// we use num_rows rather than MATRIX_ROWS to support split keyboards
|
||||
void debounce_init(uint8_t num_rows) {
|
||||
debounce_counters = (debounce_counter_t *)malloc(num_rows * sizeof(debounce_counter_t));
|
||||
for (uint8_t r = 0; r < num_rows; r++) {
|
||||
debounce_counters[r] = DEBOUNCE_ELAPSED;
|
||||
}
|
||||
}
|
||||
|
||||
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
|
||||
uint8_t current_time = timer_read() % MAX_DEBOUNCE;
|
||||
bool needed_update = counters_need_update;
|
||||
if (counters_need_update) {
|
||||
update_debounce_counters(num_rows, current_time);
|
||||
}
|
||||
|
||||
if (changed || (needed_update && !counters_need_update) || matrix_need_update) {
|
||||
transfer_matrix_values(raw, cooked, num_rows, current_time);
|
||||
}
|
||||
}
|
||||
|
||||
// If the current time is > debounce counter, set the counter to enable input.
|
||||
void update_debounce_counters(uint8_t num_rows, uint8_t current_time) {
|
||||
counters_need_update = false;
|
||||
debounce_counter_t *debounce_pointer = debounce_counters;
|
||||
for (uint8_t row = 0; row < num_rows; row++) {
|
||||
if (*debounce_pointer != DEBOUNCE_ELAPSED) {
|
||||
if (TIMER_DIFF(current_time, *debounce_pointer, MAX_DEBOUNCE) >= DEBOUNCE) {
|
||||
*debounce_pointer = DEBOUNCE_ELAPSED;
|
||||
} else {
|
||||
counters_need_update = true;
|
||||
}
|
||||
}
|
||||
debounce_pointer++;
|
||||
}
|
||||
}
|
||||
|
||||
// upload from raw_matrix to final matrix;
|
||||
void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time) {
|
||||
matrix_need_update = false;
|
||||
debounce_counter_t *debounce_pointer = debounce_counters;
|
||||
for (uint8_t row = 0; row < num_rows; row++) {
|
||||
matrix_row_t existing_row = cooked[row];
|
||||
matrix_row_t raw_row = raw[row];
|
||||
|
||||
// determine new value basd on debounce pointer + raw value
|
||||
if (existing_row != raw_row) {
|
||||
if (*debounce_pointer == DEBOUNCE_ELAPSED) {
|
||||
*debounce_pointer = current_time;
|
||||
cooked[row] = raw_row;
|
||||
counters_need_update = true;
|
||||
} else {
|
||||
matrix_need_update = true;
|
||||
}
|
||||
}
|
||||
debounce_pointer++;
|
||||
}
|
||||
}
|
||||
|
||||
bool debounce_active(void) { return true; }
|
||||
28
quantum/debounce/readme.md
Normal file
28
quantum/debounce/readme.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
Debounce algorithms belong in this folder.
|
||||
Here are a few ideas
|
||||
|
||||
1) Global vs Per-Key vs Per-Row
|
||||
* Global - one timer for all keys. Any key change state affects global timer
|
||||
* Per key - one timer per key
|
||||
* Per row - one timer per row
|
||||
|
||||
2) Eager vs symmetric vs asymmetric
|
||||
* Eager - any key change is reported immediately. All further inputs for DEBOUNCE ms are ignored.
|
||||
* Symmetric - wait for no changes for DEBOUNCE ms before reporting change
|
||||
* Asymmetric - wait for different times depending on key-down/key-up. E.g. Eager key-down, DEBOUNCE ms key up.
|
||||
|
||||
3) Timestamp vs cycles
|
||||
* old old old code waits n cycles, decreasing count by one each matrix_scan
|
||||
* newer code stores the millisecond the change occurred, and does subraction to figure out time elapsed.
|
||||
* Timestamps are superior, i don't think cycles will ever be used again once upgraded.
|
||||
|
||||
The default algorithm is symmetric and global.
|
||||
Here are a few that could be implemented:
|
||||
|
||||
sym_g.c
|
||||
sym_pk.c
|
||||
sym_pr.c
|
||||
sym_pr_cycles.c
|
||||
eager_g.c
|
||||
eager_pk.c
|
||||
eager_pr.c //could be used in ergo-dox!
|
||||
57
quantum/debounce/sym_g.c
Normal file
57
quantum/debounce/sym_g.c
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
Copyright 2017 Alex Ong<the.onga@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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
Basic global debounce algorithm. Used in 99% of keyboards at time of implementation
|
||||
When no state changes have occured for DEBOUNCE milliseconds, we push the state.
|
||||
*/
|
||||
#include "matrix.h"
|
||||
#include "timer.h"
|
||||
#include "quantum.h"
|
||||
#ifndef DEBOUNCE
|
||||
#define DEBOUNCE 5
|
||||
#endif
|
||||
|
||||
void debounce_init(uint8_t num_rows) {}
|
||||
static bool debouncing = false;
|
||||
|
||||
#if DEBOUNCE > 0
|
||||
static uint16_t debouncing_time;
|
||||
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
|
||||
{
|
||||
if (changed) {
|
||||
debouncing = true;
|
||||
debouncing_time = timer_read();
|
||||
}
|
||||
|
||||
if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
|
||||
for (int i = 0; i < num_rows; i++) {
|
||||
cooked[i] = raw[i];
|
||||
}
|
||||
debouncing = false;
|
||||
}
|
||||
}
|
||||
#else //no debouncing.
|
||||
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
|
||||
{
|
||||
for (int i = 0; i < num_rows; i++) {
|
||||
cooked[i] = raw[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool debounce_active(void) {
|
||||
return debouncing;
|
||||
}
|
||||
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "keymap.h" // to get keymaps[][][]
|
||||
#include "tmk_core/common/eeprom.h"
|
||||
#include "progmem.h" // to read default from flash
|
||||
|
||||
#include "quantum.h" // for send_string()
|
||||
#include "dynamic_keymap.h"
|
||||
|
||||
#ifdef DYNAMIC_KEYMAP_ENABLE
|
||||
|
|
@ -31,6 +31,23 @@
|
|||
#error DYNAMIC_KEYMAP_LAYER_COUNT not defined
|
||||
#endif
|
||||
|
||||
#ifndef DYNAMIC_KEYMAP_MACRO_COUNT
|
||||
#error DYNAMIC_KEYMAP_MACRO_COUNT not defined
|
||||
#endif
|
||||
|
||||
#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR
|
||||
#error DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR not defined
|
||||
#endif
|
||||
|
||||
#ifndef DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE
|
||||
#error DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE not defined
|
||||
#endif
|
||||
|
||||
uint8_t dynamic_keymap_get_layer_count(void)
|
||||
{
|
||||
return DYNAMIC_KEYMAP_LAYER_COUNT;
|
||||
}
|
||||
|
||||
void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column)
|
||||
{
|
||||
// TODO: optimize this with some left shifts
|
||||
|
|
@ -69,6 +86,36 @@ void dynamic_keymap_reset(void)
|
|||
}
|
||||
}
|
||||
|
||||
void dynamic_keymap_get_buffer( uint16_t offset, uint16_t size, uint8_t *data )
|
||||
{
|
||||
uint16_t dynamic_keymap_eeprom_size = DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2;
|
||||
void *source = (void*)(DYNAMIC_KEYMAP_EEPROM_ADDR+offset);
|
||||
uint8_t *target = data;
|
||||
for ( uint16_t i = 0; i < size; i++ ) {
|
||||
if ( offset + i < dynamic_keymap_eeprom_size ) {
|
||||
*target = eeprom_read_byte(source);
|
||||
} else {
|
||||
*target = 0x00;
|
||||
}
|
||||
source++;
|
||||
target++;
|
||||
}
|
||||
}
|
||||
|
||||
void dynamic_keymap_set_buffer( uint16_t offset, uint16_t size, uint8_t *data )
|
||||
{
|
||||
uint16_t dynamic_keymap_eeprom_size = DYNAMIC_KEYMAP_LAYER_COUNT * MATRIX_ROWS * MATRIX_COLS * 2;
|
||||
void *target = (void*)(DYNAMIC_KEYMAP_EEPROM_ADDR+offset);
|
||||
uint8_t *source = data;
|
||||
for ( uint16_t i = 0; i < size; i++ ) {
|
||||
if ( offset + i < dynamic_keymap_eeprom_size ) {
|
||||
eeprom_update_byte(target, *source);
|
||||
}
|
||||
source++;
|
||||
target++;
|
||||
}
|
||||
}
|
||||
|
||||
// This overrides the one in quantum/keymap_common.c
|
||||
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
||||
{
|
||||
|
|
@ -81,5 +128,111 @@ uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t dynamic_keymap_macro_get_count(void)
|
||||
{
|
||||
return DYNAMIC_KEYMAP_MACRO_COUNT;
|
||||
}
|
||||
|
||||
uint16_t dynamic_keymap_macro_get_buffer_size(void)
|
||||
{
|
||||
return DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE;
|
||||
}
|
||||
|
||||
void dynamic_keymap_macro_get_buffer( uint16_t offset, uint16_t size, uint8_t *data )
|
||||
{
|
||||
void *source = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR+offset);
|
||||
uint8_t *target = data;
|
||||
for ( uint16_t i = 0; i < size; i++ ) {
|
||||
if ( offset + i < DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE ) {
|
||||
*target = eeprom_read_byte(source);
|
||||
} else {
|
||||
*target = 0x00;
|
||||
}
|
||||
source++;
|
||||
target++;
|
||||
}
|
||||
}
|
||||
|
||||
void dynamic_keymap_macro_set_buffer( uint16_t offset, uint16_t size, uint8_t *data )
|
||||
{
|
||||
void *target = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR+offset);
|
||||
uint8_t *source = data;
|
||||
for ( uint16_t i = 0; i < size; i++ ) {
|
||||
if ( offset + i < DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE ) {
|
||||
eeprom_update_byte(target, *source);
|
||||
}
|
||||
source++;
|
||||
target++;
|
||||
}
|
||||
}
|
||||
|
||||
void dynamic_keymap_macro_reset(void)
|
||||
{
|
||||
void *p = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR);
|
||||
void *end = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR+DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE);
|
||||
while ( p != end ) {
|
||||
eeprom_update_byte(p, 0);
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
||||
void dynamic_keymap_macro_send( uint8_t id )
|
||||
{
|
||||
if ( id >= DYNAMIC_KEYMAP_MACRO_COUNT ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the last byte of the buffer.
|
||||
// If it's not zero, then we are in the middle
|
||||
// of buffer writing, possibly an aborted buffer
|
||||
// write. So do nothing.
|
||||
void *p = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR+DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE-1);
|
||||
if ( eeprom_read_byte(p) != 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip N null characters
|
||||
// p will then point to the Nth macro
|
||||
p = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR);
|
||||
void *end = (void*)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR+DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE);
|
||||
while ( id > 0 ) {
|
||||
// If we are past the end of the buffer, then the buffer
|
||||
// contents are garbage, i.e. there were not DYNAMIC_KEYMAP_MACRO_COUNT
|
||||
// nulls in the buffer.
|
||||
if ( p == end ) {
|
||||
return;
|
||||
}
|
||||
if ( eeprom_read_byte(p) == 0 ) {
|
||||
--id;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
|
||||
// Send the macro string one or two chars at a time
|
||||
// by making temporary 1 or 2 char strings
|
||||
char data[3] = { 0, 0, 0 };
|
||||
// We already checked there was a null at the end of
|
||||
// the buffer, so this cannot go past the end
|
||||
while ( 1 ) {
|
||||
data[0] = eeprom_read_byte(p++);
|
||||
data[1] = 0;
|
||||
// Stop at the null terminator of this macro string
|
||||
if ( data[0] == 0 ) {
|
||||
break;
|
||||
}
|
||||
// If the char is magic (tap, down, up),
|
||||
// add the next char (key to use) and send a 2 char string.
|
||||
if ( data[0] == SS_TAP_CODE || data[0] == SS_DOWN_CODE || data[0] == SS_UP_CODE ) {
|
||||
data[1] = eeprom_read_byte(p++);
|
||||
if ( data[1] == 0 ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
send_string(data);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DYNAMIC_KEYMAP_ENABLE
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,46 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
uint8_t dynamic_keymap_get_layer_count(void);
|
||||
void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column);
|
||||
uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column);
|
||||
void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode);
|
||||
void dynamic_keymap_reset(void);
|
||||
// These get/set the keycodes as stored in the EEPROM buffer
|
||||
// Data is big-endian 16-bit values (the keycodes)
|
||||
// Order is by layer/row/column
|
||||
// Thus offset 0 = 0,0,0, offset MATRIX_COLS*2 = 0,1,0, offset MATRIX_ROWS*MATRIX_COLS*2 = 1,0,0
|
||||
// Note the *2, because offset is in bytes and keycodes are two bytes
|
||||
// This is only really useful for host applications that want to get a whole keymap fast,
|
||||
// by reading 14 keycodes (28 bytes) at a time, reducing the number of raw HID transfers by
|
||||
// a factor of 14.
|
||||
void dynamic_keymap_get_buffer( uint16_t offset, uint16_t size, uint8_t *data );
|
||||
void dynamic_keymap_set_buffer( uint16_t offset, uint16_t size, uint8_t *data );
|
||||
|
||||
// This overrides the one in quantum/keymap_common.c
|
||||
// uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
|
||||
|
||||
|
||||
|
||||
// Note regarding dynamic_keymap_macro_set_buffer():
|
||||
// The last byte of the buffer is used as a valid flag,
|
||||
// so macro sending is disabled during writing a new buffer,
|
||||
// should it happen during, or after an interrupted transfer.
|
||||
//
|
||||
// Users writing to the buffer must first set the last byte of the buffer
|
||||
// to non-zero (i.e. 0xFF). After (or during) the final write, set the
|
||||
// last byte of the buffer to zero.
|
||||
//
|
||||
// Since the contents of the buffer must be a list of null terminated
|
||||
// strings, the last byte must be a null when at maximum capacity,
|
||||
// and it not being null means the buffer can be considered in an
|
||||
// invalid state.
|
||||
|
||||
uint8_t dynamic_keymap_macro_get_count(void);
|
||||
uint16_t dynamic_keymap_macro_get_buffer_size(void);
|
||||
void dynamic_keymap_macro_get_buffer( uint16_t offset, uint16_t size, uint8_t *data );
|
||||
void dynamic_keymap_macro_set_buffer( uint16_t offset, uint16_t size, uint8_t *data );
|
||||
void dynamic_keymap_macro_reset(void);
|
||||
|
||||
void dynamic_keymap_macro_send( uint8_t id );
|
||||
|
||||
|
|
|
|||
|
|
@ -17,25 +17,33 @@
|
|||
|
||||
#include "encoder.h"
|
||||
|
||||
// for memcpy
|
||||
#include <string.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;
|
||||
|
||||
#define NUMBER_OF_ENCODERS (sizeof(encoders_pad_a)/sizeof(pin_t))
|
||||
static pin_t encoders_pad_a[] = ENCODERS_PAD_A;
|
||||
static pin_t encoders_pad_b[] = 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};
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
// slave half encoders come over as second set of encoders
|
||||
static int8_t encoder_value[NUMBER_OF_ENCODERS * 2] = {0};
|
||||
#else
|
||||
static int8_t encoder_value[NUMBER_OF_ENCODERS] = {0};
|
||||
#endif
|
||||
|
||||
__attribute__ ((weak))
|
||||
void encoder_update_user(int8_t index, bool clockwise) { }
|
||||
|
|
@ -60,11 +68,30 @@ void encoder_read(void) {
|
|||
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);
|
||||
encoder_update_kb(i, false);
|
||||
}
|
||||
if (encoder_value[i] <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise
|
||||
encoder_update_kb(i, CLOCKWISE);
|
||||
encoder_update_kb(i, true);
|
||||
}
|
||||
encoder_value[i] %= ENCODER_RESOLUTION;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
void encoder_state_raw(uint8_t* slave_state) {
|
||||
memcpy(slave_state, encoder_state, sizeof(encoder_state));
|
||||
}
|
||||
|
||||
void encoder_update_raw(uint8_t* slave_state) {
|
||||
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
|
||||
encoder_value[NUMBER_OF_ENCODERS + i] += encoder_LUT[slave_state[i] & 0xF];
|
||||
if (encoder_value[NUMBER_OF_ENCODERS + i] >= ENCODER_RESOLUTION) {
|
||||
encoder_update_kb(NUMBER_OF_ENCODERS + i, false);
|
||||
}
|
||||
if (encoder_value[NUMBER_OF_ENCODERS + i] <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise
|
||||
encoder_update_kb(NUMBER_OF_ENCODERS + i, true);
|
||||
}
|
||||
encoder_value[NUMBER_OF_ENCODERS + i] %= ENCODER_RESOLUTION;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -19,11 +19,13 @@
|
|||
|
||||
#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);
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
void encoder_state_raw(uint8_t* slave_state);
|
||||
void encoder_update_raw(uint8_t* slave_state);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "backlight.h"
|
||||
#include "quantum.h"
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
#include "split_flags.h"
|
||||
#endif
|
||||
|
||||
#ifdef MIDI_ENABLE
|
||||
#include "process_midi.h"
|
||||
#endif
|
||||
|
|
@ -64,7 +60,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
|
|||
case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
|
||||
action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode));
|
||||
break;
|
||||
case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
|
||||
case KC_AUDIO_MUTE ... KC_BRIGHTNESS_DOWN:
|
||||
action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
|
||||
break;
|
||||
case KC_MS_UP ... KC_MS_ACCEL2:
|
||||
|
|
@ -120,14 +116,14 @@ action_t action_for_key(uint8_t layer, keypos_t key)
|
|||
break;
|
||||
case QK_ONE_SHOT_MOD ... QK_ONE_SHOT_MOD_MAX: ;
|
||||
// OSM(mod) - One-shot mod
|
||||
mod = keycode & 0xFF;
|
||||
mod = mod_config(keycode & 0xFF);
|
||||
action.code = ACTION_MODS_ONESHOT(mod);
|
||||
break;
|
||||
case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
|
||||
action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF);
|
||||
break;
|
||||
case QK_LAYER_MOD ... QK_LAYER_MOD_MAX:
|
||||
mod = keycode & 0xF;
|
||||
mod = mod_config(keycode & 0xF);
|
||||
action_layer = (keycode >> 4) & 0xF;
|
||||
action.code = ACTION_LAYER_MODS(action_layer, mod);
|
||||
break;
|
||||
|
|
@ -138,39 +134,21 @@ action_t action_for_key(uint8_t layer, keypos_t key)
|
|||
#ifdef BACKLIGHT_ENABLE
|
||||
case BL_ON:
|
||||
action.code = ACTION_BACKLIGHT_ON();
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
BACKLIT_DIRTY = true;
|
||||
#endif
|
||||
break;
|
||||
case BL_OFF:
|
||||
action.code = ACTION_BACKLIGHT_OFF();
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
BACKLIT_DIRTY = true;
|
||||
#endif
|
||||
break;
|
||||
case BL_DEC:
|
||||
action.code = ACTION_BACKLIGHT_DECREASE();
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
BACKLIT_DIRTY = true;
|
||||
#endif
|
||||
break;
|
||||
case BL_INC:
|
||||
action.code = ACTION_BACKLIGHT_INCREASE();
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
BACKLIT_DIRTY = true;
|
||||
#endif
|
||||
break;
|
||||
case BL_TOGG:
|
||||
action.code = ACTION_BACKLIGHT_TOGGLE();
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
BACKLIT_DIRTY = true;
|
||||
#endif
|
||||
break;
|
||||
case BL_STEP:
|
||||
action.code = ACTION_BACKLIGHT_STEP();
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
BACKLIT_DIRTY = true;
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#ifdef SWAP_HANDS_ENABLE
|
||||
|
|
|
|||
|
|
@ -18,15 +18,6 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
#define BE_LGUI KC_LALT
|
||||
#define BE_LALT KC_LGUI
|
||||
|
||||
// Alt gr
|
||||
#ifndef ALGR
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#endif
|
||||
#define NO_ALGR KC_RALT
|
||||
|
||||
// Normal characters
|
||||
// Line 1
|
||||
#define BE_SUP2 KC_GRV
|
||||
|
|
|
|||
|
|
@ -19,15 +19,6 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#ifndef ALTGR
|
||||
#define ALTGR(kc) RALT(kc)
|
||||
#endif
|
||||
#ifndef ALGR
|
||||
#define ALGR(kc) ALTGR(kc)
|
||||
#endif
|
||||
#define BP_ALGR KC_RALT
|
||||
|
||||
// Normal characters
|
||||
// First row (on usual keyboards)
|
||||
#define BP_DOLLAR KC_GRAVE // $
|
||||
|
|
@ -142,138 +133,138 @@
|
|||
|
||||
// AltGr-ed characters
|
||||
// First row
|
||||
#define BP_EN_DASH ALTGR(BP_DOLLAR) // –
|
||||
#define BP_EN_DASH ALGR(BP_DOLLAR) // –
|
||||
#define BP_NDSH BP_EN_DASH
|
||||
#define BP_EM_DASH ALTGR(KC_1) // —
|
||||
#define BP_EM_DASH ALGR(KC_1) // —
|
||||
#define BP_MDSH BP_EM_DASH
|
||||
#define BP_LESS ALTGR(KC_2) // <
|
||||
#define BP_GREATER ALTGR(KC_3) // >
|
||||
#define BP_LESS ALGR(KC_2) // <
|
||||
#define BP_GREATER ALGR(KC_3) // >
|
||||
#define BP_GRTR BP_GREATER
|
||||
#define BP_LBRACKET ALTGR(KC_4) // [
|
||||
#define BP_LBRACKET ALGR(KC_4) // [
|
||||
#define BP_LBRC BP_LBRACKET
|
||||
#define BP_RBRACKET ALTGR(KC_5) // ]
|
||||
#define BP_RBRACKET ALGR(KC_5) // ]
|
||||
#define BP_RBRC BP_RBRACKET
|
||||
#define BP_CIRCUMFLEX ALTGR(KC_6) // ^
|
||||
#define BP_CIRCUMFLEX ALGR(KC_6) // ^
|
||||
#define BP_CIRC BP_CIRCUMFLEX
|
||||
#define BP_PLUS_MINUS ALTGR(KC_7) // ±
|
||||
#define BP_PLUS_MINUS ALGR(KC_7) // ±
|
||||
#define BP_PSMS BP_PLUS_MINUS
|
||||
#define BP_MATH_MINUS ALTGR(KC_8) // −
|
||||
#define BP_MATH_MINUS ALGR(KC_8) // −
|
||||
#define BP_MMNS BP_MATH_MINUS
|
||||
#define BP_OBELUS ALTGR(KC_9) // ÷
|
||||
#define BP_OBELUS ALGR(KC_9) // ÷
|
||||
#define BP_OBEL BP_OBELUS
|
||||
// more conventional name of the symbol
|
||||
#define BP_DIVISION_SIGN BP_OBELUS
|
||||
#define BP_DVSN BP_DIVISION_SIGN
|
||||
#define BP_TIMES ALTGR(KC_0) // ×
|
||||
#define BP_TIMES ALGR(KC_0) // ×
|
||||
#define BP_TIMS BP_TIMES
|
||||
#define BP_DIFFERENT ALTGR(BP_EQUAL) // ≠
|
||||
#define BP_DIFFERENT ALGR(BP_EQUAL) // ≠
|
||||
#define BP_DIFF BP_DIFFERENT
|
||||
#define BP_PERMILLE ALTGR(BP_PERCENT) // ‰
|
||||
#define BP_PERMILLE ALGR(BP_PERCENT) // ‰
|
||||
#define BP_PMIL BP_PERMILLE
|
||||
|
||||
// Second row
|
||||
#define BP_PIPE ALTGR(BP_B) // |
|
||||
#define BP_DEAD_ACUTE ALTGR(BP_E_ACUTE) // dead ´
|
||||
#define BP_PIPE ALGR(BP_B) // |
|
||||
#define BP_DEAD_ACUTE ALGR(BP_E_ACUTE) // dead ´
|
||||
#define BP_DACT BP_DEAD_ACUTE
|
||||
#define BP_AMPERSAND ALTGR(BP_P) // &
|
||||
#define BP_AMPERSAND ALGR(BP_P) // &
|
||||
#define BP_AMPR BP_AMPERSAND
|
||||
#define BP_OE_LIGATURE ALTGR(BP_O) // œ
|
||||
#define BP_OE_LIGATURE ALGR(BP_O) // œ
|
||||
#define BP_OE BP_OE_LIGATURE
|
||||
#define BP_DEAD_GRAVE ALTGR(BP_E_GRAVE) // `
|
||||
#define BP_DEAD_GRAVE ALGR(BP_E_GRAVE) // `
|
||||
#define BP_DGRV BP_DEAD_GRAVE
|
||||
#define BP_INVERTED_EXCLAIM ALTGR(BP_DEAD_CIRCUMFLEX) // ¡
|
||||
#define BP_INVERTED_EXCLAIM ALGR(BP_DEAD_CIRCUMFLEX) // ¡
|
||||
#define BP_IXLM BP_INVERTED_EXCLAIM
|
||||
#define BP_DEAD_CARON ALTGR(BP_V) // dead ˇ
|
||||
#define BP_DEAD_CARON ALGR(BP_V) // dead ˇ
|
||||
#define BP_DCAR BP_DEAD_CARON
|
||||
#define BP_ETH ALTGR(BP_D) // ð
|
||||
#define BP_DEAD_SLASH ALTGR(BP_L) // dead /
|
||||
#define BP_ETH ALGR(BP_D) // ð
|
||||
#define BP_DEAD_SLASH ALGR(BP_L) // dead /
|
||||
#define BP_DSLH BP_DEAD_SLASH
|
||||
#define BP_IJ_LIGATURE ALTGR(BP_J) // ij
|
||||
#define BP_IJ_LIGATURE ALGR(BP_J) // ij
|
||||
#define BP_IJ BP_IJ_LIGATURE
|
||||
#define BP_SCHWA ALTGR(BP_Z) // ə
|
||||
#define BP_SCHWA ALGR(BP_Z) // ə
|
||||
#define BP_SCWA BP_SCHWA
|
||||
#define BP_DEAD_BREVE ALTGR(BP_W) // dead ˘
|
||||
#define BP_DEAD_BREVE ALGR(BP_W) // dead ˘
|
||||
#define BP_DBRV BP_DEAD_BREVE
|
||||
|
||||
// Third row
|
||||
#define BP_AE_LIGATURE ALTGR(BP_A) // æ
|
||||
#define BP_AE_LIGATURE ALGR(BP_A) // æ
|
||||
#define BP_AE BP_AE_LIGATURE
|
||||
#define BP_U_GRAVE ALTGR(BP_U) // ù
|
||||
#define BP_U_GRAVE ALGR(BP_U) // ù
|
||||
#define BP_UGRV BP_U_GRAVE
|
||||
#define BP_DEAD_TREMA ALTGR(BP_I) // dead ¨ (trema/umlaut/diaresis)
|
||||
#define BP_DEAD_TREMA ALGR(BP_I) // dead ¨ (trema/umlaut/diaresis)
|
||||
#define BP_DTRM BP_DEAD_TREMA
|
||||
#define BP_EURO ALTGR(BP_E) // €
|
||||
#define BP_TYPOGRAPHICAL_APOSTROPHE ALTGR(BP_COMMA) // ’
|
||||
#define BP_EURO ALGR(BP_E) // €
|
||||
#define BP_TYPOGRAPHICAL_APOSTROPHE ALGR(BP_COMMA) // ’
|
||||
#define BP_TAPO BP_TYPOGRAPHICAL_APOSTROPHE
|
||||
#define BP_COPYRIGHT ALTGR(BP_C) // ©
|
||||
#define BP_COPYRIGHT ALGR(BP_C) // ©
|
||||
#define BP_CPRT BP_COPYRIGHT
|
||||
#define BP_THORN ALTGR(BP_T) // þ
|
||||
#define BP_THORN ALGR(BP_T) // þ
|
||||
#define BP_THRN BP_THORN
|
||||
#define BP_SHARP_S ALTGR(BP_S) // ß
|
||||
#define BP_SHARP_S ALGR(BP_S) // ß
|
||||
#define BP_SRPS BP_SHARP_S
|
||||
#define BP_REGISTERED_TRADEMARK ALTGR(BP_R) // ®
|
||||
#define BP_REGISTERED_TRADEMARK ALGR(BP_R) // ®
|
||||
#define BP_RTM BP_REGISTERED_TRADEMARK
|
||||
#define BP_DEAD_TILDE ALTGR(BP_N) // dead ~
|
||||
#define BP_DEAD_TILDE ALGR(BP_N) // dead ~
|
||||
#define BP_DTLD BP_DEAD_TILDE
|
||||
#define BP_DEAD_MACRON ALTGR(BP_M) // dead ¯
|
||||
#define BP_DEAD_MACRON ALGR(BP_M) // dead ¯
|
||||
#define BP_DMCR BP_DEAD_MACRON
|
||||
#define BP_DEAD_CEDILLA ALTGR(BP_C_CEDILLA) // dead ¸
|
||||
#define BP_DEAD_CEDILLA ALGR(BP_C_CEDILLA) // dead ¸
|
||||
#define BP_DCED BP_DEAD_CEDILLA
|
||||
|
||||
// Fourth row
|
||||
#define BP_NONUS_SLASH ALTGR(BP_E_CIRCUMFLEX) // / on non-us backslash key (102nd key, ê in bépo)
|
||||
#define BP_NONUS_SLASH ALGR(BP_E_CIRCUMFLEX) // / on non-us backslash key (102nd key, ê in bépo)
|
||||
#define BP_NUSL BP_NONUS_SLASH
|
||||
#define BP_BACKSLASH ALTGR(BP_A_GRAVE) /* \ */
|
||||
#define BP_BACKSLASH ALGR(BP_A_GRAVE) /* \ */
|
||||
#define BP_BSLS BP_BACKSLASH
|
||||
#define BP_LEFT_CURLY_BRACE ALTGR(BP_Y) // {
|
||||
#define BP_LEFT_CURLY_BRACE ALGR(BP_Y) // {
|
||||
#define BP_LCBR BP_LEFT_CURLY_BRACE
|
||||
#define BP_RIGHT_CURLY_BRACE ALTGR(BP_X) // }
|
||||
#define BP_RIGHT_CURLY_BRACE ALGR(BP_X) // }
|
||||
#define BP_RCBR BP_RIGHT_CURLY_BRACE
|
||||
#define BP_ELLIPSIS ALTGR(BP_DOT) // …
|
||||
#define BP_ELLIPSIS ALGR(BP_DOT) // …
|
||||
#define BP_ELPS BP_ELLIPSIS
|
||||
#define BP_TILDE ALTGR(BP_K) // ~
|
||||
#define BP_TILDE ALGR(BP_K) // ~
|
||||
#define BP_TILD BP_TILDE
|
||||
#define BP_INVERTED_QUESTION ALTGR(BP_QUESTION) // ¿
|
||||
#define BP_INVERTED_QUESTION ALGR(BP_QUESTION) // ¿
|
||||
#define BP_IQST BP_INVERTED_QUESTION
|
||||
#define BP_DEAD_RING ALTGR(BP_Q) // dead °
|
||||
#define BP_DEAD_RING ALGR(BP_Q) // dead °
|
||||
#define BP_DRNG BP_DEAD_RING
|
||||
#define BP_DEAD_GREEK ALTGR(BP_G) // dead Greek key (following key will make a Greek letter)
|
||||
#define BP_DEAD_GREEK ALGR(BP_G) // dead Greek key (following key will make a Greek letter)
|
||||
#define BP_DGRK BP_DEAD_GREEK
|
||||
#define BP_DAGGER ALTGR(BP_H) // †
|
||||
#define BP_DAGGER ALGR(BP_H) // †
|
||||
#define BP_DAGR BP_DAGGER
|
||||
#define BP_DEAD_OGONEK ALTGR(BP_F) // dead ˛
|
||||
#define BP_DEAD_OGONEK ALGR(BP_F) // dead ˛
|
||||
#define BP_DOGO BP_DEAD_OGONEK
|
||||
|
||||
// Space bar
|
||||
#define BP_UNDERSCORE ALTGR(KC_SPACE) // _
|
||||
#define BP_UNDERSCORE ALGR(KC_SPACE) // _
|
||||
#define BP_UNDS BP_UNDERSCORE
|
||||
|
||||
// AltGr-Shifted characters (different from capitalised AltGr-ed characters)
|
||||
// First row
|
||||
#define BP_PARAGRAPH ALTGR(BP_HASH) // ¶
|
||||
#define BP_PARAGRAPH ALGR(BP_HASH) // ¶
|
||||
#define BP_PARG BP_PARAGRAPH
|
||||
#define BP_LOW_DOUBLE_QUOTE ALTGR(BP_1) // „
|
||||
#define BP_LOW_DOUBLE_QUOTE ALGR(BP_1) // „
|
||||
#define BP_LWQT BP_LOW_DOUBLE_QUOTE
|
||||
#define BP_LEFT_DOUBLE_QUOTE ALTGR(BP_2) // “
|
||||
#define BP_LEFT_DOUBLE_QUOTE ALGR(BP_2) // “
|
||||
#define BP_LDQT BP_LEFT_DOUBLE_QUOTE
|
||||
#define BP_RIGHT_DOUBLE_QUOTE ALTGR(BP_3) // ”
|
||||
#define BP_RIGHT_DOUBLE_QUOTE ALGR(BP_3) // ”
|
||||
#define BP_RDQT BP_RIGHT_DOUBLE_QUOTE
|
||||
#define BP_LESS_OR_EQUAL ALTGR(BP_4) // ≤
|
||||
#define BP_LESS_OR_EQUAL ALGR(BP_4) // ≤
|
||||
#define BP_LEQL BP_LESS_OR_EQUAL
|
||||
#define BP_GREATER_OR_EQUAL ALTGR(BP_5) // ≥
|
||||
#define BP_GREATER_OR_EQUAL ALGR(BP_5) // ≥
|
||||
#define BP_GEQL BP_GREATER_OR_EQUAL
|
||||
// nothing on ALTGR(BP_6)
|
||||
#define BP_NEGATION ALTGR(BP_7) // ¬
|
||||
// nothing on ALGR(BP_6)
|
||||
#define BP_NEGATION ALGR(BP_7) // ¬
|
||||
#define BP_NEGT BP_NEGATION
|
||||
#define BP_ONE_QUARTER ALTGR(BP_8) // ¼
|
||||
#define BP_ONE_QUARTER ALGR(BP_8) // ¼
|
||||
#define BP_1QRT BP_ONE_QUARTER
|
||||
#define BP_ONE_HALF ALTGR(BP_9) // ½
|
||||
#define BP_ONE_HALF ALGR(BP_9) // ½
|
||||
#define BP_1HLF BP_ONE_HALF
|
||||
#define BP_THREE_QUARTERS ALTGR(BP_0) // ¾
|
||||
#define BP_THREE_QUARTERS ALGR(BP_0) // ¾
|
||||
#define BP_3QRT BP_THREE_QUARTERS
|
||||
#define BP_MINUTES ALTGR(BP_DEGREE) // ′
|
||||
#define BP_MINUTES ALGR(BP_DEGREE) // ′
|
||||
#define BP_MNUT BP_MINUTES
|
||||
#define BP_SECONDS ALTGR(BP_GRAVE) // ″
|
||||
#define BP_SECONDS ALGR(BP_GRAVE) // ″
|
||||
#define BP_SCND BP_SECONDS
|
||||
|
||||
// Second row
|
||||
|
|
@ -281,7 +272,7 @@
|
|||
#define BP_BPIP BP_BROKEN_PIPE
|
||||
#define BP_DEAD_DOUBLE_ACUTE LSFT(BP_DEAD_ACUTE) // ˝
|
||||
#define BP_DDCT BP_DEAD_DOUBLE_ACUTE
|
||||
#define BP_SECTION ALTGR(LSFT(BP_P)) // §
|
||||
#define BP_SECTION ALGR(LSFT(BP_P)) // §
|
||||
#define BP_SECT BP_SECTION
|
||||
// LSFT(BP_DEAD_GRAVE) is actually the same character as LSFT(BP_PERCENT)
|
||||
#define BP_GRAVE_BIS LSFT(BP_DEAD_GRAVE) // `
|
||||
|
|
@ -292,35 +283,35 @@
|
|||
#define BP_DDTA BP_DEAD_DOT_ABOVE
|
||||
#define BP_DEAD_CURRENCY LSFT(BP_EURO) // dead ¤ (next key will generate a currency code like ¥ or £)
|
||||
#define BP_DCUR BP_DEAD_CURRENCY
|
||||
#define BP_DEAD_HORN LSFT(ALTGR(BP_COMMA)) // dead ̛
|
||||
#define BP_DEAD_HORN LSFT(ALGR(BP_COMMA)) // dead ̛
|
||||
#define BP_DHRN BP_DEAD_HORN
|
||||
#define BP_LONG_S LSFT(ALTGR(BP_C)) // ſ
|
||||
#define BP_LONG_S LSFT(ALGR(BP_C)) // ſ
|
||||
#define BP_LNGS BP_LONG_S
|
||||
#define BP_TRADEMARK LSFT(BP_REGISTERED_TRADEMARK) // ™
|
||||
#define BP_TM BP_TRADEMARK
|
||||
#define BP_ORDINAL_INDICATOR_O LSFT(ALTGR(BP_M)) // º
|
||||
#define BP_ORDINAL_INDICATOR_O LSFT(ALGR(BP_M)) // º
|
||||
#define BP_ORDO BP_ORDINAL_INDICATOR_O
|
||||
#define BP_DEAD_COMMA LSFT(BP_DEAD_CEDILLA) // dead ˛
|
||||
#define BP_DCOM BP_DEAD_COMMA
|
||||
|
||||
// Fourth row
|
||||
#define BP_LEFT_QUOTE LSFT(ALTGR(BP_Y)) // ‘
|
||||
#define BP_LEFT_QUOTE LSFT(ALGR(BP_Y)) // ‘
|
||||
#define BP_LQOT BP_LEFT_QUOTE
|
||||
#define BP_RIGHT_QUOTE LSFT(ALTGR(BP_X)) // ’
|
||||
#define BP_RIGHT_QUOTE LSFT(ALGR(BP_X)) // ’
|
||||
#define BP_RQOT BP_RIGHT_QUOTE
|
||||
#define BP_INTERPUNCT LSFT(ALTGR(BP_DOT)) // ·
|
||||
#define BP_INTERPUNCT LSFT(ALGR(BP_DOT)) // ·
|
||||
#define BP_IPCT BP_INTERPUNCT
|
||||
#define BP_DEAD_HOOK_ABOVE LSFT(ALTGR(BP_QUESTION)) // dead ̉
|
||||
#define BP_DEAD_HOOK_ABOVE LSFT(ALGR(BP_QUESTION)) // dead ̉
|
||||
#define BP_DHKA BP_DEAD_HOOK_ABOVE
|
||||
#define BP_DEAD_UNDERDOT LSFT(BP_DEAD_RING) // dead ̣
|
||||
#define BP_DUDT BP_DEAD_UNDERDOT
|
||||
#define BP_DOUBLE_DAGGER LSFT(BP_DAGGER) // ‡
|
||||
#define BP_DDGR BP_DOUBLE_DAGGER
|
||||
#define BP_ORDINAL_INDICATOR_A LSFT(ALTGR(BP_F)) // ª
|
||||
#define BP_ORDINAL_INDICATOR_A LSFT(ALGR(BP_F)) // ª
|
||||
#define BP_ORDA BP_ORDINAL_INDICATOR_A
|
||||
|
||||
// Space bar
|
||||
#define BP_NARROW_NON_BREAKING_SPACE ALTGR(BP_NON_BREAKING_SPACE)
|
||||
#define BP_NARROW_NON_BREAKING_SPACE ALGR(BP_NON_BREAKING_SPACE)
|
||||
#define BP_NNBS BP_NARROW_NON_BREAKING_SPACE
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,22 +13,11 @@
|
|||
* 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_CANADIAN_MULTILINGUAG_H
|
||||
#define KEYMAP_CANADIAN_MULTILINGUAG_H
|
||||
#ifndef KEYMAP_CANADIAN_MULTILINGUAL_H
|
||||
#define KEYMAP_CANADIAN_MULTILINGUAL_H
|
||||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#ifndef ALTGR
|
||||
#define ALTGR(kc) RALT(kc)
|
||||
#endif
|
||||
#ifndef ALGR
|
||||
#define ALGR(kc) ALTGR(kc)
|
||||
#endif
|
||||
|
||||
#define CSA_ALTGR KC_RALT
|
||||
#define CSA_ALGR CSA_ALTGR
|
||||
|
||||
#ifndef GR2A
|
||||
#define GR2A(kc) RCTL(kc)
|
||||
#endif
|
||||
|
|
@ -78,43 +67,43 @@
|
|||
|
||||
// Alt Gr-ed characters
|
||||
// First row
|
||||
#define CSA_PIPE ALTGR(CSA_SLASH) // |
|
||||
#define CSA_CURRENCY ALTGR(KC_4) // ¤
|
||||
#define CSA_PIPE ALGR(CSA_SLASH) // |
|
||||
#define CSA_CURRENCY ALGR(KC_4) // ¤
|
||||
#define CSA_CURR CSA_CURRENCY
|
||||
#define CSA_LEFT_CURLY_BRACE ALTGR(KC_7) // {
|
||||
#define CSA_LEFT_CURLY_BRACE ALGR(KC_7) // {
|
||||
#define CSA_LCBR CSA_LEFT_CURLY_BRACE
|
||||
#define CSA_RIGHT_CURLY_BRACE ALTGR(KC_8) // }
|
||||
#define CSA_RIGHT_CURLY_BRACE ALGR(KC_8) // }
|
||||
#define CSA_RCBR CSA_RIGHT_CURLY_BRACE
|
||||
#define CSA_LBRACKET ALTGR(KC_9) // [
|
||||
#define CSA_LBRACKET ALGR(KC_9) // [
|
||||
#define CSA_LBRC CSA_LBRACKET
|
||||
#define CSA_RBRACKET ALTGR(KC_0) // ]
|
||||
#define CSA_RBRACKET ALGR(KC_0) // ]
|
||||
#define CSA_RBRC CSA_RBRACKET
|
||||
#define CSA_NEGATION ALTGR(KC_EQUAL) // ¬
|
||||
#define CSA_NEGATION ALGR(KC_EQUAL) // ¬
|
||||
#define CSA_NEGT CSA_NEGATION
|
||||
|
||||
// Second row
|
||||
// euro symbol not available on Linux? (X.org)
|
||||
#define CSA_EURO ALTGR(KC_E) // €
|
||||
#define CSA_DEAD_GRAVE ALTGR(CSA_DEAD_CIRCUMFLEX)
|
||||
#define CSA_EURO ALGR(KC_E) // €
|
||||
#define CSA_DEAD_GRAVE ALGR(CSA_DEAD_CIRCUMFLEX)
|
||||
#define CSA_DGRV CSA_DEAD_GRAVE // dead `
|
||||
#define CSA_DEAD_TILDE ALTGR(CSA_C_CEDILLA) // ~
|
||||
#define CSA_DEAD_TILDE ALGR(CSA_C_CEDILLA) // ~
|
||||
#define CSA_DTLD CSA_DEAD_TILDE
|
||||
|
||||
// Third row
|
||||
#define CSA_DEGREE ALTGR(KC_SCOLON) // °
|
||||
#define CSA_DEGREE ALGR(KC_SCOLON) // °
|
||||
#define CSA_DEGR CSA_DEGREE
|
||||
|
||||
// Fourth row
|
||||
#define CSA_LEFT_GUILLEMET ALTGR(KC_Z) // «
|
||||
#define CSA_LEFT_GUILLEMET ALGR(KC_Z) // «
|
||||
#define CSA_LGIL CSA_LEFT_GUILLEMET
|
||||
#define CSA_RIGHT_GUILLEMET ALTGR(KC_X) // »
|
||||
#define CSA_RIGHT_GUILLEMET ALGR(KC_X) // »
|
||||
#define CSA_RGIL CSA_RIGHT_GUILLEMET
|
||||
#define CSA_LESS ALTGR(KC_COMMA) // <
|
||||
#define CSA_GREATER ALTGR(KC_DOT) // >
|
||||
#define CSA_LESS ALGR(KC_COMMA) // <
|
||||
#define CSA_GREATER ALGR(KC_DOT) // >
|
||||
#define CSA_GRTR CSA_GREATER
|
||||
|
||||
// Space bar
|
||||
#define CSA_NON_BREAKING_SPACE ALTGR(KC_SPACE)
|
||||
#define CSA_NON_BREAKING_SPACE ALGR(KC_SPACE)
|
||||
#define CSA_NBSP CSA_NON_BREAKING_SPACE
|
||||
|
||||
// GR2A-ed characters
|
||||
|
|
@ -201,7 +190,7 @@
|
|||
// nothing on 2
|
||||
#define CSA_POUND GR2A(LSFT(KC_3)) // £
|
||||
#define CSA_GBP CSA_POUND_SIGN
|
||||
// already on ALTGR(KC_E)
|
||||
// already on ALGR(KC_E)
|
||||
#define CSA_EURO_BIS GR2A(LSFT(KC_4)) // €
|
||||
#define CSA_EURB CSA_EURO_BIS
|
||||
#define CSA_THREE_EIGHTHS GR2A(LSFT(KC_5)) // ⅜
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#define FR_CH_ALGR KC_RALT
|
||||
|
||||
// normal characters
|
||||
#define FR_CH_Z KC_Y
|
||||
#define FR_CH_Y KC_Z
|
||||
|
|
|
|||
|
|
@ -18,12 +18,6 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#ifndef ALGR
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#endif
|
||||
#define NO_ALGR KC_RALT
|
||||
|
||||
// Normal characters
|
||||
#define FR_SUP2 KC_GRV
|
||||
#define FR_AMP KC_1
|
||||
|
|
|
|||
|
|
@ -19,10 +19,6 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#define DE_ALGR KC_RALT
|
||||
|
||||
// normal characters
|
||||
#define DE_Z KC_Y
|
||||
#define DE_Y KC_Z
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#define CH_ALGR KC_RALT
|
||||
|
||||
// normal characters
|
||||
#define CH_Z KC_Y
|
||||
#define CH_Y KC_Z
|
||||
|
|
|
|||
|
|
@ -19,10 +19,6 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#define HU_ALGR KC_RALT
|
||||
|
||||
// basic letters
|
||||
#define HU_Z KC_Y
|
||||
#define HU_Y KC_Z
|
||||
|
|
|
|||
|
|
@ -19,14 +19,7 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#define IT_ALGR KC_RALT
|
||||
|
||||
// normal characters
|
||||
|
||||
|
||||
|
||||
#define IT_A KC_A
|
||||
#define IT_B KC_B
|
||||
#define IT_C KC_C
|
||||
|
|
|
|||
|
|
@ -73,6 +73,6 @@
|
|||
#define NEO_L1_R DE_HASH
|
||||
|
||||
#define NEO_L2_L DE_LESS
|
||||
#define NEO_L2_R DE_ALGR
|
||||
#define NEO_L2_R KC_ALGR
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#define NO_ALGR KC_RALT
|
||||
|
||||
// Normal characters
|
||||
#define NO_HALF KC_GRV
|
||||
#define NO_PLUS KC_MINS
|
||||
|
|
|
|||
54
quantum/keymap_extras/keymap_norman.h
Normal file
54
quantum/keymap_extras/keymap_norman.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
/* Copyright 2019 Torben Hoffmann
|
||||
*
|
||||
* 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 "keymap.h"
|
||||
// For software implementation of norman
|
||||
#define NM_Q KC_Q
|
||||
#define NM_W KC_W
|
||||
#define NM_D KC_E
|
||||
#define NM_F KC_R
|
||||
#define NM_K KC_T
|
||||
#define NM_J KC_Y
|
||||
#define NM_U KC_U
|
||||
#define NM_R KC_I
|
||||
#define NM_L KC_O
|
||||
#define NM_SCLN KC_P
|
||||
#define NM_COLN LSFT(NM_SCLN)
|
||||
|
||||
#define NM_A KC_A
|
||||
#define NM_S KC_S
|
||||
#define NM_E KC_D
|
||||
#define NM_T KC_F
|
||||
#define NM_G KC_G
|
||||
#define NM_Y KC_H
|
||||
#define NM_N KC_J
|
||||
#define NM_I KC_K
|
||||
#define NM_O KC_L
|
||||
#define NM_H KC_SCLN
|
||||
|
||||
#define NM_Z KC_Z
|
||||
#define NM_X KC_X
|
||||
#define NM_C KC_C
|
||||
#define NM_V KC_V
|
||||
#define NM_B KC_B
|
||||
#define NM_P KC_N
|
||||
#define NM_M KC_M
|
||||
#define NM_COMM KC_COMM
|
||||
#define NM_DOT KC_DOT
|
||||
#define NM_SLSH KC_SLSH
|
||||
|
||||
|
|
@ -1,10 +1,4 @@
|
|||
/*
|
||||
* light weight WS2812 lib include
|
||||
*
|
||||
* Version 2.3 - Nev 29th 2015
|
||||
* Author: Tim (cpldcpu@gmail.com)
|
||||
*
|
||||
* Please do not change this file! All configuration is handled in "ws2812_config.h"
|
||||
/* Copyright 2016 James Kay
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -19,29 +13,35 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef KEYMAP_PLOVER_DVORAK_H
|
||||
#define KEYMAP_PLOVER_DVORAK_H
|
||||
|
||||
#ifndef RGBLIGHT_TYPES
|
||||
#define RGBLIGHT_TYPES
|
||||
#include "keymap_dvorak.h"
|
||||
|
||||
#ifdef __AVR__
|
||||
#include <avr/io.h>
|
||||
#endif
|
||||
#define PD_NUM DV_1
|
||||
#define PD_LS DV_Q
|
||||
#define PD_LT DV_W
|
||||
#define PD_LP DV_E
|
||||
#define PD_LH DV_R
|
||||
#define PD_LK DV_S
|
||||
#define PD_LW DV_D
|
||||
#define PD_LR DV_F
|
||||
|
||||
#ifdef RGBW
|
||||
#define LED_TYPE struct cRGBW
|
||||
#else
|
||||
#define LED_TYPE struct cRGB
|
||||
#endif
|
||||
#define PD_STAR DV_Y
|
||||
#define PD_RF DV_U
|
||||
#define PD_RP DV_I
|
||||
#define PD_RL DV_O
|
||||
#define PD_RT DV_P
|
||||
#define PD_RD DV_LBRC
|
||||
#define PD_RR DV_J
|
||||
#define PD_RB DV_K
|
||||
#define PD_RG DV_L
|
||||
#define PD_RS DV_SCLN
|
||||
#define PD_RZ DV_QUOT
|
||||
|
||||
|
||||
/*
|
||||
* Structure of the LED array
|
||||
*
|
||||
* cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106
|
||||
* cRGBW: RGBW for SK6812RGBW
|
||||
*/
|
||||
|
||||
struct cRGB { uint8_t g; uint8_t r; uint8_t b; };
|
||||
struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;};
|
||||
#define PD_A DV_C
|
||||
#define PD_O DV_V
|
||||
#define PD_E DV_N
|
||||
#define PD_U DV_M
|
||||
|
||||
#endif
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
#ifndef KEYMAP_SLOVENIAN
|
||||
#define KEYMAP_SLOVENIAN
|
||||
#include "keymap.h"
|
||||
|
||||
#include "keymap.h"
|
||||
|
||||
//Swapped Z and Y
|
||||
#define SI_Z KC_Y
|
||||
|
|
@ -90,18 +90,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
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#define NO_ALGR KC_RALT
|
||||
|
||||
// Normal characters
|
||||
#define ES_OVRR KC_GRV
|
||||
#define ES_APOS KC_MINS
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@
|
|||
|
||||
#include "keymap.h"
|
||||
|
||||
// Alt gr
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#define NO_ALGR KC_RALT
|
||||
|
||||
// Normal characters
|
||||
#define UK_HASH KC_NUHS
|
||||
#define UK_BSLS KC_NUBS
|
||||
|
|
|
|||
97
quantum/keymap_extras/sendstring_belgian.h
Normal file
97
quantum/keymap_extras/sendstring_belgian.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/* Copyright 2019 kimat
|
||||
*
|
||||
* 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 lookup tables for Belgian layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_belgian.h"
|
||||
|
||||
const bool ascii_to_shift_lut[128] 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, 0, 0, 0, 0, 1, 0, 0,
|
||||
0, 0, 1, 1, 0, 0, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 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, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
const bool ascii_to_altgr_lut[128] 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, 0, 0, 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, 0, 0,
|
||||
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,
|
||||
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
|
||||
};
|
||||
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
// ! " # $ % & '
|
||||
KC_SPC, BE_EXLM, BE_QUOT, BE_QUOT, BE_DLR, BE_UGRV, BE_AMP, BE_APOS,
|
||||
// ( ) * + , - . /
|
||||
BE_LPRN, BE_RPRN, BE_DLR, BE_EQL, BE_COMM, BE_MINS, BE_SCLN, BE_COLN,
|
||||
// 0 1 2 3 4 5 6 7
|
||||
BE_AGRV, BE_AMP, BE_EACU, BE_QUOT, BE_APOS, BE_LPRN, BE_PARA, BE_EGRV,
|
||||
// 8 9 : ; < = > ?
|
||||
BE_EXLM, BE_CCED, BE_COLN, BE_SCLN, BE_LESS, BE_EQL, BE_LESS, BE_COMM,
|
||||
// @ A B C D E F G
|
||||
BE_EACU, BE_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, BE_M, KC_N, KC_O,
|
||||
// P Q R S T U V W
|
||||
KC_P, BE_Q, KC_R, KC_S, KC_T, KC_U, KC_V, BE_W,
|
||||
// X Y Z [ \ ] ^ _
|
||||
KC_X, KC_Y, BE_Z, BE_CIRC, BE_LESS, BE_DLR, BE_PARA, BE_MINS,
|
||||
// ` a b c d e f g
|
||||
BE_MU, BE_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, BE_M, KC_N, KC_O,
|
||||
// p q r s t u v w
|
||||
KC_P, BE_Q, KC_R, KC_S, KC_T, KC_U, KC_V, BE_W,
|
||||
// x y z { | } ~ DEL
|
||||
KC_X, KC_Y, BE_Z, BE_CCED, BE_AMP, BE_AGRV, BE_EQL, KC_DEL
|
||||
};
|
||||
|
|
@ -13,29 +13,85 @@
|
|||
* 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 bépo layout */
|
||||
#ifndef SENDSTRING_BEPO
|
||||
#define SENDSTRING_BEPO
|
||||
|
||||
// Sendstring lookup tables for BÉPO layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_bepo.h"
|
||||
|
||||
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,
|
||||
KC_SPC, BP_DCRC, BP_DQOT, BP_DOLLAR, BP_DOLLAR, BP_PERCENT, BP_P, BP_APOS,
|
||||
BP_LPRN, BP_RPRN, BP_ASTR, BP_PLUS, BP_COMM, BP_MINUS, BP_DOT, BP_SLSH,
|
||||
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
|
||||
KC_8, KC_9, BP_DOT, BP_DOT, KC_2, BP_EQUAL, KC_2, BP_APOS,
|
||||
BP_AT, BP_A, BP_B, BP_C, BP_D, BP_E, BP_F, BP_G,
|
||||
BP_H, BP_I, BP_J, BP_K, BP_L, BP_M, BP_N, BP_O,
|
||||
BP_P, BP_Q, BP_R, BP_S, BP_T, BP_U, BP_V, BP_W,
|
||||
BP_X, BP_Y, BP_Z, KC_4, BP_AGRV, KC_5, KC_5, KC_MINS,
|
||||
KC_2, BP_A, BP_B, BP_C, BP_D, BP_E, BP_F, BP_G,
|
||||
BP_H, BP_I, BP_J, BP_K, BP_L, BP_M, BP_N, BP_O,
|
||||
BP_P, BP_Q, BP_R, BP_S, BP_T, BP_U, BP_V, BP_W,
|
||||
BP_X, BP_Y, BP_Z, BP_Y, BP_B, BP_X, BP_K, KC_DEL,
|
||||
const bool ascii_to_shift_lut[128] 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, 0, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 0, 0, 0, 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, 0, 0, 0, 0, 0,
|
||||
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, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
#endif
|
||||
const bool ascii_to_altgr_lut[128] 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, 0, 0, 0, 0, 0, 1, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0, 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, 0, 0, 1, 1, 1, 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, 0, 1, 1, 1, 1, 0
|
||||
};
|
||||
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
// ! " # $ % & '
|
||||
KC_SPC, BP_DCRC, BP_DQOT, BP_DLR, BP_DLR, BP_PERC, BP_P, BP_APOS,
|
||||
// ( ) * + , - . /
|
||||
BP_LPRN, BP_RPRN, BP_ASTR, BP_PLUS, BP_COMM, BP_MINS, BP_DOT, BP_SLSH,
|
||||
// 0 1 2 3 4 5 6 7
|
||||
BP_ASTR, BP_DQOT, BP_LGIL, BP_RGIL, BP_LPRN, BP_RPRN, BP_AT, BP_PLUS,
|
||||
// 8 9 : ; < = > ?
|
||||
BP_MINS, BP_SLSH, BP_DOT, BP_COMM, BP_LGIL, BP_EQL, BP_RGIL, BP_APOS,
|
||||
// @ A B C D E F G
|
||||
BP_AT, BP_A, BP_B, BP_C, BP_D, BP_E, BP_F, BP_G,
|
||||
// H I J K L M N O
|
||||
BP_H, BP_I, BP_J, BP_K, BP_L, BP_M, BP_N, BP_O,
|
||||
// P Q R S T U V W
|
||||
BP_P, BP_Q, BP_R, BP_S, BP_T, BP_U, BP_V, BP_W,
|
||||
// X Y Z [ \ ] ^ _
|
||||
BP_X, BP_Y, BP_Z, BP_LPRN, BP_AGRV, BP_RPRN, BP_AT, KC_SPC,
|
||||
// ` a b c d e f g
|
||||
BP_PERC, BP_A, BP_B, BP_C, BP_D, BP_E, BP_F, BP_G,
|
||||
// h i j k l m n o
|
||||
BP_H, BP_I, BP_J, BP_K, BP_L, BP_M, BP_N, BP_O,
|
||||
// p q r s t u v w
|
||||
BP_P, BP_Q, BP_R, BP_S, BP_T, BP_U, BP_V, BP_W,
|
||||
// x y z { | } ~ DEL
|
||||
BP_X, BP_Y, BP_Z, BP_Y, BP_B, BP_X, BP_K, KC_DEL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,29 +13,45 @@
|
|||
* 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 Colemak layout */
|
||||
#ifndef SENDSTRING_COLEMAK
|
||||
#define SENDSTRING_COLEMAK
|
||||
|
||||
// Sendstring lookup tables for Colemak layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_colemak.h"
|
||||
|
||||
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,
|
||||
KC_SPC, KC_1, KC_QUOT, KC_3, KC_4, KC_5, KC_7, KC_QUOT,
|
||||
KC_9, KC_0, KC_8, KC_EQL, KC_COMM, KC_MINS, KC_DOT, KC_SLSH,
|
||||
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
|
||||
KC_8, KC_9, CM_SCLN, CM_SCLN, KC_COMM, KC_EQL, KC_DOT, KC_SLSH,
|
||||
KC_2, CM_A, CM_B, CM_C, CM_D, CM_E, CM_F, CM_G,
|
||||
CM_H, CM_I, CM_J, CM_K, CM_L, CM_M, CM_N, CM_O,
|
||||
CM_P, CM_Q, CM_R, CM_S, CM_T, CM_U, CM_V, CM_W,
|
||||
CM_X, CM_Y, CM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_6, KC_MINS,
|
||||
KC_GRV, CM_A, CM_B, CM_C, CM_D, CM_E, CM_F, CM_G,
|
||||
CM_H, CM_I, CM_J, CM_K, CM_L, CM_M, CM_N, CM_O,
|
||||
CM_P, CM_Q, CM_R, CM_S, CM_T, CM_U, CM_V, CM_W,
|
||||
CM_X, CM_Y, CM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL
|
||||
};
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
#endif
|
||||
// ! " # $ % & '
|
||||
KC_SPC, KC_1, KC_QUOT, KC_3, KC_4, KC_5, KC_7, KC_QUOT,
|
||||
// ( ) * + , - . /
|
||||
KC_9, KC_0, KC_8, KC_EQL, KC_COMM, KC_MINS, KC_DOT, KC_SLSH,
|
||||
// 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, CM_SCLN, CM_SCLN, KC_COMM, KC_EQL, KC_DOT, KC_SLSH,
|
||||
// @ A B C D E F G
|
||||
KC_2, CM_A, CM_B, CM_C, CM_D, CM_E, CM_F, CM_G,
|
||||
// H I J K L M N O
|
||||
CM_H, CM_I, CM_J, CM_K, CM_L, CM_M, CM_N, CM_O,
|
||||
// P Q R S T U V W
|
||||
CM_P, CM_Q, CM_R, CM_S, CM_T, CM_U, CM_V, CM_W,
|
||||
// X Y Z [ \ ] ^ _
|
||||
CM_X, CM_Y, CM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_6, KC_MINS,
|
||||
// ` a b c d e f g
|
||||
KC_GRV, CM_A, CM_B, CM_C, CM_D, CM_E, CM_F, CM_G,
|
||||
// h i j k l m n o
|
||||
CM_H, CM_I, CM_J, CM_K, CM_L, CM_M, CM_N, CM_O,
|
||||
// p q r s t u v w
|
||||
CM_P, CM_Q, CM_R, CM_S, CM_T, CM_U, CM_V, CM_W,
|
||||
// x y z { | } ~ DEL
|
||||
CM_X, CM_Y, CM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,29 +13,45 @@
|
|||
* 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 Dvorak layout */
|
||||
#ifndef SENDSTRING_DVORAK
|
||||
#define SENDSTRING_DVORAK
|
||||
|
||||
// Sendstring lookup tables for Dvorak layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_dvorak.h"
|
||||
|
||||
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,
|
||||
KC_SPC, DV_1, DV_QUOT, DV_3, DV_4, DV_5, DV_7, DV_QUOT,
|
||||
DV_9, DV_0, DV_8, DV_EQL, DV_COMM, DV_MINS, DV_DOT, DV_SLSH,
|
||||
DV_0, DV_1, DV_2, DV_3, DV_4, DV_5, DV_6, DV_7,
|
||||
DV_8, DV_9, DV_SCLN, DV_SCLN, DV_COMM, DV_EQL, DV_DOT, DV_SLSH,
|
||||
DV_2, DV_A, DV_B, DV_C, DV_D, DV_E, DV_F, DV_G,
|
||||
DV_H, DV_I, DV_J, DV_K, DV_L, DV_M, DV_N, DV_O,
|
||||
DV_P, DV_Q, DV_R, DV_S, DV_T, DV_U, DV_V, DV_W,
|
||||
DV_X, DV_Y, DV_Z, DV_LBRC, DV_BSLS, DV_RBRC, DV_6, DV_MINS,
|
||||
DV_GRV, DV_A, DV_B, DV_C, DV_D, DV_E, DV_F, DV_G,
|
||||
DV_H, DV_I, DV_J, DV_K, DV_L, DV_M, DV_N, DV_O,
|
||||
DV_P, DV_Q, DV_R, DV_S, DV_T, DV_U, DV_V, DV_W,
|
||||
DV_X, DV_Y, DV_Z, DV_LBRC, DV_BSLS, DV_RBRC, DV_GRV, KC_DEL
|
||||
};
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
#endif
|
||||
// ! " # $ % & '
|
||||
KC_SPC, DV_1, DV_QUOT, DV_3, DV_4, DV_5, DV_7, DV_QUOT,
|
||||
// ( ) * + , - . /
|
||||
DV_9, DV_0, DV_8, DV_EQL, DV_COMM, DV_MINS, DV_DOT, DV_SLSH,
|
||||
// 0 1 2 3 4 5 6 7
|
||||
DV_0, DV_1, DV_2, DV_3, DV_4, DV_5, DV_6, DV_7,
|
||||
// 8 9 : ; < = > ?
|
||||
DV_8, DV_9, DV_SCLN, DV_SCLN, DV_COMM, DV_EQL, DV_DOT, DV_SLSH,
|
||||
// @ A B C D E F G
|
||||
DV_2, DV_A, DV_B, DV_C, DV_D, DV_E, DV_F, DV_G,
|
||||
// H I J K L M N O
|
||||
DV_H, DV_I, DV_J, DV_K, DV_L, DV_M, DV_N, DV_O,
|
||||
// P Q R S T U V W
|
||||
DV_P, DV_Q, DV_R, DV_S, DV_T, DV_U, DV_V, DV_W,
|
||||
// X Y Z [ \ ] ^ _
|
||||
DV_X, DV_Y, DV_Z, DV_LBRC, DV_BSLS, DV_RBRC, DV_6, DV_MINS,
|
||||
// ` a b c d e f g
|
||||
DV_GRV, DV_A, DV_B, DV_C, DV_D, DV_E, DV_F, DV_G,
|
||||
// h i j k l m n o
|
||||
DV_H, DV_I, DV_J, DV_K, DV_L, DV_M, DV_N, DV_O,
|
||||
// p q r s t u v w
|
||||
DV_P, DV_Q, DV_R, DV_S, DV_T, DV_U, DV_V, DV_W,
|
||||
// x y z { | } ~ DEL
|
||||
DV_X, DV_Y, DV_Z, DV_LBRC, DV_BSLS, DV_RBRC, DV_GRV, KC_DEL
|
||||
};
|
||||
|
|
|
|||
97
quantum/keymap_extras/sendstring_french.h
Normal file
97
quantum/keymap_extras/sendstring_french.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/* Copyright 2016 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
|
||||
* 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 lookup tables for French (AZERTY) layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_french.h"
|
||||
|
||||
const bool ascii_to_shift_lut[128] 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, 0, 0, 0, 0, 1, 0, 0,
|
||||
0, 0, 0, 1, 0, 0, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 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, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
const bool ascii_to_altgr_lut[128] 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, 0, 0, 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, 0, 0,
|
||||
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,
|
||||
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
|
||||
};
|
||||
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
// ! " # $ % & '
|
||||
KC_SPC, FR_EXLM, FR_QUOT, FR_QUOT, FR_DLR, FR_UGRV, FR_AMP, FR_APOS,
|
||||
// ( ) * + , - . /
|
||||
FR_LPRN, FR_RPRN, FR_ASTR, FR_EQL, FR_COMM, FR_MINS, FR_SCLN, FR_COLN,
|
||||
// 0 1 2 3 4 5 6 7
|
||||
FR_AGRV, FR_AMP, FR_EACU, FR_QUOT, FR_APOS, FR_LPRN, FR_MINS, FR_EGRV,
|
||||
// 8 9 : ; < = > ?
|
||||
FR_CCED, FR_AGRV, FR_COLN, FR_SCLN, FR_LESS, FR_EQL, FR_LESS, FR_COMM,
|
||||
// @ A B C D E F G
|
||||
FR_AGRV, FR_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, FR_M, KC_N, KC_O,
|
||||
// P Q R S T U V W
|
||||
KC_P, FR_Q, KC_R, KC_S, KC_T, KC_U, KC_V, FR_W,
|
||||
// X Y Z [ \ ] ^ _
|
||||
KC_X, KC_Y, FR_Z, FR_LPRN, FR_UNDS, FR_RPRN, FR_CCED, FR_UNDS,
|
||||
// ` a b c d e f g
|
||||
FR_EGRV, FR_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, FR_M, KC_N, KC_O,
|
||||
// p q r s t u v w
|
||||
KC_P, FR_Q, KC_R, KC_S, KC_T, KC_U, KC_V, FR_W,
|
||||
// x y z { | } ~ DEL
|
||||
KC_X, KC_Y, FR_Z, FR_APOS, FR_MINS, FR_EQL, FR_EACU, KC_DEL
|
||||
};
|
||||
|
|
@ -13,69 +13,85 @@
|
|||
* 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
|
||||
|
||||
// Sendstring lookup tables for German layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_german.h"
|
||||
|
||||
const bool ascii_to_shift_lut[0x80] PROGMEM = {
|
||||
const bool ascii_to_shift_lut[128] 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,
|
||||
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, 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, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
const bool ascii_to_altgr_lut[128] 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, 0, 0, 0, 0, 0, 0, 0,
|
||||
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, 0, 0, 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, 0, 0,
|
||||
0, 0, 0, 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,
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
/* 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
|
||||
// ! " # $ % & '
|
||||
KC_SPC, DE_1, DE_2, DE_HASH, DE_4, DE_5, DE_6, DE_HASH,
|
||||
// ( ) * + , - . /
|
||||
DE_8, DE_9, DE_PLUS, DE_PLUS, DE_COMM, DE_MINS, DE_DOT, DE_7,
|
||||
// 0 1 2 3 4 5 6 7
|
||||
DE_0, DE_1, DE_2, DE_3, DE_4, DE_5, DE_6, DE_7,
|
||||
// 8 9 : ; < = > ?
|
||||
DE_8, DE_9, DE_DOT, DE_COMM, DE_LESS, DE_0, DE_LESS, DE_SS,
|
||||
// @ A B C D E F G
|
||||
DE_Q, DE_A, DE_B, DE_C, DE_D, DE_E, DE_F, DE_G,
|
||||
// H I J K L M N O
|
||||
DE_H, DE_I, DE_J, DE_K, DE_L, DE_M, DE_N, DE_O,
|
||||
// P Q R S T U V W
|
||||
DE_P, DE_Q, DE_R, DE_S, DE_T, DE_U, DE_V, DE_W,
|
||||
// X Y Z [ \ ] ^ _
|
||||
DE_X, DE_Y, DE_Z, DE_8, DE_SS, DE_9, DE_CIRC, DE_MINS,
|
||||
// ` a b c d e f g
|
||||
DE_ACUT, DE_A, DE_B, DE_C, DE_D, DE_E, DE_F, DE_G,
|
||||
// h i j k l m n o
|
||||
DE_H, DE_I, DE_J, DE_K, DE_L, DE_M, DE_N, DE_O,
|
||||
// p q r s t u v w
|
||||
DE_P, DE_Q, DE_R, DE_S, DE_T, DE_U, DE_V, DE_W,
|
||||
// x y z { | } ~ DEL
|
||||
DE_X, DE_Y, DE_Z, DE_7, DE_LESS, DE_0, DE_PLUS, KC_DEL
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,15 +13,19 @@
|
|||
* 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 JIS keyboard layout */
|
||||
#ifndef SENDSTRING_JIS
|
||||
#define SENDSTRING_JIS
|
||||
|
||||
const bool ascii_to_shift_lut[0x80] PROGMEM = {
|
||||
// Sendstring lookup tables for JIS layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_jp.h"
|
||||
|
||||
const bool ascii_to_shift_lut[128] 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, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
|
@ -36,23 +40,38 @@ const bool ascii_to_shift_lut[0x80] PROGMEM = {
|
|||
0, 0, 0, 1, 1, 1, 1, 0
|
||||
};
|
||||
|
||||
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,
|
||||
KC_SPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
|
||||
KC_8, KC_9, KC_QUOT, KC_SCLN, KC_COMM, KC_MINS, KC_DOT, KC_SLSH,
|
||||
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
|
||||
KC_8, KC_9, KC_QUOT, KC_SCLN, KC_COMM, KC_MINS, KC_DOT, KC_SLSH,
|
||||
KC_LBRC, KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, KC_G,
|
||||
KC_H, KC_I, KC_J, KC_K, KC_L, KC_M, KC_N, KC_O,
|
||||
KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W,
|
||||
KC_X, KC_Y, KC_Z, KC_RBRC, KC_JYEN, KC_BSLS, KC_EQL, KC_RO,
|
||||
KC_LBRC, KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, KC_G,
|
||||
KC_H, KC_I, KC_J, KC_K, KC_L, KC_M, KC_N, KC_O,
|
||||
KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W,
|
||||
KC_X, KC_Y, KC_Z, KC_RBRC, KC_JYEN, KC_BSLS, KC_EQL, KC_DEL,
|
||||
};
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
#endif
|
||||
// ! " # $ % & '
|
||||
KC_SPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
|
||||
// ( ) * + , - . /
|
||||
KC_8, KC_9, JP_COLN, JP_SCLN, JP_COMM, JP_MINS, JP_DOT, JP_SLSH,
|
||||
// 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, JP_COLN, JP_SCLN, JP_COMM, JP_MINS, JP_DOT, JP_SLSH,
|
||||
// @ A B C D E F G
|
||||
JP_AT, 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, JP_LBRC, JP_BSLS, JP_RBRC, JP_CIRC, JP_BSLS,
|
||||
// ` a b c d e f g
|
||||
JP_AT, 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 { | } ~ DEL
|
||||
KC_X, KC_Y, KC_Z, JP_LBRC, JP_YEN, JP_RBRC, JP_CIRC, KC_DEL
|
||||
};
|
||||
|
|
|
|||
57
quantum/keymap_extras/sendstring_norman.h
Normal file
57
quantum/keymap_extras/sendstring_norman.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/* Copyright 2019 Torben Hoffmann
|
||||
*
|
||||
* 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 lookup tables for Norman layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_norman.h"
|
||||
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
// ! " # $ % & '
|
||||
KC_SPC, KC_1, KC_QUOT, KC_3, KC_4, KC_5, KC_7, KC_QUOT,
|
||||
// ( ) * + , - . /
|
||||
KC_9, KC_0, KC_8, KC_EQL, KC_COMM, KC_MINS, KC_DOT, KC_SLSH,
|
||||
// 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, NM_SCLN, NM_SCLN, KC_COMM, KC_EQL, KC_DOT, KC_SLSH,
|
||||
// @ A B C D E F G
|
||||
KC_2, NM_A, NM_B, NM_C, NM_D, NM_E, NM_F, NM_G,
|
||||
// H I J K L M N O
|
||||
NM_H, NM_I, NM_J, NM_K, NM_L, NM_M, NM_N, NM_O,
|
||||
// P Q R S T U V W
|
||||
NM_P, NM_Q, NM_R, NM_S, NM_T, NM_U, NM_V, NM_W,
|
||||
// X Y Z [ \ ] ^ _
|
||||
NM_X, NM_Y, NM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_6, KC_MINS,
|
||||
// ` a b c d e f g
|
||||
KC_GRV, NM_A, NM_B, NM_C, NM_D, NM_E, NM_F, NM_G,
|
||||
// h i j k l m n o
|
||||
NM_H, NM_I, NM_J, NM_K, NM_L, NM_M, NM_N, NM_O,
|
||||
// p q r s t u v w
|
||||
NM_P, NM_Q, NM_R, NM_S, NM_T, NM_U, NM_V, NM_W,
|
||||
// x y z { | } ~ DEL
|
||||
NM_X, NM_Y, NM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL
|
||||
};
|
||||
|
|
@ -13,59 +13,85 @@
|
|||
* 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 Spanish layout */
|
||||
#ifndef SENDSTRING_SPANISH
|
||||
#define SENDSTRING_SPANISH
|
||||
|
||||
// Sendstring lookup tables for Spanish layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_spanish.h"
|
||||
|
||||
const bool ascii_to_shift_lut[0x80] PROGMEM = {
|
||||
const bool ascii_to_shift_lut[128] 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, 1, 1, 1, 1, 0,
|
||||
0, 1, 1, 0, 1, 1, 1, 0,
|
||||
1, 1, 1, 0, 0, 0, 0, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 1, 1, 0, 1, 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, 1,
|
||||
|
||||
1, 1, 1, 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, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
const bool ascii_to_altgr_lut[128] 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, 0, 0, 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, 0, 0,
|
||||
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, 0, 0,
|
||||
0, 0, 0, 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:
|
||||
# @ [ ] { } | ~
|
||||
*/
|
||||
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,
|
||||
/* , ! " # $ % & ' */
|
||||
KC_SPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, ES_APOS,
|
||||
/* ( ) * + , - . / */
|
||||
KC_8, KC_9, ES_PLUS, ES_PLUS, KC_COMM, ES_MINS, KC_DOT, KC_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, KC_NUBS, KC_0, KC_NUBS, ES_APOS,
|
||||
/* @ A B C D E F G */
|
||||
KC_2, KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, KC_G,
|
||||
KC_H, KC_I, KC_J, KC_K, KC_L, KC_M, KC_N, KC_O,
|
||||
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, ES_GRV, ES_MINS,
|
||||
ES_GRV, KC_A, KC_B, KC_C, KC_D, KC_E, KC_F, KC_G,
|
||||
KC_H, KC_I, KC_J, KC_K, KC_L, KC_M, KC_N, KC_O,
|
||||
KC_P, KC_Q, KC_R, KC_S, KC_T, KC_U, KC_V, KC_W,
|
||||
KC_X, KC_Y, KC_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL
|
||||
};
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
#endif
|
||||
// ! " # $ % & '
|
||||
KC_SPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, ES_APOS,
|
||||
// ( ) * + , - . /
|
||||
KC_8, KC_9, ES_PLUS, ES_PLUS, KC_COMM, ES_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, ES_LESS, KC_0, ES_LESS, ES_APOS,
|
||||
// @ 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, ES_GRV, ES_OVRR, ES_PLUS, ES_GRV, ES_MINS,
|
||||
// ` a b c d e f g
|
||||
ES_GRV, 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 { | } ~ DEL
|
||||
KC_X, KC_Y, KC_Z, ES_ACUT, KC_1, ES_CCED, ES_NTIL, KC_DEL
|
||||
};
|
||||
|
|
|
|||
77
quantum/keymap_extras/sendstring_uk.h
Normal file
77
quantum/keymap_extras/sendstring_uk.h
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/* Copyright 2019 Rys Sommefeldt
|
||||
*
|
||||
* 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 lookup tables for UK layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_uk.h"
|
||||
|
||||
const bool ascii_to_shift_lut[128] 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, 0,
|
||||
1, 1, 1, 1, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 1, 0, 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, 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, 0, 1, 1, 1, 1, 0
|
||||
};
|
||||
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
// ! " # $ % & '
|
||||
UK_SPC, UK_1, UK_2, UK_HASH, UK_4, UK_5, UK_7, UK_QUOT,
|
||||
// ( ) * + , - . /
|
||||
UK_9, UK_0, UK_8, UK_EQL, UK_COMM, UK_MINS, UK_DOT, UK_SLSH,
|
||||
// 0 1 2 3 4 5 6 7
|
||||
UK_0, UK_1, UK_2, UK_3, UK_4, UK_5, UK_6, UK_7,
|
||||
// 8 9 : ; < = > ?
|
||||
UK_8, UK_9, UK_SCLN, UK_SCLN, UK_COMM, UK_EQL, UK_DOT, UK_SLSH,
|
||||
// @ A B C D E F G
|
||||
UK_QUOT, UK_A, UK_B, UK_C, UK_D, UK_E, UK_F, UK_G,
|
||||
// H I J K L M N O
|
||||
UK_H, UK_I, UK_J, UK_K, UK_L, UK_M, UK_N, UK_O,
|
||||
// P Q R S T U V W
|
||||
UK_P, UK_Q, UK_R, UK_S, UK_T, UK_U, UK_V, UK_W,
|
||||
// X Y Z [ \ ] ^ _
|
||||
UK_X, UK_Y, UK_Z, UK_LBRC, UK_BSLS, UK_RBRC, UK_6, UK_MINS,
|
||||
// ` a b c d e f g
|
||||
UK_GRV, UK_A, UK_B, UK_C, UK_D, UK_E, UK_F, UK_G,
|
||||
// h i j k l m n o
|
||||
UK_H, UK_I, UK_J, UK_K, UK_L, UK_M, UK_N, UK_O,
|
||||
// p q r s t u v w
|
||||
UK_P, UK_Q, UK_R, UK_S, UK_T, UK_U, UK_V, UK_W,
|
||||
// x y z { | } ~ DEL
|
||||
UK_X, UK_Y, UK_Z, UK_LBRC, UK_BSLS, UK_RBRC, UK_HASH, KC_DEL
|
||||
};
|
||||
|
|
@ -13,29 +13,45 @@
|
|||
* 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 Workman layout */
|
||||
#ifndef SENDSTRING_WORKMAN
|
||||
#define SENDSTRING_WORKMAN
|
||||
|
||||
// Sendstring lookup tables for Workman layouts
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_workman.h"
|
||||
|
||||
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,
|
||||
KC_SPC, KC_1, KC_QUOT, KC_3, KC_4, KC_5, KC_7, KC_QUOT,
|
||||
KC_9, KC_0, KC_8, KC_EQL, KC_COMM, KC_MINS, KC_DOT, KC_SLSH,
|
||||
KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
|
||||
KC_8, KC_9, KC_SCLN, KC_SCLN, KC_COMM, KC_EQL, KC_DOT, KC_SLSH,
|
||||
KC_2, WK_A, WK_B, WK_C, WK_D, WK_E, WK_F, WK_G,
|
||||
WK_H, WK_I, WK_J, WK_K, WK_L, WK_M, WK_N, WK_O,
|
||||
WK_P, WK_Q, WK_R, WK_S, WK_T, WK_U, WK_V, WK_W,
|
||||
WK_X, WK_Y, WK_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_6, KC_MINS,
|
||||
KC_GRV, WK_A, WK_B, WK_C, WK_D, WK_E, WK_F, WK_G,
|
||||
WK_H, WK_I, WK_J, WK_K, WK_L, WK_M, WK_N, WK_O,
|
||||
WK_P, WK_Q, WK_R, WK_S, WK_T, WK_U, WK_V, WK_W,
|
||||
WK_X, WK_Y, WK_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL
|
||||
};
|
||||
const uint8_t ascii_to_keycode_lut[128] PROGMEM = {
|
||||
// NUL SOH STX ETX EOT ENQ ACK BEL
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// BS TAB LF VT FF CR SO SI
|
||||
KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// DLE DC1 DC2 DC3 DC4 NAK SYN ETB
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
// CAN EM SUB ESC FS GS RS US
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
||||
#endif
|
||||
// ! " # $ % & '
|
||||
KC_SPC, KC_1, KC_QUOT, KC_3, KC_4, KC_5, KC_7, KC_QUOT,
|
||||
// ( ) * + , - . /
|
||||
KC_9, KC_0, KC_8, KC_EQL, KC_COMM, KC_MINS, KC_DOT, KC_SLSH,
|
||||
// 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_SCLN, KC_SCLN, KC_COMM, KC_EQL, KC_DOT, KC_SLSH,
|
||||
// @ A B C D E F G
|
||||
KC_2, WK_A, WK_B, WK_C, WK_D, WK_E, WK_F, WK_G,
|
||||
// H I J K L M N O
|
||||
WK_H, WK_I, WK_J, WK_K, WK_L, WK_M, WK_N, WK_O,
|
||||
// P Q R S T U V W
|
||||
WK_P, WK_Q, WK_R, WK_S, WK_T, WK_U, WK_V, WK_W,
|
||||
// X Y Z [ \ ] ^ _
|
||||
WK_X, WK_Y, WK_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_6, KC_MINS,
|
||||
// ` a b c d e f g
|
||||
KC_GRV, WK_A, WK_B, WK_C, WK_D, WK_E, WK_F, WK_G,
|
||||
// h i j k l m n o
|
||||
WK_H, WK_I, WK_J, WK_K, WK_L, WK_M, WK_N, WK_O,
|
||||
// p q r s t u v w
|
||||
WK_P, WK_Q, WK_R, WK_S, WK_T, WK_U, WK_V, WK_W,
|
||||
// x y z { | } ~ DEL
|
||||
WK_X, WK_Y, WK_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL
|
||||
};
|
||||
|
|
|
|||
391
quantum/led_matrix.c
Normal file
391
quantum/led_matrix.c
Normal file
|
|
@ -0,0 +1,391 @@
|
|||
/* Copyright 2017 Jason Williams
|
||||
* Copyright 2017 Jack Humbert
|
||||
* Copyright 2018 Yiancar
|
||||
* Copyright 2019 Clueboard
|
||||
*
|
||||
* 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "quantum.h"
|
||||
#include "ledmatrix.h"
|
||||
#include "progmem.h"
|
||||
#include "config.h"
|
||||
#include "eeprom.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
led_config_t led_matrix_config;
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a) < (b)? (a): (b))
|
||||
#endif
|
||||
|
||||
#ifndef LED_DISABLE_AFTER_TIMEOUT
|
||||
#define LED_DISABLE_AFTER_TIMEOUT 0
|
||||
#endif
|
||||
|
||||
#ifndef LED_DISABLE_WHEN_USB_SUSPENDED
|
||||
#define LED_DISABLE_WHEN_USB_SUSPENDED false
|
||||
#endif
|
||||
|
||||
#ifndef EECONFIG_LED_MATRIX
|
||||
#define EECONFIG_LED_MATRIX EECONFIG_RGBLIGHT
|
||||
#endif
|
||||
|
||||
#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > 255
|
||||
#define LED_MATRIX_MAXIMUM_BRIGHTNESS 255
|
||||
#endif
|
||||
|
||||
bool g_suspend_state = false;
|
||||
|
||||
// Global tick at 20 Hz
|
||||
uint32_t g_tick = 0;
|
||||
|
||||
// Ticks since this key was last hit.
|
||||
uint8_t g_key_hit[LED_DRIVER_LED_COUNT];
|
||||
|
||||
// Ticks since any key was last hit.
|
||||
uint32_t g_any_key_hit = 0;
|
||||
|
||||
uint32_t eeconfig_read_led_matrix(void) {
|
||||
return eeprom_read_dword(EECONFIG_LED_MATRIX);
|
||||
}
|
||||
|
||||
void eeconfig_update_led_matrix(uint32_t config_value) {
|
||||
eeprom_update_dword(EECONFIG_LED_MATRIX, config_value);
|
||||
}
|
||||
|
||||
void eeconfig_update_led_matrix_default(void) {
|
||||
dprintf("eeconfig_update_led_matrix_default\n");
|
||||
led_matrix_config.enable = 1;
|
||||
led_matrix_config.mode = LED_MATRIX_UNIFORM_BRIGHTNESS;
|
||||
led_matrix_config.val = 128;
|
||||
led_matrix_config.speed = 0;
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);
|
||||
}
|
||||
|
||||
void eeconfig_debug_led_matrix(void) {
|
||||
dprintf("led_matrix_config eeprom\n");
|
||||
dprintf("led_matrix_config.enable = %d\n", led_matrix_config.enable);
|
||||
dprintf("led_matrix_config.mode = %d\n", led_matrix_config.mode);
|
||||
dprintf("led_matrix_config.val = %d\n", led_matrix_config.val);
|
||||
dprintf("led_matrix_config.speed = %d\n", led_matrix_config.speed);
|
||||
}
|
||||
|
||||
// Last led hit
|
||||
#ifndef LED_HITS_TO_REMEMBER
|
||||
#define LED_HITS_TO_REMEMBER 8
|
||||
#endif
|
||||
uint8_t g_last_led_hit[LED_HITS_TO_REMEMBER] = {255};
|
||||
uint8_t g_last_led_count = 0;
|
||||
|
||||
void map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i, uint8_t *led_count) {
|
||||
led_matrix led;
|
||||
*led_count = 0;
|
||||
|
||||
for (uint8_t i = 0; i < LED_DRIVER_LED_COUNT; i++) {
|
||||
// map_index_to_led(i, &led);
|
||||
led = g_leds[i];
|
||||
if (row == led.matrix_co.row && column == led.matrix_co.col) {
|
||||
led_i[*led_count] = i;
|
||||
(*led_count)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void led_matrix_update_pwm_buffers(void) {
|
||||
led_matrix_driver.flush();
|
||||
}
|
||||
|
||||
void led_matrix_set_index_value(int index, uint8_t value) {
|
||||
led_matrix_driver.set_value(index, value);
|
||||
}
|
||||
|
||||
void led_matrix_set_index_value_all(uint8_t value) {
|
||||
led_matrix_driver.set_value_all(value);
|
||||
}
|
||||
|
||||
bool process_led_matrix(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
uint8_t led[8], led_count;
|
||||
map_row_column_to_led(record->event.key.row, record->event.key.col, led, &led_count);
|
||||
if (led_count > 0) {
|
||||
for (uint8_t i = LED_HITS_TO_REMEMBER; i > 1; i--) {
|
||||
g_last_led_hit[i - 1] = g_last_led_hit[i - 2];
|
||||
}
|
||||
g_last_led_hit[0] = led[0];
|
||||
g_last_led_count = MIN(LED_HITS_TO_REMEMBER, g_last_led_count + 1);
|
||||
}
|
||||
for(uint8_t i = 0; i < led_count; i++)
|
||||
g_key_hit[led[i]] = 0;
|
||||
g_any_key_hit = 0;
|
||||
} else {
|
||||
#ifdef LED_MATRIX_KEYRELEASES
|
||||
uint8_t led[8], led_count;
|
||||
map_row_column_to_led(record->event.key.row, record->event.key.col, led, &led_count);
|
||||
for(uint8_t i = 0; i < led_count; i++)
|
||||
g_key_hit[led[i]] = 255;
|
||||
|
||||
g_any_key_hit = 255;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void led_matrix_set_suspend_state(bool state) {
|
||||
g_suspend_state = state;
|
||||
}
|
||||
|
||||
// All LEDs off
|
||||
void led_matrix_all_off(void) {
|
||||
led_matrix_set_index_value_all(0);
|
||||
}
|
||||
|
||||
// Uniform brightness
|
||||
void led_matrix_uniform_brightness(void) {
|
||||
led_matrix_set_index_value_all(LED_MATRIX_MAXIMUM_BRIGHTNESS / BACKLIGHT_LEVELS * led_matrix_config.val);
|
||||
}
|
||||
|
||||
void led_matrix_custom(void) {}
|
||||
|
||||
void led_matrix_task(void) {
|
||||
if (!led_matrix_config.enable) {
|
||||
led_matrix_all_off();
|
||||
led_matrix_indicators();
|
||||
return;
|
||||
}
|
||||
|
||||
g_tick++;
|
||||
|
||||
if (g_any_key_hit < 0xFFFFFFFF) {
|
||||
g_any_key_hit++;
|
||||
}
|
||||
|
||||
for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) {
|
||||
if (g_key_hit[led] < 255) {
|
||||
if (g_key_hit[led] == 254)
|
||||
g_last_led_count = MAX(g_last_led_count - 1, 0);
|
||||
g_key_hit[led]++;
|
||||
}
|
||||
}
|
||||
|
||||
// Ideally we would also stop sending zeros to the LED driver PWM buffers
|
||||
// while suspended and just do a software shutdown. This is a cheap hack for now.
|
||||
bool suspend_backlight = ((g_suspend_state && LED_DISABLE_WHEN_USB_SUSPENDED) ||
|
||||
(LED_DISABLE_AFTER_TIMEOUT > 0 && g_any_key_hit > LED_DISABLE_AFTER_TIMEOUT * 60 * 20));
|
||||
uint8_t effect = suspend_backlight ? 0 : led_matrix_config.mode;
|
||||
|
||||
// this gets ticked at 20 Hz.
|
||||
// each effect can opt to do calculations
|
||||
// and/or request PWM buffer updates.
|
||||
switch (effect) {
|
||||
case LED_MATRIX_UNIFORM_BRIGHTNESS:
|
||||
led_matrix_uniform_brightness();
|
||||
break;
|
||||
default:
|
||||
led_matrix_custom();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!suspend_backlight) {
|
||||
led_matrix_indicators();
|
||||
}
|
||||
|
||||
// Tell the LED driver to update its state
|
||||
led_matrix_driver.flush();
|
||||
}
|
||||
|
||||
void led_matrix_indicators(void) {
|
||||
led_matrix_indicators_kb();
|
||||
led_matrix_indicators_user();
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void led_matrix_indicators_kb(void) {}
|
||||
|
||||
__attribute__((weak))
|
||||
void led_matrix_indicators_user(void) {}
|
||||
|
||||
|
||||
// void led_matrix_set_indicator_index(uint8_t *index, uint8_t row, uint8_t column)
|
||||
// {
|
||||
// if (row >= MATRIX_ROWS)
|
||||
// {
|
||||
// // Special value, 255=none, 254=all
|
||||
// *index = row;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // This needs updated to something like
|
||||
// // 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++)
|
||||
// map_row_column_to_led(row, column, index);
|
||||
// }
|
||||
// }
|
||||
|
||||
void led_matrix_init(void) {
|
||||
led_matrix_driver.init();
|
||||
|
||||
// Wait half a second for the driver to finish initializing
|
||||
wait_ms(500);
|
||||
|
||||
// clear the key hits
|
||||
for (int led=0; led<LED_DRIVER_LED_COUNT; led++) {
|
||||
g_key_hit[led] = 255;
|
||||
}
|
||||
|
||||
if (!eeconfig_is_enabled()) {
|
||||
dprintf("led_matrix_init_drivers eeconfig is not enabled.\n");
|
||||
eeconfig_init();
|
||||
eeconfig_update_led_matrix_default();
|
||||
}
|
||||
|
||||
led_matrix_config.raw = eeconfig_read_led_matrix();
|
||||
|
||||
if (!led_matrix_config.mode) {
|
||||
dprintf("led_matrix_init_drivers led_matrix_config.mode = 0. Write default values to EEPROM.\n");
|
||||
eeconfig_update_led_matrix_default();
|
||||
led_matrix_config.raw = eeconfig_read_led_matrix();
|
||||
}
|
||||
|
||||
eeconfig_debug_led_matrix(); // display current eeprom values
|
||||
}
|
||||
|
||||
// Deals with the messy details of incrementing an integer
|
||||
static uint8_t increment(uint8_t value, uint8_t step, uint8_t min, uint8_t max) {
|
||||
int16_t new_value = value;
|
||||
new_value += step;
|
||||
return MIN(MAX(new_value, min), max);
|
||||
}
|
||||
|
||||
static uint8_t decrement(uint8_t value, uint8_t step, uint8_t min, uint8_t max) {
|
||||
int16_t new_value = value;
|
||||
new_value -= step;
|
||||
return MIN(MAX(new_value, min), max);
|
||||
}
|
||||
|
||||
// void *backlight_get_custom_key_value_eeprom_address(uint8_t led) {
|
||||
// // 3 bytes per value
|
||||
// return EECONFIG_LED_MATRIX + (led * 3);
|
||||
// }
|
||||
|
||||
// void backlight_get_key_value(uint8_t led, uint8_t *value) {
|
||||
// void *address = backlight_get_custom_key_value_eeprom_address(led);
|
||||
// value = eeprom_read_byte(address);
|
||||
// }
|
||||
|
||||
// void backlight_set_key_value(uint8_t row, uint8_t column, uint8_t value) {
|
||||
// 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++) {
|
||||
// if (led[i] < LED_DRIVER_LED_COUNT) {
|
||||
// void *address = backlight_get_custom_key_value_eeprom_address(led[i]);
|
||||
// eeprom_update_byte(address, value);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
uint32_t led_matrix_get_tick(void) {
|
||||
return g_tick;
|
||||
}
|
||||
|
||||
void led_matrix_toggle(void) {
|
||||
led_matrix_config.enable ^= 1;
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);
|
||||
}
|
||||
|
||||
void led_matrix_enable(void) {
|
||||
led_matrix_config.enable = 1;
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);
|
||||
}
|
||||
|
||||
void led_matrix_enable_noeeprom(void) {
|
||||
led_matrix_config.enable = 1;
|
||||
}
|
||||
|
||||
void led_matrix_disable(void) {
|
||||
led_matrix_config.enable = 0;
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);
|
||||
}
|
||||
|
||||
void led_matrix_disable_noeeprom(void) {
|
||||
led_matrix_config.enable = 0;
|
||||
}
|
||||
|
||||
void led_matrix_step(void) {
|
||||
led_matrix_config.mode++;
|
||||
if (led_matrix_config.mode >= LED_MATRIX_EFFECT_MAX) {
|
||||
led_matrix_config.mode = 1;
|
||||
}
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);
|
||||
}
|
||||
|
||||
void led_matrix_step_reverse(void) {
|
||||
led_matrix_config.mode--;
|
||||
if (led_matrix_config.mode < 1) {
|
||||
led_matrix_config.mode = LED_MATRIX_EFFECT_MAX - 1;
|
||||
}
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);
|
||||
}
|
||||
|
||||
void led_matrix_increase_val(void) {
|
||||
led_matrix_config.val = increment(led_matrix_config.val, 8, 0, LED_MATRIX_MAXIMUM_BRIGHTNESS);
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);
|
||||
}
|
||||
|
||||
void led_matrix_decrease_val(void) {
|
||||
led_matrix_config.val = decrement(led_matrix_config.val, 8, 0, LED_MATRIX_MAXIMUM_BRIGHTNESS);
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);
|
||||
}
|
||||
|
||||
void led_matrix_increase_speed(void) {
|
||||
led_matrix_config.speed = increment(led_matrix_config.speed, 1, 0, 3);
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);//EECONFIG needs to be increased to support this
|
||||
}
|
||||
|
||||
void led_matrix_decrease_speed(void) {
|
||||
led_matrix_config.speed = decrement(led_matrix_config.speed, 1, 0, 3);
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);//EECONFIG needs to be increased to support this
|
||||
}
|
||||
|
||||
void led_matrix_mode(uint8_t mode, bool eeprom_write) {
|
||||
led_matrix_config.mode = mode;
|
||||
if (eeprom_write) {
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t led_matrix_get_mode(void) {
|
||||
return led_matrix_config.mode;
|
||||
}
|
||||
|
||||
void led_matrix_set_value_noeeprom(uint8_t val) {
|
||||
led_matrix_config.val = val;
|
||||
}
|
||||
|
||||
void led_matrix_set_value(uint8_t val) {
|
||||
led_matrix_set_value_noeeprom(val);
|
||||
eeconfig_update_led_matrix(led_matrix_config.raw);
|
||||
}
|
||||
|
||||
void backlight_set(uint8_t val) {
|
||||
led_matrix_set_value(val);
|
||||
}
|
||||
149
quantum/led_matrix_drivers.c
Normal file
149
quantum/led_matrix_drivers.c
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
/* Copyright 2018 James Laird-Wah
|
||||
* Copyright 2019 Clueboard
|
||||
*
|
||||
* 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "quantum.h"
|
||||
#include "ledmatrix.h"
|
||||
|
||||
/* Each driver needs to define a struct:
|
||||
*
|
||||
* const led_matrix_driver_t led_matrix_driver;
|
||||
*
|
||||
* All members must be provided. Keyboard custom drivers must define this
|
||||
* in their own files.
|
||||
*/
|
||||
|
||||
#if defined(IS31FL3731) || defined(IS31FL3733)
|
||||
|
||||
#if defined(IS31FL3731)
|
||||
#include "is31fl3731-simple.h"
|
||||
#endif
|
||||
|
||||
#include "i2c_master.h"
|
||||
|
||||
static void init(void) {
|
||||
i2c_init();
|
||||
#ifdef IS31FL3731
|
||||
#ifdef LED_DRIVER_ADDR_1
|
||||
IS31FL3731_init(LED_DRIVER_ADDR_1);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_2
|
||||
IS31FL3731_init(LED_DRIVER_ADDR_2);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_3
|
||||
IS31FL3731_init(LED_DRIVER_ADDR_3);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_4
|
||||
IS31FL3731_init(LED_DRIVER_ADDR_4);
|
||||
#endif
|
||||
#else
|
||||
#ifdef LED_DRIVER_ADDR_1
|
||||
IS31FL3733_init(LED_DRIVER_ADDR_1, 0 );
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_2
|
||||
IS31FL3733_init(LED_DRIVER_ADDR_2, 0 );
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_3
|
||||
IS31FL3733_init(LED_DRIVER_ADDR_3, 0 );
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_4
|
||||
IS31FL3733_init(LED_DRIVER_ADDR_4, 0 );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int index = 0; index < LED_DRIVER_LED_COUNT; index++) {
|
||||
#ifdef IS31FL3731
|
||||
IS31FL3731_set_led_control_register(index, true);
|
||||
#else
|
||||
IS31FL3733_set_led_control_register(index, true);
|
||||
#endif
|
||||
}
|
||||
// This actually updates the LED drivers
|
||||
#ifdef IS31FL3731
|
||||
#ifdef LED_DRIVER_ADDR_1
|
||||
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_2
|
||||
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_2, 1);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_3
|
||||
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_3, 2);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_4
|
||||
IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_4, 3);
|
||||
#endif
|
||||
#else
|
||||
#ifdef LED_DRIVER_ADDR_1
|
||||
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_1, 0);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_2
|
||||
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_2, 1);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_3
|
||||
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_3, 2);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_4
|
||||
IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_4, 3);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void flush(void) {
|
||||
#ifdef IS31FL3731
|
||||
#ifdef LED_DRIVER_ADDR_1
|
||||
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_2
|
||||
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_2, 1);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_3
|
||||
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_3, 2);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_4
|
||||
IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_4, 3);
|
||||
#endif
|
||||
#else
|
||||
#ifdef LED_DRIVER_ADDR_1
|
||||
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_1, 0);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_2
|
||||
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_2, 1);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_3
|
||||
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_3, 2);
|
||||
#endif
|
||||
#ifdef LED_DRIVER_ADDR_4
|
||||
IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_4, 3);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
const led_matrix_driver_t led_matrix_driver = {
|
||||
.init = init,
|
||||
.flush = flush,
|
||||
#ifdef IS31FL3731
|
||||
.set_value = IS31FL3731_set_value,
|
||||
.set_value_all = IS31FL3731_set_value_all,
|
||||
#else
|
||||
.set_value = IS31FL3733_set_value,
|
||||
.set_value_all = IS31FL3733_set_value_all,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -19,38 +19,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#ifdef USE_CIE1931_CURVE
|
||||
// Lightness curve using the CIE 1931 lightness formula
|
||||
//Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm
|
||||
const uint8_t CIE1931_CURVE[] PROGMEM = {
|
||||
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 4, 4, 4, 4, 4, 4, 5, 5, 5,
|
||||
5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
|
||||
7, 8, 8, 8, 8, 9, 9, 9, 10, 10,
|
||||
10, 10, 11, 11, 11, 12, 12, 12, 13, 13,
|
||||
13, 14, 14, 15, 15, 15, 16, 16, 17, 17,
|
||||
17, 18, 18, 19, 19, 20, 20, 21, 21, 22,
|
||||
22, 23, 23, 24, 24, 25, 25, 26, 26, 27,
|
||||
28, 28, 29, 29, 30, 31, 31, 32, 32, 33,
|
||||
34, 34, 35, 36, 37, 37, 38, 39, 39, 40,
|
||||
41, 42, 43, 43, 44, 45, 46, 47, 47, 48,
|
||||
49, 50, 51, 52, 53, 54, 54, 55, 56, 57,
|
||||
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
|
||||
68, 70, 71, 72, 73, 74, 75, 76, 77, 79,
|
||||
80, 81, 82, 83, 85, 86, 87, 88, 90, 91,
|
||||
92, 94, 95, 96, 98, 99, 100, 102, 103, 105,
|
||||
106, 108, 109, 110, 112, 113, 115, 116, 118, 120,
|
||||
121, 123, 124, 126, 128, 129, 131, 132, 134, 136,
|
||||
138, 139, 141, 143, 145, 146, 148, 150, 152, 154,
|
||||
155, 157, 159, 161, 163, 165, 167, 169, 171, 173,
|
||||
175, 177, 179, 181, 183, 185, 187, 189, 191, 193,
|
||||
196, 198, 200, 202, 204, 207, 209, 211, 214, 216,
|
||||
218, 220, 223, 225, 228, 230, 232, 235, 237, 240,
|
||||
242, 245, 247, 250, 252, 255,
|
||||
};
|
||||
const uint8_t CIE1931_CURVE[256] PROGMEM = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
|
||||
3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6,
|
||||
6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11,
|
||||
11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16,
|
||||
17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24,
|
||||
25, 25, 26, 26, 27, 28, 28, 29, 29, 30, 31, 31, 32, 33, 33, 34,
|
||||
35, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 43, 44, 44, 45, 46,
|
||||
47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
|
||||
62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78,
|
||||
79, 80, 82, 83, 84, 85, 87, 88, 89, 90, 92, 93, 94, 96, 97, 99,
|
||||
100, 101, 103, 104, 106, 107, 108, 110, 111, 113, 114, 116, 118, 119, 121, 122,
|
||||
124, 125, 127, 129, 130, 132, 134, 135, 137, 139, 141, 142, 144, 146, 148, 149,
|
||||
151, 153, 155, 157, 159, 161, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180,
|
||||
182, 185, 187, 189, 191, 193, 195, 197, 200, 202, 204, 206, 208, 211, 213, 215,
|
||||
218, 220, 222, 225, 227, 230, 232, 234, 237, 239, 242, 244, 247, 249, 252, 255
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef USE_LED_BREATHING_TABLE
|
||||
const uint8_t LED_BREATHING_TABLE[] PROGMEM = {
|
||||
const uint8_t LED_BREATHING_TABLE[256] PROGMEM = {
|
||||
0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9,
|
||||
10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35,
|
||||
37, 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76,
|
||||
|
|
|
|||
129
quantum/ledmatrix.h
Normal file
129
quantum/ledmatrix.h
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/* Copyright 2017 Jason Williams
|
||||
* Copyright 2017 Jack Humbert
|
||||
* Copyright 2018 Yiancar
|
||||
* Copyright 2019 Clueboard
|
||||
*
|
||||
* 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 LED_MATRIX_H
|
||||
#define LED_MATRIX_H
|
||||
|
||||
|
||||
#ifndef BACKLIGHT_ENABLE
|
||||
#error You must define BACKLIGHT_ENABLE with LED_MATRIX_ENABLE
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct Point {
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
} __attribute__((packed)) Point;
|
||||
|
||||
typedef struct led_matrix {
|
||||
union {
|
||||
uint8_t raw;
|
||||
struct {
|
||||
uint8_t row:4; // 16 max
|
||||
uint8_t col:4; // 16 max
|
||||
};
|
||||
} matrix_co;
|
||||
Point point;
|
||||
uint8_t modifier:1;
|
||||
} __attribute__((packed)) led_matrix;
|
||||
|
||||
extern const led_matrix g_leds[LED_DRIVER_LED_COUNT];
|
||||
|
||||
typedef struct {
|
||||
uint8_t index;
|
||||
uint8_t value;
|
||||
} led_indicator;
|
||||
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
struct {
|
||||
bool enable :1;
|
||||
uint8_t mode :6;
|
||||
uint8_t hue :8; // Unused by led_matrix
|
||||
uint8_t sat :8; // Unused by led_matrix
|
||||
uint8_t val :8;
|
||||
uint8_t speed :8;//EECONFIG needs to be increased to support this
|
||||
};
|
||||
} led_config_t;
|
||||
|
||||
enum led_matrix_effects {
|
||||
LED_MATRIX_UNIFORM_BRIGHTNESS = 1,
|
||||
// All new effects go above this line
|
||||
LED_MATRIX_EFFECT_MAX
|
||||
};
|
||||
|
||||
void led_matrix_set_index_value(int index, uint8_t value);
|
||||
void led_matrix_set_index_value_all(uint8_t value);
|
||||
|
||||
// This runs after another backlight effect and replaces
|
||||
// colors already set
|
||||
void led_matrix_indicators(void);
|
||||
void led_matrix_indicators_kb(void);
|
||||
void led_matrix_indicators_user(void);
|
||||
|
||||
void led_matrix_init(void);
|
||||
void led_matrix_setup_drivers(void);
|
||||
|
||||
void led_matrix_set_suspend_state(bool state);
|
||||
void led_matrix_set_indicator_state(uint8_t state);
|
||||
|
||||
void led_matrix_task(void);
|
||||
|
||||
// This should not be called from an interrupt
|
||||
// (eg. from a timer interrupt).
|
||||
// Call this while idle (in between matrix scans).
|
||||
// If the buffer is dirty, it will update the driver with the buffer.
|
||||
void led_matrix_update_pwm_buffers(void);
|
||||
|
||||
bool process_led_matrix(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
uint32_t led_matrix_get_tick(void);
|
||||
|
||||
void led_matrix_toggle(void);
|
||||
void led_matrix_enable(void);
|
||||
void led_matrix_enable_noeeprom(void);
|
||||
void led_matrix_disable(void);
|
||||
void led_matrix_disable_noeeprom(void);
|
||||
void led_matrix_step(void);
|
||||
void led_matrix_step_reverse(void);
|
||||
void led_matrix_increase_val(void);
|
||||
void led_matrix_decrease_val(void);
|
||||
void led_matrix_increase_speed(void);
|
||||
void led_matrix_decrease_speed(void);
|
||||
void led_matrix_mode(uint8_t mode, bool eeprom_write);
|
||||
void led_matrix_mode_noeeprom(uint8_t mode);
|
||||
uint8_t led_matrix_get_mode(void);
|
||||
void led_matrix_set_value(uint8_t mode);
|
||||
void led_matrix_set_value_noeeprom(uint8_t mode);
|
||||
|
||||
typedef struct {
|
||||
/* Perform any initialisation required for the other driver functions to work. */
|
||||
void (*init)(void);
|
||||
|
||||
/* Set the brightness of a single LED in the buffer. */
|
||||
void (*set_value)(int index, uint8_t value);
|
||||
/* Set the brightness of all LEDS on the keyboard in the buffer. */
|
||||
void (*set_value_all)(uint8_t value);
|
||||
/* Flush any buffered changes to the hardware. */
|
||||
void (*flush)(void);
|
||||
} led_matrix_driver_t;
|
||||
|
||||
extern const led_matrix_driver_t led_matrix_driver;
|
||||
|
||||
#endif
|
||||
295
quantum/matrix.c
295
quantum/matrix.c
|
|
@ -21,21 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
#include "timer.h"
|
||||
#include "debounce.h"
|
||||
#include "quantum.h"
|
||||
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
|
||||
#ifndef DEBOUNCING_DELAY
|
||||
# define DEBOUNCING_DELAY 5
|
||||
#endif
|
||||
|
||||
#if (DEBOUNCING_DELAY > 0)
|
||||
static uint16_t debouncing_time;
|
||||
static bool debouncing = false;
|
||||
#endif
|
||||
|
||||
#if (MATRIX_COLS <= 8)
|
||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
|
||||
|
|
@ -57,30 +45,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
extern const matrix_row_t matrix_mask[];
|
||||
#endif
|
||||
|
||||
#if (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
|
||||
#ifdef DIRECT_PINS
|
||||
static pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
|
||||
#elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
|
||||
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) */
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
|
||||
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
static void init_cols(void);
|
||||
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
|
||||
static void unselect_rows(void);
|
||||
static void select_row(uint8_t row);
|
||||
static void unselect_row(uint8_t row);
|
||||
#elif (DIODE_DIRECTION == ROW2COL)
|
||||
static void init_rows(void);
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
|
||||
static void unselect_cols(void);
|
||||
static void unselect_col(uint8_t col);
|
||||
static void select_col(uint8_t col);
|
||||
#endif
|
||||
static matrix_row_t raw_matrix[MATRIX_ROWS]; //raw values
|
||||
static matrix_row_t matrix[MATRIX_ROWS]; //debounced values
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_quantum(void) {
|
||||
|
|
@ -120,114 +94,17 @@ uint8_t matrix_cols(void) {
|
|||
return MATRIX_COLS;
|
||||
}
|
||||
|
||||
// void matrix_power_up(void) {
|
||||
// #if (DIODE_DIRECTION == COL2ROW)
|
||||
// for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
|
||||
// /* DDRxn */
|
||||
// _SFR_IO8((row_pins[r] >> 4) + 1) |= _BV(row_pins[r] & 0xF);
|
||||
// toggle_row(r);
|
||||
// }
|
||||
// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
|
||||
// /* PORTxn */
|
||||
// _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF);
|
||||
// }
|
||||
// #elif (DIODE_DIRECTION == ROW2COL)
|
||||
// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
|
||||
// /* DDRxn */
|
||||
// _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF);
|
||||
// toggle_col(c);
|
||||
// }
|
||||
// for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
|
||||
// /* PORTxn */
|
||||
// _SFR_IO8((row_pins[r] >> 4) + 2) |= _BV(row_pins[r] & 0xF);
|
||||
// }
|
||||
// #endif
|
||||
// }
|
||||
|
||||
void matrix_init(void) {
|
||||
|
||||
// initialize row and col
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
unselect_rows();
|
||||
init_cols();
|
||||
#elif (DIODE_DIRECTION == ROW2COL)
|
||||
unselect_cols();
|
||||
init_rows();
|
||||
#endif
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = 0;
|
||||
matrix_debouncing[i] = 0;
|
||||
}
|
||||
|
||||
matrix_init_quantum();
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
|
||||
// Set row, read cols
|
||||
for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
|
||||
# if (DEBOUNCING_DELAY > 0)
|
||||
bool matrix_changed = read_cols_on_row(matrix_debouncing, current_row);
|
||||
|
||||
if (matrix_changed) {
|
||||
debouncing = true;
|
||||
debouncing_time = timer_read();
|
||||
}
|
||||
|
||||
# else
|
||||
read_cols_on_row(matrix, current_row);
|
||||
# endif
|
||||
|
||||
}
|
||||
|
||||
#elif (DIODE_DIRECTION == ROW2COL)
|
||||
|
||||
// Set col, read rows
|
||||
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
||||
# if (DEBOUNCING_DELAY > 0)
|
||||
bool matrix_changed = read_rows_on_col(matrix_debouncing, current_col);
|
||||
if (matrix_changed) {
|
||||
debouncing = true;
|
||||
debouncing_time = timer_read();
|
||||
}
|
||||
# else
|
||||
read_rows_on_col(matrix, current_col);
|
||||
# endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
# if (DEBOUNCING_DELAY > 0)
|
||||
if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = matrix_debouncing[i];
|
||||
}
|
||||
debouncing = false;
|
||||
}
|
||||
# endif
|
||||
|
||||
matrix_scan_quantum();
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Deprecated.
|
||||
bool matrix_is_modified(void)
|
||||
{
|
||||
#if (DEBOUNCING_DELAY > 0)
|
||||
if (debouncing) return false;
|
||||
#endif
|
||||
if (debounce_active()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline
|
||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||
{
|
||||
return (matrix[row] & ((matrix_row_t)1<col));
|
||||
return (matrix[row] & ((matrix_row_t)1<<col));
|
||||
}
|
||||
|
||||
inline
|
||||
|
|
@ -263,14 +140,58 @@ uint8_t matrix_key_count(void)
|
|||
}
|
||||
|
||||
|
||||
#ifdef DIRECT_PINS
|
||||
|
||||
#if (DIODE_DIRECTION == COL2ROW)
|
||||
|
||||
static void init_cols(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh(col_pins[x]);
|
||||
static void init_pins(void) {
|
||||
for (int row = 0; row < MATRIX_ROWS; row++) {
|
||||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
pin_t pin = direct_pins[row][col];
|
||||
if (pin != NO_PIN) {
|
||||
setPinInputHigh(pin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
|
||||
matrix_row_t last_row_value = current_matrix[current_row];
|
||||
current_matrix[current_row] = 0;
|
||||
|
||||
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
pin_t pin = direct_pins[current_row][col_index];
|
||||
if (pin != NO_PIN) {
|
||||
current_matrix[current_row] |= readPin(pin) ? 0 : (ROW_SHIFTER << col_index);
|
||||
}
|
||||
}
|
||||
|
||||
return (last_row_value != current_matrix[current_row]);
|
||||
}
|
||||
|
||||
#elif (DIODE_DIRECTION == COL2ROW)
|
||||
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
setPinOutput(row_pins[row]);
|
||||
writePinLow(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_row(uint8_t row)
|
||||
{
|
||||
setPinInputHigh(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_rows();
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||
|
|
@ -301,33 +222,33 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
|||
return (last_row_value != current_matrix[current_row]);
|
||||
}
|
||||
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
setPinOutput(row_pins[row]);
|
||||
writePinLow(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_row(uint8_t row)
|
||||
{
|
||||
setPinInputHigh(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInput(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
#elif (DIODE_DIRECTION == ROW2COL)
|
||||
|
||||
static void init_rows(void)
|
||||
static void select_col(uint8_t col)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
setPinOutput(col_pins[col]);
|
||||
writePinLow(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col)
|
||||
{
|
||||
setPinInputHigh(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_cols(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
||||
{
|
||||
bool matrix_changed = false;
|
||||
|
|
@ -368,22 +289,42 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
|||
return matrix_changed;
|
||||
}
|
||||
|
||||
static void select_col(uint8_t col)
|
||||
{
|
||||
setPinOutput(col_pins[col]);
|
||||
writePinLow(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col)
|
||||
{
|
||||
setPinInputHigh(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_cols(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void matrix_init(void) {
|
||||
|
||||
// initialize key pins
|
||||
init_pins();
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||
raw_matrix[i] = 0;
|
||||
matrix[i] = 0;
|
||||
}
|
||||
|
||||
debounce_init(MATRIX_ROWS);
|
||||
|
||||
matrix_init_quantum();
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
|
||||
// Set row, read cols
|
||||
for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
|
||||
changed |= read_cols_on_row(raw_matrix, current_row);
|
||||
}
|
||||
#elif (DIODE_DIRECTION == ROW2COL)
|
||||
// Set col, read rows
|
||||
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
||||
changed |= read_rows_on_col(raw_matrix, current_col);
|
||||
}
|
||||
#endif
|
||||
|
||||
debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
|
||||
|
||||
matrix_scan_quantum();
|
||||
return (uint8_t)changed;
|
||||
}
|
||||
|
|
|
|||
71
quantum/mcu_selection.mk
Normal file
71
quantum/mcu_selection.mk
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
|
||||
ifneq ($(findstring STM32F303, $(MCU)),)
|
||||
## chip/board settings
|
||||
# - the next two should match the directories in
|
||||
# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
|
||||
MCU_FAMILY ?= STM32
|
||||
MCU_SERIES ?= STM32F3xx
|
||||
|
||||
# Linker script to use
|
||||
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
|
||||
# or <this_dir>/ld/
|
||||
MCU_LDSCRIPT ?= STM32F303xC
|
||||
|
||||
# Startup code to use
|
||||
# - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
|
||||
MCU_STARTUP ?= stm32f3xx
|
||||
|
||||
# Board: it should exist either in <chibios>/os/hal/boards/
|
||||
# or <this_dir>/boards
|
||||
BOARD ?= GENERIC_STM32_F303XC
|
||||
|
||||
# Cortex version
|
||||
MCU = cortex-m4
|
||||
|
||||
# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
|
||||
ARMV ?= 7
|
||||
|
||||
USE_FPU = yes
|
||||
|
||||
# Vector table for application
|
||||
# 0x00000000-0x00001000 area is occupied by bootlaoder.*/
|
||||
# The CORTEX_VTOR... is needed only for MCHCK/Infinity KB
|
||||
# OPT_DEFS = -DCORTEX_VTOR_INIT=0x08005000
|
||||
|
||||
# Options to pass to dfu-util when flashing
|
||||
DFU_ARGS ?= -d 0483:df11 -a 0 -s 0x08000000:leave
|
||||
DFU_SUFFIX_ARGS = -p DF11 -v 0483
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(MCU),atmega32u4 at90usb1286))
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This will be an integer division of F_USB below, as it is sourced by
|
||||
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||
# does not *change* the processor frequency - it should merely be updated to
|
||||
# reflect the processor speed set externally so that the code can use accurate
|
||||
# software delays.
|
||||
F_CPU ?= 16000000
|
||||
|
||||
# LUFA specific
|
||||
#
|
||||
# Target architecture (see library "Board Types" documentation).
|
||||
ARCH ?= AVR8
|
||||
|
||||
# Input clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||
# at the end, this will be done automatically to create a 32-bit value in your
|
||||
# source code.
|
||||
#
|
||||
# If no clock division is performed on the input clock inside the AVR (via the
|
||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||
F_USB ?= $(F_CPU)
|
||||
endif
|
||||
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
#ifdef AUDIO_CLICKY
|
||||
|
||||
#ifndef AUDIO_CLICKY_DELAY_DURATION
|
||||
#define AUDIO_CLICKY_DELAY_DURATION 1
|
||||
#endif // !AUDIO_CLICKY_DELAY_DURATION
|
||||
#ifndef AUDIO_CLICKY_FREQ_DEFAULT
|
||||
#define AUDIO_CLICKY_FREQ_DEFAULT 440.0f
|
||||
#endif // !AUDIO_CLICKY_FREQ_DEFAULT
|
||||
|
|
@ -21,7 +24,9 @@
|
|||
|
||||
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
|
||||
|
||||
// the first "note" is an intentional delay; the 2nd and 3rd notes are the "clicky"
|
||||
float clicky_song[][2] = {{AUDIO_CLICKY_FREQ_MIN, AUDIO_CLICKY_DELAY_DURATION}, {AUDIO_CLICKY_FREQ_DEFAULT, 3}, {AUDIO_CLICKY_FREQ_DEFAULT, 1}}; // 3 and 1 --> durations
|
||||
|
||||
extern audio_config_t audio_config;
|
||||
|
||||
|
|
@ -32,10 +37,10 @@ extern bool midi_activated;
|
|||
|
||||
void clicky_play(void) {
|
||||
#ifndef NO_MUSIC_MODE
|
||||
if (music_activated || midi_activated) return;
|
||||
if (music_activated || midi_activated || !audio_config.enable) return;
|
||||
#endif // !NO_MUSIC_MODE
|
||||
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)) ) );
|
||||
clicky_song[1][0] = 2.0f * clicky_freq * (1.0f + clicky_rand * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
|
||||
clicky_song[2][0] = clicky_freq * (1.0f + clicky_rand * ( ((float)rand()) / ((float)(RAND_MAX)) ) );
|
||||
PLAY_SONG(clicky_song);
|
||||
}
|
||||
|
||||
|
|
@ -73,27 +78,29 @@ void clicky_off(void) {
|
|||
}
|
||||
|
||||
bool is_clicky_on(void) {
|
||||
return (audio_config.clicky_enable != 0);
|
||||
return (audio_config.clicky_enable != 0);
|
||||
}
|
||||
|
||||
bool process_clicky(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode == CLICKY_TOGGLE && record->event.pressed) { clicky_toggle(); }
|
||||
if (keycode == CLICKY_TOGGLE && record->event.pressed) { clicky_toggle(); }
|
||||
|
||||
if (keycode == CLICKY_ENABLE && record->event.pressed) { clicky_on(); }
|
||||
if (keycode == CLICKY_DISABLE && record->event.pressed) { clicky_off(); }
|
||||
if (keycode == CLICKY_ENABLE && record->event.pressed) { clicky_on(); }
|
||||
if (keycode == CLICKY_DISABLE && record->event.pressed) { clicky_off(); }
|
||||
|
||||
if (keycode == CLICKY_RESET && record->event.pressed) { clicky_freq_reset(); }
|
||||
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 (keycode == CLICKY_UP && record->event.pressed) { clicky_freq_up(); }
|
||||
if (keycode == CLICKY_DOWN && record->event.pressed) { clicky_freq_down(); }
|
||||
|
||||
|
||||
if ( audio_config.clicky_enable ) {
|
||||
if (record->event.pressed) {
|
||||
clicky_play();;
|
||||
if (audio_config.enable && audio_config.clicky_enable) {
|
||||
if (record->event.pressed) { // Leave this separate so it's easier to add upstroke sound
|
||||
if (keycode != AU_OFF && keycode != AU_TOG) { // DO NOT PLAY if audio will be disabled, and causes issuse on ARM
|
||||
clicky_play();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif //AUDIO_CLICKY
|
||||
|
|
|
|||
|
|
@ -14,141 +14,205 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "process_combo.h"
|
||||
#include "print.h"
|
||||
#include "process_combo.h"
|
||||
|
||||
|
||||
#define COMBO_TIMER_ELAPSED -1
|
||||
|
||||
|
||||
__attribute__ ((weak))
|
||||
combo_t key_combos[COMBO_COUNT] = {
|
||||
__attribute__((weak)) combo_t key_combos[COMBO_COUNT] = {
|
||||
|
||||
};
|
||||
|
||||
__attribute__ ((weak))
|
||||
void process_combo_event(uint8_t combo_index, bool pressed) {
|
||||
|
||||
}
|
||||
__attribute__((weak)) void process_combo_event(uint8_t combo_index,
|
||||
bool pressed) {}
|
||||
|
||||
static uint16_t timer = 0;
|
||||
static uint8_t current_combo_index = 0;
|
||||
static bool drop_buffer = false;
|
||||
static bool is_active = false;
|
||||
static bool b_combo_enable = true; // defaults to enabled
|
||||
|
||||
static inline void send_combo(uint16_t action, bool pressed)
|
||||
{
|
||||
if (action) {
|
||||
if (pressed) {
|
||||
register_code16(action);
|
||||
} else {
|
||||
unregister_code16(action);
|
||||
}
|
||||
static uint8_t buffer_size = 0;
|
||||
#ifdef COMBO_ALLOW_ACTION_KEYS
|
||||
static keyrecord_t key_buffer[MAX_COMBO_LENGTH];
|
||||
#else
|
||||
static uint16_t key_buffer[MAX_COMBO_LENGTH];
|
||||
#endif
|
||||
|
||||
static inline void send_combo(uint16_t action, bool pressed) {
|
||||
if (action) {
|
||||
if (pressed) {
|
||||
register_code16(action);
|
||||
} else {
|
||||
process_combo_event(current_combo_index, pressed);
|
||||
unregister_code16(action);
|
||||
}
|
||||
} else {
|
||||
process_combo_event(current_combo_index, pressed);
|
||||
}
|
||||
}
|
||||
|
||||
#define ALL_COMBO_KEYS_ARE_DOWN (((1<<count)-1) == combo->state)
|
||||
#define NO_COMBO_KEYS_ARE_DOWN (0 == combo->state)
|
||||
#define KEY_STATE_DOWN(key) do{ combo->state |= (1<<key); } while(0)
|
||||
#define KEY_STATE_UP(key) do{ combo->state &= ~(1<<key); } while(0)
|
||||
static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
uint8_t index = -1;
|
||||
/* Find index of keycode and number of combo keys */
|
||||
for (const uint16_t *keys = combo->keys; ;++count) {
|
||||
uint16_t key = pgm_read_word(&keys[count]);
|
||||
if (keycode == key) index = count;
|
||||
if (COMBO_END == key) break;
|
||||
}
|
||||
static inline void dump_key_buffer(bool emit) {
|
||||
if (buffer_size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Return if not a combo key */
|
||||
if (-1 == (int8_t)index) return false;
|
||||
|
||||
/* The combos timer is used to signal whether the combo is active */
|
||||
bool is_combo_active = COMBO_TIMER_ELAPSED == combo->timer ? false : true;
|
||||
|
||||
if (record->event.pressed) {
|
||||
KEY_STATE_DOWN(index);
|
||||
|
||||
if (is_combo_active) {
|
||||
if (ALL_COMBO_KEYS_ARE_DOWN) { /* Combo was pressed */
|
||||
send_combo(combo->keycode, true);
|
||||
combo->timer = COMBO_TIMER_ELAPSED;
|
||||
} else { /* Combo key was pressed */
|
||||
combo->timer = timer_read();
|
||||
if (emit) {
|
||||
for (uint8_t i = 0; i < buffer_size; i++) {
|
||||
#ifdef COMBO_ALLOW_ACTION_KEYS
|
||||
combo->prev_record = *record;
|
||||
const action_t action = store_or_get_action(key_buffer[i].event.pressed,
|
||||
key_buffer[i].event.key);
|
||||
process_action(&(key_buffer[i]), action);
|
||||
#else
|
||||
combo->prev_key = keycode;
|
||||
register_code16(key_buffer[i]);
|
||||
send_keyboard_report();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer_size = 0;
|
||||
}
|
||||
|
||||
#define ALL_COMBO_KEYS_ARE_DOWN (((1 << count) - 1) == combo->state)
|
||||
#define KEY_STATE_DOWN(key) \
|
||||
do { \
|
||||
combo->state |= (1 << key); \
|
||||
} while (0)
|
||||
#define KEY_STATE_UP(key) \
|
||||
do { \
|
||||
combo->state &= ~(1 << key); \
|
||||
} while (0)
|
||||
|
||||
static bool process_single_combo(combo_t *combo, uint16_t keycode,
|
||||
keyrecord_t *record) {
|
||||
uint8_t count = 0;
|
||||
uint8_t index = -1;
|
||||
/* Find index of keycode and number of combo keys */
|
||||
for (const uint16_t *keys = combo->keys;; ++count) {
|
||||
uint16_t key = pgm_read_word(&keys[count]);
|
||||
if (keycode == key)
|
||||
index = count;
|
||||
if (COMBO_END == key)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Continue processing if not a combo key */
|
||||
if (-1 == (int8_t)index)
|
||||
return false;
|
||||
|
||||
bool is_combo_active = is_active;
|
||||
|
||||
if (record->event.pressed) {
|
||||
KEY_STATE_DOWN(index);
|
||||
|
||||
if (is_combo_active) {
|
||||
if (ALL_COMBO_KEYS_ARE_DOWN) { /* Combo was pressed */
|
||||
send_combo(combo->keycode, true);
|
||||
drop_buffer = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ALL_COMBO_KEYS_ARE_DOWN) { /* Combo was released */
|
||||
send_combo(combo->keycode, false);
|
||||
} else {
|
||||
if (ALL_COMBO_KEYS_ARE_DOWN) { /* Combo was released */
|
||||
send_combo(combo->keycode, false);
|
||||
}
|
||||
/* continue processing without immediately returning */
|
||||
is_combo_active = false;
|
||||
}
|
||||
|
||||
if (is_combo_active) { /* Combo key was tapped */
|
||||
KEY_STATE_UP(index);
|
||||
}
|
||||
|
||||
return is_combo_active;
|
||||
}
|
||||
|
||||
#define NO_COMBO_KEYS_ARE_DOWN (0 == combo->state)
|
||||
|
||||
bool process_combo(uint16_t keycode, keyrecord_t *record) {
|
||||
bool is_combo_key = false;
|
||||
drop_buffer = false;
|
||||
bool no_combo_keys_pressed = true;
|
||||
|
||||
if (keycode == CMB_ON && record->event.pressed) {
|
||||
combo_enable();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (keycode == CMB_OFF && record->event.pressed) {
|
||||
combo_disable();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (keycode == CMB_TOG && record->event.pressed) {
|
||||
combo_toggle();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!is_combo_enabled()) { return true; }
|
||||
|
||||
for (current_combo_index = 0; current_combo_index < COMBO_COUNT;
|
||||
++current_combo_index) {
|
||||
combo_t *combo = &key_combos[current_combo_index];
|
||||
is_combo_key |= process_single_combo(combo, keycode, record);
|
||||
no_combo_keys_pressed = no_combo_keys_pressed && NO_COMBO_KEYS_ARE_DOWN;
|
||||
}
|
||||
|
||||
if (drop_buffer) {
|
||||
/* buffer is only dropped when we complete a combo, so we refresh the timer
|
||||
* here */
|
||||
timer = timer_read();
|
||||
dump_key_buffer(false);
|
||||
} else if (!is_combo_key) {
|
||||
/* if no combos claim the key we need to emit the keybuffer */
|
||||
dump_key_buffer(true);
|
||||
|
||||
// reset state if there are no combo keys pressed at all
|
||||
if (no_combo_keys_pressed) {
|
||||
timer = 0;
|
||||
is_active = true;
|
||||
}
|
||||
} else if (record->event.pressed && is_active) {
|
||||
/* otherwise the key is consumed and placed in the buffer */
|
||||
timer = timer_read();
|
||||
|
||||
if (buffer_size < MAX_COMBO_LENGTH) {
|
||||
#ifdef COMBO_ALLOW_ACTION_KEYS
|
||||
record->event.pressed = true;
|
||||
process_action(record, store_or_get_action(record->event.pressed, record->event.key));
|
||||
record->event.pressed = false;
|
||||
process_action(record, store_or_get_action(record->event.pressed, record->event.key));
|
||||
key_buffer[buffer_size++] = *record;
|
||||
#else
|
||||
register_code16(keycode);
|
||||
send_keyboard_report();
|
||||
unregister_code16(keycode);
|
||||
key_buffer[buffer_size++] = keycode;
|
||||
#endif
|
||||
combo->timer = 0;
|
||||
}
|
||||
|
||||
KEY_STATE_UP(index);
|
||||
}
|
||||
}
|
||||
|
||||
if (NO_COMBO_KEYS_ARE_DOWN) {
|
||||
combo->timer = 0;
|
||||
}
|
||||
|
||||
return is_combo_active;
|
||||
return !is_combo_key;
|
||||
}
|
||||
|
||||
bool process_combo(uint16_t keycode, keyrecord_t *record)
|
||||
{
|
||||
bool is_combo_key = false;
|
||||
void matrix_scan_combo(void) {
|
||||
if (b_combo_enable && is_active && timer && timer_elapsed(timer) > COMBO_TERM) {
|
||||
|
||||
for (current_combo_index = 0; current_combo_index < COMBO_COUNT; ++current_combo_index) {
|
||||
combo_t *combo = &key_combos[current_combo_index];
|
||||
is_combo_key |= process_single_combo(combo, keycode, record);
|
||||
}
|
||||
|
||||
return !is_combo_key;
|
||||
/* This disables the combo, meaning key events for this
|
||||
* combo will be handled by the next processors in the chain
|
||||
*/
|
||||
is_active = false;
|
||||
dump_key_buffer(true);
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_scan_combo(void)
|
||||
{
|
||||
for (int i = 0; i < COMBO_COUNT; ++i) {
|
||||
// Do not treat the (weak) key_combos too strict.
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
combo_t *combo = &key_combos[i];
|
||||
#pragma GCC diagnostic pop
|
||||
if (combo->timer &&
|
||||
combo->timer != COMBO_TIMER_ELAPSED &&
|
||||
timer_elapsed(combo->timer) > COMBO_TERM) {
|
||||
|
||||
/* This disables the combo, meaning key events for this
|
||||
* combo will be handled by the next processors in the chain
|
||||
*/
|
||||
combo->timer = COMBO_TIMER_ELAPSED;
|
||||
void combo_enable(void) {
|
||||
b_combo_enable = true;
|
||||
}
|
||||
|
||||
#ifdef COMBO_ALLOW_ACTION_KEYS
|
||||
process_action(&combo->prev_record,
|
||||
store_or_get_action(combo->prev_record.event.pressed,
|
||||
combo->prev_record.event.key));
|
||||
#else
|
||||
unregister_code16(combo->prev_key);
|
||||
register_code16(combo->prev_key);
|
||||
#endif
|
||||
}
|
||||
void combo_disable(void) {
|
||||
b_combo_enable = is_active = false;
|
||||
timer = 0;
|
||||
dump_key_buffer(true);
|
||||
|
||||
}
|
||||
|
||||
void combo_toggle(void) {
|
||||
if (b_combo_enable) {
|
||||
combo_disable();
|
||||
} else {
|
||||
combo_enable();
|
||||
}
|
||||
}
|
||||
|
||||
bool is_combo_enabled(void) {
|
||||
return b_combo_enable;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,32 +17,34 @@
|
|||
#ifndef PROCESS_COMBO_H
|
||||
#define PROCESS_COMBO_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "progmem.h"
|
||||
#include "quantum.h"
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const uint16_t *keys;
|
||||
uint16_t keycode;
|
||||
#ifdef EXTRA_EXTRA_LONG_COMBOS
|
||||
uint32_t state;
|
||||
#define MAX_COMBO_LENGTH 32
|
||||
#elif EXTRA_LONG_COMBOS
|
||||
uint16_t state;
|
||||
#define MAX_COMBO_LENGTH 16
|
||||
#else
|
||||
uint8_t state;
|
||||
#define MAX_COMBO_LENGTH 8
|
||||
#endif
|
||||
uint16_t timer;
|
||||
#ifdef COMBO_ALLOW_ACTION_KEYS
|
||||
keyrecord_t prev_record;
|
||||
|
||||
typedef struct {
|
||||
const uint16_t *keys;
|
||||
uint16_t keycode;
|
||||
#ifdef EXTRA_EXTRA_LONG_COMBOS
|
||||
uint32_t state;
|
||||
#elif EXTRA_LONG_COMBOS
|
||||
uint16_t state;
|
||||
#else
|
||||
uint16_t prev_key;
|
||||
uint8_t state;
|
||||
#endif
|
||||
} combo_t;
|
||||
|
||||
|
||||
#define COMBO(ck, ca) {.keys = &(ck)[0], .keycode = (ca)}
|
||||
#define COMBO_ACTION(ck) {.keys = &(ck)[0]}
|
||||
#define COMBO(ck, ca) \
|
||||
{ .keys = &(ck)[0], .keycode = (ca) }
|
||||
#define COMBO_ACTION(ck) \
|
||||
{ .keys = &(ck)[0] }
|
||||
|
||||
#define COMBO_END 0
|
||||
#ifndef COMBO_COUNT
|
||||
|
|
@ -56,4 +58,9 @@ bool process_combo(uint16_t keycode, keyrecord_t *record);
|
|||
void matrix_scan_combo(void);
|
||||
void process_combo_event(uint8_t combo_index, bool pressed);
|
||||
|
||||
void combo_enable(void);
|
||||
void combo_disable(void);
|
||||
void combo_toggle(void);
|
||||
bool is_combo_enabled(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#ifdef LEADER_ENABLE
|
||||
|
||||
#include "process_leader.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifndef LEADER_TIMEOUT
|
||||
#define LEADER_TIMEOUT 300
|
||||
|
|
@ -35,25 +36,41 @@ uint16_t leader_time = 0;
|
|||
uint16_t leader_sequence[5] = {0, 0, 0, 0, 0};
|
||||
uint8_t leader_sequence_size = 0;
|
||||
|
||||
void qk_leader_start(void) {
|
||||
if (leading) { return; }
|
||||
leader_start();
|
||||
leading = true;
|
||||
leader_time = timer_read();
|
||||
leader_sequence_size = 0;
|
||||
memset(leader_sequence, 0, sizeof(leader_sequence));
|
||||
}
|
||||
|
||||
bool process_leader(uint16_t keycode, keyrecord_t *record) {
|
||||
// Leader key set-up
|
||||
if (record->event.pressed) {
|
||||
if (!leading && keycode == KC_LEAD) {
|
||||
leader_start();
|
||||
leading = true;
|
||||
leader_time = timer_read();
|
||||
leader_sequence_size = 0;
|
||||
leader_sequence[0] = 0;
|
||||
leader_sequence[1] = 0;
|
||||
leader_sequence[2] = 0;
|
||||
leader_sequence[3] = 0;
|
||||
leader_sequence[4] = 0;
|
||||
return false;
|
||||
}
|
||||
if (leading && timer_elapsed(leader_time) < LEADER_TIMEOUT) {
|
||||
leader_sequence[leader_sequence_size] = keycode;
|
||||
leader_sequence_size++;
|
||||
return false;
|
||||
if (leading) {
|
||||
if (timer_elapsed(leader_time) < LEADER_TIMEOUT) {
|
||||
#ifndef LEADER_KEY_STRICT_KEY_PROCESSING
|
||||
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
|
||||
keycode = keycode & 0xFF;
|
||||
}
|
||||
#endif // LEADER_KEY_STRICT_KEY_PROCESSING
|
||||
if ( leader_sequence_size < ( sizeof(leader_sequence) / sizeof(leader_sequence[0]) ) ) {
|
||||
leader_sequence[leader_sequence_size] = keycode;
|
||||
leader_sequence_size++;
|
||||
} else {
|
||||
leading = false;
|
||||
leader_end();
|
||||
}
|
||||
#ifdef LEADER_PER_KEY_TIMING
|
||||
leader_time = timer_read();
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (keycode == KC_LEAD) {
|
||||
qk_leader_start();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ bool process_leader(uint16_t keycode, keyrecord_t *record);
|
|||
|
||||
void leader_start(void);
|
||||
void leader_end(void);
|
||||
|
||||
void qk_leader_start(void);
|
||||
|
||||
#define SEQ_ONE_KEY(key) if (leader_sequence[0] == (key) && leader_sequence[1] == 0 && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
|
||||
#define SEQ_TWO_KEYS(key1, key2) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
|
||||
|
|
|
|||
165
quantum/process_keycode/process_space_cadet.c
Normal file
165
quantum/process_keycode/process_space_cadet.c
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
/* Copyright 2019 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
|
||||
* 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 "process_space_cadet.h"
|
||||
|
||||
#ifndef TAPPING_TERM
|
||||
#define TAPPING_TERM 200
|
||||
#endif
|
||||
|
||||
// ********** OBSOLETE DEFINES, STOP USING! (pls?) **********
|
||||
// Shift / paren setup
|
||||
#ifndef LSPO_KEY
|
||||
#define LSPO_KEY KC_9
|
||||
#endif
|
||||
#ifndef RSPC_KEY
|
||||
#define RSPC_KEY KC_0
|
||||
#endif
|
||||
|
||||
// Shift / Enter setup
|
||||
#ifndef SFTENT_KEY
|
||||
#define SFTENT_KEY KC_ENT
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_SPACE_CADET_MODIFIER
|
||||
#ifndef LSPO_MOD
|
||||
#define LSPO_MOD KC_TRNS
|
||||
#endif
|
||||
#ifndef RSPC_MOD
|
||||
#define RSPC_MOD KC_TRNS
|
||||
#endif
|
||||
#else
|
||||
#ifndef LSPO_MOD
|
||||
#define LSPO_MOD KC_LSFT
|
||||
#endif
|
||||
#ifndef RSPC_MOD
|
||||
#define RSPC_MOD KC_RSFT
|
||||
#endif
|
||||
#endif
|
||||
// **********************************************************
|
||||
|
||||
// Shift / paren setup
|
||||
#ifndef LSPO_KEYS
|
||||
#define LSPO_KEYS KC_LSFT, LSPO_MOD, LSPO_KEY
|
||||
#endif
|
||||
#ifndef RSPC_KEYS
|
||||
#define RSPC_KEYS KC_RSFT, RSPC_MOD, RSPC_KEY
|
||||
#endif
|
||||
|
||||
// Control / paren setup
|
||||
#ifndef LCPO_KEYS
|
||||
#define LCPO_KEYS KC_LCTL, KC_LSFT, KC_9
|
||||
#endif
|
||||
#ifndef RCPC_KEYS
|
||||
#define RCPC_KEYS KC_RCTL, KC_RSFT, KC_0
|
||||
#endif
|
||||
|
||||
// Alt / paren setup
|
||||
#ifndef LAPO_KEYS
|
||||
#define LAPO_KEYS KC_LALT, KC_LSFT, KC_9
|
||||
#endif
|
||||
#ifndef RAPC_KEYS
|
||||
#define RAPC_KEYS KC_RALT, KC_RSFT, KC_0
|
||||
#endif
|
||||
|
||||
// Shift / Enter setup
|
||||
#ifndef SFTENT_KEYS
|
||||
#define SFTENT_KEYS KC_RSFT, KC_TRNS, SFTENT_KEY
|
||||
#endif
|
||||
|
||||
static uint8_t sc_last = 0;
|
||||
static uint16_t sc_timer = 0;
|
||||
#ifdef SPACE_CADET_MODIFIER_CARRYOVER
|
||||
static uint8_t sc_mods = 0;
|
||||
#endif
|
||||
|
||||
void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) {
|
||||
if (record->event.pressed) {
|
||||
sc_last = holdMod;
|
||||
sc_timer = timer_read ();
|
||||
#ifdef SPACE_CADET_MODIFIER_CARRYOVER
|
||||
sc_mods = get_mods();
|
||||
#endif
|
||||
if (IS_MOD(holdMod)) {
|
||||
register_mods(MOD_BIT(holdMod));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM) {
|
||||
if (holdMod != tapMod) {
|
||||
if (IS_MOD(holdMod)) {
|
||||
unregister_mods(MOD_BIT(holdMod));
|
||||
}
|
||||
if (IS_MOD(tapMod)) {
|
||||
register_mods(MOD_BIT(tapMod));
|
||||
}
|
||||
}
|
||||
#ifdef SPACE_CADET_MODIFIER_CARRYOVER
|
||||
set_weak_mods(sc_mods);
|
||||
#endif
|
||||
tap_code(keycode);
|
||||
#ifdef SPACE_CADET_MODIFIER_CARRYOVER
|
||||
clear_weak_mods();
|
||||
#endif
|
||||
if (IS_MOD(tapMod)) {
|
||||
unregister_mods(MOD_BIT(tapMod));
|
||||
}
|
||||
} else {
|
||||
if (IS_MOD(holdMod)) {
|
||||
unregister_mods(MOD_BIT(holdMod));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool process_space_cadet(uint16_t keycode, keyrecord_t *record) {
|
||||
switch(keycode) {
|
||||
case KC_LSPO: {
|
||||
perform_space_cadet(record, LSPO_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_RSPC: {
|
||||
perform_space_cadet(record, RSPC_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_LCPO: {
|
||||
perform_space_cadet(record, LCPO_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_RCPC: {
|
||||
perform_space_cadet(record, RCPC_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_LAPO: {
|
||||
perform_space_cadet(record, LAPO_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_RAPC: {
|
||||
perform_space_cadet(record, RAPC_KEYS);
|
||||
return false;
|
||||
}
|
||||
case KC_SFTENT: {
|
||||
perform_space_cadet(record, SFTENT_KEYS);
|
||||
return false;
|
||||
}
|
||||
default: {
|
||||
if (record->event.pressed) {
|
||||
sc_last = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2018 REPLACE_WITH_YOUR_NAME
|
||||
/* Copyright 2019 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
|
||||
|
|
@ -13,26 +13,9 @@
|
|||
* 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 %KEYBOARD_UPPERCASE%_H
|
||||
#define %KEYBOARD_UPPERCASE%_H
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
/* This a shortcut to help you visually see your layout.
|
||||
*
|
||||
* The first section contains all of the arguments representing the physical
|
||||
* layout of the board and position of the keys.
|
||||
*
|
||||
* The second converts the arguments into a two-dimensional array which
|
||||
* represents the switch matrix.
|
||||
*/
|
||||
#define LAYOUT( \
|
||||
K00, K01, K02, \
|
||||
K10, K11 \
|
||||
) \
|
||||
{ \
|
||||
{ K00, K01, K02 }, \
|
||||
{ K10, KC_NO, K11 }, \
|
||||
}
|
||||
|
||||
#endif
|
||||
void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode);
|
||||
bool process_space_cadet(uint16_t keycode, keyrecord_t *record);
|
||||
|
|
@ -114,13 +114,13 @@ static void send_steno_chord(void) {
|
|||
if (send_steno_chord_user(mode, chord)) {
|
||||
switch(mode) {
|
||||
case STENO_MODE_BOLT:
|
||||
send_steno_state(BOLT_STATE_SIZE, false);
|
||||
virtser_send(0); // terminating byte
|
||||
break;
|
||||
send_steno_state(BOLT_STATE_SIZE, false);
|
||||
virtser_send(0); // terminating byte
|
||||
break;
|
||||
case STENO_MODE_GEMINI:
|
||||
chord[0] |= 0x80; // Indicate start of packet
|
||||
send_steno_state(GEMINI_STATE_SIZE, true);
|
||||
break;
|
||||
chord[0] |= 0x80; // Indicate start of packet
|
||||
send_steno_state(GEMINI_STATE_SIZE, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
steno_clear_state();
|
||||
|
|
@ -161,7 +161,7 @@ bool process_steno(uint16_t keycode, keyrecord_t *record) {
|
|||
switch (keycode) {
|
||||
case QK_STENO_BOLT:
|
||||
if (!process_steno_user(keycode, record)) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
if (IS_PRESSED(record->event)) {
|
||||
steno_set_mode(STENO_MODE_BOLT);
|
||||
|
|
@ -170,7 +170,7 @@ bool process_steno(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
case QK_STENO_GEMINI:
|
||||
if (!process_steno_user(keycode, record)) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
if (IS_PRESSED(record->event)) {
|
||||
steno_set_mode(STENO_MODE_GEMINI);
|
||||
|
|
@ -179,25 +179,27 @@ bool process_steno(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
case STN__MIN...STN__MAX:
|
||||
if (!process_steno_user(keycode, record)) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
switch(mode) {
|
||||
case STENO_MODE_BOLT:
|
||||
update_state_bolt(keycode - QK_STENO, IS_PRESSED(record->event));
|
||||
case STENO_MODE_GEMINI:
|
||||
update_state_gemini(keycode - QK_STENO, IS_PRESSED(record->event));
|
||||
case STENO_MODE_BOLT:
|
||||
update_state_bolt(keycode - QK_STENO, IS_PRESSED(record->event));
|
||||
break;
|
||||
case STENO_MODE_GEMINI:
|
||||
update_state_gemini(keycode - QK_STENO, IS_PRESSED(record->event));
|
||||
break;
|
||||
}
|
||||
// allow postprocessing hooks
|
||||
if (postprocess_steno_user(keycode, record, mode, chord, pressed)) {
|
||||
if (IS_PRESSED(record->event)) {
|
||||
++pressed;
|
||||
} else {
|
||||
--pressed;
|
||||
if (pressed <= 0) {
|
||||
pressed = 0;
|
||||
send_steno_chord();
|
||||
}
|
||||
}
|
||||
if (IS_PRESSED(record->event)) {
|
||||
++pressed;
|
||||
} else {
|
||||
--pressed;
|
||||
if (pressed <= 0) {
|
||||
pressed = 0;
|
||||
send_steno_chord();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) {
|
|||
if (keycode == action->state.keycode && keycode == last_td)
|
||||
continue;
|
||||
action->state.interrupted = true;
|
||||
action->state.interrupting_keycode = keycode;
|
||||
process_tap_dance_action_on_dance_finished (action);
|
||||
reset_tap_dance (&action->state);
|
||||
}
|
||||
|
|
@ -209,5 +210,6 @@ void reset_tap_dance (qk_tap_dance_state_t *state) {
|
|||
state->count = 0;
|
||||
state->interrupted = false;
|
||||
state->finished = false;
|
||||
state->interrupting_keycode = 0;
|
||||
last_td = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ typedef struct
|
|||
uint8_t oneshot_mods;
|
||||
uint8_t weak_mods;
|
||||
uint16_t keycode;
|
||||
uint16_t interrupting_keycode;
|
||||
uint16_t timer;
|
||||
bool interrupted;
|
||||
bool pressed;
|
||||
|
|
|
|||
|
|
@ -273,11 +273,17 @@ bool process_terminal(uint16_t keycode, keyrecord_t *record) {
|
|||
disable_terminal();
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
|
||||
keycode = keycode & 0xFF;
|
||||
}
|
||||
|
||||
if (keycode < 256) {
|
||||
uint8_t str_len;
|
||||
char char_to_add;
|
||||
switch (keycode) {
|
||||
case KC_ENTER:
|
||||
case KC_KP_ENTER:
|
||||
push_to_cmd_buffer();
|
||||
current_cmd_buffer_pos = 0;
|
||||
process_terminal_command();
|
||||
|
|
|
|||
|
|
@ -64,6 +64,10 @@ void qk_ucis_symbol_fallback (void) {
|
|||
}
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void qk_ucis_cancel(void) {
|
||||
}
|
||||
|
||||
void register_ucis(const char *hex) {
|
||||
for(int i = 0; hex[i]; i++) {
|
||||
uint8_t kc = 0;
|
||||
|
|
@ -93,7 +97,7 @@ void register_ucis(const char *hex) {
|
|||
}
|
||||
|
||||
bool process_ucis (uint16_t keycode, keyrecord_t *record) {
|
||||
unicode_input_mode_init();
|
||||
uint8_t i;
|
||||
|
||||
if (!qk_ucis_state.in_progress)
|
||||
return true;
|
||||
|
|
@ -122,7 +126,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);
|
||||
|
|
@ -130,11 +134,12 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
if (keycode == KC_ESC) {
|
||||
qk_ucis_state.in_progress = false;
|
||||
qk_ucis_cancel();
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PROCESS_UCIS_H
|
||||
#define PROCESS_UCIS_H
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
#include "process_unicode_common.h"
|
||||
|
|
@ -48,5 +47,3 @@ 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);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,18 +13,16 @@
|
|||
* 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 "process_unicode.h"
|
||||
#include "action_util.h"
|
||||
#include "eeprom.h"
|
||||
|
||||
bool process_unicode(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode > QK_UNICODE && record->event.pressed) {
|
||||
uint16_t unicode = keycode & 0x7FFF;
|
||||
unicode_input_mode_init();
|
||||
if (keycode >= QK_UNICODE && keycode <= QK_UNICODE_MAX && record->event.pressed) {
|
||||
unicode_input_start();
|
||||
register_hex(unicode);
|
||||
register_hex(keycode & 0x7FFF);
|
||||
unicode_input_finish();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,12 +13,9 @@
|
|||
* 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 PROCESS_UNICODE_H
|
||||
#define PROCESS_UNICODE_H
|
||||
|
||||
#include "quantum.h"
|
||||
#pragma once
|
||||
|
||||
#include "process_unicode_common.h"
|
||||
|
||||
bool process_unicode(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -16,98 +16,128 @@
|
|||
|
||||
#include "process_unicode_common.h"
|
||||
#include "eeprom.h"
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
static uint8_t input_mode;
|
||||
uint8_t mods;
|
||||
unicode_config_t unicode_config;
|
||||
uint8_t unicode_saved_mods;
|
||||
|
||||
void set_unicode_input_mode(uint8_t os_target) {
|
||||
input_mode = os_target;
|
||||
eeprom_update_byte(EECONFIG_UNICODEMODE, os_target);
|
||||
#if UNICODE_SELECTED_MODES != -1
|
||||
static uint8_t selected[] = { UNICODE_SELECTED_MODES };
|
||||
static uint8_t selected_count = sizeof selected / sizeof *selected;
|
||||
static uint8_t selected_index;
|
||||
#endif
|
||||
|
||||
void unicode_input_mode_init(void) {
|
||||
unicode_config.raw = eeprom_read_byte(EECONFIG_UNICODEMODE);
|
||||
#if UNICODE_SELECTED_MODES != -1
|
||||
#if UNICODE_CYCLE_PERSIST
|
||||
// Find input_mode in selected modes
|
||||
uint8_t i;
|
||||
for (i = 0; i < selected_count; i++) {
|
||||
if (selected[i] == unicode_config.input_mode) {
|
||||
selected_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == selected_count) {
|
||||
// Not found: input_mode isn't selected, change to one that is
|
||||
unicode_config.input_mode = selected[selected_index = 0];
|
||||
}
|
||||
#else
|
||||
// Always change to the first selected input mode
|
||||
unicode_config.input_mode = selected[selected_index = 0];
|
||||
#endif
|
||||
#endif
|
||||
dprintf("Unicode input mode init to: %u\n", unicode_config.input_mode);
|
||||
}
|
||||
|
||||
uint8_t get_unicode_input_mode(void) {
|
||||
return input_mode;
|
||||
return unicode_config.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;
|
||||
}
|
||||
void set_unicode_input_mode(uint8_t mode) {
|
||||
unicode_config.input_mode = mode;
|
||||
persist_unicode_input_mode();
|
||||
dprintf("Unicode input mode set to: %u\n", unicode_config.input_mode);
|
||||
}
|
||||
|
||||
void cycle_unicode_input_mode(uint8_t offset) {
|
||||
#if UNICODE_SELECTED_MODES != -1
|
||||
selected_index = (selected_index + offset) % selected_count;
|
||||
unicode_config.input_mode = selected[selected_index];
|
||||
#if UNICODE_CYCLE_PERSIST
|
||||
persist_unicode_input_mode();
|
||||
#endif
|
||||
dprintf("Unicode input mode cycle to: %u\n", unicode_config.input_mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
void persist_unicode_input_mode(void) {
|
||||
eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode);
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void unicode_input_start (void) {
|
||||
// save current mods
|
||||
mods = keyboard_report->mods;
|
||||
void unicode_input_start(void) {
|
||||
unicode_saved_mods = get_mods(); // Save current mods
|
||||
clear_mods(); // Unregister mods to start from a clean state
|
||||
|
||||
// unregister all mods to start from clean state
|
||||
if (mods & MOD_BIT(KC_LSFT)) unregister_code(KC_LSFT);
|
||||
if (mods & MOD_BIT(KC_RSFT)) unregister_code(KC_RSFT);
|
||||
if (mods & MOD_BIT(KC_LCTL)) unregister_code(KC_LCTL);
|
||||
if (mods & MOD_BIT(KC_RCTL)) unregister_code(KC_RCTL);
|
||||
if (mods & MOD_BIT(KC_LALT)) unregister_code(KC_LALT);
|
||||
if (mods & MOD_BIT(KC_RALT)) unregister_code(KC_RALT);
|
||||
if (mods & MOD_BIT(KC_LGUI)) unregister_code(KC_LGUI);
|
||||
if (mods & MOD_BIT(KC_RGUI)) unregister_code(KC_RGUI);
|
||||
|
||||
switch(input_mode) {
|
||||
switch (unicode_config.input_mode) {
|
||||
case UC_OSX:
|
||||
register_code(KC_LALT);
|
||||
break;
|
||||
case UC_OSX_RALT:
|
||||
register_code(KC_RALT);
|
||||
register_code(UNICODE_KEY_OSX);
|
||||
break;
|
||||
case UC_LNX:
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_U);
|
||||
unregister_code(KC_U);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
tap_code16(UNICODE_KEY_LNX);
|
||||
break;
|
||||
case UC_WIN:
|
||||
register_code(KC_LALT);
|
||||
register_code(KC_PPLS);
|
||||
unregister_code(KC_PPLS);
|
||||
tap_code(KC_PPLS);
|
||||
break;
|
||||
case UC_WINC:
|
||||
register_code(KC_RALT);
|
||||
unregister_code(KC_RALT);
|
||||
register_code(KC_U);
|
||||
unregister_code(KC_U);
|
||||
tap_code(UNICODE_KEY_WINC);
|
||||
tap_code(KC_U);
|
||||
break;
|
||||
}
|
||||
|
||||
wait_ms(UNICODE_TYPE_DELAY);
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void unicode_input_finish (void) {
|
||||
switch(input_mode) {
|
||||
case UC_OSX:
|
||||
case UC_WIN:
|
||||
unregister_code(KC_LALT);
|
||||
break;
|
||||
case UC_OSX_RALT:
|
||||
unregister_code(KC_RALT);
|
||||
break;
|
||||
case UC_LNX:
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
break;
|
||||
void unicode_input_finish(void) {
|
||||
switch (unicode_config.input_mode) {
|
||||
case UC_OSX:
|
||||
unregister_code(UNICODE_KEY_OSX);
|
||||
break;
|
||||
case UC_LNX:
|
||||
tap_code(KC_SPC);
|
||||
break;
|
||||
case UC_WIN:
|
||||
unregister_code(KC_LALT);
|
||||
break;
|
||||
case UC_WINC:
|
||||
tap_code(KC_ENTER);
|
||||
break;
|
||||
}
|
||||
|
||||
// reregister previously set mods
|
||||
if (mods & MOD_BIT(KC_LSFT)) register_code(KC_LSFT);
|
||||
if (mods & MOD_BIT(KC_RSFT)) register_code(KC_RSFT);
|
||||
if (mods & MOD_BIT(KC_LCTL)) register_code(KC_LCTL);
|
||||
if (mods & MOD_BIT(KC_RCTL)) register_code(KC_RCTL);
|
||||
if (mods & MOD_BIT(KC_LALT)) register_code(KC_LALT);
|
||||
if (mods & MOD_BIT(KC_RALT)) register_code(KC_RALT);
|
||||
if (mods & MOD_BIT(KC_LGUI)) register_code(KC_LGUI);
|
||||
if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI);
|
||||
set_mods(unicode_saved_mods); // Reregister previously set mods
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void unicode_input_cancel(void) {
|
||||
switch (unicode_config.input_mode) {
|
||||
case UC_OSX:
|
||||
unregister_code(UNICODE_KEY_OSX);
|
||||
break;
|
||||
case UC_LNX:
|
||||
case UC_WINC:
|
||||
tap_code(KC_ESC);
|
||||
break;
|
||||
case UC_WIN:
|
||||
unregister_code(KC_LALT);
|
||||
break;
|
||||
}
|
||||
|
||||
set_mods(unicode_saved_mods); // Reregister previously set mods
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
|
|
@ -124,13 +154,12 @@ uint16_t hex_to_keycode(uint8_t hex) {
|
|||
void register_hex(uint16_t hex) {
|
||||
for(int i = 3; i >= 0; i--) {
|
||||
uint8_t digit = ((hex >> (i*4)) & 0xF);
|
||||
register_code(hex_to_keycode(digit));
|
||||
unregister_code(hex_to_keycode(digit));
|
||||
tap_code(hex_to_keycode(digit));
|
||||
}
|
||||
}
|
||||
|
||||
void send_unicode_hex_string(const char *str) {
|
||||
if (!str) { return; } // Safety net
|
||||
if (!str) { return; }
|
||||
|
||||
while (*str) {
|
||||
// Find the next code point (token) in the string
|
||||
|
|
@ -153,3 +182,61 @@ void send_unicode_hex_string(const char *str) {
|
|||
str += n; // Move to the first ' ' (or '\0') after the current token
|
||||
}
|
||||
}
|
||||
|
||||
bool process_unicode_common(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
switch (keycode) {
|
||||
case UNICODE_MODE_FORWARD:
|
||||
cycle_unicode_input_mode(+1);
|
||||
break;
|
||||
case UNICODE_MODE_REVERSE:
|
||||
cycle_unicode_input_mode(-1);
|
||||
break;
|
||||
|
||||
case UNICODE_MODE_OSX:
|
||||
set_unicode_input_mode(UC_OSX);
|
||||
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_OSX)
|
||||
static float song_osx[][2] = UNICODE_SONG_OSX;
|
||||
PLAY_SONG(song_osx);
|
||||
#endif
|
||||
break;
|
||||
case UNICODE_MODE_LNX:
|
||||
set_unicode_input_mode(UC_LNX);
|
||||
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_LNX)
|
||||
static float song_lnx[][2] = UNICODE_SONG_LNX;
|
||||
PLAY_SONG(song_lnx);
|
||||
#endif
|
||||
break;
|
||||
case UNICODE_MODE_WIN:
|
||||
set_unicode_input_mode(UC_WIN);
|
||||
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_WIN)
|
||||
static float song_win[][2] = UNICODE_SONG_WIN;
|
||||
PLAY_SONG(song_win);
|
||||
#endif
|
||||
break;
|
||||
case UNICODE_MODE_BSD:
|
||||
set_unicode_input_mode(UC_BSD);
|
||||
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_BSD)
|
||||
static float song_bsd[][2] = UNICODE_SONG_BSD;
|
||||
PLAY_SONG(song_bsd);
|
||||
#endif
|
||||
break;
|
||||
case UNICODE_MODE_WINC:
|
||||
set_unicode_input_mode(UC_WINC);
|
||||
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_WINC)
|
||||
static float song_winc[][2] = UNICODE_SONG_WINC;
|
||||
PLAY_SONG(song_winc);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if defined(UNICODE_ENABLE)
|
||||
return process_unicode(keycode, record);
|
||||
#elif defined(UNICODEMAP_ENABLE)
|
||||
return process_unicodemap(keycode, record);
|
||||
#elif defined(UCIS_ENABLE)
|
||||
return process_ucis(keycode, record);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,35 +14,76 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PROCESS_UNICODE_COMMON_H
|
||||
#define PROCESS_UNICODE_COMMON_H
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#ifndef UNICODE_TYPE_DELAY
|
||||
#define UNICODE_TYPE_DELAY 10
|
||||
#if defined(UNICODE_ENABLE) + defined(UNICODEMAP_ENABLE) + defined(UCIS_ENABLE) > 1
|
||||
#error "Cannot enable more than one Unicode method (UNICODE, UNICODEMAP, UCIS) at the same time"
|
||||
#endif
|
||||
|
||||
__attribute__ ((unused))
|
||||
static uint8_t input_mode;
|
||||
// Keycodes used for starting Unicode input on different platforms
|
||||
#ifndef UNICODE_KEY_OSX
|
||||
#define UNICODE_KEY_OSX KC_LALT
|
||||
#endif
|
||||
#ifndef UNICODE_KEY_LNX
|
||||
#define UNICODE_KEY_LNX LCTL(LSFT(KC_U))
|
||||
#endif
|
||||
#ifndef UNICODE_KEY_WINC
|
||||
#define UNICODE_KEY_WINC KC_RALT
|
||||
#endif
|
||||
|
||||
// Comma-delimited, ordered list of input modes selected for use (e.g. in cycle)
|
||||
// Example: #define UNICODE_SELECTED_MODES UC_WINC, UC_LNX
|
||||
#ifndef UNICODE_SELECTED_MODES
|
||||
#define UNICODE_SELECTED_MODES -1
|
||||
#endif
|
||||
|
||||
// Whether input mode changes in cycle should be written to EEPROM
|
||||
#ifndef UNICODE_CYCLE_PERSIST
|
||||
#define UNICODE_CYCLE_PERSIST true
|
||||
#endif
|
||||
|
||||
// Delay between starting Unicode input and sending a sequence, in ms
|
||||
#ifndef UNICODE_TYPE_DELAY
|
||||
#define UNICODE_TYPE_DELAY 10
|
||||
#endif
|
||||
|
||||
enum unicode_input_modes {
|
||||
UC_OSX, // Mac OS X using Unicode Hex Input
|
||||
UC_LNX, // Linux using IBus
|
||||
UC_WIN, // Windows using EnableHexNumpad
|
||||
UC_BSD, // BSD (not implemented)
|
||||
UC_WINC, // Windows using WinCompose (https://github.com/samhocevar/wincompose)
|
||||
UC__COUNT // Number of available input modes (always leave at the end)
|
||||
};
|
||||
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
struct {
|
||||
uint8_t input_mode : 8;
|
||||
};
|
||||
} unicode_config_t;
|
||||
|
||||
extern unicode_config_t unicode_config;
|
||||
extern uint8_t unicode_saved_mods;
|
||||
|
||||
void set_unicode_input_mode(uint8_t os_target);
|
||||
uint8_t get_unicode_input_mode(void);
|
||||
void unicode_input_mode_init(void);
|
||||
uint8_t get_unicode_input_mode(void);
|
||||
void set_unicode_input_mode(uint8_t mode);
|
||||
void cycle_unicode_input_mode(uint8_t offset);
|
||||
void persist_unicode_input_mode(void);
|
||||
|
||||
void unicode_input_start(void);
|
||||
void unicode_input_finish(void);
|
||||
void unicode_input_cancel(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
|
||||
#define UC_WIN 2 // Windows 'HexNumpad'
|
||||
#define UC_BSD 3 // BSD (not implemented)
|
||||
#define UC_WINC 4 // WinCompose https://github.com/samhocevar/wincompose
|
||||
#define UC_OSX_RALT 5 // Mac OS X using Right Alt key for Unicode Compose
|
||||
bool process_unicode_common(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
#define UC_BSPC UC(0x0008)
|
||||
|
||||
#define UC_SPC UC(0x0020)
|
||||
|
||||
#define UC_EXLM UC(0x0021)
|
||||
|
|
@ -147,5 +188,3 @@ void send_unicode_hex_string(const char *str);
|
|||
#define UC_RCBR UC(0x007D)
|
||||
#define UC_TILD UC(0x007E)
|
||||
#define UC_DEL UC(0x007F)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -15,11 +15,6 @@
|
|||
*/
|
||||
|
||||
#include "process_unicodemap.h"
|
||||
#include "process_unicode_common.h"
|
||||
|
||||
__attribute__((weak))
|
||||
const uint32_t PROGMEM unicode_map[] = {
|
||||
};
|
||||
|
||||
void register_hex32(uint32_t hex) {
|
||||
bool onzerostart = true;
|
||||
|
|
@ -42,29 +37,39 @@ void register_hex32(uint32_t hex) {
|
|||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void unicode_map_input_error() {}
|
||||
uint16_t unicodemap_index(uint16_t keycode) {
|
||||
if (keycode >= QK_UNICODEMAP_PAIR) {
|
||||
// Keycode is a pair: extract index based on Shift / Caps Lock state
|
||||
uint16_t index = keycode - QK_UNICODEMAP_PAIR;
|
||||
|
||||
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;
|
||||
uint16_t index = keycode - QK_UNICODE_MAP;
|
||||
uint32_t code = pgm_read_dword(&map[index]);
|
||||
if (code > 0xFFFF && code <= 0x10ffff && (input_mode == UC_OSX || input_mode == UC_OSX_RALT)) {
|
||||
// Convert to UTF-16 surrogate pair
|
||||
bool shift = unicode_saved_mods & MOD_MASK_SHIFT, caps = IS_HOST_LED_ON(USB_LED_CAPS_LOCK);
|
||||
if (shift ^ caps) { index >>= 7; }
|
||||
|
||||
return index & 0x7F;
|
||||
} else {
|
||||
// Keycode is a regular index
|
||||
return keycode - QK_UNICODEMAP;
|
||||
}
|
||||
}
|
||||
|
||||
bool process_unicodemap(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode >= QK_UNICODEMAP && keycode <= QK_UNICODEMAP_PAIR_MAX && record->event.pressed) {
|
||||
unicode_input_start();
|
||||
|
||||
uint32_t code = pgm_read_dword(unicode_map + unicodemap_index(keycode));
|
||||
uint8_t input_mode = get_unicode_input_mode();
|
||||
|
||||
if (code > 0x10FFFF || (code > 0xFFFF && input_mode == UC_WIN)) {
|
||||
// Character is out of range supported by the platform
|
||||
unicode_input_cancel();
|
||||
} else if (code > 0xFFFF && input_mode == UC_OSX) {
|
||||
// Convert to UTF-16 surrogate pair on Mac
|
||||
code -= 0x10000;
|
||||
uint32_t lo = code & 0x3ff;
|
||||
uint32_t hi = (code & 0xffc00) >> 10;
|
||||
unicode_input_start();
|
||||
register_hex32(hi + 0xd800);
|
||||
register_hex32(lo + 0xdc00);
|
||||
uint32_t lo = code & 0x3FF, hi = (code & 0xFFC00) >> 10;
|
||||
register_hex32(hi + 0xD800);
|
||||
register_hex32(lo + 0xDC00);
|
||||
unicode_input_finish();
|
||||
} else if ((code > 0x10ffff && (input_mode == UC_OSX || input_mode == UC_OSX_RALT)) || (code > 0xFFFFF && input_mode == UC_LNX)) {
|
||||
// when character is out of range supported by the OS
|
||||
unicode_map_input_error();
|
||||
} else {
|
||||
unicode_input_start();
|
||||
register_hex32(code);
|
||||
unicode_input_finish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PROCESS_UNICODEMAP_H
|
||||
#define PROCESS_UNICODEMAP_H
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
#include "process_unicode_common.h"
|
||||
|
||||
void unicode_map_input_error(void);
|
||||
bool process_unicode_map(uint16_t keycode, keyrecord_t *record);
|
||||
#endif
|
||||
extern const uint32_t PROGMEM unicode_map[];
|
||||
|
||||
void register_hex32(uint32_t hex);
|
||||
uint16_t unicodemap_index(uint16_t keycode);
|
||||
bool process_unicodemap(uint16_t keycode, keyrecord_t *record);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -13,8 +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 QUANTUM_H
|
||||
#define QUANTUM_H
|
||||
#pragma once
|
||||
|
||||
#if defined(__AVR__)
|
||||
#include <avr/pgmspace.h>
|
||||
|
|
@ -24,27 +23,25 @@
|
|||
#if defined(PROTOCOL_CHIBIOS)
|
||||
#include "hal.h"
|
||||
#endif
|
||||
|
||||
#include "wait.h"
|
||||
#include "matrix.h"
|
||||
#include "keymap.h"
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
#include "backlight.h"
|
||||
#endif
|
||||
#if !defined(RGBLIGHT_ENABLE) && !defined(RGB_MATRIX_ENABLE)
|
||||
#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"
|
||||
#ifdef LED_MATRIX_ENABLE
|
||||
#include "ledmatrix.h"
|
||||
#else
|
||||
#include "backlight.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
#include "split_flags.h"
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
#include "rgblight.h"
|
||||
#elif defined(RGB_MATRIX_ENABLE)
|
||||
// Dummy define RGBLIGHT_MODE_xxxx
|
||||
#define RGBLIGHT_H_DUMMY_DEFINE
|
||||
#include "rgblight.h"
|
||||
#endif
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
|
|
@ -53,35 +50,33 @@
|
|||
|
||||
#include "action_layer.h"
|
||||
#include "eeconfig.h"
|
||||
#include <stddef.h>
|
||||
#include "bootloader.h"
|
||||
#include "timer.h"
|
||||
#include "config_common.h"
|
||||
#include "led.h"
|
||||
#include "action_util.h"
|
||||
#include <stdlib.h>
|
||||
#include "print.h"
|
||||
#include "send_string_keycodes.h"
|
||||
#include "suspend.h"
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern uint32_t default_layer_state;
|
||||
extern layer_state_t default_layer_state;
|
||||
|
||||
#ifndef NO_ACTION_LAYER
|
||||
extern uint32_t layer_state;
|
||||
extern layer_state_t layer_state;
|
||||
#endif
|
||||
|
||||
#ifdef MIDI_ENABLE
|
||||
#ifdef MIDI_ADVANCED
|
||||
#if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)
|
||||
#include "process_midi.h"
|
||||
#endif
|
||||
#endif // MIDI_ENABLE
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
#include "audio.h"
|
||||
#include "process_audio.h"
|
||||
#ifdef AUDIO_CLICKY
|
||||
#include "process_clicky.h"
|
||||
#endif // AUDIO_CLICKY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef STENO_ENABLE
|
||||
|
|
@ -109,7 +104,7 @@ extern uint32_t default_layer_state;
|
|||
#endif
|
||||
|
||||
#ifdef TAP_DANCE_ENABLE
|
||||
#include "process_tap_dance.h"
|
||||
#include "process_tap_dance.h"
|
||||
#endif
|
||||
|
||||
#ifdef PRINTING_ENABLE
|
||||
|
|
@ -134,62 +129,68 @@ extern uint32_t default_layer_state;
|
|||
#include "process_terminal_nop.h"
|
||||
#endif
|
||||
|
||||
#ifdef SPACE_CADET_ENABLE
|
||||
#include "process_space_cadet.h"
|
||||
#endif
|
||||
|
||||
#ifdef HD44780_ENABLE
|
||||
#include "hd44780.h"
|
||||
#endif
|
||||
|
||||
//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) PIN_ADDRESS(pin, 1) &= ~ _BV(pin & 0xF)
|
||||
#define setPinInputHigh(pin) ({\
|
||||
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) PIN_ADDRESS(pin, 1) |= _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){
|
||||
PIN_ADDRESS(pin, 2) |= _BV(pin & 0xF);
|
||||
} else {
|
||||
PIN_ADDRESS(pin, 2) &= ~_BV(pin & 0xF);
|
||||
}
|
||||
}
|
||||
|
||||
#define readPin(pin) ((PIN_ADDRESS(pin, 0) & _BV(pin & 0xF)) != 0)
|
||||
#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)
|
||||
#ifdef HAPTIC_ENABLE
|
||||
#include "haptic.h"
|
||||
#endif
|
||||
|
||||
#ifdef OLED_DRIVER_ENABLE
|
||||
#include "oled_driver.h"
|
||||
#endif
|
||||
|
||||
// Function substitutions to ease GPIO manipulation
|
||||
#if defined(__AVR__)
|
||||
typedef uint8_t pin_t;
|
||||
|
||||
#define PIN_ADDRESS(p, offset) (_SFR_IO8(ADDRESS_BASE + ((p) >> PORT_SHIFTER) + (offset)))
|
||||
#define setPinInput(pin) (PIN_ADDRESS(pin, 1) &= ~_BV((pin) & 0xF))
|
||||
#define setPinInputHigh(pin) (PIN_ADDRESS(pin, 1) &= ~_BV((pin) & 0xF), \
|
||||
PIN_ADDRESS(pin, 2) |= _BV((pin) & 0xF))
|
||||
#define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low")
|
||||
#define setPinOutput(pin) (PIN_ADDRESS(pin, 1) |= _BV((pin) & 0xF))
|
||||
|
||||
#define writePinHigh(pin) (PIN_ADDRESS(pin, 2) |= _BV((pin) & 0xF))
|
||||
#define writePinLow(pin) (PIN_ADDRESS(pin, 2) &= ~_BV((pin) & 0xF))
|
||||
#define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
|
||||
|
||||
#define readPin(pin) ((bool)(PIN_ADDRESS(pin, 0) & _BV((pin) & 0xF)))
|
||||
#elif defined(PROTOCOL_CHIBIOS)
|
||||
typedef ioline_t pin_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)
|
||||
#define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
|
||||
|
||||
#define readPin(pin) palReadLine(pin)
|
||||
#endif
|
||||
|
||||
// Send string macros
|
||||
#define STRINGIZE(z) #z
|
||||
#define ADD_SLASH_X(y) STRINGIZE(\x ## y)
|
||||
#define SYMBOL_STR(x) ADD_SLASH_X(x)
|
||||
|
||||
#define SS_TAP_CODE 1
|
||||
#define SS_DOWN_CODE 2
|
||||
#define SS_UP_CODE 3
|
||||
|
||||
#define SS_TAP(keycode) "\1" SYMBOL_STR(keycode)
|
||||
#define SS_DOWN(keycode) "\2" SYMBOL_STR(keycode)
|
||||
#define SS_UP(keycode) "\3" SYMBOL_STR(keycode)
|
||||
|
||||
// `string` arguments must not be parenthesized
|
||||
#define SS_LCTRL(string) SS_DOWN(X_LCTRL) string SS_UP(X_LCTRL)
|
||||
#define SS_LGUI(string) SS_DOWN(X_LGUI) string SS_UP(X_LGUI)
|
||||
#define SS_LCMD(string) SS_LGUI(string)
|
||||
|
|
@ -197,10 +198,14 @@ extern uint32_t default_layer_state;
|
|||
#define SS_LALT(string) SS_DOWN(X_LALT) string SS_UP(X_LALT)
|
||||
#define SS_LSFT(string) SS_DOWN(X_LSHIFT) string SS_UP(X_LSHIFT)
|
||||
#define SS_RALT(string) SS_DOWN(X_RALT) string SS_UP(X_RALT)
|
||||
#define SS_ALGR(string) SS_RALT(string)
|
||||
|
||||
#define SEND_STRING(string) send_string_P(PSTR(string))
|
||||
|
||||
extern const bool ascii_to_shift_lut[128];
|
||||
extern const bool ascii_to_altgr_lut[128];
|
||||
extern const uint8_t ascii_to_keycode_lut[128];
|
||||
|
||||
#define SEND_STRING(str) send_string_P(PSTR(str))
|
||||
extern const bool ascii_to_shift_lut[0x80];
|
||||
extern const uint8_t ascii_to_keycode_lut[0x80];
|
||||
void send_string(const char *str);
|
||||
void send_string_with_delay(const char *str, uint8_t interval);
|
||||
void send_string_P(const char *str);
|
||||
|
|
@ -222,15 +227,17 @@ void matrix_init_kb(void);
|
|||
void matrix_scan_kb(void);
|
||||
void matrix_init_user(void);
|
||||
void matrix_scan_user(void);
|
||||
uint16_t get_record_keycode(keyrecord_t *record);
|
||||
uint16_t get_event_keycode(keyevent_t event);
|
||||
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
|
||||
#define BOOTMAGIC_LITE_COLUMN 0
|
||||
#endif
|
||||
#ifndef BOOTMAGIC_LITE_ROW
|
||||
#define BOOTMAGIC_LITE_ROW 0
|
||||
#define BOOTMAGIC_LITE_ROW 0
|
||||
#endif
|
||||
|
||||
void bootmagic_lite(void);
|
||||
|
|
@ -240,14 +247,19 @@ void reset_keyboard(void);
|
|||
void startup_user(void);
|
||||
void shutdown_user(void);
|
||||
|
||||
void register_code16 (uint16_t code);
|
||||
void unregister_code16 (uint16_t code);
|
||||
void register_code16(uint16_t code);
|
||||
void unregister_code16(uint16_t code);
|
||||
void tap_code16(uint16_t code);
|
||||
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
void backlight_init_ports(void);
|
||||
void backlight_task(void);
|
||||
void backlight_task_internal(void);
|
||||
void backlight_on(uint8_t backlight_pin);
|
||||
void backlight_off(uint8_t backlight_pin);
|
||||
|
||||
#ifdef BACKLIGHT_BREATHING
|
||||
#ifdef BACKLIGHT_BREATHING
|
||||
void breathing_task(void);
|
||||
void breathing_enable(void);
|
||||
void breathing_pulse(void);
|
||||
void breathing_disable(void);
|
||||
|
|
@ -260,9 +272,9 @@ void breathing_period_default(void);
|
|||
void breathing_period_set(uint8_t value);
|
||||
void breathing_period_inc(void);
|
||||
void breathing_period_dec(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
void send_dword(uint32_t number);
|
||||
void send_word(uint16_t number);
|
||||
void send_byte(uint8_t number);
|
||||
|
|
@ -273,5 +285,3 @@ void led_set_user(uint8_t usb_led);
|
|||
void led_set_kb(uint8_t usb_led);
|
||||
|
||||
void api_send_unicode(uint32_t unicode);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -81,16 +81,15 @@ enum quantum_keycodes {
|
|||
#endif
|
||||
QK_MOD_TAP = 0x6000,
|
||||
QK_MOD_TAP_MAX = 0x7FFF,
|
||||
#if defined(UNICODEMAP_ENABLE) && defined(UNICODE_ENABLE)
|
||||
#error "Cannot enable both UNICODEMAP && UNICODE"
|
||||
#endif
|
||||
#ifdef UNICODE_ENABLE
|
||||
QK_UNICODE = 0x8000,
|
||||
QK_UNICODE_MAX = 0xFFFF,
|
||||
#endif
|
||||
#ifdef UNICODEMAP_ENABLE
|
||||
QK_UNICODE_MAP = 0x8000,
|
||||
QK_UNICODE_MAP_MAX = 0x83FF,
|
||||
QK_UNICODEMAP = 0x8000,
|
||||
QK_UNICODEMAP_MAX = 0xBFFF,
|
||||
QK_UNICODEMAP_PAIR = 0xC000,
|
||||
QK_UNICODEMAP_PAIR_MAX = 0xFFFF,
|
||||
#endif
|
||||
|
||||
// Loose keycodes - to be used directly
|
||||
|
|
@ -425,6 +424,9 @@ enum quantum_keycodes {
|
|||
RGB_MODE_GRADIENT,
|
||||
RGB_MODE_RGBTEST,
|
||||
|
||||
//Momentum matching toggle
|
||||
VLK_TOG,
|
||||
|
||||
// Left shift, open paren
|
||||
KC_LSPO,
|
||||
|
||||
|
|
@ -454,6 +456,42 @@ enum quantum_keycodes {
|
|||
TERM_OFF,
|
||||
#endif
|
||||
|
||||
EEPROM_RESET,
|
||||
|
||||
UNICODE_MODE_FORWARD,
|
||||
UNICODE_MODE_REVERSE,
|
||||
UNICODE_MODE_OSX,
|
||||
UNICODE_MODE_LNX,
|
||||
UNICODE_MODE_WIN,
|
||||
UNICODE_MODE_BSD,
|
||||
UNICODE_MODE_WINC,
|
||||
|
||||
HPT_ON,
|
||||
HPT_OFF,
|
||||
HPT_TOG,
|
||||
HPT_RST,
|
||||
HPT_FBK,
|
||||
HPT_BUZ,
|
||||
HPT_MODI,
|
||||
HPT_MODD,
|
||||
HPT_DWLI,
|
||||
HPT_DWLD,
|
||||
|
||||
// Left control, open paren
|
||||
KC_LCPO,
|
||||
|
||||
// Right control, close paren
|
||||
KC_RCPC,
|
||||
|
||||
// Left control, open paren
|
||||
KC_LAPO,
|
||||
|
||||
// Right control, close paren
|
||||
KC_RAPC,
|
||||
|
||||
CMB_ON,
|
||||
CMB_OFF,
|
||||
CMB_TOG,
|
||||
// always leave at the end
|
||||
SAFE_RANGE
|
||||
};
|
||||
|
|
@ -468,6 +506,7 @@ enum quantum_keycodes {
|
|||
#define RCTL(kc) (QK_RCTL | (kc))
|
||||
#define RSFT(kc) (QK_RSFT | (kc))
|
||||
#define RALT(kc) (QK_RALT | (kc))
|
||||
#define ALGR(kc) RALT(kc)
|
||||
#define RGUI(kc) (QK_RGUI | (kc))
|
||||
#define RCMD(kc) RGUI(kc)
|
||||
#define RWIN(kc) RGUI(kc)
|
||||
|
|
@ -475,15 +514,13 @@ enum quantum_keycodes {
|
|||
#define HYPR(kc) (QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI | (kc))
|
||||
#define MEH(kc) (QK_LCTL | QK_LSFT | QK_LALT | (kc))
|
||||
#define LCAG(kc) (QK_LCTL | QK_LALT | QK_LGUI | (kc))
|
||||
#define ALTG(kc) (QK_RCTL | QK_RALT | (kc))
|
||||
#define SGUI(kc) (QK_LGUI | QK_LSFT | (kc))
|
||||
#define SCMD(kc) SGUI(kc)
|
||||
#define SWIN(kc) SGUI(kc)
|
||||
#define LCA(kc) (QK_LCTL | QK_LALT | (kc))
|
||||
|
||||
#define MOD_HYPR 0xf
|
||||
#define MOD_MEH 0x7
|
||||
#define LCA(kc) (QK_LCTL | QK_LALT | (kc))
|
||||
|
||||
#define MOD_HYPR 0xF
|
||||
#define MOD_MEH 0x7
|
||||
|
||||
// Aliases for shifted symbols
|
||||
// Each key has a 4-letter code, and some have longer aliases too.
|
||||
|
|
@ -560,9 +597,12 @@ enum quantum_keycodes {
|
|||
#define FUNC(kc) (QK_FUNCTION | (kc))
|
||||
|
||||
// Aliases
|
||||
#define C(kc) LCTL(kc)
|
||||
#define S(kc) LSFT(kc)
|
||||
#define F(kc) FUNC(kc)
|
||||
#define A(kc) LALT(kc)
|
||||
#define G(kc) LGUI(kc)
|
||||
|
||||
#define F(kc) FUNC(kc)
|
||||
#define M(kc) (QK_MACRO | (kc))
|
||||
|
||||
#define MACROTAP(kc) (QK_MACRO | (FUNC_TAP << 8) | (kc))
|
||||
|
|
@ -570,6 +610,8 @@ enum quantum_keycodes {
|
|||
|
||||
#define KC_GESC GRAVE_ESC
|
||||
|
||||
#define EEP_RST EEPROM_RESET
|
||||
|
||||
#define CK_TOGG CLICKY_TOGGLE
|
||||
#define CK_RST CLICKY_RESET
|
||||
#define CK_UP CLICKY_UP
|
||||
|
|
@ -578,7 +620,6 @@ enum quantum_keycodes {
|
|||
#define CK_OFF CLICKY_DISABLE
|
||||
|
||||
#define RGB_MOD RGB_MODE_FORWARD
|
||||
#define RGB_SMOD RGB_MODE_FORWARD
|
||||
#define RGB_RMOD RGB_MODE_REVERSE
|
||||
|
||||
#define RGB_M_P RGB_MODE_PLAIN
|
||||
|
|
@ -592,7 +633,7 @@ enum quantum_keycodes {
|
|||
#define RGB_M_T RGB_MODE_RGBTEST
|
||||
|
||||
// L-ayer, T-ap - 256 keycode max, 16 layer max
|
||||
#define LT(layer, kc) (QK_LAYER_TAP | ((layer & 0xF) << 8) | ((kc) & 0xFF))
|
||||
#define LT(layer, kc) (QK_LAYER_TAP | (((layer) & 0xF) << 8) | ((kc) & 0xFF))
|
||||
|
||||
#define AG_SWAP MAGIC_SWAP_ALT_GUI
|
||||
#define AG_NORM MAGIC_UNSWAP_ALT_GUI
|
||||
|
|
@ -606,80 +647,88 @@ enum quantum_keycodes {
|
|||
// In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own
|
||||
// keycode modeled after the old version, kept below for this.
|
||||
/* #define TO(layer, when) (QK_TO | (when << 0x4) | (layer & 0xFF)) */
|
||||
#define TO(layer) (QK_TO | (ON_PRESS << 0x4) | (layer & 0xFF))
|
||||
#define TO(layer) (QK_TO | (ON_PRESS << 0x4) | ((layer) & 0xFF))
|
||||
|
||||
// Momentary switch layer - 256 layer max
|
||||
#define MO(layer) (QK_MOMENTARY | (layer & 0xFF))
|
||||
#define MO(layer) (QK_MOMENTARY | ((layer) & 0xFF))
|
||||
|
||||
// Set default layer - 256 layer max
|
||||
#define DF(layer) (QK_DEF_LAYER | (layer & 0xFF))
|
||||
#define DF(layer) (QK_DEF_LAYER | ((layer) & 0xFF))
|
||||
|
||||
// Toggle to layer - 256 layer max
|
||||
#define TG(layer) (QK_TOGGLE_LAYER | (layer & 0xFF))
|
||||
#define TG(layer) (QK_TOGGLE_LAYER | ((layer) & 0xFF))
|
||||
|
||||
// One-shot layer - 256 layer max
|
||||
#define OSL(layer) (QK_ONE_SHOT_LAYER | (layer & 0xFF))
|
||||
#define OSL(layer) (QK_ONE_SHOT_LAYER | ((layer) & 0xFF))
|
||||
|
||||
// L-ayer M-od: Momentary switch layer with modifiers active - 16 layer max, left mods only
|
||||
#define LM(layer, mod) (QK_LAYER_MOD | ((layer & 0xF) << 4) | ((mod) & 0xF))
|
||||
#define LM(layer, mod) (QK_LAYER_MOD | (((layer) & 0xF) << 4) | ((mod) & 0xF))
|
||||
|
||||
// One-shot mod
|
||||
#define OSM(mod) (QK_ONE_SHOT_MOD | ((mod) & 0xFF))
|
||||
|
||||
// Layer tap-toggle
|
||||
#define TT(layer) (QK_LAYER_TAP_TOGGLE | (layer & 0xFF))
|
||||
#define TT(layer) (QK_LAYER_TAP_TOGGLE | ((layer) & 0xFF))
|
||||
|
||||
// M-od, T-ap - 256 keycode max
|
||||
#define MT(mod, kc) (QK_MOD_TAP | (((mod) & 0x1F) << 8) | ((kc) & 0xFF))
|
||||
|
||||
#define CTL_T(kc) MT(MOD_LCTL, kc)
|
||||
#define LCTL_T(kc) MT(MOD_LCTL, kc)
|
||||
#define RCTL_T(kc) MT(MOD_RCTL, kc)
|
||||
#define CTL_T(kc) LCTL_T(kc)
|
||||
|
||||
#define SFT_T(kc) MT(MOD_LSFT, kc)
|
||||
#define LSFT_T(kc) MT(MOD_LSFT, kc)
|
||||
#define RSFT_T(kc) MT(MOD_RSFT, kc)
|
||||
#define SFT_T(kc) LSFT_T(kc)
|
||||
|
||||
#define ALT_T(kc) MT(MOD_LALT, kc)
|
||||
#define LALT_T(kc) MT(MOD_LALT, kc)
|
||||
#define RALT_T(kc) MT(MOD_RALT, kc)
|
||||
#define ALGR_T(kc) MT(MOD_RALT, kc) // dual-function AltGR
|
||||
#define ALT_T(kc) LALT_T(kc)
|
||||
#define ALGR_T(kc) RALT_T(kc)
|
||||
|
||||
#define GUI_T(kc) MT(MOD_LGUI, kc)
|
||||
#define CMD_T(kc) GUI_T(kc)
|
||||
#define WIN_T(kc) GUI_T(kc)
|
||||
#define LGUI_T(kc) MT(MOD_LGUI, kc)
|
||||
#define RGUI_T(kc) MT(MOD_RGUI, kc)
|
||||
#define LCMD_T(kc) LGUI_T(kc)
|
||||
#define LWIN_T(kc) LGUI_T(kc)
|
||||
#define RGUI_T(kc) MT(MOD_RGUI, kc)
|
||||
#define RCMD_T(kc) RGUI_T(kc)
|
||||
#define RWIN_T(kc) RGUI_T(kc)
|
||||
#define GUI_T(kc) LGUI_T(kc)
|
||||
#define CMD_T(kc) LCMD_T(kc)
|
||||
#define WIN_T(kc) LWIN_T(kc)
|
||||
|
||||
#define C_S_T(kc) MT(MOD_LCTL | MOD_LSFT, kc) // Control + Shift e.g. for gnome-terminal
|
||||
#define MEH_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT, kc) // Meh is a less hyper version of the Hyper key -- doesn't include Win or Cmd, so just alt+shift+ctrl
|
||||
#define LCAG_T(kc) MT(MOD_LCTL | MOD_LALT | MOD_LGUI, kc) // Left control alt and gui
|
||||
#define RCAG_T(kc) MT(MOD_RCTL | MOD_RALT | MOD_RGUI, kc) // Right control alt and gui
|
||||
#define ALL_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI, kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/
|
||||
#define SGUI_T(kc) MT(MOD_LGUI | MOD_LSFT, kc)
|
||||
#define C_S_T(kc) MT(MOD_LCTL | MOD_LSFT, kc) // Left Control + Shift e.g. for gnome-terminal
|
||||
#define MEH_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT, kc) // Meh is a less hyper version of the Hyper key -- doesn't include GUI, so just Left Control + Shift + Alt
|
||||
#define LCAG_T(kc) MT(MOD_LCTL | MOD_LALT | MOD_LGUI, kc) // Left Control + Alt + GUI
|
||||
#define RCAG_T(kc) MT(MOD_RCTL | MOD_RALT | MOD_RGUI, kc) // Right Control + Alt + GUI
|
||||
#define HYPR_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI, kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/
|
||||
#define SGUI_T(kc) MT(MOD_LGUI | MOD_LSFT, kc) // Left Shift + GUI
|
||||
#define SCMD_T(kc) SGUI_T(kc)
|
||||
#define SWIN_T(kc) SGUI_T(kc)
|
||||
#define LCA_T(kc) MT(MOD_LCTL | MOD_LALT, kc) // Left control and left alt
|
||||
#define LCA_T(kc) MT(MOD_LCTL | MOD_LALT, kc) // Left Control + Alt
|
||||
#define ALL_T(kc) HYPR_T(kc)
|
||||
|
||||
// Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap
|
||||
#define KC_HYPR HYPR(KC_NO)
|
||||
#define KC_MEH MEH(KC_NO)
|
||||
|
||||
#ifdef UNICODE_ENABLE
|
||||
// For sending unicode codes.
|
||||
// You may not send codes over 7FFF -- this supports most of UTF8.
|
||||
// To have a key that sends out Œ, go UC(0x0152)
|
||||
#define UNICODE(n) (QK_UNICODE | (n))
|
||||
#define UC(n) UNICODE(n)
|
||||
// Allows Unicode input up to 0x7FFF
|
||||
#define UC(c) (QK_UNICODE | (c))
|
||||
#endif
|
||||
#ifdef UNICODEMAP_ENABLE
|
||||
// Allows Unicode input up to 0x10FFFF, requires unicode_map
|
||||
#define X(i) (QK_UNICODEMAP | (i))
|
||||
#define XP(i, j) (QK_UNICODEMAP_PAIR | ((i) & 0x7F) | (((j) & 0x7F) << 7)) // 127 max i and j
|
||||
#endif
|
||||
|
||||
#ifdef UNICODEMAP_ENABLE
|
||||
#define X(n) (QK_UNICODE_MAP | (n))
|
||||
#endif
|
||||
#define UC_MOD UNICODE_MODE_FORWARD
|
||||
#define UC_RMOD UNICODE_MODE_REVERSE
|
||||
|
||||
#define UC_M_OS UNICODE_MODE_OSX
|
||||
#define UC_M_LN UNICODE_MODE_LNX
|
||||
#define UC_M_WI UNICODE_MODE_WIN
|
||||
#define UC_M_BS UNICODE_MODE_BSD
|
||||
#define UC_M_WC UNICODE_MODE_WINC
|
||||
|
||||
#ifdef SWAP_HANDS_ENABLE
|
||||
#define SH_T(kc) (QK_SWAP_HANDS | (kc))
|
||||
|
|
|
|||
1144
quantum/rgb_matrix.c
1144
quantum/rgb_matrix.c
File diff suppressed because it is too large
Load diff
|
|
@ -21,78 +21,77 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "rgb_matrix_types.h"
|
||||
#include "color.h"
|
||||
#include "quantum.h"
|
||||
#include "rgblight_list.h"
|
||||
|
||||
#ifdef IS31FL3731
|
||||
#include "is31fl3731.h"
|
||||
#include "is31fl3731.h"
|
||||
#elif defined (IS31FL3733)
|
||||
#include "is31fl3733.h"
|
||||
#include "is31fl3733.h"
|
||||
#elif defined (IS31FL3737)
|
||||
#include "is31fl3737.h"
|
||||
#elif defined (WS2812)
|
||||
#include "ws2812.h"
|
||||
#endif
|
||||
|
||||
typedef struct Point {
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
} __attribute__((packed)) Point;
|
||||
#ifndef RGB_MATRIX_LED_FLUSH_LIMIT
|
||||
#define RGB_MATRIX_LED_FLUSH_LIMIT 16
|
||||
#endif
|
||||
|
||||
typedef struct rgb_led {
|
||||
union {
|
||||
uint8_t raw;
|
||||
struct {
|
||||
uint8_t row:4; // 16 max
|
||||
uint8_t col:4; // 16 max
|
||||
};
|
||||
} matrix_co;
|
||||
Point point;
|
||||
uint8_t modifier:1;
|
||||
} __attribute__((packed)) rgb_led;
|
||||
#ifndef RGB_MATRIX_LED_PROCESS_LIMIT
|
||||
#define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL
|
||||
#define RGB_MATRIX_USE_LIMITS(min, max) uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \
|
||||
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \
|
||||
if (max > DRIVER_LED_TOTAL) \
|
||||
max = DRIVER_LED_TOTAL;
|
||||
#else
|
||||
#define RGB_MATRIX_USE_LIMITS(min, max) uint8_t min = 0; \
|
||||
uint8_t max = DRIVER_LED_TOTAL;
|
||||
#endif
|
||||
|
||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HSV color;
|
||||
uint8_t index;
|
||||
} rgb_indicator;
|
||||
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
struct {
|
||||
bool enable :1;
|
||||
uint8_t mode :6;
|
||||
uint16_t hue :9;
|
||||
uint8_t sat :8;
|
||||
uint8_t val :8;
|
||||
uint8_t speed :8;//EECONFIG needs to be increased to support this
|
||||
};
|
||||
} rgb_config_t;
|
||||
#define RGB_MATRIX_TEST_LED_FLAGS() if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) continue
|
||||
|
||||
enum rgb_matrix_effects {
|
||||
RGB_MATRIX_SOLID_COLOR = 1,
|
||||
RGB_MATRIX_ALPHAS_MODS,
|
||||
RGB_MATRIX_DUAL_BEACON,
|
||||
RGB_MATRIX_GRADIENT_UP_DOWN,
|
||||
RGB_MATRIX_RAINDROPS,
|
||||
RGB_MATRIX_CYCLE_ALL,
|
||||
RGB_MATRIX_CYCLE_LEFT_RIGHT,
|
||||
RGB_MATRIX_CYCLE_UP_DOWN,
|
||||
RGB_MATRIX_RAINBOW_BEACON,
|
||||
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,
|
||||
RGB_MATRIX_MULTISPLASH,
|
||||
RGB_MATRIX_SOLID_SPLASH,
|
||||
RGB_MATRIX_SOLID_MULTISPLASH,
|
||||
RGB_MATRIX_NONE = 0,
|
||||
|
||||
// --------------------------------------
|
||||
// -----Begin rgb effect enum macros-----
|
||||
#define RGB_MATRIX_EFFECT(name, ...) RGB_MATRIX_##name,
|
||||
#include "rgb_matrix_animations/rgb_matrix_effects.inc"
|
||||
#undef RGB_MATRIX_EFFECT
|
||||
|
||||
#if defined(RGB_MATRIX_CUSTOM_KB) || defined(RGB_MATRIX_CUSTOM_USER)
|
||||
#define RGB_MATRIX_EFFECT(name, ...) RGB_MATRIX_CUSTOM_##name,
|
||||
#ifdef RGB_MATRIX_CUSTOM_KB
|
||||
#include "rgb_matrix_kb.inc"
|
||||
#endif
|
||||
#ifdef RGB_MATRIX_CUSTOM_USER
|
||||
#include "rgb_matrix_user.inc"
|
||||
#endif
|
||||
#undef RGB_MATRIX_EFFECT
|
||||
#endif
|
||||
RGB_MATRIX_EFFECT_MAX
|
||||
// --------------------------------------
|
||||
// -----End rgb effect enum macros-------
|
||||
|
||||
RGB_MATRIX_EFFECT_MAX
|
||||
};
|
||||
|
||||
void eeconfig_update_rgb_matrix_default(void);
|
||||
|
||||
uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i);
|
||||
uint8_t rgb_matrix_map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led_i);
|
||||
|
||||
void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
|
||||
void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
|
||||
|
||||
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
void rgb_matrix_task(void);
|
||||
|
||||
// This runs after another backlight effect and replaces
|
||||
// colors already set
|
||||
|
|
@ -101,50 +100,57 @@ void rgb_matrix_indicators_kb(void);
|
|||
void rgb_matrix_indicators_user(void);
|
||||
|
||||
void rgb_matrix_init(void);
|
||||
void rgb_matrix_setup_drivers(void);
|
||||
|
||||
void rgb_matrix_set_suspend_state(bool state);
|
||||
void rgb_matrix_set_indicator_state(uint8_t state);
|
||||
void rgb_matrix_toggle(void);
|
||||
void rgb_matrix_enable(void);
|
||||
void rgb_matrix_enable_noeeprom(void);
|
||||
void rgb_matrix_disable(void);
|
||||
void rgb_matrix_disable_noeeprom(void);
|
||||
void rgb_matrix_step(void);
|
||||
void rgb_matrix_step_reverse(void);
|
||||
void rgb_matrix_increase_hue(void);
|
||||
void rgb_matrix_decrease_hue(void);
|
||||
void rgb_matrix_increase_sat(void);
|
||||
void rgb_matrix_decrease_sat(void);
|
||||
void rgb_matrix_increase_val(void);
|
||||
void rgb_matrix_decrease_val(void);
|
||||
void rgb_matrix_increase_speed(void);
|
||||
void rgb_matrix_decrease_speed(void);
|
||||
led_flags_t rgb_matrix_get_flags(void);
|
||||
void rgb_matrix_set_flags(led_flags_t flags);
|
||||
void rgb_matrix_mode(uint8_t mode);
|
||||
void rgb_matrix_mode_noeeprom(uint8_t mode);
|
||||
uint8_t rgb_matrix_get_mode(void);
|
||||
void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
|
||||
void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
|
||||
|
||||
|
||||
void rgb_matrix_task(void);
|
||||
|
||||
// This should not be called from an interrupt
|
||||
// (eg. from a timer interrupt).
|
||||
// Call this while idle (in between matrix scans).
|
||||
// If the buffer is dirty, it will update the driver with the buffer.
|
||||
void rgb_matrix_update_pwm_buffers(void);
|
||||
|
||||
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
void rgb_matrix_increase(void);
|
||||
void rgb_matrix_decrease(void);
|
||||
|
||||
// void *backlight_get_key_color_eeprom_address(uint8_t led);
|
||||
// void backlight_get_key_color( uint8_t led, HSV *hsv );
|
||||
// void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv );
|
||||
|
||||
uint32_t rgb_matrix_get_tick(void);
|
||||
|
||||
void rgblight_toggle(void);
|
||||
void rgblight_step(void);
|
||||
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
|
||||
void rgblight_step_reverse(void);
|
||||
void rgblight_increase_hue(void);
|
||||
void rgblight_decrease_hue(void);
|
||||
void rgblight_increase_sat(void);
|
||||
void rgblight_decrease_sat(void);
|
||||
void rgblight_increase_val(void);
|
||||
void rgblight_decrease_val(void);
|
||||
void rgblight_increase_speed(void);
|
||||
void rgblight_decrease_speed(void);
|
||||
void rgblight_mode(uint8_t mode);
|
||||
uint32_t rgblight_get_mode(void);
|
||||
#ifndef RGBLIGHT_ENABLE
|
||||
#define rgblight_toggle() rgb_matrix_toggle()
|
||||
#define rgblight_enable() rgb_matrix_enable()
|
||||
#define rgblight_enable_noeeprom() rgb_matrix_enable_noeeprom()
|
||||
#define rgblight_disable() rgb_matrix_disable()
|
||||
#define rgblight_disable_noeeprom() rgb_matrix_disable_noeeprom()
|
||||
#define rgblight_step() rgb_matrix_step()
|
||||
#define rgblight_sethsv(hue, sat, val) rgb_matrix_sethsv(hue, sat, val)
|
||||
#define rgblight_sethsv_noeeprom(hue, sat, val) rgb_matrix_sethsv_noeeprom(hue, sat, val)
|
||||
#define rgblight_step_reverse() rgb_matrix_step_reverse()
|
||||
#define rgblight_increase_hue() rgb_matrix_increase_hue()
|
||||
#define rgblight_decrease_hue() rgb_matrix_decrease_hue()
|
||||
#define rgblight_increase_sat() rgb_matrix_increase_sat()
|
||||
#define rgblight_decrease_sat() rgb_matrix_decrease_sat()
|
||||
#define rgblight_increase_val() rgb_matrix_increase_val()
|
||||
#define rgblight_decrease_val() rgb_matrix_decrease_val()
|
||||
#define rgblight_increase_speed() rgb_matrix_increase_speed()
|
||||
#define rgblight_decrease_speed() rgb_matrix_decrease_speed()
|
||||
#define rgblight_mode(mode) rgb_matrix_mode(mode)
|
||||
#define rgblight_mode_noeeprom(mode) rgb_matrix_mode_noeeprom(mode)
|
||||
#define rgblight_get_mode() rgb_matrix_get_mode()
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
/* Perform any initialisation required for the other driver functions to work. */
|
||||
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. */
|
||||
|
|
@ -155,4 +161,16 @@ typedef struct {
|
|||
|
||||
extern const rgb_matrix_driver_t rgb_matrix_driver;
|
||||
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
|
||||
extern bool g_suspend_state;
|
||||
extern rgb_counters_t g_rgb_counters;
|
||||
extern led_config_t g_led_config;
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
extern last_hit_t g_last_hit_tracker;
|
||||
#endif
|
||||
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
||||
extern uint8_t rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
26
quantum/rgb_matrix_animations/alpha_mods_anim.h
Normal file
26
quantum/rgb_matrix_animations/alpha_mods_anim.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
RGB_MATRIX_EFFECT(ALPHAS_MODS)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
// alphas = color1, mods = color2
|
||||
bool ALPHAS_MODS(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
RGB rgb1 = hsv_to_rgb(hsv);
|
||||
hsv.h += rgb_matrix_config.speed;
|
||||
RGB rgb2 = hsv_to_rgb(hsv);
|
||||
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
|
||||
rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b);
|
||||
} else {
|
||||
rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b);
|
||||
}
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||
20
quantum/rgb_matrix_animations/breathing_anim.h
Normal file
20
quantum/rgb_matrix_animations/breathing_anim.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_BREATHING
|
||||
RGB_MATRIX_EFFECT(BREATHING)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
bool BREATHING(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
uint16_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 8);
|
||||
hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BREATHING
|
||||
15
quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h
Normal file
15
quantum/rgb_matrix_animations/colorband_pinwheel_sat_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
|
||||
RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_PINWHEEL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
hsv.s = scale8(hsv.s - time - atan2_8(dy, dx) * 3, hsv.s);
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool BAND_PINWHEEL_SAT(effect_params_t* params) {
|
||||
return effect_runner_dx_dy(params, &BAND_PINWHEEL_SAT_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
|
||||
15
quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h
Normal file
15
quantum/rgb_matrix_animations/colorband_pinwheel_val_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
|
||||
RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_PINWHEEL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
hsv.v = scale8(hsv.v - time - atan2_8(dy, dx) * 3, hsv.v);
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool BAND_PINWHEEL_VAL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy(params, &BAND_PINWHEEL_VAL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
|
||||
16
quantum/rgb_matrix_animations/colorband_sat_anim.h
Normal file
16
quantum/rgb_matrix_animations/colorband_sat_anim.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_BAND_SAT
|
||||
RGB_MATRIX_EFFECT(BAND_SAT)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_SAT_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
int16_t s = hsv.s - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
|
||||
hsv.s = scale8(s < 0 ? 0 : s, hsv.s);
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool BAND_SAT(effect_params_t* params) {
|
||||
return effect_runner_i(params, &BAND_SAT_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_SAT
|
||||
15
quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h
Normal file
15
quantum/rgb_matrix_animations/colorband_spiral_sat_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
|
||||
RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_SPIRAL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv.s = scale8(hsv.s + dist - time - atan2_8(dy, dx), hsv.s);
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool BAND_SPIRAL_SAT(effect_params_t* params) {
|
||||
return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_SAT_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
|
||||
15
quantum/rgb_matrix_animations/colorband_spiral_val_anim.h
Normal file
15
quantum/rgb_matrix_animations/colorband_spiral_val_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
|
||||
RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_SPIRAL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv.v = scale8(hsv.v + dist - time - atan2_8(dy, dx), hsv.v);
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool BAND_SPIRAL_VAL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_VAL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
|
||||
16
quantum/rgb_matrix_animations/colorband_val_anim.h
Normal file
16
quantum/rgb_matrix_animations/colorband_val_anim.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_BAND_VAL
|
||||
RGB_MATRIX_EFFECT(BAND_VAL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV BAND_VAL_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
int16_t v = hsv.v - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
|
||||
hsv.v = scale8(v < 0 ? 0 : v, hsv.v);
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool BAND_VAL(effect_params_t* params) {
|
||||
return effect_runner_i(params, &BAND_VAL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_BAND_VAL
|
||||
15
quantum/rgb_matrix_animations/cycle_all_anim.h
Normal file
15
quantum/rgb_matrix_animations/cycle_all_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||
RGB_MATRIX_EFFECT(CYCLE_ALL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_ALL_math(HSV hsv, uint8_t i, uint8_t time){
|
||||
hsv.h = time;
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool CYCLE_ALL(effect_params_t* params) {
|
||||
return effect_runner_i(params, &CYCLE_ALL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||
15
quantum/rgb_matrix_animations/cycle_left_right_anim.h
Normal file
15
quantum/rgb_matrix_animations/cycle_left_right_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_LEFT_RIGHT_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
hsv.h = g_led_config.point[i].x - time;
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool CYCLE_LEFT_RIGHT(effect_params_t* params) {
|
||||
return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||
15
quantum/rgb_matrix_animations/cycle_out_in_anim.h
Normal file
15
quantum/rgb_matrix_animations/cycle_out_in_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN
|
||||
RGB_MATRIX_EFFECT(CYCLE_OUT_IN)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_OUT_IN_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv.h = 3 * dist / 2 + time;
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool CYCLE_OUT_IN(effect_params_t* params) {
|
||||
return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_OUT_IN
|
||||
17
quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h
Normal file
17
quantum/rgb_matrix_animations/cycle_out_in_dual_anim.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
||||
RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_OUT_IN_DUAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
dx = (k_rgb_matrix_center.x / 2) - abs8(dx);
|
||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||
hsv.h = 3 * dist + time;
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool CYCLE_OUT_IN_DUAL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy(params, &CYCLE_OUT_IN_DUAL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
|
||||
15
quantum/rgb_matrix_animations/cycle_pinwheel_anim.h
Normal file
15
quantum/rgb_matrix_animations/cycle_pinwheel_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
|
||||
RGB_MATRIX_EFFECT(CYCLE_PINWHEEL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_PINWHEEL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) {
|
||||
hsv.h = atan2_8(dy, dx) + time;
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool CYCLE_PINWHEEL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy(params, &CYCLE_PINWHEEL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
|
||||
15
quantum/rgb_matrix_animations/cycle_spiral_anim.h
Normal file
15
quantum/rgb_matrix_animations/cycle_spiral_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL
|
||||
RGB_MATRIX_EFFECT(CYCLE_SPIRAL)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_SPIRAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
hsv.h = dist - time - atan2_8(dy, dx);
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool CYCLE_SPIRAL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy_dist(params, &CYCLE_SPIRAL_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_SPIRAL
|
||||
15
quantum/rgb_matrix_animations/cycle_up_down_anim.h
Normal file
15
quantum/rgb_matrix_animations/cycle_up_down_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
RGB_MATRIX_EFFECT(CYCLE_UP_DOWN)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV CYCLE_UP_DOWN_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
hsv.h = g_led_config.point[i].y - time;
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool CYCLE_UP_DOWN(effect_params_t* params) {
|
||||
return effect_runner_i(params, &CYCLE_UP_DOWN_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||
77
quantum/rgb_matrix_animations/digital_rain_anim.h
Normal file
77
quantum/rgb_matrix_animations/digital_rain_anim.h
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN)
|
||||
RGB_MATRIX_EFFECT(DIGITAL_RAIN)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
#ifndef RGB_DIGITAL_RAIN_DROPS
|
||||
// lower the number for denser effect/wider keyboard
|
||||
#define RGB_DIGITAL_RAIN_DROPS 24
|
||||
#endif
|
||||
|
||||
bool DIGITAL_RAIN(effect_params_t* params) {
|
||||
// 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 drop = 0;
|
||||
|
||||
if (params->init) {
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
memset(rgb_frame_buffer, 0, sizeof(rgb_frame_buffer));
|
||||
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
|
||||
rgb_frame_buffer[row][col] = max_intensity;
|
||||
}
|
||||
else if (rgb_frame_buffer[row][col] > 0 && rgb_frame_buffer[row][col] < max_intensity) {
|
||||
// neither fully bright nor dark, decay it
|
||||
rgb_frame_buffer[row][col]--;
|
||||
}
|
||||
// set the pixel colour
|
||||
uint8_t led[LED_HITS_TO_REMEMBER];
|
||||
uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led);
|
||||
|
||||
// TODO: multiple leds are supported mapped to the same row/column
|
||||
if (led_count > 0) {
|
||||
if (rgb_frame_buffer[row][col] > pure_green_intensity) {
|
||||
const uint8_t boost = (uint8_t) ((uint16_t) max_brightness_boost * (rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity));
|
||||
rgb_matrix_set_color(led[0], boost, max_intensity, boost);
|
||||
}
|
||||
else {
|
||||
const uint8_t green = (uint8_t) ((uint16_t) max_intensity * rgb_frame_buffer[row][col] / pure_green_intensity);
|
||||
rgb_matrix_set_color(led[0], 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 && rgb_frame_buffer[row][col] == max_intensity) {
|
||||
rgb_frame_buffer[row][col]--;
|
||||
}
|
||||
// check if the pixel above is bright
|
||||
if (rgb_frame_buffer[row - 1][col] == max_intensity) {
|
||||
// allow old bright pixel to decay
|
||||
rgb_frame_buffer[row - 1][col]--;
|
||||
// make this pixel bright
|
||||
rgb_frame_buffer[row][col] = max_intensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN)
|
||||
15
quantum/rgb_matrix_animations/dual_beacon_anim.h
Normal file
15
quantum/rgb_matrix_animations/dual_beacon_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||
RGB_MATRIX_EFFECT(DUAL_BEACON)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV DUAL_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||
hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * sin) / 128;
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool DUAL_BEACON(effect_params_t* params) {
|
||||
return effect_runner_sin_cos_i(params, &DUAL_BEACON_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||
22
quantum/rgb_matrix_animations/gradient_up_down_anim.h
Normal file
22
quantum/rgb_matrix_animations/gradient_up_down_anim.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
bool GRADIENT_UP_DOWN(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
|
||||
HSV hsv = rgb_matrix_config.hsv;
|
||||
uint8_t scale = scale8(64, rgb_matrix_config.speed);
|
||||
for (uint8_t i = led_min; i < led_max; i++) {
|
||||
RGB_MATRIX_TEST_LED_FLAGS();
|
||||
// The y range will be 0..64, map this to 0..4
|
||||
// Relies on hue being 8-bit and wrapping
|
||||
hsv.h = rgb_matrix_config.hsv.h + scale * (g_led_config.point[i].y >> 4);
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||
29
quantum/rgb_matrix_animations/jellybean_raindrops_anim.h
Normal file
29
quantum/rgb_matrix_animations/jellybean_raindrops_anim.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
|
||||
HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.hsv.v };
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
|
||||
bool JELLYBEAN_RAINDROPS(effect_params_t* params) {
|
||||
if (!params->init) {
|
||||
// Change one LED every tick, make sure speed is not 0
|
||||
if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
|
||||
jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
for (int i = led_min; i < led_max; i++) {
|
||||
jellybean_raindrops_set_color(i, params);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||
15
quantum/rgb_matrix_animations/rainbow_beacon_anim.h
Normal file
15
quantum/rgb_matrix_animations/rainbow_beacon_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
RGB_MATRIX_EFFECT(RAINBOW_BEACON)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV RAINBOW_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||
hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 2 * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * 2 * sin) / 128;
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool RAINBOW_BEACON(effect_params_t* params) {
|
||||
return effect_runner_sin_cos_i(params, &RAINBOW_BEACON_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||
15
quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h
Normal file
15
quantum/rgb_matrix_animations/rainbow_moving_chevron_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV RAINBOW_MOVING_CHEVRON_math(HSV hsv, uint8_t i, uint8_t time) {
|
||||
hsv.h += abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time);
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) {
|
||||
return effect_runner_i(params, &RAINBOW_MOVING_CHEVRON_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||
15
quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h
Normal file
15
quantum/rgb_matrix_animations/rainbow_pinwheels_anim.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
RGB_MATRIX_EFFECT(PINWHEELS)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static HSV PINWHEELS_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||
hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 3 * cos + (56 - abs8(g_led_config.point[i].x - k_rgb_matrix_center.x)) * 3 * sin) / 128;
|
||||
return hsv;
|
||||
}
|
||||
|
||||
bool PINWHEELS(effect_params_t* params) {
|
||||
return effect_runner_sin_cos_i(params, &PINWHEELS_math);
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||
39
quantum/rgb_matrix_animations/raindrops_anim.h
Normal file
39
quantum/rgb_matrix_animations/raindrops_anim.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef DISABLE_RGB_MATRIX_RAINDROPS
|
||||
RGB_MATRIX_EFFECT(RAINDROPS)
|
||||
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static void raindrops_set_color(int i, effect_params_t* params) {
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
|
||||
HSV hsv = { 0 , rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v };
|
||||
|
||||
// Take the shortest path between hues
|
||||
int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4;
|
||||
if (deltaH > 127) {
|
||||
deltaH -= 256;
|
||||
} else if (deltaH < -127) {
|
||||
deltaH += 256;
|
||||
}
|
||||
|
||||
hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03));
|
||||
RGB rgb = hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
|
||||
bool RAINDROPS(effect_params_t* params) {
|
||||
if (!params->init) {
|
||||
// Change one LED every tick, make sure speed is not 0
|
||||
if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
|
||||
raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
for (int i = led_min; i < led_max; i++) {
|
||||
raindrops_set_color(i, params);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
}
|
||||
|
||||
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // DISABLE_RGB_MATRIX_RAINDROPS
|
||||
33
quantum/rgb_matrix_animations/rgb_matrix_effects.inc
Normal file
33
quantum/rgb_matrix_animations/rgb_matrix_effects.inc
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Add your new core rgb matrix effect here, order determins enum order, requires "rgb_matrix_animations/ directory
|
||||
#include "rgb_matrix_animations/solid_color_anim.h"
|
||||
#include "rgb_matrix_animations/alpha_mods_anim.h"
|
||||
#include "rgb_matrix_animations/gradient_up_down_anim.h"
|
||||
#include "rgb_matrix_animations/breathing_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_sat_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_val_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_pinwheel_sat_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_pinwheel_val_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_spiral_sat_anim.h"
|
||||
#include "rgb_matrix_animations/colorband_spiral_val_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_all_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_left_right_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_up_down_anim.h"
|
||||
#include "rgb_matrix_animations/rainbow_moving_chevron_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_out_in_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_out_in_dual_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_pinwheel_anim.h"
|
||||
#include "rgb_matrix_animations/cycle_spiral_anim.h"
|
||||
#include "rgb_matrix_animations/dual_beacon_anim.h"
|
||||
#include "rgb_matrix_animations/rainbow_beacon_anim.h"
|
||||
#include "rgb_matrix_animations/rainbow_pinwheels_anim.h"
|
||||
#include "rgb_matrix_animations/raindrops_anim.h"
|
||||
#include "rgb_matrix_animations/jellybean_raindrops_anim.h"
|
||||
#include "rgb_matrix_animations/typing_heatmap_anim.h"
|
||||
#include "rgb_matrix_animations/digital_rain_anim.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_simple_anim.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_anim.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_wide.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_cross.h"
|
||||
#include "rgb_matrix_animations/solid_reactive_nexus.h"
|
||||
#include "rgb_matrix_animations/splash_anim.h"
|
||||
#include "rgb_matrix_animations/solid_splash_anim.h"
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue