1
0
Fork 0

clang-format changes

This commit is contained in:
skullY 2019-08-30 11:19:03 -07:00 committed by skullydazed
parent 61af76a10d
commit b624f32f94
502 changed files with 32259 additions and 39062 deletions

View file

@ -17,40 +17,28 @@
#include "api.h"
#include "quantum.h"
void dword_to_bytes(uint32_t dword, uint8_t * bytes) {
void dword_to_bytes(uint32_t dword, uint8_t* bytes) {
bytes[0] = (dword >> 24) & 0xFF;
bytes[1] = (dword >> 16) & 0xFF;
bytes[2] = (dword >> 8) & 0xFF;
bytes[3] = (dword >> 0) & 0xFF;
bytes[1] = (dword >> 16) & 0xFF;
bytes[2] = (dword >> 8) & 0xFF;
bytes[3] = (dword >> 0) & 0xFF;
}
uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index) {
return ((uint32_t)bytes[index + 0] << 24) | ((uint32_t)bytes[index + 1] << 16) | ((uint32_t)bytes[index + 2] << 8) | (uint32_t)bytes[index + 3];
}
uint32_t bytes_to_dword(uint8_t* bytes, uint8_t index) { return ((uint32_t)bytes[index + 0] << 24) | ((uint32_t)bytes[index + 1] << 16) | ((uint32_t)bytes[index + 2] << 8) | (uint32_t)bytes[index + 3]; }
__attribute__ ((weak))
bool process_api_quantum(uint8_t length, uint8_t * data) {
return process_api_keyboard(length, data);
}
__attribute__((weak)) bool process_api_quantum(uint8_t length, uint8_t* data) { return process_api_keyboard(length, data); }
__attribute__ ((weak))
bool process_api_keyboard(uint8_t length, uint8_t * data) {
return process_api_user(length, data);
}
__attribute__((weak)) bool process_api_keyboard(uint8_t length, uint8_t* data) { return process_api_user(length, data); }
__attribute__ ((weak))
bool process_api_user(uint8_t length, uint8_t * data) {
return true;
}
__attribute__((weak)) bool process_api_user(uint8_t length, uint8_t* data) { return true; }
void process_api(uint16_t length, uint8_t * data) {
void process_api(uint16_t length, uint8_t* data) {
// SEND_STRING("\nRX: ");
// for (uint8_t i = 0; i < length; i++) {
// send_byte(data[i]);
// SEND_STRING(" ");
// }
if (!process_api_quantum(length, data))
return;
if (!process_api_quantum(length, data)) return;
switch (data[0]) {
case MT_SET_DATA:
@ -65,10 +53,10 @@ void process_api(uint16_t length, uint8_t * data) {
break;
}
case DT_RGBLIGHT: {
#ifdef RGBLIGHT_ENABLE
uint32_t rgblight = bytes_to_dword(data, 2);
eeconfig_update_rgblight(rgblight);
#endif
#ifdef RGBLIGHT_ENABLE
uint32_t rgblight = bytes_to_dword(data, 2);
eeconfig_update_rgblight(rgblight);
#endif
break;
}
}
@ -79,12 +67,12 @@ void process_api(uint16_t length, uint8_t * data) {
break;
}
case DT_DEBUG: {
uint8_t debug_bytes[1] = { eeprom_read_byte(EECONFIG_DEBUG) };
uint8_t debug_bytes[1] = {eeprom_read_byte(EECONFIG_DEBUG)};
MT_GET_DATA_ACK(DT_DEBUG, debug_bytes, 1);
break;
}
case DT_DEFAULT_LAYER: {
uint8_t default_bytes[1] = { eeprom_read_byte(EECONFIG_DEFAULT_LAYER) };
uint8_t default_bytes[1] = {eeprom_read_byte(EECONFIG_DEFAULT_LAYER)};
MT_GET_DATA_ACK(DT_DEFAULT_LAYER, default_bytes, 1);
break;
}
@ -95,35 +83,35 @@ void process_api(uint16_t length, uint8_t * data) {
break;
}
case DT_AUDIO: {
#ifdef AUDIO_ENABLE
uint8_t audio_bytes[1] = { eeprom_read_byte(EECONFIG_AUDIO) };
MT_GET_DATA_ACK(DT_AUDIO, audio_bytes, 1);
#else
MT_GET_DATA_ACK(DT_AUDIO, NULL, 0);
#endif
#ifdef AUDIO_ENABLE
uint8_t audio_bytes[1] = {eeprom_read_byte(EECONFIG_AUDIO)};
MT_GET_DATA_ACK(DT_AUDIO, audio_bytes, 1);
#else
MT_GET_DATA_ACK(DT_AUDIO, NULL, 0);
#endif
break;
}
case DT_BACKLIGHT: {
#ifdef BACKLIGHT_ENABLE
uint8_t backlight_bytes[1] = { eeprom_read_byte(EECONFIG_BACKLIGHT) };
MT_GET_DATA_ACK(DT_BACKLIGHT, backlight_bytes, 1);
#else
MT_GET_DATA_ACK(DT_BACKLIGHT, NULL, 0);
#endif
#ifdef BACKLIGHT_ENABLE
uint8_t backlight_bytes[1] = {eeprom_read_byte(EECONFIG_BACKLIGHT)};
MT_GET_DATA_ACK(DT_BACKLIGHT, backlight_bytes, 1);
#else
MT_GET_DATA_ACK(DT_BACKLIGHT, NULL, 0);
#endif
break;
}
case DT_RGBLIGHT: {
#ifdef RGBLIGHT_ENABLE
uint8_t rgblight_bytes[4];
dword_to_bytes(eeconfig_read_rgblight(), rgblight_bytes);
MT_GET_DATA_ACK(DT_RGBLIGHT, rgblight_bytes, 4);
#else
MT_GET_DATA_ACK(DT_RGBLIGHT, NULL, 0);
#endif
#ifdef RGBLIGHT_ENABLE
uint8_t rgblight_bytes[4];
dword_to_bytes(eeconfig_read_rgblight(), rgblight_bytes);
MT_GET_DATA_ACK(DT_RGBLIGHT, rgblight_bytes, 4);
#else
MT_GET_DATA_ACK(DT_RGBLIGHT, NULL, 0);
#endif
break;
}
case DT_KEYMAP_OPTIONS: {
uint8_t keymap_bytes[1] = { eeconfig_read_keymap() };
uint8_t keymap_bytes[1] = {eeconfig_read_keymap()};
MT_GET_DATA_ACK(DT_KEYMAP_OPTIONS, keymap_bytes, 1);
break;
}
@ -172,24 +160,23 @@ void process_api(uint16_t length, uint8_t * data) {
break;
case MT_TYPE_ERROR:
break;
default: ; // command not recognised
default:; // command not recognised
SEND_BYTES(MT_TYPE_ERROR, DT_NONE, data, length);
break;
// #ifdef RGBLIGHT_ENABLE
// case 0x27: ; // RGB LED functions
// switch (*data++) {
// case 0x00: ; // Update HSV
// rgblight_sethsv((data[0] << 8 | data[1]) % 360, data[2], data[3]);
// break;
// case 0x01: ; // Update RGB
// break;
// case 0x02: ; // Update mode
// rgblight_mode(data[0]);
// break;
// }
// break;
// #endif
// #ifdef RGBLIGHT_ENABLE
// case 0x27: ; // RGB LED functions
// switch (*data++) {
// case 0x00: ; // Update HSV
// rgblight_sethsv((data[0] << 8 | data[1]) % 360, data[2], data[3]);
// break;
// case 0x01: ; // Update RGB
// break;
// case 0x02: ; // Update mode
// rgblight_mode(data[0]);
// break;
// }
// break;
// #endif
}
}

View file

@ -18,41 +18,25 @@
#define _API_H_
#ifdef __AVR__
#include "lufa.h"
# include "lufa.h"
#endif
enum MESSAGE_TYPE {
MT_GET_DATA = 0x10, // Get data from keyboard
MT_GET_DATA_ACK = 0x11, // returned data to process (ACK)
MT_SET_DATA = 0x20, // Set data on keyboard
MT_SET_DATA_ACK = 0x21, // returned data to confirm (ACK)
MT_SEND_DATA = 0x30, // Sending data/action from keyboard
MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK)
MT_EXE_ACTION = 0x40, // executing actions on keyboard
MT_EXE_ACTION_ACK =0x41, // return confirmation/value (ACK)
MT_TYPE_ERROR = 0x80 // type not recognised (ACK)
MT_GET_DATA = 0x10, // Get data from keyboard
MT_GET_DATA_ACK = 0x11, // returned data to process (ACK)
MT_SET_DATA = 0x20, // Set data on keyboard
MT_SET_DATA_ACK = 0x21, // returned data to confirm (ACK)
MT_SEND_DATA = 0x30, // Sending data/action from keyboard
MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK)
MT_EXE_ACTION = 0x40, // executing actions on keyboard
MT_EXE_ACTION_ACK = 0x41, // return confirmation/value (ACK)
MT_TYPE_ERROR = 0x80 // type not recognised (ACK)
};
enum DATA_TYPE {
DT_NONE = 0x00,
DT_HANDSHAKE,
DT_DEFAULT_LAYER,
DT_CURRENT_LAYER,
DT_KEYMAP_OPTIONS,
DT_BACKLIGHT,
DT_RGBLIGHT,
DT_UNICODE,
DT_DEBUG,
DT_AUDIO,
DT_QUANTUM_ACTION,
DT_KEYBOARD_ACTION,
DT_USER_ACTION,
DT_KEYMAP_SIZE,
DT_KEYMAP
};
enum DATA_TYPE { DT_NONE = 0x00, DT_HANDSHAKE, DT_DEFAULT_LAYER, DT_CURRENT_LAYER, DT_KEYMAP_OPTIONS, DT_BACKLIGHT, DT_RGBLIGHT, DT_UNICODE, DT_DEBUG, DT_AUDIO, DT_QUANTUM_ACTION, DT_KEYBOARD_ACTION, DT_USER_ACTION, DT_KEYMAP_SIZE, DT_KEYMAP };
void dword_to_bytes(uint32_t dword, uint8_t * bytes);
uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index);
void dword_to_bytes(uint32_t dword, uint8_t* bytes);
uint32_t bytes_to_dword(uint8_t* bytes, uint8_t index);
#define MT_GET_DATA(data_type, data, length) SEND_BYTES(MT_GET_DATA, data_type, data, length)
#define MT_GET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_GET_DATA_ACK, data_type, data, length)
@ -63,15 +47,12 @@ uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index);
#define MT_EXE_ACTION(data_type, data, length) SEND_BYTES(MT_EXE_ACTION, data_type, data, length)
#define MT_EXE_ACTION_ACK(data_type, data, length) SEND_BYTES(MT_EXE_ACTION_ACK, data_type, data, length)
void process_api(uint16_t length, uint8_t * data);
void process_api(uint16_t length, uint8_t* data);
__attribute__ ((weak))
bool process_api_quantum(uint8_t length, uint8_t * data);
__attribute__((weak)) bool process_api_quantum(uint8_t length, uint8_t* data);
__attribute__ ((weak))
bool process_api_keyboard(uint8_t length, uint8_t * data);
__attribute__((weak)) bool process_api_keyboard(uint8_t length, uint8_t* data);
__attribute__ ((weak))
bool process_api_user(uint8_t length, uint8_t * data);
__attribute__((weak)) bool process_api_user(uint8_t length, uint8_t* data);
#endif

View file

@ -18,7 +18,7 @@
#include "print.h"
#include "qmk_midi.h"
void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length) {
void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t* bytes, uint16_t length) {
// SEND_STRING("\nTX: ");
// for (uint8_t i = 0; i < length; i++) {
// send_byte(bytes[i]);
@ -29,7 +29,6 @@ void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes,
return;
}
// The buffer size required is calculated as the following
// API_SYSEX_MAX_SIZE is the maximum length
// In addition to that we have a two byte message header consisting of the message_type and data_type
@ -37,14 +36,14 @@ void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes,
// We just add one extra byte in case it's not divisible by 7
// Then we have an unencoded header consisting of 4 bytes
// Plus a one byte terminator
const unsigned message_header = 2;
const unsigned message_header = 2;
const unsigned unencoded_message = API_SYSEX_MAX_SIZE + message_header;
const unsigned encoding_overhead = unencoded_message / 7 + 1;
const unsigned encoded_size = unencoded_message + encoding_overhead;
const unsigned unencoded_header = 4;
const unsigned terminator = 1;
const unsigned buffer_size = encoded_size + unencoded_header + terminator;
uint8_t buffer[encoded_size + unencoded_header + terminator];
const unsigned encoded_size = unencoded_message + encoding_overhead;
const unsigned unencoded_header = 4;
const unsigned terminator = 1;
const unsigned buffer_size = encoded_size + unencoded_header + terminator;
uint8_t buffer[encoded_size + unencoded_header + terminator];
// The unencoded header
buffer[0] = 0xF0;
buffer[1] = 0x00;
@ -53,16 +52,16 @@ void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes,
// We copy the message to the end of the array, this way we can do an inplace encoding, using the same
// buffer for both input and output
const unsigned message_size = length + message_header;
uint8_t* unencoded_start = buffer + buffer_size - message_size;
uint8_t* ptr = unencoded_start;
*(ptr++) = message_type;
*(ptr++) = data_type;
const unsigned message_size = length + message_header;
uint8_t* unencoded_start = buffer + buffer_size - message_size;
uint8_t* ptr = unencoded_start;
*(ptr++) = message_type;
*(ptr++) = data_type;
memcpy(ptr, bytes, length);
unsigned encoded_length = sysex_encode(buffer + unencoded_header, unencoded_start, message_size);
unsigned final_size = unencoded_header + encoded_length + terminator;
buffer[final_size - 1] = 0xF7;
unsigned final_size = unencoded_header + encoded_length + terminator;
buffer[final_size - 1] = 0xF7;
midi_send_array(&midi_device, final_size, buffer);
// SEND_STRING("\nTD: ");

View file

@ -19,7 +19,7 @@
#include "api.h"
void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length);
void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t* bytes, uint16_t length);
#define SEND_BYTES(mt, dt, b, l) send_bytes_sysex(mt, dt, b, l)

File diff suppressed because it is too large Load diff

View file

@ -19,7 +19,7 @@
#include <stdint.h>
#include <stdbool.h>
#if defined(__AVR__)
#include <avr/io.h>
# include <avr/io.h>
#endif
#include "wait.h"
#include "musical_notes.h"
@ -39,9 +39,9 @@
typedef union {
uint8_t raw;
struct {
bool enable :1;
bool clicky_enable :1;
uint8_t level :6;
bool enable : 1;
bool clicky_enable : 1;
uint8_t level : 6;
};
} audio_config_t;
@ -58,13 +58,13 @@ void set_vibrato_rate(float rate);
void increase_vibrato_rate(float change);
void decrease_vibrato_rate(float change);
#ifdef VIBRATO_STRENGTH_ENABLE
# ifdef VIBRATO_STRENGTH_ENABLE
void set_vibrato_strength(float strength);
void increase_vibrato_strength(float change);
void decrease_vibrato_strength(float change);
#endif
# endif
#endif
@ -85,25 +85,23 @@ void decrease_tempo(uint8_t tempo_change);
void audio_init(void);
#ifdef PWM_AUDIO
void play_sample(uint8_t * s, uint16_t l, bool r);
void play_sample(uint8_t* s, uint16_t l, bool r);
#endif
void play_note(float freq, int vol);
void stop_note(float freq);
void stop_all_notes(void);
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat);
#define SCALE (int8_t []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
#define SCALE \
(int8_t[]) { 0 + (12 * 0), 2 + (12 * 0), 4 + (12 * 0), 5 + (12 * 0), 7 + (12 * 0), 9 + (12 * 0), 11 + (12 * 0), 0 + (12 * 1), 2 + (12 * 1), 4 + (12 * 1), 5 + (12 * 1), 7 + (12 * 1), 9 + (12 * 1), 11 + (12 * 1), 0 + (12 * 2), 2 + (12 * 2), 4 + (12 * 2), 5 + (12 * 2), 7 + (12 * 2), 9 + (12 * 2), 11 + (12 * 2), 0 + (12 * 3), 2 + (12 * 3), 4 + (12 * 3), 5 + (12 * 3), 7 + (12 * 3), 9 + (12 * 3), 11 + (12 * 3), 0 + (12 * 4), 2 + (12 * 4), 4 + (12 * 4), 5 + (12 * 4), 7 + (12 * 4), 9 + (12 * 4), 11 + (12 * 4), }
// These macros are used to allow play_notes to play an array of indeterminate
// length. This works around the limitation of C's sizeof operation on pointers.
// The global float array for the song must be used here.
#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0]))))
#define PLAY_NOTE_ARRAY(note_array, note_repeat, deprecated_arg) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat)); \
_Pragma ("message \"'PLAY_NOTE_ARRAY' macro is deprecated\"")
#define PLAY_NOTE_ARRAY(note_array, note_repeat, deprecated_arg) \
play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat)); \
_Pragma("message \"'PLAY_NOTE_ARRAY' macro is deprecated\"")
#define PLAY_SONG(note_array) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), false)
#define PLAY_LOOP(note_array) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), true)

File diff suppressed because it is too large Load diff

View file

@ -29,7 +29,6 @@
#define CPU_PRESCALER 8
// Timer Abstractions
// TIMSK3 - Timer/Counter #3 Interrupt Mask Register
@ -37,70 +36,67 @@
#define ENABLE_AUDIO_COUNTER_3_ISR TIMSK3 |= _BV(OCIE3A)
#define DISABLE_AUDIO_COUNTER_3_ISR TIMSK3 &= ~_BV(OCIE3A)
// TCCR3A: Timer/Counter #3 Control Register
// Compare Output Mode (COM3An) = 0b00 = Normal port operation, OC3A disconnected from PC6
#define ENABLE_AUDIO_COUNTER_3_OUTPUT TCCR3A |= _BV(COM3A1);
#define DISABLE_AUDIO_COUNTER_3_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0));
#define NOTE_PERIOD ICR3
#define NOTE_DUTY_CYCLE OCR3A
#ifdef PWM_AUDIO
#include "wave.h"
#define SAMPLE_DIVIDER 39
#define SAMPLE_RATE (2000000.0/SAMPLE_DIVIDER/2048)
// Resistor value of 1/ (2 * PI * 10nF * (2000000 hertz / SAMPLE_DIVIDER / 10)) for 10nF cap
# include "wave.h"
# define SAMPLE_DIVIDER 39
# define SAMPLE_RATE (2000000.0 / SAMPLE_DIVIDER / 2048)
// Resistor value of 1/ (2 * PI * 10nF * (2000000 hertz / SAMPLE_DIVIDER / 10)) for 10nF cap
float places[8] = {0, 0, 0, 0, 0, 0, 0, 0};
uint16_t place_int = 0;
bool repeat = true;
float places[8] = {0, 0, 0, 0, 0, 0, 0, 0};
uint16_t place_int = 0;
bool repeat = true;
#endif
void delay_us(int count) {
while(count--) {
_delay_us(1);
}
while (count--) {
_delay_us(1);
}
}
int voices = 0;
int voice_place = 0;
float frequency = 0;
int volume = 0;
long position = 0;
int voices = 0;
int voice_place = 0;
float frequency = 0;
int volume = 0;
long position = 0;
float frequencies[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int volumes[8] = {0, 0, 0, 0, 0, 0, 0, 0};
bool sliding = false;
int volumes[8] = {0, 0, 0, 0, 0, 0, 0, 0};
bool sliding = false;
float place = 0;
uint8_t * sample;
uint8_t* sample;
uint16_t sample_length = 0;
// float freq = 0;
bool playing_notes = false;
bool playing_note = false;
bool playing_notes = false;
bool playing_note = false;
float note_frequency = 0;
float note_length = 0;
uint8_t note_tempo = TEMPO_DEFAULT;
float note_timbre = TIMBRE_DEFAULT;
uint16_t note_position = 0;
float (* notes_pointer)[][2];
float note_length = 0;
uint8_t note_tempo = TEMPO_DEFAULT;
float note_timbre = TIMBRE_DEFAULT;
uint16_t note_position = 0;
float (*notes_pointer)[][2];
uint16_t notes_count;
bool notes_repeat;
float notes_rest;
bool note_resting = false;
uint16_t current_note = 0;
uint8_t rest_counter = 0;
uint8_t rest_counter = 0;
#ifdef VIBRATO_ENABLE
float vibrato_counter = 0;
float vibrato_counter = 0;
float vibrato_strength = .5;
float vibrato_rate = 0.125;
float vibrato_rate = 0.125;
#endif
float polyphony_rate = 0;
@ -112,50 +108,49 @@ audio_config_t audio_config;
uint16_t envelope_index = 0;
void audio_init() {
// Check EEPROM
if (!eeconfig_is_enabled())
{
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
audio_config.raw = eeconfig_read_audio();
#ifdef PWM_AUDIO
#ifdef PWM_AUDIO
PLLFRQ = _BV(PDIV2);
PLLCSR = _BV(PLLE);
while(!(PLLCSR & _BV(PLOCK)));
PLLFRQ |= _BV(PLLTM0); /* PCK 48MHz */
PLLFRQ = _BV(PDIV2);
PLLCSR = _BV(PLLE);
while (!(PLLCSR & _BV(PLOCK)))
;
PLLFRQ |= _BV(PLLTM0); /* PCK 48MHz */
/* Init a fast PWM on Timer4 */
TCCR4A = _BV(COM4A0) | _BV(PWM4A); /* Clear OC4A on Compare Match */
TCCR4B = _BV(CS40); /* No prescaling => f = PCK/256 = 187500Hz */
OCR4A = 0;
/* Init a fast PWM on Timer4 */
TCCR4A = _BV(COM4A0) | _BV(PWM4A); /* Clear OC4A on Compare Match */
TCCR4B = _BV(CS40); /* No prescaling => f = PCK/256 = 187500Hz */
OCR4A = 0;
/* Enable the OC4A output */
DDRC |= _BV(PORTC6);
/* Enable the OC4A output */
DDRC |= _BV(PORTC6);
DISABLE_AUDIO_COUNTER_3_ISR; // Turn off 3A interputs
DISABLE_AUDIO_COUNTER_3_ISR; // Turn off 3A interputs
TCCR3A = 0x0; // Options not needed
TCCR3B = _BV(CS31) | _BV(CS30) | _BV(WGM32); // 64th prescaling and CTC
OCR3A = SAMPLE_DIVIDER - 1; // Correct count/compare, related to sample playback
TCCR3A = 0x0; // Options not needed
TCCR3B = _BV(CS31) | _BV(CS30) | _BV(WGM32); // 64th prescaling and CTC
OCR3A = SAMPLE_DIVIDER - 1; // Correct count/compare, related to sample playback
#else
#else
// Set port PC6 (OC3A and /OC4A) as output
DDRC |= _BV(PORTC6);
// Set port PC6 (OC3A and /OC4A) as output
DDRC |= _BV(PORTC6);
DISABLE_AUDIO_COUNTER_3_ISR;
DISABLE_AUDIO_COUNTER_3_ISR;
// TCCR3A / TCCR3B: Timer/Counter #3 Control Registers
// Compare Output Mode (COM3An) = 0b00 = Normal port operation, OC3A disconnected from PC6
// Waveform Generation Mode (WGM3n) = 0b1110 = Fast PWM Mode 14 (Period = ICR3, Duty Cycle = OCR3A)
// Clock Select (CS3n) = 0b010 = Clock / 8
TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
// TCCR3A / TCCR3B: Timer/Counter #3 Control Registers
// Compare Output Mode (COM3An) = 0b00 = Normal port operation, OC3A disconnected from PC6
// Waveform Generation Mode (WGM3n) = 0b1110 = Fast PWM Mode 14 (Period = ICR3, Duty Cycle = OCR3A)
// Clock Select (CS3n) = 0b010 = Clock / 8
TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
#endif
#endif
audio_initialized = true;
}
@ -165,62 +160,59 @@ void stop_all_notes() {
audio_init();
}
voices = 0;
#ifdef PWM_AUDIO
DISABLE_AUDIO_COUNTER_3_ISR;
#else
DISABLE_AUDIO_COUNTER_3_ISR;
DISABLE_AUDIO_COUNTER_3_OUTPUT;
#endif
#ifdef PWM_AUDIO
DISABLE_AUDIO_COUNTER_3_ISR;
#else
DISABLE_AUDIO_COUNTER_3_ISR;
DISABLE_AUDIO_COUNTER_3_OUTPUT;
#endif
playing_notes = false;
playing_note = false;
frequency = 0;
volume = 0;
playing_note = false;
frequency = 0;
volume = 0;
for (uint8_t i = 0; i < 8; i++)
{
for (uint8_t i = 0; i < 8; i++) {
frequencies[i] = 0;
volumes[i] = 0;
volumes[i] = 0;
}
}
void stop_note(float freq)
{
void stop_note(float freq) {
if (playing_note) {
if (!audio_initialized) {
audio_init();
}
#ifdef PWM_AUDIO
freq = freq / SAMPLE_RATE;
#endif
#ifdef PWM_AUDIO
freq = freq / SAMPLE_RATE;
#endif
for (int i = 7; i >= 0; i--) {
if (frequencies[i] == freq) {
frequencies[i] = 0;
volumes[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;
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 (voices < 0) voices = 0;
if (voice_place >= voices) {
voice_place = 0;
}
if (voices == 0) {
#ifdef PWM_AUDIO
DISABLE_AUDIO_COUNTER_3_ISR;
#else
DISABLE_AUDIO_COUNTER_3_ISR;
DISABLE_AUDIO_COUNTER_3_OUTPUT;
#endif
frequency = 0;
volume = 0;
#ifdef PWM_AUDIO
DISABLE_AUDIO_COUNTER_3_ISR;
#else
DISABLE_AUDIO_COUNTER_3_ISR;
DISABLE_AUDIO_COUNTER_3_OUTPUT;
#endif
frequency = 0;
volume = 0;
playing_note = false;
}
}
@ -228,126 +220,120 @@ void stop_note(float freq)
#ifdef VIBRATO_ENABLE
float mod(float a, int b)
{
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);
# 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
ISR(TIMER3_COMPA_vect)
{
ISR(TIMER3_COMPA_vect) {
if (playing_note) {
#ifdef PWM_AUDIO
if (voices == 1) {
#ifdef PWM_AUDIO
if (voices == 1) {
// SINE
OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 2;
// SQUARE
// if (((int)place) >= 1024){
// OCR4A = 0xFF >> 2;
// } else {
// OCR4A = 0x00;
// }
// SAWTOOTH
// OCR4A = (int)place / 4;
// TRIANGLE
// if (((int)place) >= 1024) {
// OCR4A = (int)place / 2;
// } else {
// OCR4A = 2048 - (int)place / 2;
// }
place += frequency;
if (place >= SINE_LENGTH) place -= SINE_LENGTH;
} else {
int sum = 0;
for (int i = 0; i < voices; i++) {
// SINE
OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 2;
sum += pgm_read_byte(&sinewave[(uint16_t)places[i]]) >> 2;
// SQUARE
// if (((int)place) >= 1024){
// OCR4A = 0xFF >> 2;
// if (((int)places[i]) >= 1024){
// sum += 0xFF >> 2;
// } else {
// OCR4A = 0x00;
// sum += 0x00;
// }
// SAWTOOTH
// OCR4A = (int)place / 4;
places[i] += frequencies[i];
// TRIANGLE
// if (((int)place) >= 1024) {
// OCR4A = (int)place / 2;
// } else {
// OCR4A = 2048 - (int)place / 2;
// }
place += frequency;
if (place >= SINE_LENGTH)
place -= SINE_LENGTH;
} else {
int sum = 0;
for (int i = 0; i < voices; i++) {
// SINE
sum += pgm_read_byte(&sinewave[(uint16_t)places[i]]) >> 2;
// SQUARE
// if (((int)places[i]) >= 1024){
// sum += 0xFF >> 2;
// } else {
// sum += 0x00;
// }
places[i] += frequencies[i];
if (places[i] >= SINE_LENGTH)
places[i] -= SINE_LENGTH;
}
OCR4A = sum;
if (places[i] >= SINE_LENGTH) places[i] -= SINE_LENGTH;
}
#else
if (voices > 0) {
float freq;
if (polyphony_rate > 0) {
if (voices > 1) {
voice_place %= voices;
if (place++ > (frequencies[voice_place] / polyphony_rate / CPU_PRESCALER)) {
voice_place = (voice_place + 1) % voices;
place = 0.0;
}
}
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(frequencies[voice_place]);
} else {
#else
{
#endif
freq = frequencies[voice_place];
OCR4A = sum;
}
#else
if (voices > 0) {
float freq;
if (polyphony_rate > 0) {
if (voices > 1) {
voice_place %= voices;
if (place++ > (frequencies[voice_place] / polyphony_rate / CPU_PRESCALER)) {
voice_place = (voice_place + 1) % voices;
place = 0.0;
}
}
# ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(frequencies[voice_place]);
} 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 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];
}
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(frequency);
} else {
#else
{
#endif
freq = frequency;
}
# else
{
# endif
freq = frequencies[voice_place];
}
} 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 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];
}
if (envelope_index < 65535) {
envelope_index++;
# ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(frequency);
} else {
# else
{
# endif
freq = frequency;
}
freq = voice_envelope(freq);
if (freq < 30.517578125)
freq = 30.52;
NOTE_PERIOD = (int)(((double)F_CPU) / (freq * CPU_PRESCALER)); // Set max to the period
NOTE_DUTY_CYCLE = (int)((((double)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); // Set compare to half the period
}
#endif
if (envelope_index < 65535) {
envelope_index++;
}
freq = voice_envelope(freq);
if (freq < 30.517578125) freq = 30.52;
NOTE_PERIOD = (int)(((double)F_CPU) / (freq * CPU_PRESCALER)); // Set max to the period
NOTE_DUTY_CYCLE = (int)((((double)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); // Set compare to half the period
}
#endif
}
// SAMPLE
@ -361,41 +347,38 @@ ISR(TIMER3_COMPA_vect)
// else
// DISABLE_AUDIO_COUNTER_3_ISR;
if (playing_notes) {
#ifdef PWM_AUDIO
OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 0;
#ifdef PWM_AUDIO
OCR4A = pgm_read_byte(&sinewave[(uint16_t)place]) >> 0;
place += note_frequency;
if (place >= SINE_LENGTH)
place -= SINE_LENGTH;
#else
if (note_frequency > 0) {
float freq;
place += note_frequency;
if (place >= SINE_LENGTH) place -= SINE_LENGTH;
#else
if (note_frequency > 0) {
float freq;
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(note_frequency);
} else {
#else
{
#endif
freq = note_frequency;
}
if (envelope_index < 65535) {
envelope_index++;
}
freq = voice_envelope(freq);
NOTE_PERIOD = (int)(((double)F_CPU) / (freq * CPU_PRESCALER)); // Set max to the period
NOTE_DUTY_CYCLE = (int)((((double)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); // Set compare to half the period
# ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(note_frequency);
} else {
NOTE_PERIOD = 0;
NOTE_DUTY_CYCLE = 0;
# else
{
# endif
freq = note_frequency;
}
#endif
if (envelope_index < 65535) {
envelope_index++;
}
freq = voice_envelope(freq);
NOTE_PERIOD = (int)(((double)F_CPU) / (freq * CPU_PRESCALER)); // Set max to the period
NOTE_DUTY_CYCLE = (int)((((double)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); // Set compare to half the period
} else {
NOTE_PERIOD = 0;
NOTE_DUTY_CYCLE = 0;
}
#endif
note_position++;
bool end_of_note = false;
@ -409,126 +392,116 @@ ISR(TIMER3_COMPA_vect)
if (notes_repeat) {
current_note = 0;
} else {
#ifdef PWM_AUDIO
DISABLE_AUDIO_COUNTER_3_ISR;
#else
DISABLE_AUDIO_COUNTER_3_ISR;
DISABLE_AUDIO_COUNTER_3_OUTPUT;
#endif
#ifdef PWM_AUDIO
DISABLE_AUDIO_COUNTER_3_ISR;
#else
DISABLE_AUDIO_COUNTER_3_ISR;
DISABLE_AUDIO_COUNTER_3_OUTPUT;
#endif
playing_notes = false;
return;
}
}
if (!note_resting && (notes_rest > 0)) {
note_resting = true;
note_resting = true;
note_frequency = 0;
note_length = notes_rest;
note_length = notes_rest;
current_note--;
} else {
note_resting = false;
#ifdef PWM_AUDIO
note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE;
note_length = (*notes_pointer)[current_note][1] * (((float)note_tempo) / 100);
#else
envelope_index = 0;
note_frequency = (*notes_pointer)[current_note][0];
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
#endif
#ifdef PWM_AUDIO
note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE;
note_length = (*notes_pointer)[current_note][1] * (((float)note_tempo) / 100);
#else
envelope_index = 0;
note_frequency = (*notes_pointer)[current_note][0];
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
#endif
}
note_position = 0;
}
}
if (!audio_config.enable) {
playing_notes = false;
playing_note = false;
playing_note = false;
}
}
void play_note(float freq, int vol) {
if (!audio_initialized) {
audio_init();
}
if (audio_config.enable && voices < 8) {
DISABLE_AUDIO_COUNTER_3_ISR;
if (audio_config.enable && voices < 8) {
DISABLE_AUDIO_COUNTER_3_ISR;
// Cancel notes if notes are playing
if (playing_notes)
stop_all_notes();
// Cancel notes if notes are playing
if (playing_notes) stop_all_notes();
playing_note = true;
playing_note = true;
envelope_index = 0;
envelope_index = 0;
#ifdef PWM_AUDIO
freq = freq / SAMPLE_RATE;
#endif
if (freq > 0) {
frequencies[voices] = freq;
volumes[voices] = vol;
voices++;
}
#ifdef PWM_AUDIO
ENABLE_AUDIO_COUNTER_3_ISR;
#else
ENABLE_AUDIO_COUNTER_3_ISR;
ENABLE_AUDIO_COUNTER_3_OUTPUT;
#endif
}
#ifdef PWM_AUDIO
freq = freq / SAMPLE_RATE;
#endif
if (freq > 0) {
frequencies[voices] = freq;
volumes[voices] = vol;
voices++;
}
#ifdef PWM_AUDIO
ENABLE_AUDIO_COUNTER_3_ISR;
#else
ENABLE_AUDIO_COUNTER_3_ISR;
ENABLE_AUDIO_COUNTER_3_OUTPUT;
#endif
}
}
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest)
{
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest) {
if (!audio_initialized) {
audio_init();
}
if (audio_config.enable) {
if (audio_config.enable) {
DISABLE_AUDIO_COUNTER_3_ISR;
DISABLE_AUDIO_COUNTER_3_ISR;
// Cancel note if a note is playing
if (playing_note) stop_all_notes();
// Cancel note if a note is playing
if (playing_note)
stop_all_notes();
playing_notes = true;
playing_notes = true;
notes_pointer = np;
notes_count = n_count;
notes_repeat = n_repeat;
notes_rest = n_rest;
notes_pointer = np;
notes_count = n_count;
notes_repeat = n_repeat;
notes_rest = n_rest;
place = 0;
current_note = 0;
place = 0;
current_note = 0;
#ifdef PWM_AUDIO
note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE;
note_length = (*notes_pointer)[current_note][1] * (((float)note_tempo) / 100);
#else
note_frequency = (*notes_pointer)[current_note][0];
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
#endif
note_position = 0;
#ifdef PWM_AUDIO
ENABLE_AUDIO_COUNTER_3_ISR;
#else
ENABLE_AUDIO_COUNTER_3_ISR;
ENABLE_AUDIO_COUNTER_3_OUTPUT;
#endif
}
#ifdef PWM_AUDIO
note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE;
note_length = (*notes_pointer)[current_note][1] * (((float)note_tempo) / 100);
#else
note_frequency = (*notes_pointer)[current_note][0];
note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
#endif
note_position = 0;
#ifdef PWM_AUDIO
ENABLE_AUDIO_COUNTER_3_ISR;
#else
ENABLE_AUDIO_COUNTER_3_ISR;
ENABLE_AUDIO_COUNTER_3_OUTPUT;
#endif
}
}
#ifdef PWM_AUDIO
void play_sample(uint8_t * s, uint16_t l, bool r) {
void play_sample(uint8_t* s, uint16_t l, bool r) {
if (!audio_initialized) {
audio_init();
}
@ -536,17 +509,16 @@ void play_sample(uint8_t * s, uint16_t l, bool r) {
if (audio_config.enable) {
DISABLE_AUDIO_COUNTER_3_ISR;
stop_all_notes();
place_int = 0;
sample = s;
place_int = 0;
sample = s;
sample_length = l;
repeat = r;
repeat = r;
ENABLE_AUDIO_COUNTER_3_ISR;
}
}
#endif
void audio_toggle(void) {
audio_config.enable ^= 1;
eeconfig_update_audio(audio_config.raw);
@ -566,73 +538,45 @@ void audio_off(void) {
// Vibrato rate functions
void set_vibrato_rate(float rate) {
vibrato_rate = rate;
}
void set_vibrato_rate(float rate) { vibrato_rate = rate; }
void increase_vibrato_rate(float change) {
vibrato_rate *= change;
}
void increase_vibrato_rate(float change) { vibrato_rate *= change; }
void decrease_vibrato_rate(float change) {
vibrato_rate /= change;
}
void decrease_vibrato_rate(float change) { vibrato_rate /= change; }
#ifdef VIBRATO_STRENGTH_ENABLE
# ifdef VIBRATO_STRENGTH_ENABLE
void set_vibrato_strength(float strength) {
vibrato_strength = strength;
}
void set_vibrato_strength(float strength) { vibrato_strength = strength; }
void increase_vibrato_strength(float change) {
vibrato_strength *= change;
}
void increase_vibrato_strength(float change) { vibrato_strength *= change; }
void decrease_vibrato_strength(float change) {
vibrato_strength /= change;
}
void decrease_vibrato_strength(float change) { vibrato_strength /= change; }
#endif /* VIBRATO_STRENGTH_ENABLE */
# endif /* VIBRATO_STRENGTH_ENABLE */
#endif /* VIBRATO_ENABLE */
// Polyphony functions
void set_polyphony_rate(float rate) {
polyphony_rate = rate;
}
void set_polyphony_rate(float rate) { polyphony_rate = rate; }
void enable_polyphony() {
polyphony_rate = 5;
}
void enable_polyphony() { polyphony_rate = 5; }
void disable_polyphony() {
polyphony_rate = 0;
}
void disable_polyphony() { polyphony_rate = 0; }
void increase_polyphony_rate(float change) {
polyphony_rate *= change;
}
void increase_polyphony_rate(float change) { polyphony_rate *= change; }
void decrease_polyphony_rate(float change) {
polyphony_rate /= change;
}
void decrease_polyphony_rate(float change) { polyphony_rate /= change; }
// Timbre function
void set_timbre(float timbre) {
note_timbre = timbre;
}
void set_timbre(float timbre) { note_timbre = timbre; }
// Tempo functions
void set_tempo(uint8_t tempo) {
note_tempo = tempo;
}
void set_tempo(uint8_t tempo) { note_tempo = tempo; }
void decrease_tempo(uint8_t tempo_change) {
note_tempo += tempo_change;
}
void decrease_tempo(uint8_t tempo_change) { note_tempo += tempo_change; }
void increase_tempo(uint8_t tempo_change) {
if (note_tempo - tempo_change < 10) {
@ -642,17 +586,10 @@ void increase_tempo(uint8_t tempo_change) {
}
}
//------------------------------------------------------------------------------
// Override these functions in your keymap file to play different tunes on
// startup and bootloader jump
__attribute__ ((weak))
void play_startup_tone()
{
}
__attribute__((weak)) void play_startup_tone() {}
__attribute__ ((weak))
void play_goodbye_tone()
{
}
__attribute__((weak)) void play_goodbye_tone() {}
//------------------------------------------------------------------------------

View file

@ -16,380 +16,12 @@
#include "luts.h"
const float vibrato_lut[VIBRATO_LUT_LENGTH] =
{
1.0022336811487,
1.0042529943610,
1.0058584256028,
1.0068905285205,
1.0072464122237,
1.0068905285205,
1.0058584256028,
1.0042529943610,
1.0022336811487,
1.0000000000000,
0.9977712970630,
0.9957650169978,
0.9941756956510,
0.9931566259436,
0.9928057204913,
0.9931566259436,
0.9941756956510,
0.9957650169978,
0.9977712970630,
1.0000000000000,
const float vibrato_lut[VIBRATO_LUT_LENGTH] = {
1.0022336811487, 1.0042529943610, 1.0058584256028, 1.0068905285205, 1.0072464122237, 1.0068905285205, 1.0058584256028, 1.0042529943610, 1.0022336811487, 1.0000000000000, 0.9977712970630, 0.9957650169978, 0.9941756956510, 0.9931566259436, 0.9928057204913, 0.9931566259436, 0.9941756956510, 0.9957650169978, 0.9977712970630, 1.0000000000000,
};
const uint16_t frequency_lut[FREQUENCY_LUT_LENGTH] =
{
0x8E0B,
0x8C02,
0x8A00,
0x8805,
0x8612,
0x8426,
0x8241,
0x8063,
0x7E8C,
0x7CBB,
0x7AF2,
0x792E,
0x7772,
0x75BB,
0x740B,
0x7261,
0x70BD,
0x6F20,
0x6D88,
0x6BF6,
0x6A69,
0x68E3,
0x6762,
0x65E6,
0x6470,
0x6300,
0x6194,
0x602E,
0x5ECD,
0x5D71,
0x5C1A,
0x5AC8,
0x597B,
0x5833,
0x56EF,
0x55B0,
0x5475,
0x533F,
0x520E,
0x50E1,
0x4FB8,
0x4E93,
0x4D73,
0x4C57,
0x4B3E,
0x4A2A,
0x491A,
0x480E,
0x4705,
0x4601,
0x4500,
0x4402,
0x4309,
0x4213,
0x4120,
0x4031,
0x3F46,
0x3E5D,
0x3D79,
0x3C97,
0x3BB9,
0x3ADD,
0x3A05,
0x3930,
0x385E,
0x3790,
0x36C4,
0x35FB,
0x3534,
0x3471,
0x33B1,
0x32F3,
0x3238,
0x3180,
0x30CA,
0x3017,
0x2F66,
0x2EB8,
0x2E0D,
0x2D64,
0x2CBD,
0x2C19,
0x2B77,
0x2AD8,
0x2A3A,
0x299F,
0x2907,
0x2870,
0x27DC,
0x2749,
0x26B9,
0x262B,
0x259F,
0x2515,
0x248D,
0x2407,
0x2382,
0x2300,
0x2280,
0x2201,
0x2184,
0x2109,
0x2090,
0x2018,
0x1FA3,
0x1F2E,
0x1EBC,
0x1E4B,
0x1DDC,
0x1D6E,
0x1D02,
0x1C98,
0x1C2F,
0x1BC8,
0x1B62,
0x1AFD,
0x1A9A,
0x1A38,
0x19D8,
0x1979,
0x191C,
0x18C0,
0x1865,
0x180B,
0x17B3,
0x175C,
0x1706,
0x16B2,
0x165E,
0x160C,
0x15BB,
0x156C,
0x151D,
0x14CF,
0x1483,
0x1438,
0x13EE,
0x13A4,
0x135C,
0x1315,
0x12CF,
0x128A,
0x1246,
0x1203,
0x11C1,
0x1180,
0x1140,
0x1100,
0x10C2,
0x1084,
0x1048,
0x100C,
0xFD1,
0xF97,
0xF5E,
0xF25,
0xEEE,
0xEB7,
0xE81,
0xE4C,
0xE17,
0xDE4,
0xDB1,
0xD7E,
0xD4D,
0xD1C,
0xCEC,
0xCBC,
0xC8E,
0xC60,
0xC32,
0xC05,
0xBD9,
0xBAE,
0xB83,
0xB59,
0xB2F,
0xB06,
0xADD,
0xAB6,
0xA8E,
0xA67,
0xA41,
0xA1C,
0x9F7,
0x9D2,
0x9AE,
0x98A,
0x967,
0x945,
0x923,
0x901,
0x8E0,
0x8C0,
0x8A0,
0x880,
0x861,
0x842,
0x824,
0x806,
0x7E8,
0x7CB,
0x7AF,
0x792,
0x777,
0x75B,
0x740,
0x726,
0x70B,
0x6F2,
0x6D8,
0x6BF,
0x6A6,
0x68E,
0x676,
0x65E,
0x647,
0x630,
0x619,
0x602,
0x5EC,
0x5D7,
0x5C1,
0x5AC,
0x597,
0x583,
0x56E,
0x55B,
0x547,
0x533,
0x520,
0x50E,
0x4FB,
0x4E9,
0x4D7,
0x4C5,
0x4B3,
0x4A2,
0x491,
0x480,
0x470,
0x460,
0x450,
0x440,
0x430,
0x421,
0x412,
0x403,
0x3F4,
0x3E5,
0x3D7,
0x3C9,
0x3BB,
0x3AD,
0x3A0,
0x393,
0x385,
0x379,
0x36C,
0x35F,
0x353,
0x347,
0x33B,
0x32F,
0x323,
0x318,
0x30C,
0x301,
0x2F6,
0x2EB,
0x2E0,
0x2D6,
0x2CB,
0x2C1,
0x2B7,
0x2AD,
0x2A3,
0x299,
0x290,
0x287,
0x27D,
0x274,
0x26B,
0x262,
0x259,
0x251,
0x248,
0x240,
0x238,
0x230,
0x228,
0x220,
0x218,
0x210,
0x209,
0x201,
0x1FA,
0x1F2,
0x1EB,
0x1E4,
0x1DD,
0x1D6,
0x1D0,
0x1C9,
0x1C2,
0x1BC,
0x1B6,
0x1AF,
0x1A9,
0x1A3,
0x19D,
0x197,
0x191,
0x18C,
0x186,
0x180,
0x17B,
0x175,
0x170,
0x16B,
0x165,
0x160,
0x15B,
0x156,
0x151,
0x14C,
0x148,
0x143,
0x13E,
0x13A,
0x135,
0x131,
0x12C,
0x128,
0x124,
0x120,
0x11C,
0x118,
0x114,
0x110,
0x10C,
0x108,
0x104,
0x100,
0xFD,
0xF9,
0xF5,
0xF2,
0xEE,
const uint16_t frequency_lut[FREQUENCY_LUT_LENGTH] = {
0x8E0B, 0x8C02, 0x8A00, 0x8805, 0x8612, 0x8426, 0x8241, 0x8063, 0x7E8C, 0x7CBB, 0x7AF2, 0x792E, 0x7772, 0x75BB, 0x740B, 0x7261, 0x70BD, 0x6F20, 0x6D88, 0x6BF6, 0x6A69, 0x68E3, 0x6762, 0x65E6, 0x6470, 0x6300, 0x6194, 0x602E, 0x5ECD, 0x5D71, 0x5C1A, 0x5AC8, 0x597B, 0x5833, 0x56EF, 0x55B0, 0x5475, 0x533F, 0x520E, 0x50E1, 0x4FB8, 0x4E93, 0x4D73, 0x4C57, 0x4B3E, 0x4A2A, 0x491A, 0x480E, 0x4705, 0x4601, 0x4500, 0x4402, 0x4309, 0x4213, 0x4120, 0x4031, 0x3F46, 0x3E5D, 0x3D79, 0x3C97, 0x3BB9, 0x3ADD, 0x3A05, 0x3930, 0x385E, 0x3790, 0x36C4, 0x35FB, 0x3534, 0x3471, 0x33B1, 0x32F3, 0x3238, 0x3180, 0x30CA, 0x3017, 0x2F66, 0x2EB8, 0x2E0D, 0x2D64, 0x2CBD, 0x2C19, 0x2B77, 0x2AD8, 0x2A3A, 0x299F, 0x2907, 0x2870, 0x27DC, 0x2749, 0x26B9, 0x262B, 0x259F, 0x2515, 0x248D, 0x2407, 0x2382, 0x2300, 0x2280, 0x2201, 0x2184, 0x2109, 0x2090, 0x2018, 0x1FA3, 0x1F2E, 0x1EBC, 0x1E4B, 0x1DDC, 0x1D6E, 0x1D02, 0x1C98, 0x1C2F, 0x1BC8, 0x1B62, 0x1AFD, 0x1A9A,
0x1A38, 0x19D8, 0x1979, 0x191C, 0x18C0, 0x1865, 0x180B, 0x17B3, 0x175C, 0x1706, 0x16B2, 0x165E, 0x160C, 0x15BB, 0x156C, 0x151D, 0x14CF, 0x1483, 0x1438, 0x13EE, 0x13A4, 0x135C, 0x1315, 0x12CF, 0x128A, 0x1246, 0x1203, 0x11C1, 0x1180, 0x1140, 0x1100, 0x10C2, 0x1084, 0x1048, 0x100C, 0xFD1, 0xF97, 0xF5E, 0xF25, 0xEEE, 0xEB7, 0xE81, 0xE4C, 0xE17, 0xDE4, 0xDB1, 0xD7E, 0xD4D, 0xD1C, 0xCEC, 0xCBC, 0xC8E, 0xC60, 0xC32, 0xC05, 0xBD9, 0xBAE, 0xB83, 0xB59, 0xB2F, 0xB06, 0xADD, 0xAB6, 0xA8E, 0xA67, 0xA41, 0xA1C, 0x9F7, 0x9D2, 0x9AE, 0x98A, 0x967, 0x945, 0x923, 0x901, 0x8E0, 0x8C0, 0x8A0, 0x880, 0x861, 0x842, 0x824, 0x806, 0x7E8, 0x7CB, 0x7AF, 0x792, 0x777, 0x75B, 0x740, 0x726, 0x70B, 0x6F2, 0x6D8, 0x6BF, 0x6A6, 0x68E, 0x676, 0x65E, 0x647, 0x630, 0x619, 0x602, 0x5EC, 0x5D7, 0x5C1, 0x5AC, 0x597, 0x583, 0x56E, 0x55B, 0x547, 0x533, 0x520, 0x50E, 0x4FB, 0x4E9,
0x4D7, 0x4C5, 0x4B3, 0x4A2, 0x491, 0x480, 0x470, 0x460, 0x450, 0x440, 0x430, 0x421, 0x412, 0x403, 0x3F4, 0x3E5, 0x3D7, 0x3C9, 0x3BB, 0x3AD, 0x3A0, 0x393, 0x385, 0x379, 0x36C, 0x35F, 0x353, 0x347, 0x33B, 0x32F, 0x323, 0x318, 0x30C, 0x301, 0x2F6, 0x2EB, 0x2E0, 0x2D6, 0x2CB, 0x2C1, 0x2B7, 0x2AD, 0x2A3, 0x299, 0x290, 0x287, 0x27D, 0x274, 0x26B, 0x262, 0x259, 0x251, 0x248, 0x240, 0x238, 0x230, 0x228, 0x220, 0x218, 0x210, 0x209, 0x201, 0x1FA, 0x1F2, 0x1EB, 0x1E4, 0x1DD, 0x1D6, 0x1D0, 0x1C9, 0x1C2, 0x1BC, 0x1B6, 0x1AF, 0x1A9, 0x1A3, 0x19D, 0x197, 0x191, 0x18C, 0x186, 0x180, 0x17B, 0x175, 0x170, 0x16B, 0x165, 0x160, 0x15B, 0x156, 0x151, 0x14C, 0x148, 0x143, 0x13E, 0x13A, 0x135, 0x131, 0x12C, 0x128, 0x124, 0x120, 0x11C, 0x118, 0x114, 0x110, 0x10C, 0x108, 0x104, 0x100, 0xFD, 0xF9, 0xF5, 0xF2, 0xEE,
};

View file

@ -15,22 +15,22 @@
*/
#if defined(__AVR__)
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
# include <avr/io.h>
# include <avr/interrupt.h>
# include <avr/pgmspace.h>
#else
#include "ch.h"
#include "hal.h"
# include "ch.h"
# include "hal.h"
#endif
#ifndef LUTS_H
#define LUTS_H
# define LUTS_H
#define VIBRATO_LUT_LENGTH 20
# define VIBRATO_LUT_LENGTH 20
#define FREQUENCY_LUT_LENGTH 349
# define FREQUENCY_LUT_LENGTH 349
extern const float vibrato_lut[VIBRATO_LUT_LENGTH];
extern const float vibrato_lut[VIBRATO_LUT_LENGTH];
extern const uint16_t frequency_lut[FREQUENCY_LUT_LENGTH];
#endif /* LUTS_H */

View file

@ -1,111 +1,56 @@
#include "muse.h"
enum {
MUSE_OFF,
MUSE_ON,
MUSE_C_1_2,
MUSE_C1,
MUSE_C2,
MUSE_C4,
MUSE_C8,
MUSE_C3,
MUSE_C6,
MUSE_B1,
MUSE_B2,
MUSE_B3,
MUSE_B4,
MUSE_B5,
MUSE_B6,
MUSE_B7,
MUSE_B8,
MUSE_B9,
MUSE_B10,
MUSE_B11,
MUSE_B12,
MUSE_B13,
MUSE_B14,
MUSE_B15,
MUSE_B16,
MUSE_B17,
MUSE_B18,
MUSE_B19,
MUSE_B20,
MUSE_B21,
MUSE_B22,
MUSE_B23,
MUSE_B24,
MUSE_B25,
MUSE_B26,
MUSE_B27,
MUSE_B28,
MUSE_B29,
MUSE_B30,
MUSE_B31
};
enum { MUSE_OFF, MUSE_ON, MUSE_C_1_2, MUSE_C1, MUSE_C2, MUSE_C4, MUSE_C8, MUSE_C3, MUSE_C6, MUSE_B1, MUSE_B2, MUSE_B3, MUSE_B4, MUSE_B5, MUSE_B6, MUSE_B7, MUSE_B8, MUSE_B9, MUSE_B10, MUSE_B11, MUSE_B12, MUSE_B13, MUSE_B14, MUSE_B15, MUSE_B16, MUSE_B17, MUSE_B18, MUSE_B19, MUSE_B20, MUSE_B21, MUSE_B22, MUSE_B23, MUSE_B24, MUSE_B25, MUSE_B26, MUSE_B27, MUSE_B28, MUSE_B29, MUSE_B30, MUSE_B31 };
bool number_of_ones_to_bool[16] = {
1, 0, 0, 1, 0, 1, 1, 0,
0, 1, 1, 0, 1, 0, 0, 1
};
bool number_of_ones_to_bool[16] = {1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1};
uint8_t muse_interval[4] = {MUSE_B7, MUSE_B19, MUSE_B3, MUSE_B28};
uint8_t muse_interval[4] = {MUSE_B7, MUSE_B19, MUSE_B3, MUSE_B28};
uint8_t muse_theme[4] = {MUSE_B8, MUSE_B23, MUSE_B18, MUSE_B17};
bool muse_timer_1bit = 0;
uint8_t muse_timer_2bit = 0;
uint8_t muse_timer_2bit_counter = 0;
uint8_t muse_timer_4bit = 0;
uint32_t muse_timer_31bit = 0;
bool muse_timer_1bit = 0;
uint8_t muse_timer_2bit = 0;
uint8_t muse_timer_2bit_counter = 0;
uint8_t muse_timer_4bit = 0;
uint32_t muse_timer_31bit = 0;
bool bit_for_value(uint8_t value) {
switch (value) {
case MUSE_OFF:
return 0;
case MUSE_ON:
return 1;
case MUSE_C_1_2:
return muse_timer_1bit;
case MUSE_C1:
return (muse_timer_4bit & 1);
case MUSE_C2:
return (muse_timer_4bit & 2);
case MUSE_C4:
return (muse_timer_4bit & 4);
case MUSE_C8:
return (muse_timer_4bit & 8);
case MUSE_C3:
return (muse_timer_2bit & 1);
case MUSE_C6:
return (muse_timer_2bit & 2);
default:
return muse_timer_31bit & (1UL << (value - MUSE_B1));
}
switch (value) {
case MUSE_OFF:
return 0;
case MUSE_ON:
return 1;
case MUSE_C_1_2:
return muse_timer_1bit;
case MUSE_C1:
return (muse_timer_4bit & 1);
case MUSE_C2:
return (muse_timer_4bit & 2);
case MUSE_C4:
return (muse_timer_4bit & 4);
case MUSE_C8:
return (muse_timer_4bit & 8);
case MUSE_C3:
return (muse_timer_2bit & 1);
case MUSE_C6:
return (muse_timer_2bit & 2);
default:
return muse_timer_31bit & (1UL << (value - MUSE_B1));
}
}
uint8_t muse_clock_pulse(void) {
bool top = number_of_ones_to_bool[bit_for_value(muse_theme[0]) + (bit_for_value(muse_theme[1]) << 1) + (bit_for_value(muse_theme[2]) << 2) + (bit_for_value(muse_theme[3]) << 3)];
bool top = number_of_ones_to_bool[
bit_for_value(muse_theme[0]) +
(bit_for_value(muse_theme[1]) << 1) +
(bit_for_value(muse_theme[2]) << 2) +
(bit_for_value(muse_theme[3]) << 3)
];
if (muse_timer_1bit == 0) {
if (muse_timer_2bit_counter == 0) {
muse_timer_2bit = (muse_timer_2bit + 1) % 4;
if (muse_timer_1bit == 0) {
if (muse_timer_2bit_counter == 0) {
muse_timer_2bit = (muse_timer_2bit + 1) % 4;
}
muse_timer_2bit_counter = (muse_timer_2bit_counter + 1) % 3;
muse_timer_4bit = (muse_timer_4bit + 1) % 16;
muse_timer_31bit = (muse_timer_31bit << 1) + top;
}
muse_timer_2bit_counter = (muse_timer_2bit_counter + 1) % 3;
muse_timer_4bit = (muse_timer_4bit + 1) % 16;
muse_timer_31bit = (muse_timer_31bit << 1) + top;
}
muse_timer_1bit = (muse_timer_1bit + 1) % 2;
return
bit_for_value(muse_interval[0]) +
(bit_for_value(muse_interval[1]) << 1) +
(bit_for_value(muse_interval[2]) << 2) +
(bit_for_value(muse_interval[3]) << 3);
muse_timer_1bit = (muse_timer_1bit + 1) % 2;
return bit_for_value(muse_interval[0]) + (bit_for_value(muse_interval[1]) << 1) + (bit_for_value(muse_interval[2]) << 2) + (bit_for_value(muse_interval[3]) << 3);
}

View file

@ -20,55 +20,55 @@
// Tempo Placeholder
#define TEMPO_DEFAULT 100
#define SONG(notes...) { notes }
#define SONG(notes...) \
{ notes }
// 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 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)
#define EIGHTH_DOT_NOTE(note) MUSICAL_NOTE(note, 8+4)
#define SIXTEENTH_DOT_NOTE(note) MUSICAL_NOTE(note, 4+2)
#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)
#define EIGHTH_DOT_NOTE(note) MUSICAL_NOTE(note, 8 + 4)
#define SIXTEENTH_DOT_NOTE(note) MUSICAL_NOTE(note, 4 + 2)
// 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)
#define ED_NOTE(n) EIGHTH_DOT_NOTE(n)
#define SD_NOTE(n) SIXTEENTH_DOT_NOTE(n)
#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)
#define ED_NOTE(n) EIGHTH_DOT_NOTE(n)
#define SD_NOTE(n) SIXTEENTH_DOT_NOTE(n)
// Note Timbre
// Changes how the notes sound
#define TIMBRE_12 0.125f
#define TIMBRE_25 0.250f
#define TIMBRE_50 0.500f
#define TIMBRE_75 0.750f
#define TIMBRE_DEFAULT TIMBRE_50
#define TIMBRE_12 0.125f
#define TIMBRE_25 0.250f
#define TIMBRE_50 0.500f
#define TIMBRE_75 0.750f
#define TIMBRE_DEFAULT TIMBRE_50
// Notes - # = Octave
#ifdef __arm__
#define NOTE_REST 1.00f
# define NOTE_REST 1.00f
#else
#define NOTE_REST 0.00f
# define NOTE_REST 0.00f
#endif
/* These notes are currently bugged
@ -97,91 +97,91 @@
#define NOTE_AS1 58.27f
*/
#define NOTE_B1 61.74f
#define NOTE_C2 65.41f
#define NOTE_CS2 69.30f
#define NOTE_D2 73.42f
#define NOTE_DS2 77.78f
#define NOTE_E2 82.41f
#define NOTE_F2 87.31f
#define NOTE_FS2 92.50f
#define NOTE_G2 98.00f
#define NOTE_GS2 103.83f
#define NOTE_A2 110.00f
#define NOTE_AS2 116.54f
#define NOTE_B2 123.47f
#define NOTE_C3 130.81f
#define NOTE_CS3 138.59f
#define NOTE_D3 146.83f
#define NOTE_DS3 155.56f
#define NOTE_E3 164.81f
#define NOTE_F3 174.61f
#define NOTE_FS3 185.00f
#define NOTE_G3 196.00f
#define NOTE_GS3 207.65f
#define NOTE_A3 220.00f
#define NOTE_AS3 233.08f
#define NOTE_B3 246.94f
#define NOTE_C4 261.63f
#define NOTE_CS4 277.18f
#define NOTE_D4 293.66f
#define NOTE_DS4 311.13f
#define NOTE_E4 329.63f
#define NOTE_F4 349.23f
#define NOTE_FS4 369.99f
#define NOTE_G4 392.00f
#define NOTE_GS4 415.30f
#define NOTE_A4 440.00f
#define NOTE_AS4 466.16f
#define NOTE_B4 493.88f
#define NOTE_C5 523.25f
#define NOTE_CS5 554.37f
#define NOTE_D5 587.33f
#define NOTE_DS5 622.25f
#define NOTE_E5 659.26f
#define NOTE_F5 698.46f
#define NOTE_FS5 739.99f
#define NOTE_G5 783.99f
#define NOTE_GS5 830.61f
#define NOTE_A5 880.00f
#define NOTE_AS5 932.33f
#define NOTE_B5 987.77f
#define NOTE_C6 1046.50f
#define NOTE_CS6 1108.73f
#define NOTE_D6 1174.66f
#define NOTE_DS6 1244.51f
#define NOTE_E6 1318.51f
#define NOTE_F6 1396.91f
#define NOTE_FS6 1479.98f
#define NOTE_G6 1567.98f
#define NOTE_GS6 1661.22f
#define NOTE_A6 1760.00f
#define NOTE_AS6 1864.66f
#define NOTE_B6 1975.53f
#define NOTE_C7 2093.00f
#define NOTE_CS7 2217.46f
#define NOTE_D7 2349.32f
#define NOTE_DS7 2489.02f
#define NOTE_E7 2637.02f
#define NOTE_F7 2793.83f
#define NOTE_FS7 2959.96f
#define NOTE_G7 3135.96f
#define NOTE_GS7 3322.44f
#define NOTE_A7 3520.00f
#define NOTE_AS7 3729.31f
#define NOTE_B7 3951.07f
#define NOTE_C8 4186.01f
#define NOTE_CS8 4434.92f
#define NOTE_D8 4698.64f
#define NOTE_DS8 4978.03f
#define NOTE_E8 5274.04f
#define NOTE_F8 5587.65f
#define NOTE_FS8 5919.91f
#define NOTE_G8 6271.93f
#define NOTE_GS8 6644.88f
#define NOTE_A8 7040.00f
#define NOTE_AS8 7458.62f
#define NOTE_B8 7902.13f
#define NOTE_B1 61.74f
#define NOTE_C2 65.41f
#define NOTE_CS2 69.30f
#define NOTE_D2 73.42f
#define NOTE_DS2 77.78f
#define NOTE_E2 82.41f
#define NOTE_F2 87.31f
#define NOTE_FS2 92.50f
#define NOTE_G2 98.00f
#define NOTE_GS2 103.83f
#define NOTE_A2 110.00f
#define NOTE_AS2 116.54f
#define NOTE_B2 123.47f
#define NOTE_C3 130.81f
#define NOTE_CS3 138.59f
#define NOTE_D3 146.83f
#define NOTE_DS3 155.56f
#define NOTE_E3 164.81f
#define NOTE_F3 174.61f
#define NOTE_FS3 185.00f
#define NOTE_G3 196.00f
#define NOTE_GS3 207.65f
#define NOTE_A3 220.00f
#define NOTE_AS3 233.08f
#define NOTE_B3 246.94f
#define NOTE_C4 261.63f
#define NOTE_CS4 277.18f
#define NOTE_D4 293.66f
#define NOTE_DS4 311.13f
#define NOTE_E4 329.63f
#define NOTE_F4 349.23f
#define NOTE_FS4 369.99f
#define NOTE_G4 392.00f
#define NOTE_GS4 415.30f
#define NOTE_A4 440.00f
#define NOTE_AS4 466.16f
#define NOTE_B4 493.88f
#define NOTE_C5 523.25f
#define NOTE_CS5 554.37f
#define NOTE_D5 587.33f
#define NOTE_DS5 622.25f
#define NOTE_E5 659.26f
#define NOTE_F5 698.46f
#define NOTE_FS5 739.99f
#define NOTE_G5 783.99f
#define NOTE_GS5 830.61f
#define NOTE_A5 880.00f
#define NOTE_AS5 932.33f
#define NOTE_B5 987.77f
#define NOTE_C6 1046.50f
#define NOTE_CS6 1108.73f
#define NOTE_D6 1174.66f
#define NOTE_DS6 1244.51f
#define NOTE_E6 1318.51f
#define NOTE_F6 1396.91f
#define NOTE_FS6 1479.98f
#define NOTE_G6 1567.98f
#define NOTE_GS6 1661.22f
#define NOTE_A6 1760.00f
#define NOTE_AS6 1864.66f
#define NOTE_B6 1975.53f
#define NOTE_C7 2093.00f
#define NOTE_CS7 2217.46f
#define NOTE_D7 2349.32f
#define NOTE_DS7 2489.02f
#define NOTE_E7 2637.02f
#define NOTE_F7 2793.83f
#define NOTE_FS7 2959.96f
#define NOTE_G7 3135.96f
#define NOTE_GS7 3322.44f
#define NOTE_A7 3520.00f
#define NOTE_AS7 3729.31f
#define NOTE_B7 3951.07f
#define NOTE_C8 4186.01f
#define NOTE_CS8 4434.92f
#define NOTE_D8 4698.64f
#define NOTE_DS8 4978.03f
#define NOTE_E8 5274.04f
#define NOTE_F8 5587.65f
#define NOTE_FS8 5919.91f
#define NOTE_G8 6271.93f
#define NOTE_GS8 6644.88f
#define NOTE_A8 7040.00f
#define NOTE_AS8 7458.62f
#define NOTE_B8 7902.13f
// Flat Aliases
#define NOTE_DF0 NOTE_CS0
@ -230,5 +230,4 @@
#define NOTE_AF8 NOTE_GS8
#define NOTE_BF8 NOTE_AS8
#endif

View file

@ -26,25 +26,15 @@
* 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),
#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 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 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)
#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)
/*
HD_NOTE(_G3), HD_NOTE(_E3), HD_NOTE(_C3), \
Q__NOTE(_E3), Q__NOTE(_C3), Q__NOTE(_G3), \
@ -56,258 +46,93 @@
Q__NOTE(_F3)
*/
#define STARTUP_SOUND \
E__NOTE(_E6), \
E__NOTE(_A6), \
ED_NOTE(_E7),
#define STARTUP_SOUND E__NOTE(_E6), E__NOTE(_A6), ED_NOTE(_E7),
#define GOODBYE_SOUND \
E__NOTE(_E7), \
E__NOTE(_A6), \
ED_NOTE(_E6),
#define GOODBYE_SOUND E__NOTE(_E7), E__NOTE(_A6), ED_NOTE(_E6),
#define PLANCK_SOUND \
ED_NOTE(_E7 ), \
E__NOTE(_CS7), \
E__NOTE(_E6 ), \
E__NOTE(_A6 ), \
M__NOTE(_CS7, 20),
#define PLANCK_SOUND ED_NOTE(_E7), E__NOTE(_CS7), E__NOTE(_E6), E__NOTE(_A6), M__NOTE(_CS7, 20),
#define PREONIC_SOUND \
M__NOTE(_B5, 20), \
E__NOTE(_B6), \
M__NOTE(_DS6, 20), \
E__NOTE(_B6),
#define PREONIC_SOUND M__NOTE(_B5, 20), E__NOTE(_B6), M__NOTE(_DS6, 20), E__NOTE(_B6),
#define QWERTY_SOUND \
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
Q__NOTE(_E7 ),
#define QWERTY_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), Q__NOTE(_E7),
#define COLEMAK_SOUND \
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
ED_NOTE(_E7 ), \
S__NOTE(_REST), \
ED_NOTE(_GS7 ),
#define COLEMAK_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), ED_NOTE(_E7), S__NOTE(_REST), ED_NOTE(_GS7),
#define DVORAK_SOUND \
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
E__NOTE(_E7 ), \
S__NOTE(_REST), \
E__NOTE(_FS7 ), \
S__NOTE(_REST), \
E__NOTE(_E7 ),
#define DVORAK_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), E__NOTE(_E7), S__NOTE(_REST), E__NOTE(_FS7), 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 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 ), \
S__NOTE(_REST), \
ED_NOTE(_E7 ), \
S__NOTE(_REST), \
ED_NOTE(_A7 ),
#define PLOVER_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), ED_NOTE(_E7), S__NOTE(_REST), ED_NOTE(_A7),
#define PLOVER_GOODBYE_SOUND \
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
S__NOTE(_REST), \
ED_NOTE(_A7 ), \
S__NOTE(_REST), \
ED_NOTE(_E7 ),
#define PLOVER_GOODBYE_SOUND E__NOTE(_GS6), E__NOTE(_A6), S__NOTE(_REST), ED_NOTE(_A7), S__NOTE(_REST), ED_NOTE(_E7),
#define MUSIC_ON_SOUND \
E__NOTE(_A5 ), \
E__NOTE(_B5 ), \
E__NOTE(_CS6), \
E__NOTE(_D6 ), \
E__NOTE(_E6 ), \
E__NOTE(_FS6), \
E__NOTE(_GS6), \
E__NOTE(_A6 ),
#define MUSIC_ON_SOUND E__NOTE(_A5), E__NOTE(_B5), E__NOTE(_CS6), E__NOTE(_D6), E__NOTE(_E6), E__NOTE(_FS6), E__NOTE(_GS6), E__NOTE(_A6),
#define AUDIO_ON_SOUND \
E__NOTE(_A5 ), \
E__NOTE(_A6 ),
#define AUDIO_ON_SOUND E__NOTE(_A5), E__NOTE(_A6),
#define AUDIO_OFF_SOUND \
E__NOTE(_A6 ), \
E__NOTE(_A5 ),
#define AUDIO_OFF_SOUND E__NOTE(_A6), E__NOTE(_A5),
#define MUSIC_SCALE_SOUND MUSIC_ON_SOUND
#define MUSIC_OFF_SOUND \
E__NOTE(_A6 ), \
E__NOTE(_GS6 ), \
E__NOTE(_FS6), \
E__NOTE(_E6 ), \
E__NOTE(_D6 ), \
E__NOTE(_CS6), \
E__NOTE(_B5), \
E__NOTE(_A5 ),
#define MUSIC_OFF_SOUND E__NOTE(_A6), E__NOTE(_GS6), E__NOTE(_FS6), E__NOTE(_E6), E__NOTE(_D6), E__NOTE(_CS6), E__NOTE(_B5), E__NOTE(_A5),
#define VOICE_CHANGE_SOUND \
Q__NOTE(_A5 ), \
Q__NOTE(_CS6), \
Q__NOTE(_E6 ), \
Q__NOTE(_A6 ),
#define VOICE_CHANGE_SOUND Q__NOTE(_A5), Q__NOTE(_CS6), Q__NOTE(_E6), Q__NOTE(_A6),
#define CHROMATIC_SOUND \
Q__NOTE(_A5 ), \
Q__NOTE(_AS5 ), \
Q__NOTE(_B5), \
Q__NOTE(_C6 ), \
Q__NOTE(_CS6 ),
#define CHROMATIC_SOUND Q__NOTE(_A5), Q__NOTE(_AS5), Q__NOTE(_B5), Q__NOTE(_C6), Q__NOTE(_CS6),
#define MAJOR_SOUND \
Q__NOTE(_A5 ), \
Q__NOTE(_B5 ), \
Q__NOTE(_CS6), \
Q__NOTE(_D6 ), \
Q__NOTE(_E6 ),
#define MAJOR_SOUND Q__NOTE(_A5), Q__NOTE(_B5), Q__NOTE(_CS6), Q__NOTE(_D6), Q__NOTE(_E6),
#define MINOR_SOUND \
Q__NOTE(_A5 ), \
Q__NOTE(_B5 ), \
Q__NOTE(_C6 ), \
Q__NOTE(_D6 ), \
Q__NOTE(_E6 ),
#define MINOR_SOUND Q__NOTE(_A5), Q__NOTE(_B5), Q__NOTE(_C6), Q__NOTE(_D6), Q__NOTE(_E6),
#define GUITAR_SOUND \
Q__NOTE(_E5 ), \
Q__NOTE(_A5), \
Q__NOTE(_D6 ), \
Q__NOTE(_G6 ),
#define GUITAR_SOUND Q__NOTE(_E5), Q__NOTE(_A5), Q__NOTE(_D6), Q__NOTE(_G6),
#define VIOLIN_SOUND \
Q__NOTE(_G5 ), \
Q__NOTE(_D6), \
Q__NOTE(_A6 ), \
Q__NOTE(_E7 ),
#define VIOLIN_SOUND Q__NOTE(_G5), Q__NOTE(_D6), Q__NOTE(_A6), Q__NOTE(_E7),
#define CAPS_LOCK_ON_SOUND \
E__NOTE(_A3), \
E__NOTE(_B3),
#define CAPS_LOCK_ON_SOUND E__NOTE(_A3), E__NOTE(_B3),
#define CAPS_LOCK_OFF_SOUND \
E__NOTE(_B3), \
E__NOTE(_A3),
#define CAPS_LOCK_OFF_SOUND E__NOTE(_B3), E__NOTE(_A3),
#define SCROLL_LOCK_ON_SOUND \
E__NOTE(_D4), \
E__NOTE(_E4),
#define SCROLL_LOCK_ON_SOUND E__NOTE(_D4), E__NOTE(_E4),
#define SCROLL_LOCK_OFF_SOUND \
E__NOTE(_E4), \
E__NOTE(_D4),
#define SCROLL_LOCK_OFF_SOUND E__NOTE(_E4), E__NOTE(_D4),
#define NUM_LOCK_ON_SOUND \
E__NOTE(_D5), \
E__NOTE(_E5),
#define NUM_LOCK_ON_SOUND E__NOTE(_D5), E__NOTE(_E5),
#define NUM_LOCK_OFF_SOUND \
E__NOTE(_E5), \
E__NOTE(_D5),
#define NUM_LOCK_OFF_SOUND E__NOTE(_E5), E__NOTE(_D5),
#define AG_NORM_SOUND \
E__NOTE(_A5), \
E__NOTE(_A5),
#define AG_NORM_SOUND E__NOTE(_A5), E__NOTE(_A5),
#define AG_SWAP_SOUND \
SD_NOTE(_B5), \
SD_NOTE(_A5), \
SD_NOTE(_B5), \
SD_NOTE(_A5),
#define AG_SWAP_SOUND SD_NOTE(_B5), SD_NOTE(_A5), SD_NOTE(_B5), SD_NOTE(_A5),
#define UNICODE_WINDOWS \
E__NOTE(_B5), \
S__NOTE(_E6),
#define UNICODE_WINDOWS E__NOTE(_B5), S__NOTE(_E6),
#define UNICODE_LINUX \
E__NOTE(_E6), \
S__NOTE(_B5),
#define TERMINAL_SOUND \
E__NOTE(_C5 )
#define UNICODE_LINUX E__NOTE(_E6), S__NOTE(_B5),
#define TERMINAL_SOUND E__NOTE(_C5)
/* 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 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),
/* 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 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),
/* 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 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),
/* Removed sounds
+ This list is here solely for compatibility, so that removed songs don't just break things

View file

@ -19,40 +19,33 @@
// these are imported from audio.c
extern uint16_t envelope_index;
extern float note_timbre;
extern float polyphony_rate;
extern bool glissando;
extern float note_timbre;
extern float polyphony_rate;
extern bool glissando;
voice_type voice = default_voice;
void set_voice(voice_type v) {
voice = v;
}
void set_voice(voice_type v) { voice = v; }
void voice_iterate() {
voice = (voice + 1) % number_of_voices;
}
void voice_iterate() { voice = (voice + 1) % number_of_voices; }
void voice_deiterate() {
voice = (voice - 1 + number_of_voices) % number_of_voices;
}
void voice_deiterate() { voice = (voice - 1 + number_of_voices) % number_of_voices; }
float voice_envelope(float frequency) {
// envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz
__attribute__ ((unused))
uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency));
__attribute__((unused)) uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency));
switch (voice) {
case default_voice:
glissando = false;
note_timbre = TIMBRE_50;
glissando = false;
note_timbre = TIMBRE_50;
polyphony_rate = 0;
break;
break;
#ifdef AUDIO_VOICES
#ifdef AUDIO_VOICES
case something:
glissando = false;
glissando = false;
polyphony_rate = 0;
switch (compensated_index) {
case 0 ... 9:
@ -74,25 +67,23 @@ float voice_envelope(float frequency) {
break;
case drums:
glissando = false;
glissando = false;
polyphony_rate = 0;
// switch (compensated_index) {
// case 0 ... 10:
// note_timbre = 0.5;
// break;
// case 11 ... 20:
// note_timbre = 0.5 * (21 - compensated_index) / 10;
// break;
// default:
// note_timbre = 0;
// break;
// }
// frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8);
// switch (compensated_index) {
// case 0 ... 10:
// note_timbre = 0.5;
// break;
// case 11 ... 20:
// note_timbre = 0.5 * (21 - compensated_index) / 10;
// break;
// default:
// note_timbre = 0;
// break;
// }
// frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8);
if (frequency < 80.0) {
} else if (frequency < 160.0) {
// Bass drum: 60 - 100 Hz
frequency = (rand() % (int)(40)) + 60;
switch (envelope_index) {
@ -108,8 +99,6 @@ float voice_envelope(float frequency) {
}
} else if (frequency < 320.0) {
// Snare drum: 1 - 2 KHz
frequency = (rand() % (int)(1000)) + 1000;
switch (envelope_index) {
@ -125,7 +114,6 @@ float voice_envelope(float frequency) {
}
} else if (frequency < 640.0) {
// Closed Hi-hat: 3 - 5 KHz
frequency = (rand() % (int)(2000)) + 3000;
switch (envelope_index) {
@ -141,7 +129,6 @@ float voice_envelope(float frequency) {
}
} else if (frequency < 1280.0) {
// Open Hi-hat: 3 - 5 KHz
frequency = (rand() % (int)(2000)) + 3000;
switch (envelope_index) {
@ -155,141 +142,138 @@ float voice_envelope(float frequency) {
note_timbre = 0;
break;
}
}
break;
case butts_fader:
glissando = true;
glissando = true;
polyphony_rate = 0;
switch (compensated_index) {
case 0 ... 9:
frequency = frequency / 4;
frequency = frequency / 4;
note_timbre = TIMBRE_12;
break;
break;
case 10 ... 19:
frequency = frequency / 2;
frequency = frequency / 2;
note_timbre = TIMBRE_12;
break;
break;
case 20 ... 200:
note_timbre = .125 - pow(((float)compensated_index - 20) / (200 - 20), 2)*.125;
break;
note_timbre = .125 - pow(((float)compensated_index - 20) / (200 - 20), 2) * .125;
break;
default:
note_timbre = 0;
break;
break;
}
break;
break;
// case octave_crunch:
// polyphony_rate = 0;
// switch (compensated_index) {
// case 0 ... 9:
// case 20 ... 24:
// case 30 ... 32:
// frequency = frequency / 2;
// note_timbre = TIMBRE_12;
// break;
// case octave_crunch:
// polyphony_rate = 0;
// switch (compensated_index) {
// case 0 ... 9:
// case 20 ... 24:
// case 30 ... 32:
// frequency = frequency / 2;
// note_timbre = TIMBRE_12;
// break;
// case 10 ... 19:
// case 25 ... 29:
// case 33 ... 35:
// frequency = frequency * 2;
// note_timbre = TIMBRE_12;
// break;
// case 10 ... 19:
// case 25 ... 29:
// case 33 ... 35:
// frequency = frequency * 2;
// note_timbre = TIMBRE_12;
// break;
// default:
// note_timbre = TIMBRE_12;
// break;
// }
// break;
// default:
// note_timbre = TIMBRE_12;
// break;
// }
// break;
case duty_osc:
// This slows the loop down a substantial amount, so higher notes may freeze
glissando = true;
glissando = true;
polyphony_rate = 0;
switch (compensated_index) {
default:
#define OCS_SPEED 10
#define OCS_AMP .25
# define OCS_SPEED 10
# define OCS_AMP .25
// sine wave is slow
// note_timbre = (sin((float)compensated_index/10000*OCS_SPEED) * OCS_AMP / 2) + .5;
// triangle wave is a bit faster
note_timbre = (float)abs((compensated_index*OCS_SPEED % 3000) - 1500) * ( OCS_AMP / 1500 ) + (1 - OCS_AMP) / 2;
break;
note_timbre = (float)abs((compensated_index * OCS_SPEED % 3000) - 1500) * (OCS_AMP / 1500) + (1 - OCS_AMP) / 2;
break;
}
break;
break;
case duty_octave_down:
glissando = true;
glissando = true;
polyphony_rate = 0;
note_timbre = (envelope_index % 2) * .125 + .375 * 2;
if ((envelope_index % 4) == 0)
note_timbre = 0.5;
if ((envelope_index % 8) == 0)
note_timbre = 0;
note_timbre = (envelope_index % 2) * .125 + .375 * 2;
if ((envelope_index % 4) == 0) note_timbre = 0.5;
if ((envelope_index % 8) == 0) note_timbre = 0;
break;
case delayed_vibrato:
glissando = true;
glissando = true;
polyphony_rate = 0;
note_timbre = TIMBRE_50;
#define VOICE_VIBRATO_DELAY 150
#define VOICE_VIBRATO_SPEED 50
note_timbre = TIMBRE_50;
# define VOICE_VIBRATO_DELAY 150
# define VOICE_VIBRATO_SPEED 50
switch (compensated_index) {
case 0 ... VOICE_VIBRATO_DELAY:
break;
default:
frequency = frequency * vibrato_lut[(int)fmod((((float)compensated_index - (VOICE_VIBRATO_DELAY + 1))/1000*VOICE_VIBRATO_SPEED), VIBRATO_LUT_LENGTH)];
frequency = frequency * vibrato_lut[(int)fmod((((float)compensated_index - (VOICE_VIBRATO_DELAY + 1)) / 1000 * VOICE_VIBRATO_SPEED), VIBRATO_LUT_LENGTH)];
break;
}
break;
// case delayed_vibrato_octave:
// polyphony_rate = 0;
// if ((envelope_index % 2) == 1) {
// note_timbre = 0.55;
// } else {
// note_timbre = 0.45;
// }
// #define VOICE_VIBRATO_DELAY 150
// #define VOICE_VIBRATO_SPEED 50
// switch (compensated_index) {
// case 0 ... VOICE_VIBRATO_DELAY:
// break;
// default:
// frequency = frequency * VIBRATO_LUT[(int)fmod((((float)compensated_index - (VOICE_VIBRATO_DELAY + 1))/1000*VOICE_VIBRATO_SPEED), VIBRATO_LUT_LENGTH)];
// break;
// }
// break;
// case duty_fifth_down:
// note_timbre = 0.5;
// if ((envelope_index % 3) == 0)
// note_timbre = 0.75;
// break;
// case duty_fourth_down:
// note_timbre = 0.0;
// if ((envelope_index % 12) == 0)
// note_timbre = 0.75;
// if (((envelope_index % 12) % 4) != 1)
// note_timbre = 0.75;
// break;
// case duty_third_down:
// note_timbre = 0.5;
// if ((envelope_index % 5) == 0)
// note_timbre = 0.75;
// break;
// case duty_fifth_third_down:
// note_timbre = 0.5;
// if ((envelope_index % 5) == 0)
// note_timbre = 0.75;
// if ((envelope_index % 3) == 0)
// note_timbre = 0.25;
// break;
// case delayed_vibrato_octave:
// polyphony_rate = 0;
// if ((envelope_index % 2) == 1) {
// note_timbre = 0.55;
// } else {
// note_timbre = 0.45;
// }
// #define VOICE_VIBRATO_DELAY 150
// #define VOICE_VIBRATO_SPEED 50
// switch (compensated_index) {
// case 0 ... VOICE_VIBRATO_DELAY:
// break;
// default:
// frequency = frequency * VIBRATO_LUT[(int)fmod((((float)compensated_index - (VOICE_VIBRATO_DELAY + 1))/1000*VOICE_VIBRATO_SPEED), VIBRATO_LUT_LENGTH)];
// break;
// }
// break;
// case duty_fifth_down:
// note_timbre = 0.5;
// if ((envelope_index % 3) == 0)
// note_timbre = 0.75;
// break;
// case duty_fourth_down:
// note_timbre = 0.0;
// if ((envelope_index % 12) == 0)
// note_timbre = 0.75;
// if (((envelope_index % 12) % 4) != 1)
// note_timbre = 0.75;
// break;
// case duty_third_down:
// note_timbre = 0.5;
// if ((envelope_index % 5) == 0)
// note_timbre = 0.75;
// break;
// case duty_fifth_third_down:
// note_timbre = 0.5;
// if ((envelope_index % 5) == 0)
// note_timbre = 0.75;
// if ((envelope_index % 3) == 0)
// note_timbre = 0.25;
// break;
#endif
#endif
default:
break;
default:
break;
}
return frequency;

View file

@ -16,19 +16,19 @@
#include <stdint.h>
#include <stdbool.h>
#if defined(__AVR__)
#include <avr/io.h>
# include <avr/io.h>
#endif
#include "wait.h"
#include "luts.h"
#ifndef VOICES_H
#define VOICES_H
# define VOICES_H
float voice_envelope(float frequency);
typedef enum {
default_voice,
#ifdef AUDIO_VOICES
# ifdef AUDIO_VOICES
something,
drums,
butts_fader,
@ -36,13 +36,13 @@ typedef enum {
duty_osc,
duty_octave_down,
delayed_vibrato,
// delayed_vibrato_octave,
// duty_fifth_down,
// duty_fourth_down,
// duty_third_down,
// duty_fifth_third_down,
#endif
number_of_voices // important that this is last
// delayed_vibrato_octave,
// duty_fifth_down,
// duty_fourth_down,
// duty_third_down,
// duty_fifth_third_down,
# endif
number_of_voices // important that this is last
} voice_type;
void set_voice(voice_type v);

View file

@ -20,262 +20,17 @@
#define SINE_LENGTH 2048
const uint8_t sinewave[] PROGMEM= //2048 values
{
0x80,0x80,0x80,0x81,0x81,0x81,0x82,0x82,
0x83,0x83,0x83,0x84,0x84,0x85,0x85,0x85,
0x86,0x86,0x87,0x87,0x87,0x88,0x88,0x88,
0x89,0x89,0x8a,0x8a,0x8a,0x8b,0x8b,0x8c,
0x8c,0x8c,0x8d,0x8d,0x8e,0x8e,0x8e,0x8f,
0x8f,0x8f,0x90,0x90,0x91,0x91,0x91,0x92,
0x92,0x93,0x93,0x93,0x94,0x94,0x95,0x95,
0x95,0x96,0x96,0x96,0x97,0x97,0x98,0x98,
0x98,0x99,0x99,0x9a,0x9a,0x9a,0x9b,0x9b,
0x9b,0x9c,0x9c,0x9d,0x9d,0x9d,0x9e,0x9e,
0x9e,0x9f,0x9f,0xa0,0xa0,0xa0,0xa1,0xa1,
0xa2,0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,
0xa5,0xa5,0xa5,0xa6,0xa6,0xa6,0xa7,0xa7,
0xa7,0xa8,0xa8,0xa9,0xa9,0xa9,0xaa,0xaa,
0xaa,0xab,0xab,0xac,0xac,0xac,0xad,0xad,
0xad,0xae,0xae,0xae,0xaf,0xaf,0xb0,0xb0,
0xb0,0xb1,0xb1,0xb1,0xb2,0xb2,0xb2,0xb3,
0xb3,0xb4,0xb4,0xb4,0xb5,0xb5,0xb5,0xb6,
0xb6,0xb6,0xb7,0xb7,0xb7,0xb8,0xb8,0xb8,
0xb9,0xb9,0xba,0xba,0xba,0xbb,0xbb,0xbb,
0xbc,0xbc,0xbc,0xbd,0xbd,0xbd,0xbe,0xbe,
0xbe,0xbf,0xbf,0xbf,0xc0,0xc0,0xc0,0xc1,
0xc1,0xc1,0xc2,0xc2,0xc2,0xc3,0xc3,0xc3,
0xc4,0xc4,0xc4,0xc5,0xc5,0xc5,0xc6,0xc6,
0xc6,0xc7,0xc7,0xc7,0xc8,0xc8,0xc8,0xc9,
0xc9,0xc9,0xca,0xca,0xca,0xcb,0xcb,0xcb,
0xcb,0xcc,0xcc,0xcc,0xcd,0xcd,0xcd,0xce,
0xce,0xce,0xcf,0xcf,0xcf,0xcf,0xd0,0xd0,
0xd0,0xd1,0xd1,0xd1,0xd2,0xd2,0xd2,0xd2,
0xd3,0xd3,0xd3,0xd4,0xd4,0xd4,0xd5,0xd5,
0xd5,0xd5,0xd6,0xd6,0xd6,0xd7,0xd7,0xd7,
0xd7,0xd8,0xd8,0xd8,0xd9,0xd9,0xd9,0xd9,
0xda,0xda,0xda,0xda,0xdb,0xdb,0xdb,0xdc,
0xdc,0xdc,0xdc,0xdd,0xdd,0xdd,0xdd,0xde,
0xde,0xde,0xde,0xdf,0xdf,0xdf,0xe0,0xe0,
0xe0,0xe0,0xe1,0xe1,0xe1,0xe1,0xe2,0xe2,
0xe2,0xe2,0xe3,0xe3,0xe3,0xe3,0xe4,0xe4,
0xe4,0xe4,0xe4,0xe5,0xe5,0xe5,0xe5,0xe6,
0xe6,0xe6,0xe6,0xe7,0xe7,0xe7,0xe7,0xe8,
0xe8,0xe8,0xe8,0xe8,0xe9,0xe9,0xe9,0xe9,
0xea,0xea,0xea,0xea,0xea,0xeb,0xeb,0xeb,
0xeb,0xeb,0xec,0xec,0xec,0xec,0xec,0xed,
0xed,0xed,0xed,0xed,0xee,0xee,0xee,0xee,
0xee,0xef,0xef,0xef,0xef,0xef,0xf0,0xf0,
0xf0,0xf0,0xf0,0xf0,0xf1,0xf1,0xf1,0xf1,
0xf1,0xf2,0xf2,0xf2,0xf2,0xf2,0xf2,0xf3,
0xf3,0xf3,0xf3,0xf3,0xf3,0xf4,0xf4,0xf4,
0xf4,0xf4,0xf4,0xf5,0xf5,0xf5,0xf5,0xf5,
0xf5,0xf5,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,
0xf6,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,
0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,
0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,
0xfa,0xfa,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,
0xfb,0xfb,0xfb,0xfb,0xfc,0xfc,0xfc,0xfc,
0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,
0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,
0xfe,0xfe,0xfe,0xfd,0xfd,0xfd,0xfd,0xfd,
0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,
0xfd,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,
0xfc,0xfc,0xfc,0xfc,0xfc,0xfb,0xfb,0xfb,
0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfa,
0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,0xfa,
0xfa,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9,
0xf9,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,
0xf8,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,
0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf6,0xf5,
0xf5,0xf5,0xf5,0xf5,0xf5,0xf5,0xf4,0xf4,
0xf4,0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf3,
0xf3,0xf3,0xf2,0xf2,0xf2,0xf2,0xf2,0xf2,
0xf1,0xf1,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,
0xf0,0xf0,0xf0,0xef,0xef,0xef,0xef,0xef,
0xee,0xee,0xee,0xee,0xee,0xed,0xed,0xed,
0xed,0xed,0xec,0xec,0xec,0xec,0xec,0xeb,
0xeb,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xea,
0xea,0xe9,0xe9,0xe9,0xe9,0xe8,0xe8,0xe8,
0xe8,0xe8,0xe7,0xe7,0xe7,0xe7,0xe6,0xe6,
0xe6,0xe6,0xe5,0xe5,0xe5,0xe5,0xe4,0xe4,
0xe4,0xe4,0xe4,0xe3,0xe3,0xe3,0xe3,0xe2,
0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe1,0xe0,
0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,
0xde,0xde,0xdd,0xdd,0xdd,0xdd,0xdc,0xdc,
0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,
0xda,0xd9,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8,
0xd7,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,
0xd5,0xd5,0xd5,0xd4,0xd4,0xd4,0xd3,0xd3,
0xd3,0xd2,0xd2,0xd2,0xd2,0xd1,0xd1,0xd1,
0xd0,0xd0,0xd0,0xcf,0xcf,0xcf,0xcf,0xce,
0xce,0xce,0xcd,0xcd,0xcd,0xcc,0xcc,0xcc,
0xcb,0xcb,0xcb,0xcb,0xca,0xca,0xca,0xc9,
0xc9,0xc9,0xc8,0xc8,0xc8,0xc7,0xc7,0xc7,
0xc6,0xc6,0xc6,0xc5,0xc5,0xc5,0xc4,0xc4,
0xc4,0xc3,0xc3,0xc3,0xc2,0xc2,0xc2,0xc1,
0xc1,0xc1,0xc0,0xc0,0xc0,0xbf,0xbf,0xbf,
0xbe,0xbe,0xbe,0xbd,0xbd,0xbd,0xbc,0xbc,
0xbc,0xbb,0xbb,0xbb,0xba,0xba,0xba,0xb9,
0xb9,0xb8,0xb8,0xb8,0xb7,0xb7,0xb7,0xb6,
0xb6,0xb6,0xb5,0xb5,0xb5,0xb4,0xb4,0xb4,
0xb3,0xb3,0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,
0xb0,0xb0,0xb0,0xaf,0xaf,0xae,0xae,0xae,
0xad,0xad,0xad,0xac,0xac,0xac,0xab,0xab,
0xaa,0xaa,0xaa,0xa9,0xa9,0xa9,0xa8,0xa8,
0xa7,0xa7,0xa7,0xa6,0xa6,0xa6,0xa5,0xa5,
0xa5,0xa4,0xa4,0xa3,0xa3,0xa3,0xa2,0xa2,
0xa2,0xa1,0xa1,0xa0,0xa0,0xa0,0x9f,0x9f,
0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0x9c,0x9c,
0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,0x99,0x99,
0x98,0x98,0x98,0x97,0x97,0x96,0x96,0x96,
0x95,0x95,0x95,0x94,0x94,0x93,0x93,0x93,
0x92,0x92,0x91,0x91,0x91,0x90,0x90,0x8f,
0x8f,0x8f,0x8e,0x8e,0x8e,0x8d,0x8d,0x8c,
0x8c,0x8c,0x8b,0x8b,0x8a,0x8a,0x8a,0x89,
0x89,0x88,0x88,0x88,0x87,0x87,0x87,0x86,
0x86,0x85,0x85,0x85,0x84,0x84,0x83,0x83,
0x83,0x82,0x82,0x81,0x81,0x81,0x80,0x80,
0x80,0x7f,0x7f,0x7e,0x7e,0x7e,0x7d,0x7d,
0x7c,0x7c,0x7c,0x7b,0x7b,0x7a,0x7a,0x7a,
0x79,0x79,0x78,0x78,0x78,0x77,0x77,0x77,
0x76,0x76,0x75,0x75,0x75,0x74,0x74,0x73,
0x73,0x73,0x72,0x72,0x71,0x71,0x71,0x70,
0x70,0x70,0x6f,0x6f,0x6e,0x6e,0x6e,0x6d,
0x6d,0x6c,0x6c,0x6c,0x6b,0x6b,0x6a,0x6a,
0x6a,0x69,0x69,0x69,0x68,0x68,0x67,0x67,
0x67,0x66,0x66,0x65,0x65,0x65,0x64,0x64,
0x64,0x63,0x63,0x62,0x62,0x62,0x61,0x61,
0x61,0x60,0x60,0x5f,0x5f,0x5f,0x5e,0x5e,
0x5d,0x5d,0x5d,0x5c,0x5c,0x5c,0x5b,0x5b,
0x5a,0x5a,0x5a,0x59,0x59,0x59,0x58,0x58,
0x58,0x57,0x57,0x56,0x56,0x56,0x55,0x55,
0x55,0x54,0x54,0x53,0x53,0x53,0x52,0x52,
0x52,0x51,0x51,0x51,0x50,0x50,0x4f,0x4f,
0x4f,0x4e,0x4e,0x4e,0x4d,0x4d,0x4d,0x4c,
0x4c,0x4b,0x4b,0x4b,0x4a,0x4a,0x4a,0x49,
0x49,0x49,0x48,0x48,0x48,0x47,0x47,0x47,
0x46,0x46,0x45,0x45,0x45,0x44,0x44,0x44,
0x43,0x43,0x43,0x42,0x42,0x42,0x41,0x41,
0x41,0x40,0x40,0x40,0x3f,0x3f,0x3f,0x3e,
0x3e,0x3e,0x3d,0x3d,0x3d,0x3c,0x3c,0x3c,
0x3b,0x3b,0x3b,0x3a,0x3a,0x3a,0x39,0x39,
0x39,0x38,0x38,0x38,0x37,0x37,0x37,0x36,
0x36,0x36,0x35,0x35,0x35,0x34,0x34,0x34,
0x34,0x33,0x33,0x33,0x32,0x32,0x32,0x31,
0x31,0x31,0x30,0x30,0x30,0x30,0x2f,0x2f,
0x2f,0x2e,0x2e,0x2e,0x2d,0x2d,0x2d,0x2d,
0x2c,0x2c,0x2c,0x2b,0x2b,0x2b,0x2a,0x2a,
0x2a,0x2a,0x29,0x29,0x29,0x28,0x28,0x28,
0x28,0x27,0x27,0x27,0x26,0x26,0x26,0x26,
0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x23,
0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x21,
0x21,0x21,0x21,0x20,0x20,0x20,0x1f,0x1f,
0x1f,0x1f,0x1e,0x1e,0x1e,0x1e,0x1d,0x1d,
0x1d,0x1d,0x1c,0x1c,0x1c,0x1c,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x1a,0x19,
0x19,0x19,0x19,0x18,0x18,0x18,0x18,0x17,
0x17,0x17,0x17,0x17,0x16,0x16,0x16,0x16,
0x15,0x15,0x15,0x15,0x15,0x14,0x14,0x14,
0x14,0x14,0x13,0x13,0x13,0x13,0x13,0x12,
0x12,0x12,0x12,0x12,0x11,0x11,0x11,0x11,
0x11,0x10,0x10,0x10,0x10,0x10,0xf,0xf,
0xf,0xf,0xf,0xf,0xe,0xe,0xe,0xe,
0xe,0xd,0xd,0xd,0xd,0xd,0xd,0xc,
0xc,0xc,0xc,0xc,0xc,0xb,0xb,0xb,
0xb,0xb,0xb,0xa,0xa,0xa,0xa,0xa,
0xa,0xa,0x9,0x9,0x9,0x9,0x9,0x9,
0x9,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
0x7,0x7,0x7,0x7,0x7,0x7,0x7,0x7,
0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,
0x5,0x5,0x4,0x4,0x4,0x4,0x4,0x4,
0x4,0x4,0x4,0x4,0x3,0x3,0x3,0x3,
0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
0x2,0x2,0x2,0x2,0x2,0x2,0x1,0x1,
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
0x1,0x1,0x1,0x1,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
0x1,0x1,0x1,0x2,0x2,0x2,0x2,0x2,
0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,
0x2,0x3,0x3,0x3,0x3,0x3,0x3,0x3,
0x3,0x3,0x3,0x3,0x3,0x4,0x4,0x4,
0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x5,
0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x5,
0x5,0x6,0x6,0x6,0x6,0x6,0x6,0x6,
0x6,0x7,0x7,0x7,0x7,0x7,0x7,0x7,
0x7,0x8,0x8,0x8,0x8,0x8,0x8,0x8,
0x9,0x9,0x9,0x9,0x9,0x9,0x9,0xa,
0xa,0xa,0xa,0xa,0xa,0xa,0xb,0xb,
0xb,0xb,0xb,0xb,0xc,0xc,0xc,0xc,
0xc,0xc,0xd,0xd,0xd,0xd,0xd,0xd,
0xe,0xe,0xe,0xe,0xe,0xf,0xf,0xf,
0xf,0xf,0xf,0x10,0x10,0x10,0x10,0x10,
0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x12,
0x12,0x12,0x13,0x13,0x13,0x13,0x13,0x14,
0x14,0x14,0x14,0x14,0x15,0x15,0x15,0x15,
0x15,0x16,0x16,0x16,0x16,0x17,0x17,0x17,
0x17,0x17,0x18,0x18,0x18,0x18,0x19,0x19,
0x19,0x19,0x1a,0x1a,0x1a,0x1a,0x1b,0x1b,
0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1c,0x1d,
0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1e,0x1f,
0x1f,0x1f,0x1f,0x20,0x20,0x20,0x21,0x21,
0x21,0x21,0x22,0x22,0x22,0x22,0x23,0x23,
0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x25,
0x25,0x26,0x26,0x26,0x26,0x27,0x27,0x27,
0x28,0x28,0x28,0x28,0x29,0x29,0x29,0x2a,
0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2c,0x2c,
0x2c,0x2d,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,
0x2f,0x2f,0x2f,0x30,0x30,0x30,0x30,0x31,
0x31,0x31,0x32,0x32,0x32,0x33,0x33,0x33,
0x34,0x34,0x34,0x34,0x35,0x35,0x35,0x36,
0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38,
0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3b,
0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3e,
0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40,
0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x43,
0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x46,
0x46,0x47,0x47,0x47,0x48,0x48,0x48,0x49,
0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,
0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,
0x4f,0x4f,0x4f,0x50,0x50,0x51,0x51,0x51,
0x52,0x52,0x52,0x53,0x53,0x53,0x54,0x54,
0x55,0x55,0x55,0x56,0x56,0x56,0x57,0x57,
0x58,0x58,0x58,0x59,0x59,0x59,0x5a,0x5a,
0x5a,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,
0x5d,0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x60,
0x61,0x61,0x61,0x62,0x62,0x62,0x63,0x63,
0x64,0x64,0x64,0x65,0x65,0x65,0x66,0x66,
0x67,0x67,0x67,0x68,0x68,0x69,0x69,0x69,
0x6a,0x6a,0x6a,0x6b,0x6b,0x6c,0x6c,0x6c,
0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x70,
0x70,0x70,0x71,0x71,0x71,0x72,0x72,0x73,
0x73,0x73,0x74,0x74,0x75,0x75,0x75,0x76,
0x76,0x77,0x77,0x77,0x78,0x78,0x78,0x79,
0x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c,
0x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f
};
const uint8_t sinewave[] PROGMEM = // 2048 values
{0x80, 0x80, 0x80, 0x81, 0x81, 0x81, 0x82, 0x82, 0x83, 0x83, 0x83, 0x84, 0x84, 0x85, 0x85, 0x85, 0x86, 0x86, 0x87, 0x87, 0x87, 0x88, 0x88, 0x88, 0x89, 0x89, 0x8a, 0x8a, 0x8a, 0x8b, 0x8b, 0x8c, 0x8c, 0x8c, 0x8d, 0x8d, 0x8e, 0x8e, 0x8e, 0x8f, 0x8f, 0x8f, 0x90, 0x90, 0x91, 0x91, 0x91, 0x92, 0x92, 0x93, 0x93, 0x93, 0x94, 0x94, 0x95, 0x95, 0x95, 0x96, 0x96, 0x96, 0x97, 0x97, 0x98, 0x98, 0x98, 0x99, 0x99, 0x9a, 0x9a, 0x9a, 0x9b, 0x9b, 0x9b, 0x9c, 0x9c, 0x9d, 0x9d, 0x9d, 0x9e, 0x9e, 0x9e, 0x9f, 0x9f, 0xa0, 0xa0, 0xa0, 0xa1, 0xa1, 0xa2, 0xa2, 0xa2, 0xa3, 0xa3, 0xa3, 0xa4, 0xa4, 0xa5, 0xa5, 0xa5, 0xa6, 0xa6, 0xa6, 0xa7, 0xa7, 0xa7, 0xa8, 0xa8, 0xa9, 0xa9, 0xa9, 0xaa, 0xaa, 0xaa, 0xab, 0xab, 0xac, 0xac, 0xac, 0xad, 0xad, 0xad, 0xae, 0xae, 0xae, 0xaf, 0xaf, 0xb0, 0xb0, 0xb0, 0xb1, 0xb1, 0xb1, 0xb2, 0xb2, 0xb2, 0xb3, 0xb3, 0xb4, 0xb4, 0xb4, 0xb5, 0xb5, 0xb5, 0xb6, 0xb6, 0xb6, 0xb7, 0xb7, 0xb7, 0xb8, 0xb8, 0xb8, 0xb9, 0xb9, 0xba, 0xba, 0xba, 0xbb,
0xbb, 0xbb, 0xbc, 0xbc, 0xbc, 0xbd, 0xbd, 0xbd, 0xbe, 0xbe, 0xbe, 0xbf, 0xbf, 0xbf, 0xc0, 0xc0, 0xc0, 0xc1, 0xc1, 0xc1, 0xc2, 0xc2, 0xc2, 0xc3, 0xc3, 0xc3, 0xc4, 0xc4, 0xc4, 0xc5, 0xc5, 0xc5, 0xc6, 0xc6, 0xc6, 0xc7, 0xc7, 0xc7, 0xc8, 0xc8, 0xc8, 0xc9, 0xc9, 0xc9, 0xca, 0xca, 0xca, 0xcb, 0xcb, 0xcb, 0xcb, 0xcc, 0xcc, 0xcc, 0xcd, 0xcd, 0xcd, 0xce, 0xce, 0xce, 0xcf, 0xcf, 0xcf, 0xcf, 0xd0, 0xd0, 0xd0, 0xd1, 0xd1, 0xd1, 0xd2, 0xd2, 0xd2, 0xd2, 0xd3, 0xd3, 0xd3, 0xd4, 0xd4, 0xd4, 0xd5, 0xd5, 0xd5, 0xd5, 0xd6, 0xd6, 0xd6, 0xd7, 0xd7, 0xd7, 0xd7, 0xd8, 0xd8, 0xd8, 0xd9, 0xd9, 0xd9, 0xd9, 0xda, 0xda, 0xda, 0xda, 0xdb, 0xdb, 0xdb, 0xdc, 0xdc, 0xdc, 0xdc, 0xdd, 0xdd, 0xdd, 0xdd, 0xde, 0xde, 0xde, 0xde, 0xdf, 0xdf, 0xdf, 0xe0, 0xe0, 0xe0, 0xe0, 0xe1, 0xe1, 0xe1, 0xe1, 0xe2, 0xe2, 0xe2, 0xe2, 0xe3, 0xe3, 0xe3, 0xe3, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe5, 0xe5, 0xe5, 0xe5, 0xe6, 0xe6, 0xe6, 0xe6, 0xe7, 0xe7, 0xe7, 0xe7, 0xe8, 0xe8, 0xe8, 0xe8, 0xe8,
0xe9, 0xe9, 0xe9, 0xe9, 0xea, 0xea, 0xea, 0xea, 0xea, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xec, 0xec, 0xec, 0xec, 0xec, 0xed, 0xed, 0xed, 0xed, 0xed, 0xee, 0xee, 0xee, 0xee, 0xee, 0xef, 0xef, 0xef, 0xef, 0xef, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf9, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7,
0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf6, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf5, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xef, 0xef, 0xef, 0xef, 0xef, 0xee, 0xee, 0xee, 0xee, 0xee, 0xed, 0xed, 0xed, 0xed, 0xed, 0xec, 0xec, 0xec, 0xec, 0xec, 0xeb, 0xeb, 0xeb, 0xeb, 0xeb, 0xea, 0xea, 0xea, 0xea, 0xea, 0xe9, 0xe9, 0xe9, 0xe9, 0xe8, 0xe8, 0xe8, 0xe8, 0xe8, 0xe7, 0xe7, 0xe7, 0xe7, 0xe6, 0xe6, 0xe6, 0xe6, 0xe5, 0xe5, 0xe5, 0xe5, 0xe4, 0xe4, 0xe4, 0xe4, 0xe4, 0xe3, 0xe3, 0xe3, 0xe3, 0xe2, 0xe2, 0xe2, 0xe2, 0xe1, 0xe1, 0xe1, 0xe1, 0xe0, 0xe0, 0xe0, 0xe0, 0xdf, 0xdf, 0xdf, 0xde, 0xde, 0xde, 0xde, 0xdd, 0xdd, 0xdd, 0xdd, 0xdc, 0xdc, 0xdc, 0xdc, 0xdb, 0xdb, 0xdb, 0xda, 0xda, 0xda, 0xda, 0xd9, 0xd9, 0xd9, 0xd9, 0xd8, 0xd8, 0xd8, 0xd7, 0xd7, 0xd7, 0xd7, 0xd6, 0xd6, 0xd6, 0xd5, 0xd5, 0xd5, 0xd5, 0xd4, 0xd4, 0xd4,
0xd3, 0xd3, 0xd3, 0xd2, 0xd2, 0xd2, 0xd2, 0xd1, 0xd1, 0xd1, 0xd0, 0xd0, 0xd0, 0xcf, 0xcf, 0xcf, 0xcf, 0xce, 0xce, 0xce, 0xcd, 0xcd, 0xcd, 0xcc, 0xcc, 0xcc, 0xcb, 0xcb, 0xcb, 0xcb, 0xca, 0xca, 0xca, 0xc9, 0xc9, 0xc9, 0xc8, 0xc8, 0xc8, 0xc7, 0xc7, 0xc7, 0xc6, 0xc6, 0xc6, 0xc5, 0xc5, 0xc5, 0xc4, 0xc4, 0xc4, 0xc3, 0xc3, 0xc3, 0xc2, 0xc2, 0xc2, 0xc1, 0xc1, 0xc1, 0xc0, 0xc0, 0xc0, 0xbf, 0xbf, 0xbf, 0xbe, 0xbe, 0xbe, 0xbd, 0xbd, 0xbd, 0xbc, 0xbc, 0xbc, 0xbb, 0xbb, 0xbb, 0xba, 0xba, 0xba, 0xb9, 0xb9, 0xb8, 0xb8, 0xb8, 0xb7, 0xb7, 0xb7, 0xb6, 0xb6, 0xb6, 0xb5, 0xb5, 0xb5, 0xb4, 0xb4, 0xb4, 0xb3, 0xb3, 0xb2, 0xb2, 0xb2, 0xb1, 0xb1, 0xb1, 0xb0, 0xb0, 0xb0, 0xaf, 0xaf, 0xae, 0xae, 0xae, 0xad, 0xad, 0xad, 0xac, 0xac, 0xac, 0xab, 0xab, 0xaa, 0xaa, 0xaa, 0xa9, 0xa9, 0xa9, 0xa8, 0xa8, 0xa7, 0xa7, 0xa7, 0xa6, 0xa6, 0xa6, 0xa5, 0xa5, 0xa5, 0xa4, 0xa4, 0xa3, 0xa3, 0xa3, 0xa2, 0xa2, 0xa2, 0xa1, 0xa1, 0xa0, 0xa0, 0xa0, 0x9f, 0x9f, 0x9e, 0x9e, 0x9e, 0x9d,
0x9d, 0x9d, 0x9c, 0x9c, 0x9b, 0x9b, 0x9b, 0x9a, 0x9a, 0x9a, 0x99, 0x99, 0x98, 0x98, 0x98, 0x97, 0x97, 0x96, 0x96, 0x96, 0x95, 0x95, 0x95, 0x94, 0x94, 0x93, 0x93, 0x93, 0x92, 0x92, 0x91, 0x91, 0x91, 0x90, 0x90, 0x8f, 0x8f, 0x8f, 0x8e, 0x8e, 0x8e, 0x8d, 0x8d, 0x8c, 0x8c, 0x8c, 0x8b, 0x8b, 0x8a, 0x8a, 0x8a, 0x89, 0x89, 0x88, 0x88, 0x88, 0x87, 0x87, 0x87, 0x86, 0x86, 0x85, 0x85, 0x85, 0x84, 0x84, 0x83, 0x83, 0x83, 0x82, 0x82, 0x81, 0x81, 0x81, 0x80, 0x80, 0x80, 0x7f, 0x7f, 0x7e, 0x7e, 0x7e, 0x7d, 0x7d, 0x7c, 0x7c, 0x7c, 0x7b, 0x7b, 0x7a, 0x7a, 0x7a, 0x79, 0x79, 0x78, 0x78, 0x78, 0x77, 0x77, 0x77, 0x76, 0x76, 0x75, 0x75, 0x75, 0x74, 0x74, 0x73, 0x73, 0x73, 0x72, 0x72, 0x71, 0x71, 0x71, 0x70, 0x70, 0x70, 0x6f, 0x6f, 0x6e, 0x6e, 0x6e, 0x6d, 0x6d, 0x6c, 0x6c, 0x6c, 0x6b, 0x6b, 0x6a, 0x6a, 0x6a, 0x69, 0x69, 0x69, 0x68, 0x68, 0x67, 0x67, 0x67, 0x66, 0x66, 0x65, 0x65, 0x65, 0x64, 0x64, 0x64, 0x63, 0x63, 0x62, 0x62, 0x62, 0x61, 0x61, 0x61, 0x60,
0x60, 0x5f, 0x5f, 0x5f, 0x5e, 0x5e, 0x5d, 0x5d, 0x5d, 0x5c, 0x5c, 0x5c, 0x5b, 0x5b, 0x5a, 0x5a, 0x5a, 0x59, 0x59, 0x59, 0x58, 0x58, 0x58, 0x57, 0x57, 0x56, 0x56, 0x56, 0x55, 0x55, 0x55, 0x54, 0x54, 0x53, 0x53, 0x53, 0x52, 0x52, 0x52, 0x51, 0x51, 0x51, 0x50, 0x50, 0x4f, 0x4f, 0x4f, 0x4e, 0x4e, 0x4e, 0x4d, 0x4d, 0x4d, 0x4c, 0x4c, 0x4b, 0x4b, 0x4b, 0x4a, 0x4a, 0x4a, 0x49, 0x49, 0x49, 0x48, 0x48, 0x48, 0x47, 0x47, 0x47, 0x46, 0x46, 0x45, 0x45, 0x45, 0x44, 0x44, 0x44, 0x43, 0x43, 0x43, 0x42, 0x42, 0x42, 0x41, 0x41, 0x41, 0x40, 0x40, 0x40, 0x3f, 0x3f, 0x3f, 0x3e, 0x3e, 0x3e, 0x3d, 0x3d, 0x3d, 0x3c, 0x3c, 0x3c, 0x3b, 0x3b, 0x3b, 0x3a, 0x3a, 0x3a, 0x39, 0x39, 0x39, 0x38, 0x38, 0x38, 0x37, 0x37, 0x37, 0x36, 0x36, 0x36, 0x35, 0x35, 0x35, 0x34, 0x34, 0x34, 0x34, 0x33, 0x33, 0x33, 0x32, 0x32, 0x32, 0x31, 0x31, 0x31, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x2f, 0x2f, 0x2e, 0x2e, 0x2e, 0x2d, 0x2d, 0x2d, 0x2d, 0x2c, 0x2c, 0x2c, 0x2b, 0x2b, 0x2b, 0x2a, 0x2a,
0x2a, 0x2a, 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x27, 0x27, 0x27, 0x26, 0x26, 0x26, 0x26, 0x25, 0x25, 0x25, 0x25, 0x24, 0x24, 0x24, 0x23, 0x23, 0x23, 0x23, 0x22, 0x22, 0x22, 0x22, 0x21, 0x21, 0x21, 0x21, 0x20, 0x20, 0x20, 0x1f, 0x1f, 0x1f, 0x1f, 0x1e, 0x1e, 0x1e, 0x1e, 0x1d, 0x1d, 0x1d, 0x1d, 0x1c, 0x1c, 0x1c, 0x1c, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1a, 0x1a, 0x1a, 0x1a, 0x19, 0x19, 0x19, 0x19, 0x18, 0x18, 0x18, 0x18, 0x17, 0x17, 0x17, 0x17, 0x17, 0x16, 0x16, 0x16, 0x16, 0x15, 0x15, 0x15, 0x15, 0x15, 0x14, 0x14, 0x14, 0x14, 0x14, 0x13, 0x13, 0x13, 0x13, 0x13, 0x12, 0x12, 0x12, 0x12, 0x12, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xe, 0xe, 0xe, 0xe, 0xe, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x8, 0x8, 0x8, 0x8, 0x8,
0x8, 0x8, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x4, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xb, 0xb, 0xb, 0xb, 0xb, 0xb, 0xc, 0xc, 0xc, 0xc, 0xc, 0xc, 0xd, 0xd, 0xd, 0xd, 0xd, 0xd, 0xe, 0xe, 0xe, 0xe, 0xe, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0x10, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x17,
0x18, 0x18, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 0x1a, 0x1a, 0x1a, 0x1a, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1c, 0x1c, 0x1c, 0x1c, 0x1d, 0x1d, 0x1d, 0x1d, 0x1e, 0x1e, 0x1e, 0x1e, 0x1f, 0x1f, 0x1f, 0x1f, 0x20, 0x20, 0x20, 0x21, 0x21, 0x21, 0x21, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23, 0x23, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x28, 0x28, 0x28, 0x28, 0x29, 0x29, 0x29, 0x2a, 0x2a, 0x2a, 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, 0x30, 0x30, 0x31, 0x31, 0x31, 0x32, 0x32, 0x32, 0x33, 0x33, 0x33, 0x34, 0x34, 0x34, 0x34, 0x35, 0x35, 0x35, 0x36, 0x36, 0x36, 0x37, 0x37, 0x37, 0x38, 0x38, 0x38, 0x39, 0x39, 0x39, 0x3a, 0x3a, 0x3a, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3d, 0x3d, 0x3d, 0x3e, 0x3e, 0x3e, 0x3f, 0x3f, 0x3f, 0x40, 0x40, 0x40, 0x41, 0x41, 0x41, 0x42, 0x42, 0x42, 0x43, 0x43, 0x43, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x46,
0x46, 0x47, 0x47, 0x47, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x4a, 0x4a, 0x4a, 0x4b, 0x4b, 0x4b, 0x4c, 0x4c, 0x4d, 0x4d, 0x4d, 0x4e, 0x4e, 0x4e, 0x4f, 0x4f, 0x4f, 0x50, 0x50, 0x51, 0x51, 0x51, 0x52, 0x52, 0x52, 0x53, 0x53, 0x53, 0x54, 0x54, 0x55, 0x55, 0x55, 0x56, 0x56, 0x56, 0x57, 0x57, 0x58, 0x58, 0x58, 0x59, 0x59, 0x59, 0x5a, 0x5a, 0x5a, 0x5b, 0x5b, 0x5c, 0x5c, 0x5c, 0x5d, 0x5d, 0x5d, 0x5e, 0x5e, 0x5f, 0x5f, 0x5f, 0x60, 0x60, 0x61, 0x61, 0x61, 0x62, 0x62, 0x62, 0x63, 0x63, 0x64, 0x64, 0x64, 0x65, 0x65, 0x65, 0x66, 0x66, 0x67, 0x67, 0x67, 0x68, 0x68, 0x69, 0x69, 0x69, 0x6a, 0x6a, 0x6a, 0x6b, 0x6b, 0x6c, 0x6c, 0x6c, 0x6d, 0x6d, 0x6e, 0x6e, 0x6e, 0x6f, 0x6f, 0x70, 0x70, 0x70, 0x71, 0x71, 0x71, 0x72, 0x72, 0x73, 0x73, 0x73, 0x74, 0x74, 0x75, 0x75, 0x75, 0x76, 0x76, 0x77, 0x77, 0x77, 0x78, 0x78, 0x78, 0x79, 0x79, 0x7a, 0x7a, 0x7a, 0x7b, 0x7b, 0x7c, 0x7c, 0x7c, 0x7d, 0x7d, 0x7e, 0x7e, 0x7e, 0x7f, 0x7f};

View file

@ -14,81 +14,76 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "color.h"
#include "led_tables.h"
#include "progmem.h"
RGB hsv_to_rgb( HSV hsv )
{
RGB rgb;
uint8_t region, remainder, p, q, t;
uint16_t h, s, v;
RGB hsv_to_rgb(HSV hsv) {
RGB rgb;
uint8_t region, remainder, p, q, t;
uint16_t h, s, v;
if ( hsv.s == 0 )
{
if (hsv.s == 0) {
#ifdef USE_CIE1931_CURVE
rgb.r = rgb.g = rgb.b = pgm_read_byte( &CIE1931_CURVE[hsv.v] );
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;
rgb.r = hsv.v;
rgb.g = hsv.v;
rgb.b = hsv.v;
#endif
return rgb;
}
return rgb;
}
h = hsv.h;
s = hsv.s;
v = hsv.v;
h = hsv.h;
s = hsv.s;
v = hsv.v;
region = h * 6 / 255;
remainder = (h * 2 - region * 85) * 3;
region = h * 6 / 255;
remainder = (h * 2 - region * 85) * 3;
p = (v * (255 - s)) >> 8;
q = (v * (255 - ((s * remainder) >> 8))) >> 8;
t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8;
p = (v * (255 - s)) >> 8;
q = (v * (255 - ((s * remainder) >> 8))) >> 8;
t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8;
switch ( region )
{
case 6:
case 0:
rgb.r = v;
rgb.g = t;
rgb.b = p;
break;
case 1:
rgb.r = q;
rgb.g = v;
rgb.b = p;
break;
case 2:
rgb.r = p;
rgb.g = v;
rgb.b = t;
break;
case 3:
rgb.r = p;
rgb.g = q;
rgb.b = v;
break;
case 4:
rgb.r = t;
rgb.g = p;
rgb.b = v;
break;
default:
rgb.r = v;
rgb.g = p;
rgb.b = q;
break;
}
switch (region) {
case 6:
case 0:
rgb.r = v;
rgb.g = t;
rgb.b = p;
break;
case 1:
rgb.r = q;
rgb.g = v;
rgb.b = p;
break;
case 2:
rgb.r = p;
rgb.g = v;
rgb.b = t;
break;
case 3:
rgb.r = p;
rgb.g = q;
rgb.b = v;
break;
case 4:
rgb.r = t;
rgb.g = p;
rgb.b = v;
break;
default:
rgb.r = v;
rgb.g = p;
rgb.b = q;
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] );
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;
return rgb;
}

View file

@ -14,60 +14,55 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COLOR_H
#define COLOR_H
#include <stdint.h>
#include <stdbool.h>
#if defined(__GNUC__)
#define PACKED __attribute__ ((__packed__))
# define PACKED __attribute__((__packed__))
#else
#define PACKED
# define PACKED
#endif
#if defined(_MSC_VER)
#pragma pack( push, 1 )
# pragma pack(push, 1)
#endif
#ifdef RGBW
#define LED_TYPE cRGBW
# define LED_TYPE cRGBW
#else
#define LED_TYPE RGB
# define LED_TYPE RGB
#endif
// WS2812 specific layout
typedef struct PACKED
{
uint8_t g;
uint8_t r;
uint8_t b;
typedef struct PACKED {
uint8_t g;
uint8_t r;
uint8_t b;
} cRGB;
typedef cRGB RGB;
// WS2812 specific layout
typedef struct PACKED
{
uint8_t g;
uint8_t r;
uint8_t b;
uint8_t w;
typedef struct PACKED {
uint8_t g;
uint8_t r;
uint8_t b;
uint8_t w;
} cRGBW;
typedef struct PACKED
{
uint8_t h;
uint8_t s;
uint8_t v;
typedef struct PACKED {
uint8_t h;
uint8_t s;
uint8_t v;
} HSV;
#if defined(_MSC_VER)
#pragma pack( pop )
# pragma pack(pop)
#endif
RGB hsv_to_rgb(HSV hsv);
#endif // COLOR_H
#endif // COLOR_H

View file

@ -17,294 +17,295 @@
#pragma once
/* diode directions */
#define COL2ROW 0
#define ROW2COL 1
#define COL2ROW 0
#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>
#endif
#define PORT_SHIFTER 4 // this may be 4 for all AVR chips
# ifndef __ASSEMBLER__
# include <avr/io.h>
# endif
# define PORT_SHIFTER 4 // this may be 4 for all AVR chips
// If you want to add more to this list, reference the PINx definitions in these header
// files: https://github.com/vancegroup-mirrors/avr-libc/tree/master/avr-libc/include/avr
// If you want to add more to this list, reference the PINx definitions in these header
// files: https://github.com/vancegroup-mirrors/avr-libc/tree/master/avr-libc/include/avr
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
#define ADDRESS_BASE 0x00
#define PINB_ADDRESS 0x3
#define PINC_ADDRESS 0x6
#define PIND_ADDRESS 0x9
#define PINE_ADDRESS 0xC
#define PINF_ADDRESS 0xF
#elif defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__)
#define ADDRESS_BASE 0x00
#define PINB_ADDRESS 0x3
#define PINC_ADDRESS 0x6
#define PIND_ADDRESS 0x9
#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__)
#define ADDRESS_BASE 0x00
#define PINA_ADDRESS 0x0
#define PINB_ADDRESS 0x3
#define PINC_ADDRESS 0x6
#define PIND_ADDRESS 0x9
#define PINE_ADDRESS 0xC
#define PINF_ADDRESS 0xF
#elif defined(__AVR_ATmega32A__)
#define ADDRESS_BASE 0x10
#define PIND_ADDRESS 0x0
#define PINC_ADDRESS 0x3
#define PINB_ADDRESS 0x6
#define PINA_ADDRESS 0x9
#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
# if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
# define ADDRESS_BASE 0x00
# define PINB_ADDRESS 0x3
# define PINC_ADDRESS 0x6
# define PIND_ADDRESS 0x9
# define PINE_ADDRESS 0xC
# define PINF_ADDRESS 0xF
# elif defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__)
# define ADDRESS_BASE 0x00
# define PINB_ADDRESS 0x3
# define PINC_ADDRESS 0x6
# define PIND_ADDRESS 0x9
# elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__)
# define ADDRESS_BASE 0x00
# define PINA_ADDRESS 0x0
# define PINB_ADDRESS 0x3
# define PINC_ADDRESS 0x6
# define PIND_ADDRESS 0x9
# define PINE_ADDRESS 0xC
# define PINF_ADDRESS 0xF
# elif defined(__AVR_ATmega32A__)
# define ADDRESS_BASE 0x10
# define PIND_ADDRESS 0x0
# define PINC_ADDRESS 0x3
# define PINB_ADDRESS 0x6
# define PINA_ADDRESS 0x9
# 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
/* I/O pins */
#define PINDEF(port, pin) ((PIN##port##_ADDRESS << PORT_SHIFTER) | pin)
/* I/O pins */
# define PINDEF(port, pin) ((PIN##port##_ADDRESS << PORT_SHIFTER) | pin)
#ifdef PORTA
#define A0 PINDEF(A, 0)
#define A1 PINDEF(A, 1)
#define A2 PINDEF(A, 2)
#define A3 PINDEF(A, 3)
#define A4 PINDEF(A, 4)
#define A5 PINDEF(A, 5)
#define A6 PINDEF(A, 6)
#define A7 PINDEF(A, 7)
#endif
#ifdef PORTB
#define B0 PINDEF(B, 0)
#define B1 PINDEF(B, 1)
#define B2 PINDEF(B, 2)
#define B3 PINDEF(B, 3)
#define B4 PINDEF(B, 4)
#define B5 PINDEF(B, 5)
#define B6 PINDEF(B, 6)
#define B7 PINDEF(B, 7)
#endif
#ifdef PORTC
#define C0 PINDEF(C, 0)
#define C1 PINDEF(C, 1)
#define C2 PINDEF(C, 2)
#define C3 PINDEF(C, 3)
#define C4 PINDEF(C, 4)
#define C5 PINDEF(C, 5)
#define C6 PINDEF(C, 6)
#define C7 PINDEF(C, 7)
#endif
#ifdef PORTD
#define D0 PINDEF(D, 0)
#define D1 PINDEF(D, 1)
#define D2 PINDEF(D, 2)
#define D3 PINDEF(D, 3)
#define D4 PINDEF(D, 4)
#define D5 PINDEF(D, 5)
#define D6 PINDEF(D, 6)
#define D7 PINDEF(D, 7)
#endif
#ifdef PORTE
#define E0 PINDEF(E, 0)
#define E1 PINDEF(E, 1)
#define E2 PINDEF(E, 2)
#define E3 PINDEF(E, 3)
#define E4 PINDEF(E, 4)
#define E5 PINDEF(E, 5)
#define E6 PINDEF(E, 6)
#define E7 PINDEF(E, 7)
#endif
#ifdef PORTF
#define F0 PINDEF(F, 0)
#define F1 PINDEF(F, 1)
#define F2 PINDEF(F, 2)
#define F3 PINDEF(F, 3)
#define F4 PINDEF(F, 4)
#define F5 PINDEF(F, 5)
#define F6 PINDEF(F, 6)
#define F7 PINDEF(F, 7)
#endif
# ifdef PORTA
# define A0 PINDEF(A, 0)
# define A1 PINDEF(A, 1)
# define A2 PINDEF(A, 2)
# define A3 PINDEF(A, 3)
# define A4 PINDEF(A, 4)
# define A5 PINDEF(A, 5)
# define A6 PINDEF(A, 6)
# define A7 PINDEF(A, 7)
# endif
# ifdef PORTB
# define B0 PINDEF(B, 0)
# define B1 PINDEF(B, 1)
# define B2 PINDEF(B, 2)
# define B3 PINDEF(B, 3)
# define B4 PINDEF(B, 4)
# define B5 PINDEF(B, 5)
# define B6 PINDEF(B, 6)
# define B7 PINDEF(B, 7)
# endif
# ifdef PORTC
# define C0 PINDEF(C, 0)
# define C1 PINDEF(C, 1)
# define C2 PINDEF(C, 2)
# define C3 PINDEF(C, 3)
# define C4 PINDEF(C, 4)
# define C5 PINDEF(C, 5)
# define C6 PINDEF(C, 6)
# define C7 PINDEF(C, 7)
# endif
# ifdef PORTD
# define D0 PINDEF(D, 0)
# define D1 PINDEF(D, 1)
# define D2 PINDEF(D, 2)
# define D3 PINDEF(D, 3)
# define D4 PINDEF(D, 4)
# define D5 PINDEF(D, 5)
# define D6 PINDEF(D, 6)
# define D7 PINDEF(D, 7)
# endif
# ifdef PORTE
# define E0 PINDEF(E, 0)
# define E1 PINDEF(E, 1)
# define E2 PINDEF(E, 2)
# define E3 PINDEF(E, 3)
# define E4 PINDEF(E, 4)
# define E5 PINDEF(E, 5)
# define E6 PINDEF(E, 6)
# define E7 PINDEF(E, 7)
# endif
# ifdef PORTF
# define F0 PINDEF(F, 0)
# define F1 PINDEF(F, 1)
# define F2 PINDEF(F, 2)
# define F3 PINDEF(F, 3)
# define F4 PINDEF(F, 4)
# define F5 PINDEF(F, 5)
# define F6 PINDEF(F, 6)
# define F7 PINDEF(F, 7)
# endif
#ifndef __ASSEMBLER__
#define _PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset)
// Port X Input Pins Address
#define PINx_ADDRESS(p) _PIN_ADDRESS(p, 0)
// Port X Data Direction Register, 0:input 1:output
#define DDRx_ADDRESS(p) _PIN_ADDRESS(p, 1)
// Port X Data Register
#define PORTx_ADDRESS(p) _PIN_ADDRESS(p, 2)
#endif
# ifndef __ASSEMBLER__
# define _PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset)
// Port X Input Pins Address
# define PINx_ADDRESS(p) _PIN_ADDRESS(p, 0)
// Port X Data Direction Register, 0:input 1:output
# define DDRx_ADDRESS(p) _PIN_ADDRESS(p, 1)
// Port X Data Register
# define PORTx_ADDRESS(p) _PIN_ADDRESS(p, 2)
# 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)
// 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)
// 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)
#define A3 PAL_LINE(GPIOA, 3)
#define A4 PAL_LINE(GPIOA, 4)
#define A5 PAL_LINE(GPIOA, 5)
#define A6 PAL_LINE(GPIOA, 6)
#define A7 PAL_LINE(GPIOA, 7)
#define A8 PAL_LINE(GPIOA, 8)
#define A9 PAL_LINE(GPIOA, 9)
#define A10 PAL_LINE(GPIOA, 10)
#define A11 PAL_LINE(GPIOA, 11)
#define A12 PAL_LINE(GPIOA, 12)
#define A13 PAL_LINE(GPIOA, 13)
#define A14 PAL_LINE(GPIOA, 14)
#define A15 PAL_LINE(GPIOA, 15)
#define B0 PAL_LINE(GPIOB, 0)
#define B1 PAL_LINE(GPIOB, 1)
#define B2 PAL_LINE(GPIOB, 2)
#define B3 PAL_LINE(GPIOB, 3)
#define B4 PAL_LINE(GPIOB, 4)
#define B5 PAL_LINE(GPIOB, 5)
#define B6 PAL_LINE(GPIOB, 6)
#define B7 PAL_LINE(GPIOB, 7)
#define B8 PAL_LINE(GPIOB, 8)
#define B9 PAL_LINE(GPIOB, 9)
#define B10 PAL_LINE(GPIOB, 10)
#define B11 PAL_LINE(GPIOB, 11)
#define B12 PAL_LINE(GPIOB, 12)
#define B13 PAL_LINE(GPIOB, 13)
#define B14 PAL_LINE(GPIOB, 14)
#define B15 PAL_LINE(GPIOB, 15)
#define 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)
#define C3 PAL_LINE(GPIOC, 3)
#define C4 PAL_LINE(GPIOC, 4)
#define C5 PAL_LINE(GPIOC, 5)
#define C6 PAL_LINE(GPIOC, 6)
#define C7 PAL_LINE(GPIOC, 7)
#define C8 PAL_LINE(GPIOC, 8)
#define C9 PAL_LINE(GPIOC, 9)
#define C10 PAL_LINE(GPIOC, 10)
#define C11 PAL_LINE(GPIOC, 11)
#define C12 PAL_LINE(GPIOC, 12)
#define C13 PAL_LINE(GPIOC, 13)
#define C14 PAL_LINE(GPIOC, 14)
#define C15 PAL_LINE(GPIOC, 15)
#define D0 PAL_LINE(GPIOD, 0)
#define D1 PAL_LINE(GPIOD, 1)
#define D2 PAL_LINE(GPIOD, 2)
#define D3 PAL_LINE(GPIOD, 3)
#define D4 PAL_LINE(GPIOD, 4)
#define D5 PAL_LINE(GPIOD, 5)
#define D6 PAL_LINE(GPIOD, 6)
#define D7 PAL_LINE(GPIOD, 7)
#define D8 PAL_LINE(GPIOD, 8)
#define D9 PAL_LINE(GPIOD, 9)
#define D10 PAL_LINE(GPIOD, 10)
#define D11 PAL_LINE(GPIOD, 11)
#define D12 PAL_LINE(GPIOD, 12)
#define D13 PAL_LINE(GPIOD, 13)
#define D14 PAL_LINE(GPIOD, 14)
#define D15 PAL_LINE(GPIOD, 15)
#define E0 PAL_LINE(GPIOE, 0)
#define E1 PAL_LINE(GPIOE, 1)
#define E2 PAL_LINE(GPIOE, 2)
#define E3 PAL_LINE(GPIOE, 3)
#define E4 PAL_LINE(GPIOE, 4)
#define E5 PAL_LINE(GPIOE, 5)
#define E6 PAL_LINE(GPIOE, 6)
#define E7 PAL_LINE(GPIOE, 7)
#define E8 PAL_LINE(GPIOE, 8)
#define E9 PAL_LINE(GPIOE, 9)
#define E10 PAL_LINE(GPIOE, 10)
#define E11 PAL_LINE(GPIOE, 11)
#define E12 PAL_LINE(GPIOE, 12)
#define E13 PAL_LINE(GPIOE, 13)
#define E14 PAL_LINE(GPIOE, 14)
#define E15 PAL_LINE(GPIOE, 15)
#define F0 PAL_LINE(GPIOF, 0)
#define F1 PAL_LINE(GPIOF, 1)
#define F2 PAL_LINE(GPIOF, 2)
#define F3 PAL_LINE(GPIOF, 3)
#define F4 PAL_LINE(GPIOF, 4)
#define F5 PAL_LINE(GPIOF, 5)
#define F6 PAL_LINE(GPIOF, 6)
#define F7 PAL_LINE(GPIOF, 7)
#define F8 PAL_LINE(GPIOF, 8)
#define F9 PAL_LINE(GPIOF, 9)
#define F10 PAL_LINE(GPIOF, 10)
#define F11 PAL_LINE(GPIOF, 11)
#define F12 PAL_LINE(GPIOF, 12)
#define F13 PAL_LINE(GPIOF, 13)
#define F14 PAL_LINE(GPIOF, 14)
#define F15 PAL_LINE(GPIOF, 15)
#endif
// 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)
# define A3 PAL_LINE(GPIOA, 3)
# define A4 PAL_LINE(GPIOA, 4)
# define A5 PAL_LINE(GPIOA, 5)
# define A6 PAL_LINE(GPIOA, 6)
# define A7 PAL_LINE(GPIOA, 7)
# define A8 PAL_LINE(GPIOA, 8)
# define A9 PAL_LINE(GPIOA, 9)
# define A10 PAL_LINE(GPIOA, 10)
# define A11 PAL_LINE(GPIOA, 11)
# define A12 PAL_LINE(GPIOA, 12)
# define A13 PAL_LINE(GPIOA, 13)
# define A14 PAL_LINE(GPIOA, 14)
# define A15 PAL_LINE(GPIOA, 15)
# define B0 PAL_LINE(GPIOB, 0)
# define B1 PAL_LINE(GPIOB, 1)
# define B2 PAL_LINE(GPIOB, 2)
# define B3 PAL_LINE(GPIOB, 3)
# define B4 PAL_LINE(GPIOB, 4)
# define B5 PAL_LINE(GPIOB, 5)
# define B6 PAL_LINE(GPIOB, 6)
# define B7 PAL_LINE(GPIOB, 7)
# define B8 PAL_LINE(GPIOB, 8)
# define B9 PAL_LINE(GPIOB, 9)
# define B10 PAL_LINE(GPIOB, 10)
# define B11 PAL_LINE(GPIOB, 11)
# define B12 PAL_LINE(GPIOB, 12)
# define B13 PAL_LINE(GPIOB, 13)
# define B14 PAL_LINE(GPIOB, 14)
# define B15 PAL_LINE(GPIOB, 15)
# define 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)
# define C3 PAL_LINE(GPIOC, 3)
# define C4 PAL_LINE(GPIOC, 4)
# define C5 PAL_LINE(GPIOC, 5)
# define C6 PAL_LINE(GPIOC, 6)
# define C7 PAL_LINE(GPIOC, 7)
# define C8 PAL_LINE(GPIOC, 8)
# define C9 PAL_LINE(GPIOC, 9)
# define C10 PAL_LINE(GPIOC, 10)
# define C11 PAL_LINE(GPIOC, 11)
# define C12 PAL_LINE(GPIOC, 12)
# define C13 PAL_LINE(GPIOC, 13)
# define C14 PAL_LINE(GPIOC, 14)
# define C15 PAL_LINE(GPIOC, 15)
# define D0 PAL_LINE(GPIOD, 0)
# define D1 PAL_LINE(GPIOD, 1)
# define D2 PAL_LINE(GPIOD, 2)
# define D3 PAL_LINE(GPIOD, 3)
# define D4 PAL_LINE(GPIOD, 4)
# define D5 PAL_LINE(GPIOD, 5)
# define D6 PAL_LINE(GPIOD, 6)
# define D7 PAL_LINE(GPIOD, 7)
# define D8 PAL_LINE(GPIOD, 8)
# define D9 PAL_LINE(GPIOD, 9)
# define D10 PAL_LINE(GPIOD, 10)
# define D11 PAL_LINE(GPIOD, 11)
# define D12 PAL_LINE(GPIOD, 12)
# define D13 PAL_LINE(GPIOD, 13)
# define D14 PAL_LINE(GPIOD, 14)
# define D15 PAL_LINE(GPIOD, 15)
# define E0 PAL_LINE(GPIOE, 0)
# define E1 PAL_LINE(GPIOE, 1)
# define E2 PAL_LINE(GPIOE, 2)
# define E3 PAL_LINE(GPIOE, 3)
# define E4 PAL_LINE(GPIOE, 4)
# define E5 PAL_LINE(GPIOE, 5)
# define E6 PAL_LINE(GPIOE, 6)
# define E7 PAL_LINE(GPIOE, 7)
# define E8 PAL_LINE(GPIOE, 8)
# define E9 PAL_LINE(GPIOE, 9)
# define E10 PAL_LINE(GPIOE, 10)
# define E11 PAL_LINE(GPIOE, 11)
# define E12 PAL_LINE(GPIOE, 12)
# define E13 PAL_LINE(GPIOE, 13)
# define E14 PAL_LINE(GPIOE, 14)
# define E15 PAL_LINE(GPIOE, 15)
# define F0 PAL_LINE(GPIOF, 0)
# define F1 PAL_LINE(GPIOF, 1)
# define F2 PAL_LINE(GPIOF, 2)
# define F3 PAL_LINE(GPIOF, 3)
# define F4 PAL_LINE(GPIOF, 4)
# define F5 PAL_LINE(GPIOF, 5)
# define F6 PAL_LINE(GPIOF, 6)
# define F7 PAL_LINE(GPIOF, 7)
# define F8 PAL_LINE(GPIOF, 8)
# define F9 PAL_LINE(GPIOF, 9)
# define F10 PAL_LINE(GPIOF, 10)
# define F11 PAL_LINE(GPIOF, 11)
# define F12 PAL_LINE(GPIOF, 12)
# define F13 PAL_LINE(GPIOF, 13)
# define F14 PAL_LINE(GPIOF, 14)
# define F15 PAL_LINE(GPIOF, 15)
# endif
#endif
/* USART configuration */
#ifdef BLUETOOTH_ENABLE
# ifdef __AVR_ATmega32U4__
# define SERIAL_UART_BAUD 9600
# define SERIAL_UART_DATA UDR1
# define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
# define SERIAL_UART_RXD_VECT USART1_RX_vect
# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
# define SERIAL_UART_INIT() do { \
/* baud rate */ \
UBRR1L = SERIAL_UART_UBRR; \
/* baud rate */ \
UBRR1H = SERIAL_UART_UBRR >> 8; \
/* enable TX */ \
UCSR1B = _BV(TXEN1); \
/* 8-bit data */ \
UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
sei(); \
} while(0)
# else
# error "USART configuration is needed."
# endif
# ifdef __AVR_ATmega32U4__
# define SERIAL_UART_BAUD 9600
# define SERIAL_UART_DATA UDR1
# define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
# define SERIAL_UART_RXD_VECT USART1_RX_vect
# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
# define SERIAL_UART_INIT() \
do { \
/* baud rate */ \
UBRR1L = SERIAL_UART_UBRR; \
/* baud rate */ \
UBRR1H = SERIAL_UART_UBRR >> 8; \
/* enable TX */ \
UCSR1B = _BV(TXEN1); \
/* 8-bit data */ \
UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
sei(); \
} while (0)
# else
# error "USART configuration is needed."
# endif
#endif
#define API_SYSEX_MAX_SIZE 32

View file

@ -24,15 +24,15 @@ No further inputs are accepted until DEBOUNCE milliseconds have occurred.
#include <stdlib.h>
#ifndef DEBOUNCE
# define DEBOUNCE 5
# define DEBOUNCE 5
#endif
#if (MATRIX_COLS <= 8)
# define ROW_SHIFTER ((uint8_t)1)
# define ROW_SHIFTER ((uint8_t)1)
#elif (MATRIX_COLS <= 16)
# define ROW_SHIFTER ((uint16_t)1)
# define ROW_SHIFTER ((uint16_t)1)
#elif (MATRIX_COLS <= 32)
# define ROW_SHIFTER ((uint32_t)1)
# define ROW_SHIFTER ((uint32_t)1)
#endif
#define debounce_counter_t uint8_t
@ -49,66 +49,66 @@ void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t n
// 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;
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);
}
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 (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;
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++;
}
}
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;
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++;
}
}
debounce_pointer++;
cooked[row] = existing_row;
}
cooked[row] = existing_row;
}
}
bool debounce_active(void) { return true; }

View file

@ -24,11 +24,11 @@ No further inputs are accepted until DEBOUNCE milliseconds have occurred.
#include <stdlib.h>
#ifndef DEBOUNCE
# define DEBOUNCE 5
# define DEBOUNCE 5
#endif
#define debounce_counter_t uint8_t
static bool matrix_need_update;
static bool matrix_need_update;
static debounce_counter_t *debounce_counters;
static bool counters_need_update;
@ -41,60 +41,60 @@ void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t n
// 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;
}
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);
}
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 (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;
}
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++;
}
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];
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;
}
// 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++;
}
debounce_pointer++;
}
}
bool debounce_active(void) { return true; }

View file

@ -20,38 +20,33 @@ When no state changes have occured for DEBOUNCE milliseconds, we push the state.
#include "timer.h"
#include "quantum.h"
#ifndef DEBOUNCE
#define DEBOUNCE 5
# define DEBOUNCE 5
#endif
void debounce_init(uint8_t num_rows) {}
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];
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;
}
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];
}
#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;
}
bool debounce_active(void) { return debouncing; }

View file

@ -15,224 +15,198 @@
*/
#include "config.h"
#include "keymap.h" // to get keymaps[][][]
#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 "progmem.h" // to read default from flash
#include "quantum.h" // for send_string()
#include "dynamic_keymap.h"
#ifdef DYNAMIC_KEYMAP_ENABLE
#ifndef DYNAMIC_KEYMAP_EEPROM_ADDR
#error DYNAMIC_KEYMAP_EEPROM_ADDR not defined
#endif
# ifndef DYNAMIC_KEYMAP_EEPROM_ADDR
# error DYNAMIC_KEYMAP_EEPROM_ADDR not defined
# endif
#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
#error DYNAMIC_KEYMAP_LAYER_COUNT not defined
#endif
# ifndef DYNAMIC_KEYMAP_LAYER_COUNT
# 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_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_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
# 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;
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
return ((void *)DYNAMIC_KEYMAP_EEPROM_ADDR) + (layer * MATRIX_ROWS * MATRIX_COLS * 2) + (row * MATRIX_COLS * 2) + (column * 2);
}
void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column)
{
// TODO: optimize this with some left shifts
return ((void*)DYNAMIC_KEYMAP_EEPROM_ADDR) + ( layer * MATRIX_ROWS * MATRIX_COLS * 2 ) +
( row * MATRIX_COLS * 2 ) + ( column * 2 );
uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column) {
void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column);
// Big endian, so we can read/write EEPROM directly from host if we want
uint16_t keycode = eeprom_read_byte(address) << 8;
keycode |= eeprom_read_byte(address + 1);
return keycode;
}
uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column)
{
void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column);
// Big endian, so we can read/write EEPROM directly from host if we want
uint16_t keycode = eeprom_read_byte(address) << 8;
keycode |= eeprom_read_byte(address + 1);
return keycode;
void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) {
void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column);
// Big endian, so we can read/write EEPROM directly from host if we want
eeprom_update_byte(address, (uint8_t)(keycode >> 8));
eeprom_update_byte(address + 1, (uint8_t)(keycode & 0xFF));
}
void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode)
{
void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column);
// Big endian, so we can read/write EEPROM directly from host if we want
eeprom_update_byte(address, (uint8_t)(keycode >> 8));
eeprom_update_byte(address+1, (uint8_t)(keycode & 0xFF));
void dynamic_keymap_reset(void) {
// Reset the keymaps in EEPROM to what is in flash.
// All keyboards using dynamic keymaps should define a layout
// for the same number of layers as DYNAMIC_KEYMAP_LAYER_COUNT.
for (int layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++) {
for (int row = 0; row < MATRIX_ROWS; row++) {
for (int column = 0; column < MATRIX_COLS; column++) {
dynamic_keymap_set_keycode(layer, row, column, pgm_read_word(&keymaps[layer][row][column]));
}
}
}
}
void dynamic_keymap_reset(void)
{
// Reset the keymaps in EEPROM to what is in flash.
// All keyboards using dynamic keymaps should define a layout
// for the same number of layers as DYNAMIC_KEYMAP_LAYER_COUNT.
for ( int layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++ ) {
for ( int row = 0; row < MATRIX_ROWS; row++ ) {
for ( int column = 0; column < MATRIX_COLS; column++ ) {
dynamic_keymap_set_keycode(layer, row, column, pgm_read_word(&keymaps[layer][row][column]));
}
}
}
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_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++;
}
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)
{
if ( layer < DYNAMIC_KEYMAP_LAYER_COUNT &&
key.row < MATRIX_ROWS &&
key.col < MATRIX_COLS ) {
return dynamic_keymap_get_keycode(layer, key.row, key.col);
} else {
return KC_NO;
}
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
if (layer < DYNAMIC_KEYMAP_LAYER_COUNT && key.row < MATRIX_ROWS && key.col < MATRIX_COLS) {
return dynamic_keymap_get_keycode(layer, key.row, key.col);
} else {
return KC_NO;
}
}
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; }
uint8_t dynamic_keymap_macro_get_count(void)
{
return DYNAMIC_KEYMAP_MACRO_COUNT;
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++;
}
}
uint16_t dynamic_keymap_macro_get_buffer_size(void)
{
return DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE;
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_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_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_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_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);
}
}
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
#endif // DYNAMIC_KEYMAP_ENABLE

View file

@ -18,11 +18,11 @@
#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);
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);
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
@ -31,14 +31,12 @@ void dynamic_keymap_reset(void);
// 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 );
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,
@ -53,11 +51,10 @@ void dynamic_keymap_set_buffer( uint16_t offset, uint16_t size, uint8_t *data );
// and it not being null means the buffer can be considered in an
// invalid state.
uint8_t dynamic_keymap_macro_get_count(void);
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 );
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);

View file

@ -30,7 +30,7 @@
* there have been reports of it being too much in some users' cases,
* so 128 is considered a safe default.
*/
#define DYNAMIC_MACRO_SIZE 128
# define DYNAMIC_MACRO_SIZE 128
#endif
/* DYNAMIC_MACRO_RANGE must be set as the last element of user's
@ -46,8 +46,7 @@ enum dynamic_macro_keycodes {
};
/* Blink the LEDs to notify the user about some event. */
void dynamic_macro_led_blink(void)
{
void dynamic_macro_led_blink(void) {
#ifdef BACKLIGHT_ENABLE
backlight_toggle();
wait_ms(100);
@ -59,10 +58,8 @@ void dynamic_macro_led_blink(void)
* need a `direction` variable accessible at the call site.
*/
#define DYNAMIC_MACRO_CURRENT_SLOT() (direction > 0 ? 1 : 2)
#define DYNAMIC_MACRO_CURRENT_LENGTH(BEGIN, POINTER) \
((int)(direction * ((POINTER) - (BEGIN))))
#define DYNAMIC_MACRO_CURRENT_CAPACITY(BEGIN, END2) \
((int)(direction * ((END2) - (BEGIN)) + 1))
#define DYNAMIC_MACRO_CURRENT_LENGTH(BEGIN, POINTER) ((int)(direction * ((POINTER) - (BEGIN))))
#define DYNAMIC_MACRO_CURRENT_CAPACITY(BEGIN, END2) ((int)(direction * ((END2) - (BEGIN)) + 1))
/**
* Start recording of the dynamic macro.
@ -70,9 +67,7 @@ void dynamic_macro_led_blink(void)
* @param[out] macro_pointer The new macro buffer iterator.
* @param[in] macro_buffer The macro buffer used to initialize macro_pointer.
*/
void dynamic_macro_record_start(
keyrecord_t **macro_pointer, keyrecord_t *macro_buffer)
{
void dynamic_macro_record_start(keyrecord_t **macro_pointer, keyrecord_t *macro_buffer) {
dprintln("dynamic macro recording: started");
dynamic_macro_led_blink();
@ -89,9 +84,7 @@ void dynamic_macro_record_start(
* @param macro_end[in] The element after the last macro buffer element.
* @param direction[in] Either +1 or -1, which way to iterate the buffer.
*/
void dynamic_macro_play(
keyrecord_t *macro_buffer, keyrecord_t *macro_end, int8_t direction)
{
void dynamic_macro_play(keyrecord_t *macro_buffer, keyrecord_t *macro_end, int8_t direction) {
dprintf("dynamic macro: slot %d playback\n", DYNAMIC_MACRO_CURRENT_SLOT());
uint32_t saved_layer_state = layer_state;
@ -118,13 +111,7 @@ void dynamic_macro_play(
* @param direction[in] Either +1 or -1, which way to iterate the buffer.
* @param record[in] The current keypress.
*/
void dynamic_macro_record_key(
keyrecord_t *macro_buffer,
keyrecord_t **macro_pointer,
keyrecord_t *macro2_end,
int8_t direction,
keyrecord_t *record)
{
void dynamic_macro_record_key(keyrecord_t *macro_buffer, keyrecord_t **macro_pointer, keyrecord_t *macro2_end, int8_t direction, keyrecord_t *record) {
/* If we've just started recording, ignore all the key releases. */
if (!record->event.pressed && *macro_pointer == macro_buffer) {
dprintln("dynamic macro: ignoring a leading key-up event");
@ -141,38 +128,25 @@ void dynamic_macro_record_key(
dynamic_macro_led_blink();
}
dprintf(
"dynamic macro: slot %d length: %d/%d\n",
DYNAMIC_MACRO_CURRENT_SLOT(),
DYNAMIC_MACRO_CURRENT_LENGTH(macro_buffer, *macro_pointer),
DYNAMIC_MACRO_CURRENT_CAPACITY(macro_buffer, macro2_end));
dprintf("dynamic macro: slot %d length: %d/%d\n", DYNAMIC_MACRO_CURRENT_SLOT(), DYNAMIC_MACRO_CURRENT_LENGTH(macro_buffer, *macro_pointer), DYNAMIC_MACRO_CURRENT_CAPACITY(macro_buffer, macro2_end));
}
/**
* End recording of the dynamic macro. Essentially just update the
* pointer to the end of the macro.
*/
void dynamic_macro_record_end(
keyrecord_t *macro_buffer,
keyrecord_t *macro_pointer,
int8_t direction,
keyrecord_t **macro_end)
{
void dynamic_macro_record_end(keyrecord_t *macro_buffer, keyrecord_t *macro_pointer, int8_t direction, keyrecord_t **macro_end) {
dynamic_macro_led_blink();
/* Do not save the keys being held when stopping the recording,
* i.e. the keys used to access the layer DYN_REC_STOP is on.
*/
while (macro_pointer != macro_buffer &&
(macro_pointer - direction)->event.pressed) {
while (macro_pointer != macro_buffer && (macro_pointer - direction)->event.pressed) {
dprintln("dynamic macro: trimming a trailing key-down event");
macro_pointer -= direction;
}
dprintf(
"dynamic macro: slot %d saved, length: %d\n",
DYNAMIC_MACRO_CURRENT_SLOT(),
DYNAMIC_MACRO_CURRENT_LENGTH(macro_buffer, macro_pointer));
dprintf("dynamic macro: slot %d saved, length: %d\n", DYNAMIC_MACRO_CURRENT_SLOT(), DYNAMIC_MACRO_CURRENT_LENGTH(macro_buffer, macro_pointer));
*macro_end = macro_pointer;
}
@ -187,8 +161,7 @@ void dynamic_macro_record_end(
* <...THE REST OF THE FUNCTION...>
* }
*/
bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record)
{
bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
/* Both macros use the same buffer but read/write on different
* ends of it.
*
@ -239,57 +212,57 @@ bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record)
/* No macro recording in progress. */
if (!record->event.pressed) {
switch (keycode) {
case DYN_REC_START1:
dynamic_macro_record_start(&macro_pointer, macro_buffer);
macro_id = 1;
return false;
case DYN_REC_START2:
dynamic_macro_record_start(&macro_pointer, r_macro_buffer);
macro_id = 2;
return false;
case DYN_MACRO_PLAY1:
dynamic_macro_play(macro_buffer, macro_end, +1);
return false;
case DYN_MACRO_PLAY2:
dynamic_macro_play(r_macro_buffer, r_macro_end, -1);
return false;
case DYN_REC_START1:
dynamic_macro_record_start(&macro_pointer, macro_buffer);
macro_id = 1;
return false;
case DYN_REC_START2:
dynamic_macro_record_start(&macro_pointer, r_macro_buffer);
macro_id = 2;
return false;
case DYN_MACRO_PLAY1:
dynamic_macro_play(macro_buffer, macro_end, +1);
return false;
case DYN_MACRO_PLAY2:
dynamic_macro_play(r_macro_buffer, r_macro_end, -1);
return false;
}
}
} else {
/* A macro is being recorded right now. */
switch (keycode) {
case DYN_REC_STOP:
/* Stop the macro recording. */
if (record->event.pressed) { /* Ignore the initial release
* just after the recoding
* starts. */
switch (macro_id) {
case 1:
dynamic_macro_record_end(macro_buffer, macro_pointer, +1, &macro_end);
break;
case 2:
dynamic_macro_record_end(r_macro_buffer, macro_pointer, -1, &r_macro_end);
break;
case DYN_REC_STOP:
/* Stop the macro recording. */
if (record->event.pressed) { /* Ignore the initial release
* just after the recoding
* starts. */
switch (macro_id) {
case 1:
dynamic_macro_record_end(macro_buffer, macro_pointer, +1, &macro_end);
break;
case 2:
dynamic_macro_record_end(r_macro_buffer, macro_pointer, -1, &r_macro_end);
break;
}
macro_id = 0;
}
macro_id = 0;
}
return false;
case DYN_MACRO_PLAY1:
case DYN_MACRO_PLAY2:
dprintln("dynamic macro: ignoring macro play key while recording");
return false;
default:
/* Store the key in the macro buffer and process it normally. */
switch (macro_id) {
case 1:
dynamic_macro_record_key(macro_buffer, &macro_pointer, r_macro_end, +1, record);
return false;
case DYN_MACRO_PLAY1:
case DYN_MACRO_PLAY2:
dprintln("dynamic macro: ignoring macro play key while recording");
return false;
default:
/* Store the key in the macro buffer and process it normally. */
switch (macro_id) {
case 1:
dynamic_macro_record_key(macro_buffer, &macro_pointer, r_macro_end, +1, record);
break;
case 2:
dynamic_macro_record_key(r_macro_buffer, &macro_pointer, macro_end, -1, record);
break;
}
return true;
break;
case 2:
dynamic_macro_record_key(r_macro_buffer, &macro_pointer, macro_end, -1, record);
break;
}
return true;
break;
}
}

View file

@ -17,27 +17,25 @@
#include "encoder.h"
#ifdef SPLIT_KEYBOARD
#include "split_util.h"
# include "split_util.h"
#endif
// for memcpy
#include <string.h>
#ifndef ENCODER_RESOLUTION
#define ENCODER_RESOLUTION 4
# define ENCODER_RESOLUTION 4
#endif
#if !defined(ENCODERS_PAD_A) || !defined(ENCODERS_PAD_B)
#error "No encoder pads defined by ENCODERS_PAD_A and ENCODERS_PAD_B"
# error "No encoder pads defined by ENCODERS_PAD_A and ENCODERS_PAD_B"
#endif
#define NUMBER_OF_ENCODERS (sizeof(encoders_pad_a)/sizeof(pin_t))
#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 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};
@ -48,64 +46,58 @@ static int8_t encoder_value[NUMBER_OF_ENCODERS * 2] = {0};
static int8_t encoder_value[NUMBER_OF_ENCODERS] = {0};
#endif
__attribute__ ((weak))
void encoder_update_user(int8_t index, bool clockwise) { }
__attribute__((weak)) void encoder_update_user(int8_t index, bool clockwise) {}
__attribute__ ((weak))
void encoder_update_kb(int8_t index, bool clockwise) {
encoder_update_user(index, clockwise);
}
__attribute__((weak)) void encoder_update_kb(int8_t index, bool clockwise) { encoder_update_user(index, clockwise); }
void encoder_init(void) {
#if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT)
if (!isLeftHand) {
const pin_t encoders_pad_a_right[] = ENCODERS_PAD_A_RIGHT;
const pin_t encoders_pad_b_right[] = ENCODERS_PAD_B_RIGHT;
for (uint8_t i = 0; i < NUMBER_OF_ENCODERS; i++) {
encoders_pad_a[i] = encoders_pad_a_right[i];
encoders_pad_b[i] = encoders_pad_b_right[i];
if (!isLeftHand) {
const pin_t encoders_pad_a_right[] = ENCODERS_PAD_A_RIGHT;
const pin_t encoders_pad_b_right[] = ENCODERS_PAD_B_RIGHT;
for (uint8_t i = 0; i < NUMBER_OF_ENCODERS; i++) {
encoders_pad_a[i] = encoders_pad_a_right[i];
encoders_pad_b[i] = encoders_pad_b_right[i];
}
}
}
#endif
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
setPinInputHigh(encoders_pad_a[i]);
setPinInputHigh(encoders_pad_b[i]);
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
setPinInputHigh(encoders_pad_a[i]);
setPinInputHigh(encoders_pad_b[i]);
encoder_state[i] = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
}
encoder_state[i] = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
}
}
void encoder_read(void) {
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
encoder_state[i] <<= 2;
encoder_state[i] |= (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
encoder_value[i] += encoder_LUT[encoder_state[i] & 0xF];
if (encoder_value[i] >= ENCODER_RESOLUTION) {
encoder_update_kb(i, false);
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
encoder_state[i] <<= 2;
encoder_state[i] |= (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
encoder_value[i] += encoder_LUT[encoder_state[i] & 0xF];
if (encoder_value[i] >= ENCODER_RESOLUTION) {
encoder_update_kb(i, false);
}
if (encoder_value[i] <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise
encoder_update_kb(i, true);
}
encoder_value[i] %= ENCODER_RESOLUTION;
}
if (encoder_value[i] <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this 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_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);
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;
}
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

View file

@ -20,23 +20,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdbool.h>
#include <musical_notes.h>
bool fauxclicky_enabled = true;
uint16_t note_start = 0;
bool note_playing = false;
uint16_t note_period = 0;
bool fauxclicky_enabled = true;
uint16_t note_start = 0;
bool note_playing = false;
uint16_t note_period = 0;
void fauxclicky_init()
{
void fauxclicky_init() {
// Set port PC6 (OC3A and /OC4A) as output
DDRC |= _BV(PORTC6);
// TCCR3A / TCCR3B: Timer/Counter #3 Control Registers
TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
}
void fauxclicky_stop()
{
void fauxclicky_stop() {
FAUXCLICKY_DISABLE_OUTPUT;
note_playing = false;
}
@ -45,10 +43,10 @@ void fauxclicky_play(float note[]) {
if (!fauxclicky_enabled) return;
if (note_playing) fauxclicky_stop();
FAUXCLICKY_TIMER_PERIOD = (uint16_t)(((float)F_CPU) / (note[0] * (float)FAUXCLICKY_CPU_PRESCALER));
FAUXCLICKY_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (note[0] * (float)FAUXCLICKY_CPU_PRESCALER)) / (float)2);
note_playing = true;
note_period = (note[1] / (float)16) * ((float)60 / (float)FAUXCLICKY_TEMPO) * 1000;
note_start = timer_read();
FAUXCLICKY_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (note[0] * (float)FAUXCLICKY_CPU_PRESCALER)) / (float)2);
note_playing = true;
note_period = (note[1] / (float)16) * ((float)60 / (float)FAUXCLICKY_TEMPO) * 1000;
note_start = timer_read();
FAUXCLICKY_ENABLE_OUTPUT;
}

View file

@ -14,18 +14,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef AUDIO_ENABLE
#error "AUDIO_ENABLE and FAUXCLICKY_ENABLE cannot be both enabled"
# error "AUDIO_ENABLE and FAUXCLICKY_ENABLE cannot be both enabled"
#endif
#include "musical_notes.h"
#include "stdbool.h"
__attribute__ ((weak))
float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_D4, 0.25);
__attribute__ ((weak))
float fauxclicky_released_note[2] = MUSICAL_NOTE(_C4, 0.125);
__attribute__ ((weak))
float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C4, 0.25);
__attribute__((weak)) float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_D4, 0.25);
__attribute__((weak)) float fauxclicky_released_note[2] = MUSICAL_NOTE(_C4, 0.125);
__attribute__((weak)) float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C4, 0.25);
bool fauxclicky_enabled;
@ -34,7 +31,7 @@ bool fauxclicky_enabled;
//
#ifndef FAUXCLICKY_TEMPO
#define FAUXCLICKY_TEMPO TEMPO_DEFAULT
# define FAUXCLICKY_TEMPO TEMPO_DEFAULT
#endif
// beep on press
@ -50,42 +47,44 @@ bool fauxclicky_enabled;
#define FAUXCLICKY_ON fauxclicky_enabled = true
// disable
#define FAUXCLICKY_OFF do { \
fauxclicky_enabled = false; \
fauxclicky_stop(); \
} while (0)
#define FAUXCLICKY_OFF \
do { \
fauxclicky_enabled = false; \
fauxclicky_stop(); \
} while (0)
// toggle
#define FAUXCLICKY_TOGGLE do { \
if (fauxclicky_enabled) { \
FAUXCLICKY_OFF; \
} else { \
FAUXCLICKY_ON; \
} \
} while (0)
#define FAUXCLICKY_TOGGLE \
do { \
if (fauxclicky_enabled) { \
FAUXCLICKY_OFF; \
} else { \
FAUXCLICKY_ON; \
} \
} while (0)
//
// pin configuration
//
#ifndef FAUXCLICKY_CPU_PRESCALER
#define FAUXCLICKY_CPU_PRESCALER 8
# define FAUXCLICKY_CPU_PRESCALER 8
#endif
#ifndef FAUXCLICKY_ENABLE_OUTPUT
#define FAUXCLICKY_ENABLE_OUTPUT TCCR3A |= _BV(COM3A1)
# define FAUXCLICKY_ENABLE_OUTPUT TCCR3A |= _BV(COM3A1)
#endif
#ifndef FAUXCLICKY_DISABLE_OUTPUT
#define FAUXCLICKY_DISABLE_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0))
# define FAUXCLICKY_DISABLE_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0))
#endif
#ifndef FAUXCLICKY_TIMER_PERIOD
#define FAUXCLICKY_TIMER_PERIOD ICR3
# define FAUXCLICKY_TIMER_PERIOD ICR3
#endif
#ifndef FAUXCLICKY_DUTY_CYCLE
#define FAUXCLICKY_DUTY_CYCLE OCR3A
# define FAUXCLICKY_DUTY_CYCLE OCR3A
#endif
//
@ -96,4 +95,3 @@ void fauxclicky_init(void);
void fauxclicky_stop(void);
void fauxclicky_play(float note[2]);
void fauxclicky_check(void);

View file

@ -24,7 +24,6 @@ extern keymap_config_t keymap_config;
* and will return the corrected keycode, when appropriate.
*/
uint16_t keycode_config(uint16_t keycode) {
switch (keycode) {
case KC_CAPSLOCK:
case KC_LOCKING_CAPS:
@ -56,7 +55,7 @@ uint16_t keycode_config(uint16_t keycode) {
return KC_LALT;
}
if (keymap_config.swap_lctl_lgui) {
return KC_LCTRL;
return KC_LCTRL;
}
if (keymap_config.no_gui) {
return KC_NO;
@ -83,7 +82,7 @@ uint16_t keycode_config(uint16_t keycode) {
return KC_RALT;
}
if (keymap_config.swap_rctl_rgui) {
return KC_RCTL;
return KC_RCTL;
}
if (keymap_config.no_gui) {
return KC_NO;
@ -140,22 +139,22 @@ uint8_t mod_config(uint8_t mod) {
}
}
if (keymap_config.swap_lctl_lgui) {
if ((mod & MOD_RGUI) == MOD_LGUI) {
mod &= ~MOD_LGUI;
mod |= MOD_LCTL;
} else if ((mod & MOD_RCTL) == MOD_LCTL) {
mod &= ~MOD_LCTL;
mod |= MOD_LGUI;
}
if ((mod & MOD_RGUI) == MOD_LGUI) {
mod &= ~MOD_LGUI;
mod |= MOD_LCTL;
} else if ((mod & MOD_RCTL) == MOD_LCTL) {
mod &= ~MOD_LCTL;
mod |= MOD_LGUI;
}
}
if (keymap_config.swap_rctl_rgui) {
if ((mod & MOD_RGUI) == MOD_RGUI) {
mod &= ~MOD_RGUI;
mod |= MOD_RCTL;
} else if ((mod & MOD_RCTL) == MOD_RCTL) {
mod &= ~MOD_RCTL;
mod |= MOD_RGUI;
}
if ((mod & MOD_RGUI) == MOD_RGUI) {
mod &= ~MOD_RGUI;
mod |= MOD_RCTL;
} else if ((mod & MOD_RCTL) == MOD_RCTL) {
mod &= ~MOD_RCTL;
mod |= MOD_RGUI;
}
}
if (keymap_config.no_gui) {
mod &= ~MOD_LGUI;

View file

@ -19,25 +19,25 @@
#include "action_code.h"
#ifndef KEYCODE_CONFIG_H
#define KEYCODE_CONFIG_H
# define KEYCODE_CONFIG_H
uint16_t keycode_config(uint16_t keycode);
uint8_t mod_config(uint8_t mod);
uint8_t mod_config(uint8_t mod);
/* NOTE: Not portable. Bit field order depends on implementation */
typedef union {
uint16_t raw;
struct {
bool swap_control_capslock:1;
bool capslock_to_control:1;
bool swap_lalt_lgui:1;
bool swap_ralt_rgui:1;
bool no_gui:1;
bool swap_grave_esc:1;
bool swap_backslash_backspace:1;
bool nkro:1;
bool swap_lctl_lgui:1;
bool swap_rctl_rgui:1;
bool swap_control_capslock : 1;
bool capslock_to_control : 1;
bool swap_lalt_lgui : 1;
bool swap_ralt_rgui : 1;
bool no_gui : 1;
bool swap_grave_esc : 1;
bool swap_backslash_backspace : 1;
bool nkro : 1;
bool swap_lctl_lgui : 1;
bool swap_rctl_rgui : 1;
};
} keymap_config_t;

View file

@ -22,10 +22,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdbool.h>
#include "action.h"
#if defined(__AVR__)
#include <avr/pgmspace.h>
# include <avr/pgmspace.h>
#elif defined PROTOCOL_CHIBIOS
//We need to ensure that chibios is include before redefining reset
#include "ch.h"
// We need to ensure that chibios is include before redefining reset
# include "ch.h"
#endif
#include "keycode.h"
#include "action_macro.h"
@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// ChibiOS uses RESET in its FlagStatus enumeration
// Therefore define it as QK_RESET here, to avoid name collision
#if defined(PROTOCOL_CHIBIOS)
#define RESET QK_RESET
# define RESET QK_RESET
#endif
#include "quantum_keycodes.h"
@ -47,10 +47,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
// translates function id to action
uint16_t keymap_function_id_to_action( uint16_t function_id );
uint16_t keymap_function_id_to_action(uint16_t function_id);
extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
extern const uint16_t fn_actions[];
#endif

View file

@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "keycode.h"
#include "action_layer.h"
#if defined(__AVR__)
#include <util/delay.h>
#include <stdio.h>
# include <util/delay.h>
# include <stdio.h>
#endif
#include "action.h"
#include "action_macro.h"
@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
#ifdef MIDI_ENABLE
#include "process_midi.h"
# include "process_midi.h"
#endif
extern keymap_config_t keymap_config;
@ -38,8 +38,7 @@ extern keymap_config_t keymap_config;
#include <inttypes.h>
/* converts key to action */
action_t action_for_key(uint8_t layer, keypos_t key)
{
action_t action_for_key(uint8_t layer, keypos_t key) {
// 16bit keycodes - important
uint16_t keycode = keymap_key_to_keycode(layer, key);
@ -47,7 +46,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
keycode = keycode_config(keycode);
action_t action;
uint8_t action_layer, when, mod;
uint8_t action_layer, when, mod;
switch (keycode) {
case KC_FN0 ... KC_FN31:
@ -69,18 +68,18 @@ action_t action_for_key(uint8_t layer, keypos_t key)
case KC_TRNS:
action.code = ACTION_TRANSPARENT;
break;
case QK_MODS ... QK_MODS_MAX: ;
case QK_MODS ... QK_MODS_MAX:;
// Has a modifier
// Split it up
action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key
action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key
break;
case QK_FUNCTION ... QK_FUNCTION_MAX: ;
case QK_FUNCTION ... QK_FUNCTION_MAX:;
// Is a shortcut for function action_layer, pull last 12bits
// This means we have 4,096 FN macros at our disposal
action.code = keymap_function_id_to_action( (int)keycode & 0xFFF );
action.code = keymap_function_id_to_action((int)keycode & 0xFFF);
break;
case QK_MACRO ... QK_MACRO_MAX:
if (keycode & 0x800) // tap macros have upper bit set
if (keycode & 0x800) // tap macros have upper bit set
action.code = ACTION_MACRO_TAP(keycode & 0xFF);
else
action.code = ACTION_MACRO(keycode & 0xFF);
@ -88,50 +87,50 @@ action_t action_for_key(uint8_t layer, keypos_t key)
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
break;
case QK_TO ... QK_TO_MAX: ;
case QK_TO ... QK_TO_MAX:;
// Layer set "GOTO"
when = (keycode >> 0x4) & 0x3;
when = (keycode >> 0x4) & 0x3;
action_layer = keycode & 0xF;
action.code = ACTION_LAYER_SET(action_layer, when);
action.code = ACTION_LAYER_SET(action_layer, when);
break;
case QK_MOMENTARY ... QK_MOMENTARY_MAX: ;
case QK_MOMENTARY ... QK_MOMENTARY_MAX:;
// Momentary action_layer
action_layer = keycode & 0xFF;
action.code = ACTION_LAYER_MOMENTARY(action_layer);
action.code = ACTION_LAYER_MOMENTARY(action_layer);
break;
case QK_DEF_LAYER ... QK_DEF_LAYER_MAX: ;
case QK_DEF_LAYER ... QK_DEF_LAYER_MAX:;
// Set default action_layer
action_layer = keycode & 0xFF;
action.code = ACTION_DEFAULT_LAYER_SET(action_layer);
action.code = ACTION_DEFAULT_LAYER_SET(action_layer);
break;
case QK_TOGGLE_LAYER ... QK_TOGGLE_LAYER_MAX: ;
case QK_TOGGLE_LAYER ... QK_TOGGLE_LAYER_MAX:;
// Set toggle
action_layer = keycode & 0xFF;
action.code = ACTION_LAYER_TOGGLE(action_layer);
action.code = ACTION_LAYER_TOGGLE(action_layer);
break;
case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX: ;
case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX:;
// OSL(action_layer) - One-shot action_layer
action_layer = keycode & 0xFF;
action.code = ACTION_LAYER_ONESHOT(action_layer);
action.code = ACTION_LAYER_ONESHOT(action_layer);
break;
case QK_ONE_SHOT_MOD ... QK_ONE_SHOT_MOD_MAX: ;
case QK_ONE_SHOT_MOD ... QK_ONE_SHOT_MOD_MAX:;
// OSM(mod) - One-shot mod
mod = mod_config(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 = mod_config(keycode & 0xF);
mod = mod_config(keycode & 0xF);
action_layer = (keycode >> 4) & 0xF;
action.code = ACTION_LAYER_MODS(action_layer, mod);
action.code = ACTION_LAYER_MODS(action_layer, mod);
break;
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
mod = mod_config((keycode >> 0x8) & 0x1F);
mod = mod_config((keycode >> 0x8) & 0x1F);
action.code = ACTION_MODS_TAP_KEY(mod, keycode & 0xFF);
break;
#ifdef BACKLIGHT_ENABLE
#ifdef BACKLIGHT_ENABLE
case BL_ON:
action.code = ACTION_BACKLIGHT_ON();
break;
@ -150,12 +149,12 @@ action_t action_for_key(uint8_t layer, keypos_t key)
case BL_STEP:
action.code = ACTION_BACKLIGHT_STEP();
break;
#endif
#ifdef SWAP_HANDS_ENABLE
#endif
#ifdef SWAP_HANDS_ENABLE
case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
action.code = ACTION(ACT_SWAP_HANDS, keycode & 0xff);
break;
#endif
#endif
default:
action.code = ACTION_NO;
@ -164,42 +163,30 @@ action_t action_for_key(uint8_t layer, keypos_t key)
return action;
}
__attribute__ ((weak))
const uint16_t PROGMEM fn_actions[] = {
__attribute__((weak)) const uint16_t PROGMEM fn_actions[] = {
};
/* Macro */
__attribute__ ((weak))
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
return MACRO_NONE;
}
__attribute__((weak)) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { return MACRO_NONE; }
/* Function */
__attribute__ ((weak))
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
}
__attribute__((weak)) void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {}
// translates key to keycode
__attribute__ ((weak))
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
__attribute__((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
// Read entire word (16bits)
return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]);
}
// translates function id to action
__attribute__ ((weak))
uint16_t keymap_function_id_to_action( uint16_t function_id )
{
// The compiler sees the empty (weak) fn_actions and generates a warning
// This function should not be called in that case, so the warning is too strict
// If this function is called however, the keymap should have overridden fn_actions, and then the compile
// is comparing against the wrong array
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
return pgm_read_word(&fn_actions[function_id]);
#pragma GCC diagnostic pop
__attribute__((weak)) uint16_t keymap_function_id_to_action(uint16_t function_id) {
// The compiler sees the empty (weak) fn_actions and generates a warning
// This function should not be called in that case, so the warning is too strict
// If this function is called however, the keymap should have overridden fn_actions, and then the compile
// is comparing against the wrong array
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
return pgm_read_word(&fn_actions[function_id]);
#pragma GCC diagnostic pop
}

View file

@ -20,86 +20,86 @@
// Normal characters
// Line 1
#define BE_SUP2 KC_GRV
#define BE_AMP KC_1
#define BE_EACU KC_2
#define BE_QUOT KC_3
#define BE_APOS KC_4
#define BE_LPRN KC_5
#define BE_PARA KC_6
#define BE_EGRV KC_7
#define BE_EXLM KC_8
#define BE_CCED KC_9
#define BE_AGRV KC_0
#define BE_RPRN KC_MINS
#define BE_MINS KC_EQL
#define BE_SUP2 KC_GRV
#define BE_AMP KC_1
#define BE_EACU KC_2
#define BE_QUOT KC_3
#define BE_APOS KC_4
#define BE_LPRN KC_5
#define BE_PARA KC_6
#define BE_EGRV KC_7
#define BE_EXLM KC_8
#define BE_CCED KC_9
#define BE_AGRV KC_0
#define BE_RPRN KC_MINS
#define BE_MINS KC_EQL
// Line 2
#define BE_A KC_Q
#define BE_Z KC_W
#define BE_CIRC KC_LBRC
#define BE_DLR KC_RBRC
#define BE_A KC_Q
#define BE_Z KC_W
#define BE_CIRC KC_LBRC
#define BE_DLR KC_RBRC
// Line 3
#define BE_Q KC_A
#define BE_M KC_SCLN
#define BE_UGRV KC_QUOT
#define BE_MU KC_NUHS
#define BE_Q KC_A
#define BE_M KC_SCLN
#define BE_UGRV KC_QUOT
#define BE_MU KC_NUHS
// Line 4
#define BE_LESS KC_NUBS
#define BE_W KC_Z
#define BE_COMM KC_M
#define BE_SCLN KC_COMM
#define BE_COLN KC_DOT
#define BE_EQL KC_SLSH
#define BE_LESS KC_NUBS
#define BE_W KC_Z
#define BE_COMM KC_M
#define BE_SCLN KC_COMM
#define BE_COLN KC_DOT
#define BE_EQL KC_SLSH
// Shifted characters
// Line 1
#define BE_SUP3 KC_TILD
#define BE_1 LSFT(KC_1)
#define BE_2 LSFT(KC_2)
#define BE_3 LSFT(KC_3)
#define BE_4 LSFT(KC_4)
#define BE_5 LSFT(KC_5)
#define BE_6 LSFT(KC_6)
#define BE_7 LSFT(KC_7)
#define BE_8 LSFT(KC_8)
#define BE_9 LSFT(KC_9)
#define BE_0 LSFT(KC_0)
#define BE_OVRR KC_UNDS
#define BE_1 LSFT(KC_1)
#define BE_2 LSFT(KC_2)
#define BE_3 LSFT(KC_3)
#define BE_4 LSFT(KC_4)
#define BE_5 LSFT(KC_5)
#define BE_6 LSFT(KC_6)
#define BE_7 LSFT(KC_7)
#define BE_8 LSFT(KC_8)
#define BE_9 LSFT(KC_9)
#define BE_0 LSFT(KC_0)
#define BE_OVRR KC_UNDS
#define BE_UNDS KC_PLUS
// Line 2
#define BE_UMLT LSFT(BE_CIRC)
#define BE_PND LSFT(BE_DLR)
#define BE_UMLT LSFT(BE_CIRC)
#define BE_PND LSFT(BE_DLR)
// Line 3
#define BE_PERC LSFT(BE_UGRV)
#define BE_PERC LSFT(BE_UGRV)
// Line 4
#define BE_GRTR LSFT(BE_LESS)
#define BE_QUES LSFT(BE_COMM)
#define BE_DOT LSFT(BE_SCLN)
#define BE_SLSH LSFT(BE_COLN)
#define BE_PLUS LSFT(BE_EQL)
#define BE_GRTR LSFT(BE_LESS)
#define BE_QUES LSFT(BE_COMM)
#define BE_DOT LSFT(BE_SCLN)
#define BE_SLSH LSFT(BE_COLN)
#define BE_PLUS LSFT(BE_EQL)
// Alt Gr-ed characters
// Line 1
#define BE_PIPE ALGR(KC_1)
#define BE_AT ALGR(KC_2)
#define BE_HASH ALGR(KC_3)
#define BE_AT ALGR(KC_2)
#define BE_HASH ALGR(KC_3)
#define BE_LCBR ALGR(KC_9)
#define BE_RCBR ALGR(KC_0)
#define BE_RCBR ALGR(KC_0)
// Line 2
#define BE_EURO ALGR(KC_E)
#define BE_EURO ALGR(KC_E)
#define BE_LSBR ALGR(BE_CIRC)
#define BE_RSBR ALGR(BE_DLR)
// Line 3
#define BE_ACUT ALGR(BE_UGRV)
#define BE_GRV ALGR(BE_MU)
#define BE_GRV ALGR(BE_MU)
// Line 4
#define BE_BSLS ALGR(BE_LESS)

View file

@ -21,297 +21,297 @@
// Normal characters
// First row (on usual keyboards)
#define BP_DOLLAR KC_GRAVE // $
#define BP_DLR BP_DOLLAR
#define BP_DOUBLE_QUOTE KC_1 // "
#define BP_DQOT BP_DOUBLE_QUOTE
#define BP_LEFT_GUILLEMET KC_2 // «
#define BP_LGIL BP_LEFT_GUILLEMET
#define BP_RIGHT_GUILLEMET KC_3 // »
#define BP_RGIL BP_RIGHT_GUILLEMET
#define BP_LEFT_PAREN KC_4 // (
#define BP_LPRN BP_LEFT_PAREN
#define BP_RIGHT_PAREN KC_5 // )
#define BP_RPRN BP_RIGHT_PAREN
#define BP_AT KC_6 // @
#define BP_PLUS KC_7 // +
#define BP_MINUS KC_8 // -
#define BP_MINS BP_MINUS
#define BP_SLASH KC_9 // /
#define BP_SLSH BP_SLASH
#define BP_ASTERISK KC_0 // *
#define BP_ASTR BP_ASTERISK
#define BP_EQUAL KC_MINUS // =
#define BP_EQL BP_EQUAL
#define BP_PERCENT KC_EQUAL // %
#define BP_PERC BP_PERCENT
#define BP_DOLLAR KC_GRAVE // $
#define BP_DLR BP_DOLLAR
#define BP_DOUBLE_QUOTE KC_1 // "
#define BP_DQOT BP_DOUBLE_QUOTE
#define BP_LEFT_GUILLEMET KC_2 // «
#define BP_LGIL BP_LEFT_GUILLEMET
#define BP_RIGHT_GUILLEMET KC_3 // »
#define BP_RGIL BP_RIGHT_GUILLEMET
#define BP_LEFT_PAREN KC_4 // (
#define BP_LPRN BP_LEFT_PAREN
#define BP_RIGHT_PAREN KC_5 // )
#define BP_RPRN BP_RIGHT_PAREN
#define BP_AT KC_6 // @
#define BP_PLUS KC_7 // +
#define BP_MINUS KC_8 // -
#define BP_MINS BP_MINUS
#define BP_SLASH KC_9 // /
#define BP_SLSH BP_SLASH
#define BP_ASTERISK KC_0 // *
#define BP_ASTR BP_ASTERISK
#define BP_EQUAL KC_MINUS // =
#define BP_EQL BP_EQUAL
#define BP_PERCENT KC_EQUAL // %
#define BP_PERC BP_PERCENT
// Second row
#define BP_B KC_Q
#define BP_E_ACUTE KC_W // é
#define BP_ECUT BP_E_ACUTE
#define BP_P KC_E
#define BP_O KC_R
#define BP_E_GRAVE KC_T // è
#define BP_EGRV BP_E_GRAVE
#define BP_DEAD_CIRCUMFLEX KC_Y // dead ^
#define BP_DCRC BP_DEAD_CIRCUMFLEX
#define BP_V KC_U
#define BP_D KC_I
#define BP_L KC_O
#define BP_J KC_P
#define BP_Z KC_LBRACKET
#define BP_W KC_RBRACKET
#define BP_B KC_Q
#define BP_E_ACUTE KC_W // é
#define BP_ECUT BP_E_ACUTE
#define BP_P KC_E
#define BP_O KC_R
#define BP_E_GRAVE KC_T // è
#define BP_EGRV BP_E_GRAVE
#define BP_DEAD_CIRCUMFLEX KC_Y // dead ^
#define BP_DCRC BP_DEAD_CIRCUMFLEX
#define BP_V KC_U
#define BP_D KC_I
#define BP_L KC_O
#define BP_J KC_P
#define BP_Z KC_LBRACKET
#define BP_W KC_RBRACKET
// Third row
#define BP_A KC_A
#define BP_U KC_S
#define BP_I KC_D
#define BP_E KC_F
#define BP_COMMA KC_G // ,
#define BP_COMM BP_COMMA
#define BP_C KC_H
#define BP_T KC_J
#define BP_S KC_K
#define BP_R KC_L
#define BP_N KC_SCOLON
#define BP_M KC_QUOTE
#define BP_C_CEDILLA KC_BSLASH // ç
#define BP_CCED BP_C_CEDILLA
#define BP_A KC_A
#define BP_U KC_S
#define BP_I KC_D
#define BP_E KC_F
#define BP_COMMA KC_G // ,
#define BP_COMM BP_COMMA
#define BP_C KC_H
#define BP_T KC_J
#define BP_S KC_K
#define BP_R KC_L
#define BP_N KC_SCOLON
#define BP_M KC_QUOTE
#define BP_C_CEDILLA KC_BSLASH // ç
#define BP_CCED BP_C_CEDILLA
// Fourth row
#define BP_E_CIRCUMFLEX KC_NONUS_BSLASH // ê
#define BP_ECRC BP_E_CIRCUMFLEX
#define BP_A_GRAVE KC_Z // à
#define BP_AGRV BP_A_GRAVE
#define BP_Y KC_X
#define BP_X KC_C
#define BP_DOT KC_V // .
#define BP_K KC_B
#define BP_APOSTROPHE KC_N
#define BP_APOS BP_APOSTROPHE // '
#define BP_Q KC_M
#define BP_G KC_COMMA
#define BP_H KC_DOT
#define BP_F KC_SLASH
#define BP_E_CIRCUMFLEX KC_NONUS_BSLASH // ê
#define BP_ECRC BP_E_CIRCUMFLEX
#define BP_A_GRAVE KC_Z // à
#define BP_AGRV BP_A_GRAVE
#define BP_Y KC_X
#define BP_X KC_C
#define BP_DOT KC_V // .
#define BP_K KC_B
#define BP_APOSTROPHE KC_N
#define BP_APOS BP_APOSTROPHE // '
#define BP_Q KC_M
#define BP_G KC_COMMA
#define BP_H KC_DOT
#define BP_F KC_SLASH
// Shifted characters
// First row
#define BP_HASH LSFT(BP_DOLLAR) // #
#define BP_1 LSFT(KC_1)
#define BP_2 LSFT(KC_2)
#define BP_3 LSFT(KC_3)
#define BP_4 LSFT(KC_4)
#define BP_5 LSFT(KC_5)
#define BP_6 LSFT(KC_6)
#define BP_7 LSFT(KC_7)
#define BP_8 LSFT(KC_8)
#define BP_9 LSFT(KC_9)
#define BP_0 LSFT(KC_0)
#define BP_DEGREE LSFT(BP_EQUAL) // °
#define BP_DEGR BP_DEGREE
#define BP_GRAVE LSFT(BP_PERCENT) // `
#define BP_GRV BP_GRAVE
#define BP_HASH LSFT(BP_DOLLAR) // #
#define BP_1 LSFT(KC_1)
#define BP_2 LSFT(KC_2)
#define BP_3 LSFT(KC_3)
#define BP_4 LSFT(KC_4)
#define BP_5 LSFT(KC_5)
#define BP_6 LSFT(KC_6)
#define BP_7 LSFT(KC_7)
#define BP_8 LSFT(KC_8)
#define BP_9 LSFT(KC_9)
#define BP_0 LSFT(KC_0)
#define BP_DEGREE LSFT(BP_EQUAL) // °
#define BP_DEGR BP_DEGREE
#define BP_GRAVE LSFT(BP_PERCENT) // `
#define BP_GRV BP_GRAVE
// Second row
#define BP_EXCLAIM LSFT(BP_DEAD_CIRCUMFLEX) // !
#define BP_EXLM BP_EXCLAIM
#define BP_EXCLAIM LSFT(BP_DEAD_CIRCUMFLEX) // !
#define BP_EXLM BP_EXCLAIM
// Third row
#define BP_SCOLON LSFT(BP_COMMA) // ;
#define BP_SCLN BP_SCOLON
#define BP_SCOLON LSFT(BP_COMMA) // ;
#define BP_SCLN BP_SCOLON
// Fourth row
#define BP_COLON LSFT(BP_DOT) // :
#define BP_COLN BP_COLON
#define BP_COLON LSFT(BP_DOT) // :
#define BP_COLN BP_COLON
#define BP_QUESTION LSFT(BP_APOS) // ?
#define BP_QEST BP_QUESTION
#define BP_QEST BP_QUESTION
// Space bar
#define BP_NON_BREAKING_SPACE LSFT(KC_SPACE)
#define BP_NBSP BP_NON_BREAKING_SPACE
#define BP_NON_BREAKING_SPACE LSFT(KC_SPACE)
#define BP_NBSP BP_NON_BREAKING_SPACE
// AltGr-ed characters
// First row
#define BP_EN_DASH ALGR(BP_DOLLAR) //
#define BP_NDSH BP_EN_DASH
#define BP_EM_DASH ALGR(KC_1) // —
#define BP_MDSH BP_EM_DASH
#define BP_LESS ALGR(KC_2) // <
#define BP_GREATER ALGR(KC_3) // >
#define BP_GRTR BP_GREATER
#define BP_LBRACKET ALGR(KC_4) // [
#define BP_LBRC BP_LBRACKET
#define BP_RBRACKET ALGR(KC_5) // ]
#define BP_RBRC BP_RBRACKET
#define BP_CIRCUMFLEX ALGR(KC_6) // ^
#define BP_CIRC BP_CIRCUMFLEX
#define BP_PLUS_MINUS ALGR(KC_7) // ±
#define BP_PSMS BP_PLUS_MINUS
#define BP_MATH_MINUS ALGR(KC_8) //
#define BP_MMNS BP_MATH_MINUS
#define BP_OBELUS ALGR(KC_9) // ÷
#define BP_OBEL BP_OBELUS
#define BP_EN_DASH ALGR(BP_DOLLAR) //
#define BP_NDSH BP_EN_DASH
#define BP_EM_DASH ALGR(KC_1) // —
#define BP_MDSH BP_EM_DASH
#define BP_LESS ALGR(KC_2) // <
#define BP_GREATER ALGR(KC_3) // >
#define BP_GRTR BP_GREATER
#define BP_LBRACKET ALGR(KC_4) // [
#define BP_LBRC BP_LBRACKET
#define BP_RBRACKET ALGR(KC_5) // ]
#define BP_RBRC BP_RBRACKET
#define BP_CIRCUMFLEX ALGR(KC_6) // ^
#define BP_CIRC BP_CIRCUMFLEX
#define BP_PLUS_MINUS ALGR(KC_7) // ±
#define BP_PSMS BP_PLUS_MINUS
#define BP_MATH_MINUS ALGR(KC_8) //
#define BP_MMNS BP_MATH_MINUS
#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 ALGR(KC_0) // ×
#define BP_TIMS BP_TIMES
#define BP_DIFFERENT ALGR(BP_EQUAL) // ≠
#define BP_DIFF BP_DIFFERENT
#define BP_PERMILLE ALGR(BP_PERCENT) // ‰
#define BP_PMIL BP_PERMILLE
#define BP_DIVISION_SIGN BP_OBELUS
#define BP_DVSN BP_DIVISION_SIGN
#define BP_TIMES ALGR(KC_0) // ×
#define BP_TIMS BP_TIMES
#define BP_DIFFERENT ALGR(BP_EQUAL) // ≠
#define BP_DIFF BP_DIFFERENT
#define BP_PERMILLE ALGR(BP_PERCENT) // ‰
#define BP_PMIL BP_PERMILLE
// Second row
#define BP_PIPE ALGR(BP_B) // |
#define BP_DEAD_ACUTE ALGR(BP_E_ACUTE) // dead ´
#define BP_DACT BP_DEAD_ACUTE
#define BP_AMPERSAND ALGR(BP_P) // &
#define BP_AMPR BP_AMPERSAND
#define BP_OE_LIGATURE ALGR(BP_O) // œ
#define BP_OE BP_OE_LIGATURE
#define BP_DEAD_GRAVE ALGR(BP_E_GRAVE) // `
#define BP_DGRV BP_DEAD_GRAVE
#define BP_INVERTED_EXCLAIM ALGR(BP_DEAD_CIRCUMFLEX) // ¡
#define BP_IXLM BP_INVERTED_EXCLAIM
#define BP_DEAD_CARON ALGR(BP_V) // dead ˇ
#define BP_DCAR BP_DEAD_CARON
#define BP_ETH ALGR(BP_D) // ð
#define BP_DEAD_SLASH ALGR(BP_L) // dead /
#define BP_DSLH BP_DEAD_SLASH
#define BP_IJ_LIGATURE ALGR(BP_J) // ij
#define BP_IJ BP_IJ_LIGATURE
#define BP_SCHWA ALGR(BP_Z) // ə
#define BP_SCWA BP_SCHWA
#define BP_DEAD_BREVE ALGR(BP_W) // dead ˘
#define BP_DBRV BP_DEAD_BREVE
#define BP_PIPE ALGR(BP_B) // |
#define BP_DEAD_ACUTE ALGR(BP_E_ACUTE) // dead ´
#define BP_DACT BP_DEAD_ACUTE
#define BP_AMPERSAND ALGR(BP_P) // &
#define BP_AMPR BP_AMPERSAND
#define BP_OE_LIGATURE ALGR(BP_O) // œ
#define BP_OE BP_OE_LIGATURE
#define BP_DEAD_GRAVE ALGR(BP_E_GRAVE) // `
#define BP_DGRV BP_DEAD_GRAVE
#define BP_INVERTED_EXCLAIM ALGR(BP_DEAD_CIRCUMFLEX) // ¡
#define BP_IXLM BP_INVERTED_EXCLAIM
#define BP_DEAD_CARON ALGR(BP_V) // dead ˇ
#define BP_DCAR BP_DEAD_CARON
#define BP_ETH ALGR(BP_D) // ð
#define BP_DEAD_SLASH ALGR(BP_L) // dead /
#define BP_DSLH BP_DEAD_SLASH
#define BP_IJ_LIGATURE ALGR(BP_J) // ij
#define BP_IJ BP_IJ_LIGATURE
#define BP_SCHWA ALGR(BP_Z) // ə
#define BP_SCWA BP_SCHWA
#define BP_DEAD_BREVE ALGR(BP_W) // dead ˘
#define BP_DBRV BP_DEAD_BREVE
// Third row
#define BP_AE_LIGATURE ALGR(BP_A) // æ
#define BP_AE BP_AE_LIGATURE
#define BP_U_GRAVE ALGR(BP_U) // ù
#define BP_UGRV BP_U_GRAVE
#define BP_DEAD_TREMA ALGR(BP_I) // dead ¨ (trema/umlaut/diaresis)
#define BP_DTRM BP_DEAD_TREMA
#define BP_EURO ALGR(BP_E) // €
#define BP_TYPOGRAPHICAL_APOSTROPHE ALGR(BP_COMMA) //
#define BP_TAPO BP_TYPOGRAPHICAL_APOSTROPHE
#define BP_COPYRIGHT ALGR(BP_C) // ©
#define BP_CPRT BP_COPYRIGHT
#define BP_THORN ALGR(BP_T) // þ
#define BP_THRN BP_THORN
#define BP_SHARP_S ALGR(BP_S) // ß
#define BP_SRPS BP_SHARP_S
#define BP_REGISTERED_TRADEMARK ALGR(BP_R) // ®
#define BP_RTM BP_REGISTERED_TRADEMARK
#define BP_DEAD_TILDE ALGR(BP_N) // dead ~
#define BP_DTLD BP_DEAD_TILDE
#define BP_DEAD_MACRON ALGR(BP_M) // dead ¯
#define BP_DMCR BP_DEAD_MACRON
#define BP_DEAD_CEDILLA ALGR(BP_C_CEDILLA) // dead ¸
#define BP_DCED BP_DEAD_CEDILLA
#define BP_AE_LIGATURE ALGR(BP_A) // æ
#define BP_AE BP_AE_LIGATURE
#define BP_U_GRAVE ALGR(BP_U) // ù
#define BP_UGRV BP_U_GRAVE
#define BP_DEAD_TREMA ALGR(BP_I) // dead ¨ (trema/umlaut/diaresis)
#define BP_DTRM BP_DEAD_TREMA
#define BP_EURO ALGR(BP_E) // €
#define BP_TYPOGRAPHICAL_APOSTROPHE ALGR(BP_COMMA) //
#define BP_TAPO BP_TYPOGRAPHICAL_APOSTROPHE
#define BP_COPYRIGHT ALGR(BP_C) // ©
#define BP_CPRT BP_COPYRIGHT
#define BP_THORN ALGR(BP_T) // þ
#define BP_THRN BP_THORN
#define BP_SHARP_S ALGR(BP_S) // ß
#define BP_SRPS BP_SHARP_S
#define BP_REGISTERED_TRADEMARK ALGR(BP_R) // ®
#define BP_RTM BP_REGISTERED_TRADEMARK
#define BP_DEAD_TILDE ALGR(BP_N) // dead ~
#define BP_DTLD BP_DEAD_TILDE
#define BP_DEAD_MACRON ALGR(BP_M) // dead ¯
#define BP_DMCR BP_DEAD_MACRON
#define BP_DEAD_CEDILLA ALGR(BP_C_CEDILLA) // dead ¸
#define BP_DCED BP_DEAD_CEDILLA
// Fourth row
#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 ALGR(BP_A_GRAVE) /* \ */
#define BP_BSLS BP_BACKSLASH
#define BP_LEFT_CURLY_BRACE ALGR(BP_Y) // {
#define BP_LCBR BP_LEFT_CURLY_BRACE
#define BP_RIGHT_CURLY_BRACE ALGR(BP_X) // }
#define BP_RCBR BP_RIGHT_CURLY_BRACE
#define BP_ELLIPSIS ALGR(BP_DOT) // …
#define BP_ELPS BP_ELLIPSIS
#define BP_TILDE ALGR(BP_K) // ~
#define BP_TILD BP_TILDE
#define BP_INVERTED_QUESTION ALGR(BP_QUESTION) // ¿
#define BP_IQST BP_INVERTED_QUESTION
#define BP_DEAD_RING ALGR(BP_Q) // dead °
#define BP_DRNG BP_DEAD_RING
#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 ALGR(BP_H) // †
#define BP_DAGR BP_DAGGER
#define BP_DEAD_OGONEK ALGR(BP_F) // dead ˛
#define BP_DOGO BP_DEAD_OGONEK
#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 ALGR(BP_A_GRAVE) /* \ */
#define BP_BSLS BP_BACKSLASH
#define BP_LEFT_CURLY_BRACE ALGR(BP_Y) // {
#define BP_LCBR BP_LEFT_CURLY_BRACE
#define BP_RIGHT_CURLY_BRACE ALGR(BP_X) // }
#define BP_RCBR BP_RIGHT_CURLY_BRACE
#define BP_ELLIPSIS ALGR(BP_DOT) // …
#define BP_ELPS BP_ELLIPSIS
#define BP_TILDE ALGR(BP_K) // ~
#define BP_TILD BP_TILDE
#define BP_INVERTED_QUESTION ALGR(BP_QUESTION) // ¿
#define BP_IQST BP_INVERTED_QUESTION
#define BP_DEAD_RING ALGR(BP_Q) // dead °
#define BP_DRNG BP_DEAD_RING
#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 ALGR(BP_H) // †
#define BP_DAGR BP_DAGGER
#define BP_DEAD_OGONEK ALGR(BP_F) // dead ˛
#define BP_DOGO BP_DEAD_OGONEK
// Space bar
#define BP_UNDERSCORE ALGR(KC_SPACE) // _
#define BP_UNDS BP_UNDERSCORE
#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 ALGR(BP_HASH) // ¶
#define BP_PARG BP_PARAGRAPH
#define BP_LOW_DOUBLE_QUOTE ALGR(BP_1) // „
#define BP_LWQT BP_LOW_DOUBLE_QUOTE
#define BP_LEFT_DOUBLE_QUOTE ALGR(BP_2) // “
#define BP_LDQT BP_LEFT_DOUBLE_QUOTE
#define BP_RIGHT_DOUBLE_QUOTE ALGR(BP_3) // ”
#define BP_RDQT BP_RIGHT_DOUBLE_QUOTE
#define BP_LESS_OR_EQUAL ALGR(BP_4) // ≤
#define BP_LEQL BP_LESS_OR_EQUAL
#define BP_GREATER_OR_EQUAL ALGR(BP_5) // ≥
#define BP_GEQL BP_GREATER_OR_EQUAL
#define BP_PARAGRAPH ALGR(BP_HASH) // ¶
#define BP_PARG BP_PARAGRAPH
#define BP_LOW_DOUBLE_QUOTE ALGR(BP_1) // „
#define BP_LWQT BP_LOW_DOUBLE_QUOTE
#define BP_LEFT_DOUBLE_QUOTE ALGR(BP_2) // “
#define BP_LDQT BP_LEFT_DOUBLE_QUOTE
#define BP_RIGHT_DOUBLE_QUOTE ALGR(BP_3) // ”
#define BP_RDQT BP_RIGHT_DOUBLE_QUOTE
#define BP_LESS_OR_EQUAL ALGR(BP_4) // ≤
#define BP_LEQL BP_LESS_OR_EQUAL
#define BP_GREATER_OR_EQUAL ALGR(BP_5) // ≥
#define BP_GEQL BP_GREATER_OR_EQUAL
// nothing on ALGR(BP_6)
#define BP_NEGATION ALGR(BP_7) // ¬
#define BP_NEGT BP_NEGATION
#define BP_ONE_QUARTER ALGR(BP_8) // ¼
#define BP_1QRT BP_ONE_QUARTER
#define BP_ONE_HALF ALGR(BP_9) // ½
#define BP_1HLF BP_ONE_HALF
#define BP_THREE_QUARTERS ALGR(BP_0) // ¾
#define BP_3QRT BP_THREE_QUARTERS
#define BP_MINUTES ALGR(BP_DEGREE) //
#define BP_MNUT BP_MINUTES
#define BP_SECONDS ALGR(BP_GRAVE) // ″
#define BP_SCND BP_SECONDS
#define BP_NEGATION ALGR(BP_7) // ¬
#define BP_NEGT BP_NEGATION
#define BP_ONE_QUARTER ALGR(BP_8) // ¼
#define BP_1QRT BP_ONE_QUARTER
#define BP_ONE_HALF ALGR(BP_9) // ½
#define BP_1HLF BP_ONE_HALF
#define BP_THREE_QUARTERS ALGR(BP_0) // ¾
#define BP_3QRT BP_THREE_QUARTERS
#define BP_MINUTES ALGR(BP_DEGREE) //
#define BP_MNUT BP_MINUTES
#define BP_SECONDS ALGR(BP_GRAVE) // ″
#define BP_SCND BP_SECONDS
// Second row
#define BP_BROKEN_PIPE LSFT(BP_PIPE) // ¦
#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 ALGR(LSFT(BP_P)) // §
#define BP_SECT BP_SECTION
#define BP_BROKEN_PIPE LSFT(BP_PIPE) // ¦
#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 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) // `
#define BP_GRVB BP_GRAVE_BIS
#define BP_GRAVE_BIS LSFT(BP_DEAD_GRAVE) // `
#define BP_GRVB BP_GRAVE_BIS
// Third row
#define BP_DEAD_DOT_ABOVE LSFT(BP_DEAD_TREMA) // dead ˙
#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(ALGR(BP_COMMA)) // dead ̛
#define BP_DHRN BP_DEAD_HORN
#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(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
#define BP_DEAD_DOT_ABOVE LSFT(BP_DEAD_TREMA) // dead ˙
#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(ALGR(BP_COMMA)) // dead ̛
#define BP_DHRN BP_DEAD_HORN
#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(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(ALGR(BP_Y)) //
#define BP_LQOT BP_LEFT_QUOTE
#define BP_RIGHT_QUOTE LSFT(ALGR(BP_X)) //
#define BP_RQOT BP_RIGHT_QUOTE
#define BP_INTERPUNCT LSFT(ALGR(BP_DOT)) // ·
#define BP_IPCT BP_INTERPUNCT
#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(ALGR(BP_F)) // ª
#define BP_ORDA BP_ORDINAL_INDICATOR_A
#define BP_LEFT_QUOTE LSFT(ALGR(BP_Y)) //
#define BP_LQOT BP_LEFT_QUOTE
#define BP_RIGHT_QUOTE LSFT(ALGR(BP_X)) //
#define BP_RQOT BP_RIGHT_QUOTE
#define BP_INTERPUNCT LSFT(ALGR(BP_DOT)) // ·
#define BP_IPCT BP_INTERPUNCT
#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(ALGR(BP_F)) // ª
#define BP_ORDA BP_ORDINAL_INDICATOR_A
// Space bar
#define BP_NARROW_NON_BREAKING_SPACE ALGR(BP_NON_BREAKING_SPACE)
#define BP_NNBS BP_NARROW_NON_BREAKING_SPACE
#define BP_NARROW_NON_BREAKING_SPACE ALGR(BP_NON_BREAKING_SPACE)
#define BP_NNBS BP_NARROW_NON_BREAKING_SPACE
#endif

View file

@ -21,54 +21,54 @@
/* Scan codes for the Brazilian ABNT2 keyboard layout */
#define BR_CCDL KC_SCLN // Ç same scancode as ;: on US layout
#define BR_SCLN KC_SLSH // ;: same scancode as /? on US layout
#define BR_QUOT KC_GRV // '" same scancode as `~ on US layout
#define BR_TILD KC_QUOT // ~^ dead keys, same scancode as '" on US layout
#define BR_ACUT KC_LBRC // ´` dead keys, same scancode as [{ on US layout
#define BR_LBRC KC_RBRC // [{ same scancode as ]} on US layout
#define BR_RBRC KC_BSLS // ]} same scancode as \| on US layout
#define BR_BSLS KC_NUBS // \| uses the non-US hash scancode (#~, sometimes §±)
#define BR_SLSH KC_INT1 // /? uses the INTL1 scancode
#define BR_CCDL KC_SCLN // Ç same scancode as ;: on US layout
#define BR_SCLN KC_SLSH // ;: same scancode as /? on US layout
#define BR_QUOT KC_GRV // '" same scancode as `~ on US layout
#define BR_TILD KC_QUOT // ~^ dead keys, same scancode as '" on US layout
#define BR_ACUT KC_LBRC // ´` dead keys, same scancode as [{ on US layout
#define BR_LBRC KC_RBRC // [{ same scancode as ]} on US layout
#define BR_RBRC KC_BSLS // ]} same scancode as \| on US layout
#define BR_BSLS KC_NUBS // \| uses the non-US hash scancode (#~, sometimes §±)
#define BR_SLSH KC_INT1 // /? uses the INTL1 scancode
#define BR_COLN LSFT(BR_SCLN) // shifted :
#define BR_DQT LSFT(BR_QUOT) // shifted "
#define BR_CIRC LSFT(BR_TILD) // shifted ^ (dead key)
#define BR_GRAV LSFT(BR_ACUT) // shifted ` (dead key)
#define BR_LCBR LSFT(BR_LBRC) // shifted {
#define BR_RCBR LSFT(BR_RBRC) // shifted }
#define BR_PIPE LSFT(BR_BSLS) // shifted |
#define BR_QUES LSFT(BR_SLSH) // shifted ?
#define BR_TRMA LSFT(KC_6) // shifted ¨ (dead key - trema accent)
#define BR_COLN LSFT(BR_SCLN) // shifted :
#define BR_DQT LSFT(BR_QUOT) // shifted "
#define BR_CIRC LSFT(BR_TILD) // shifted ^ (dead key)
#define BR_GRAV LSFT(BR_ACUT) // shifted ` (dead key)
#define BR_LCBR LSFT(BR_LBRC) // shifted {
#define BR_RCBR LSFT(BR_RBRC) // shifted }
#define BR_PIPE LSFT(BR_BSLS) // shifted |
#define BR_QUES LSFT(BR_SLSH) // shifted ?
#define BR_TRMA LSFT(KC_6) // shifted ¨ (dead key - trema accent)
// On the ABNT2 the keypad comma and the keypad dot scancodes are switched
// (presumably because in Brazil comma is used as the decimal separator)
#define BR_KPDT KC_KP_COMMA // keypad .
#define BR_KPCM KC_KP_DOT // keypad ,
#define BR_1UP LALT(KC_1) // 1 superscript ¹ alt+1
#define BR_2UP LALT(KC_2) // 2 superscript ² alt+2
#define BR_3UP LALT(KC_3) // 3 superscript ³ alt+3
#define BR_PND LALT(KC_4) // Pound sign £ alt+4
#define BR_CENT LALT(KC_5) // Cent sign ¢ alt+5
#define BR_NOT LALT(KC_6) // Not sign ¬ alt+6
#define BR_SECT LALT(KC_EQL) // Section sign § alt+=
#define BR_FORD LALT(BR_LBRC) // Feminine Ordinal Sign ª alt+[
#define BR_MORD LALT(BR_RBRC) // Masculine Ordinal Sign º alt+]
#define BR_DGRE LALT(BR_SLSH) // Degree sign ° alt+/
#define BR_1UP LALT(KC_1) // 1 superscript ¹ alt+1
#define BR_2UP LALT(KC_2) // 2 superscript ² alt+2
#define BR_3UP LALT(KC_3) // 3 superscript ³ alt+3
#define BR_PND LALT(KC_4) // Pound sign £ alt+4
#define BR_CENT LALT(KC_5) // Cent sign ¢ alt+5
#define BR_NOT LALT(KC_6) // Not sign ¬ alt+6
#define BR_SECT LALT(KC_EQL) // Section sign § alt+=
#define BR_FORD LALT(BR_LBRC) // Feminine Ordinal Sign ª alt+[
#define BR_MORD LALT(BR_RBRC) // Masculine Ordinal Sign º alt+]
#define BR_DGRE LALT(BR_SLSH) // Degree sign ° alt+/
#define BR_EURO LALT(KC_E) // Euro sign € alt+e
#define BR_NDTD LALT(BR_TILD) // Non-dead key tilde ~ alt+~
#define BR_NDAC LALT(BR_ACUT) // Non-dead key acute accent ´ alt+´
#define BR_NDGV LALT(BR_QUOT) // Non-dead key grave accent ` alt+'
#define BR_NDCR LALT(BR_CIRC) // Non-dead key circumflex accent ^ alt+^ (alt+shift+~)
#define BR_NDTR LALT(BR_TRMA) // Non-dead key trema accent ¨ alt+¨ (alt+shift+6)
#define BR_EURO LALT(KC_E) // Euro sign € alt+e
#define BR_NDTD LALT(BR_TILD) // Non-dead key tilde ~ alt+~
#define BR_NDAC LALT(BR_ACUT) // Non-dead key acute accent ´ alt+´
#define BR_NDGV LALT(BR_QUOT) // Non-dead key grave accent ` alt+'
#define BR_NDCR LALT(BR_CIRC) // Non-dead key circumflex accent ^ alt+^ (alt+shift+~)
#define BR_NDTR LALT(BR_TRMA) // Non-dead key trema accent ¨ alt+¨ (alt+shift+6)
// For 101-key keyboard layouts, the ABNT2 layout allows
// the slash and question mark to be typed using alt+q and alt+w.
// The shortcuts are provided here for completeness' sake,
// but it's recommended to use BR_SLSH and BR_QUES instead
#define BR_ASLS LALT(KC_Q)
#define BR_AQST LALT(KC_W)
#define BR_ASLS LALT(KC_Q)
#define BR_AQST LALT(KC_W)
#endif

View file

@ -19,241 +19,241 @@
#include "keymap.h"
#ifndef GR2A
#define GR2A(kc) RCTL(kc)
# define GR2A(kc) RCTL(kc)
#endif
// Normal characters
// First row
#define CSA_SLASH KC_GRV // /
#define CSA_SLSH CSA_SLASH
#define CSA_SLASH KC_GRV // /
#define CSA_SLSH CSA_SLASH
// Second row
#define CSA_DEAD_CIRCUMFLEX KC_LBRACKET // dead ^
#define CSA_DCRC CSA_DEAD_CIRCUMFLEX
#define CSA_C_CEDILLA KC_RBRACKET // Ç
#define CSA_CCED CSA_C_CEDILLA
#define CSA_DEAD_CIRCUMFLEX KC_LBRACKET // dead ^
#define CSA_DCRC CSA_DEAD_CIRCUMFLEX
#define CSA_C_CEDILLA KC_RBRACKET // Ç
#define CSA_CCED CSA_C_CEDILLA
// Third row
#define CSA_E_GRAVE KC_QUOT // è
#define CSA_EGRV CSA_E_GRAVE
#define CSA_A_GRAVE KC_BSLASH // à
#define CSA_AGRV CSA_A_GRAVE
#define CSA_E_GRAVE KC_QUOT // è
#define CSA_EGRV CSA_E_GRAVE
#define CSA_A_GRAVE KC_BSLASH // à
#define CSA_AGRV CSA_A_GRAVE
// Fourth row
#define CSA_U_GRAVE KC_NONUS_BSLASH // ù
#define CSA_UGRV CSA_U_GRAVE
#define CSA_E_ACUTE KC_SLSH // é
#define CSA_ECUT CSA_E_ACUTE
#define CSA_U_GRAVE KC_NONUS_BSLASH // ù
#define CSA_UGRV CSA_U_GRAVE
#define CSA_E_ACUTE KC_SLSH // é
#define CSA_ECUT CSA_E_ACUTE
// Shifted characters
// First row
#define CSA_BACKSLASH LSFT(CSA_SLASH) /* \ */
#define CSA_BSLS CSA_BACKSLASH
#define CSA_QUESTION LSFT(KC_6) // ?
#define CSA_QEST CSA_QUESTION
#define CSA_BACKSLASH LSFT(CSA_SLASH) /* \ */
#define CSA_BSLS CSA_BACKSLASH
#define CSA_QUESTION LSFT(KC_6) // ?
#define CSA_QEST CSA_QUESTION
// Second row
#define CSA_DEAD_TREMA LSFT(CSA_DEAD_CIRCUMFLEX) // dead trema/umlaut/diaresis for ä ë ï ö ü
#define CSA_DTRM CSA_DEAD_TREMA
#define CSA_DEAD_TREMA LSFT(CSA_DEAD_CIRCUMFLEX) // dead trema/umlaut/diaresis for ä ë ï ö ü
#define CSA_DTRM CSA_DEAD_TREMA
// Third row
// all same as US-QWERTY, or capitalised character of the non-shifted key
// Fourth row
#define CSA_APOSTROPHE LSFT(KC_COMMA) // '
#define CSA_APOS CSA_APOSTROPHE
#define CSA_DOUBLE_QUOTE LSFT(KC_DOT) // "
#define CSA_DQOT CSA_DOUBLE_QUOTE
#define CSA_APOSTROPHE LSFT(KC_COMMA) // '
#define CSA_APOS CSA_APOSTROPHE
#define CSA_DOUBLE_QUOTE LSFT(KC_DOT) // "
#define CSA_DQOT CSA_DOUBLE_QUOTE
// Alt Gr-ed characters
// First row
#define CSA_PIPE ALGR(CSA_SLASH) // |
#define CSA_CURRENCY ALGR(KC_4) // ¤
#define CSA_CURR CSA_CURRENCY
#define CSA_LEFT_CURLY_BRACE ALGR(KC_7) // {
#define CSA_LCBR CSA_LEFT_CURLY_BRACE
#define CSA_RIGHT_CURLY_BRACE ALGR(KC_8) // }
#define CSA_RCBR CSA_RIGHT_CURLY_BRACE
#define CSA_LBRACKET ALGR(KC_9) // [
#define CSA_LBRC CSA_LBRACKET
#define CSA_RBRACKET ALGR(KC_0) // ]
#define CSA_RBRC CSA_RBRACKET
#define CSA_NEGATION ALGR(KC_EQUAL) // ¬
#define CSA_NEGT CSA_NEGATION
#define CSA_PIPE ALGR(CSA_SLASH) // |
#define CSA_CURRENCY ALGR(KC_4) // ¤
#define CSA_CURR CSA_CURRENCY
#define CSA_LEFT_CURLY_BRACE ALGR(KC_7) // {
#define CSA_LCBR CSA_LEFT_CURLY_BRACE
#define CSA_RIGHT_CURLY_BRACE ALGR(KC_8) // }
#define CSA_RCBR CSA_RIGHT_CURLY_BRACE
#define CSA_LBRACKET ALGR(KC_9) // [
#define CSA_LBRC CSA_LBRACKET
#define CSA_RBRACKET ALGR(KC_0) // ]
#define CSA_RBRC CSA_RBRACKET
#define CSA_NEGATION ALGR(KC_EQUAL) // ¬
#define CSA_NEGT CSA_NEGATION
// Second row
// euro symbol not available on Linux? (X.org)
#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 ALGR(CSA_C_CEDILLA) // ~
#define CSA_DTLD CSA_DEAD_TILDE
#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 ALGR(CSA_C_CEDILLA) // ~
#define CSA_DTLD CSA_DEAD_TILDE
// Third row
#define CSA_DEGREE ALGR(KC_SCOLON) // °
#define CSA_DEGR CSA_DEGREE
#define CSA_DEGREE ALGR(KC_SCOLON) // °
#define CSA_DEGR CSA_DEGREE
// Fourth row
#define CSA_LEFT_GUILLEMET ALGR(KC_Z) // «
#define CSA_LGIL CSA_LEFT_GUILLEMET
#define CSA_RIGHT_GUILLEMET ALGR(KC_X) // »
#define CSA_RGIL CSA_RIGHT_GUILLEMET
#define CSA_LESS ALGR(KC_COMMA) // <
#define CSA_GREATER ALGR(KC_DOT) // >
#define CSA_GRTR CSA_GREATER
#define CSA_LEFT_GUILLEMET ALGR(KC_Z) // «
#define CSA_LGIL CSA_LEFT_GUILLEMET
#define CSA_RIGHT_GUILLEMET ALGR(KC_X) // »
#define CSA_RGIL CSA_RIGHT_GUILLEMET
#define CSA_LESS ALGR(KC_COMMA) // <
#define CSA_GREATER ALGR(KC_DOT) // >
#define CSA_GRTR CSA_GREATER
// Space bar
#define CSA_NON_BREAKING_SPACE ALGR(KC_SPACE)
#define CSA_NBSP CSA_NON_BREAKING_SPACE
#define CSA_NON_BREAKING_SPACE ALGR(KC_SPACE)
#define CSA_NBSP CSA_NON_BREAKING_SPACE
// GR2A-ed characters
// First row
#define CSA_SUPERSCRIPT_ONE GR2A(KC_1) // ¹
#define CSA_SUP1 CSA_SUPERSCRIPT_ONE
#define CSA_SUPERSCRIPT_TWO GR2A(KC_2) // ²
#define CSA_SUP2 CSA_SUPERSCRIPT_TWO
#define CSA_SUPERSCRIPT_THREE GR2A(KC_3) // ³
#define CSA_SUP3 CSA_SUPERSCRIPT_THREE
#define CSA_ONE_QUARTER GR2A(KC_4) // ¼
#define CSA_1QRT CSA_ONE_QUARTER
#define CSA_ONE_HALF GR2A(KC_5) // ½
#define CSA_1HLF CSA_ONE_HALF
#define CSA_THREE_QUARTERS GR2A(KC_6) // ¾
#define CSA_3QRT CSA_THREE_QUARTERS
#define CSA_SUPERSCRIPT_ONE GR2A(KC_1) // ¹
#define CSA_SUP1 CSA_SUPERSCRIPT_ONE
#define CSA_SUPERSCRIPT_TWO GR2A(KC_2) // ²
#define CSA_SUP2 CSA_SUPERSCRIPT_TWO
#define CSA_SUPERSCRIPT_THREE GR2A(KC_3) // ³
#define CSA_SUP3 CSA_SUPERSCRIPT_THREE
#define CSA_ONE_QUARTER GR2A(KC_4) // ¼
#define CSA_1QRT CSA_ONE_QUARTER
#define CSA_ONE_HALF GR2A(KC_5) // ½
#define CSA_1HLF CSA_ONE_HALF
#define CSA_THREE_QUARTERS GR2A(KC_6) // ¾
#define CSA_3QRT CSA_THREE_QUARTERS
// nothing on 7-0 and -
#define CSA_DEAD_CEDILLA GR2A(KC_EQUAL) // dead ¸
#define CSA_DCED CSA_DEAD_CEDILLA
#define CSA_DEAD_CEDILLA GR2A(KC_EQUAL) // dead ¸
#define CSA_DCED CSA_DEAD_CEDILLA
// Second row
#define CSA_OMEGA GR2A(KC_Q) // ω
#define CSA_OMEG CSA_OMEGA
#define CSA_L_STROKE GR2A(KC_W) // ł
#define CSA_LSTK CSA_L_STROKE
#define CSA_OE_LIGATURE GR2A(KC_E) // œ
#define CSA_OE CSA_OE_LIGATURE
#define CSA_PARAGRAPH GR2A(KC_R) // ¶
#define CSA_PARG CSA_PARAGRAPH
#define CSA_T_STROKE GR2A(KC_T) // ŧ
#define CSA_LEFT_ARROW GR2A(KC_Y) // ←
#define CSA_LARW CSA_LEFT_ARROW
#define CSA_DOWN_ARROW GR2A(KC_U) // ↓
#define CSA_DARW CSA_DOWN_ARROW
#define CSA_RIGHT_ARROW GR2A(KC_I) // →
#define CSA_RARW CSA_RIGHT_ARROW
#define CSA_O_STROKE GR2A(KC_O) // ø
#define CSA_OSTK CSA_O_STROKE
#define CSA_THORN GR2A(KC_P) // þ
#define CSA_THRN CSA_THORN
#define CSA_OMEGA GR2A(KC_Q) // ω
#define CSA_OMEG CSA_OMEGA
#define CSA_L_STROKE GR2A(KC_W) // ł
#define CSA_LSTK CSA_L_STROKE
#define CSA_OE_LIGATURE GR2A(KC_E) // œ
#define CSA_OE CSA_OE_LIGATURE
#define CSA_PARAGRAPH GR2A(KC_R) // ¶
#define CSA_PARG CSA_PARAGRAPH
#define CSA_T_STROKE GR2A(KC_T) // ŧ
#define CSA_LEFT_ARROW GR2A(KC_Y) // ←
#define CSA_LARW CSA_LEFT_ARROW
#define CSA_DOWN_ARROW GR2A(KC_U) // ↓
#define CSA_DARW CSA_DOWN_ARROW
#define CSA_RIGHT_ARROW GR2A(KC_I) // →
#define CSA_RARW CSA_RIGHT_ARROW
#define CSA_O_STROKE GR2A(KC_O) // ø
#define CSA_OSTK CSA_O_STROKE
#define CSA_THORN GR2A(KC_P) // þ
#define CSA_THRN CSA_THORN
// nothing on ^
#define CSA_TILDE GR2A(CSA_C_CEDILLA) // dead ~
#define CSA_TILD CSA_TILDE
#define CSA_TILDE GR2A(CSA_C_CEDILLA) // dead ~
#define CSA_TILD CSA_TILDE
// Third row
#define CSA_AE_LIGATURE GR2A(KC_A) // æ
#define CSA_AE CSA_AE_LIGATURE
#define CSA_SHARP_S GR2A(KC_S) // ß
#define CSA_SRPS CSA_SHARP_S
#define CSA_ETH GR2A(KC_D) // ð
#define CSA_AE_LIGATURE GR2A(KC_A) // æ
#define CSA_AE CSA_AE_LIGATURE
#define CSA_SHARP_S GR2A(KC_S) // ß
#define CSA_SRPS CSA_SHARP_S
#define CSA_ETH GR2A(KC_D) // ð
// nothing on F
#define CSA_ENG GR2A(KC_G) // ŋ
#define CSA_H_SRTOKE GR2A(KC_H) // ħ
#define CSA_HSTK CSA_H_SRTOKE
#define CSA_IJ_LIGATURE GR2A(KC_J) // ij
#define CSA_IJ CSA_IJ_LIGATURE
#define CSA_KRA GR2A(KC_K) // ĸ
#define CSA_L_FLOWN_DOT GR2A(KC_L) // ŀ
#define CSA_LFLD CSA_L_FLOWN_DOT
#define CSA_DEAD_ACUTE GR2A(KC_SCLN) // dead acute accent
#define CSA_DACT CSA_DEAD_ACUTE
#define CSA_ENG GR2A(KC_G) // ŋ
#define CSA_H_SRTOKE GR2A(KC_H) // ħ
#define CSA_HSTK CSA_H_SRTOKE
#define CSA_IJ_LIGATURE GR2A(KC_J) // ij
#define CSA_IJ CSA_IJ_LIGATURE
#define CSA_KRA GR2A(KC_K) // ĸ
#define CSA_L_FLOWN_DOT GR2A(KC_L) // ŀ
#define CSA_LFLD CSA_L_FLOWN_DOT
#define CSA_DEAD_ACUTE GR2A(KC_SCLN) // dead acute accent
#define CSA_DACT CSA_DEAD_ACUTE
// nothing on È & À
// Fourth row
#define CSA_CENT GR2A(KC_C) // ¢
#define CSA_LEFT_DOUBLE_QUOTE GR2A(KC_V) // “
#define CSA_LDQT CSA_LEFT_DOUBLE_QUOTE
#define CSA_RIGHT_DOUBLE_QUOTE GR2A(KC_B) // ”
#define CSA_RDQT CSA_RIGHT_DOUBLE_QUOTE
#define CSA_N_APOSTROPHE GR2A(KC_N) // ʼn (deprecated unicode codepoint)
#define CSA_NAPO CSA_N_APOSTROPHE
#define CSA_MU GR2A(KC_M) // μ
#define CSA_HORIZONTAL_BAR GR2A(KC_COMMA) // ―
#define CSA_HZBR CSA_HORIZONTAL_BAR
#define CSA_DEAD_DOT_ABOVE GR2A(KC_DOT) // dead ˙
#define CSA_DDTA CSA_DEAD_DOT_ABOVE
#define CSA_CENT GR2A(KC_C) // ¢
#define CSA_LEFT_DOUBLE_QUOTE GR2A(KC_V) // “
#define CSA_LDQT CSA_LEFT_DOUBLE_QUOTE
#define CSA_RIGHT_DOUBLE_QUOTE GR2A(KC_B) // ”
#define CSA_RDQT CSA_RIGHT_DOUBLE_QUOTE
#define CSA_N_APOSTROPHE GR2A(KC_N) // ʼn (deprecated unicode codepoint)
#define CSA_NAPO CSA_N_APOSTROPHE
#define CSA_MU GR2A(KC_M) // μ
#define CSA_HORIZONTAL_BAR GR2A(KC_COMMA) // ―
#define CSA_HZBR CSA_HORIZONTAL_BAR
#define CSA_DEAD_DOT_ABOVE GR2A(KC_DOT) // dead ˙
#define CSA_DDTA CSA_DEAD_DOT_ABOVE
// GR2A-shifted characters (different from capitalised GR2A-ed characters)
// First row
#define CSA_SOFT_HYPHEN GR2A(LSFT(CSA_SLASH)) // soft-hyphen, appears as a hyphen in wrapped word
#define CSA_SHYP CSA_SOFT_HYPHEN
#define CSA_INVERTED_EXCLAIM GR2A(KC_EXCLAIM) // ¡
#define CSA_IXLM CSA_INVERTED_EXCLAIM
#define CSA_SOFT_HYPHEN GR2A(LSFT(CSA_SLASH)) // soft-hyphen, appears as a hyphen in wrapped word
#define CSA_SHYP CSA_SOFT_HYPHEN
#define CSA_INVERTED_EXCLAIM GR2A(KC_EXCLAIM) // ¡
#define CSA_IXLM CSA_INVERTED_EXCLAIM
// nothing on 2
#define CSA_POUND GR2A(LSFT(KC_3)) // £
#define CSA_GBP CSA_POUND_SIGN
#define CSA_POUND GR2A(LSFT(KC_3)) // £
#define CSA_GBP CSA_POUND_SIGN
// 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)) // ⅜
#define CSA_3ON8 CSA_THREE_EIGHTHS
#define CSA_FIVE_EIGHTHS GR2A(LSFT(KC_6)) // ⅝
#define CSA_5ON8 CSA_FIVE_EIGHTHS
#define CSA_SEVEN_EIGHTHS GR2A(LSFT(KC_7)) // ⅞
#define CSA_7ON8 CSA_SEVEN_EIGHTHS
#define CSA_TRADEMARK GR2A(LSFT(KC_8)) // ™
#define CSA_TM CSA_TRADEMARK
#define CSA_PLUS_MINUS GR2A(LSFT(KC_9)) // ±
#define CSA_PSMS CSA_PLUS_MINUS
#define CSA_EURO_BIS GR2A(LSFT(KC_4)) // €
#define CSA_EURB CSA_EURO_BIS
#define CSA_THREE_EIGHTHS GR2A(LSFT(KC_5)) // ⅜
#define CSA_3ON8 CSA_THREE_EIGHTHS
#define CSA_FIVE_EIGHTHS GR2A(LSFT(KC_6)) // ⅝
#define CSA_5ON8 CSA_FIVE_EIGHTHS
#define CSA_SEVEN_EIGHTHS GR2A(LSFT(KC_7)) // ⅞
#define CSA_7ON8 CSA_SEVEN_EIGHTHS
#define CSA_TRADEMARK GR2A(LSFT(KC_8)) // ™
#define CSA_TM CSA_TRADEMARK
#define CSA_PLUS_MINUS GR2A(LSFT(KC_9)) // ±
#define CSA_PSMS CSA_PLUS_MINUS
// nothing on 0
#define CSA_INVERTED_QUESTION GR2A(LSFT(KC_MINUS)) // ¿
#define CSA_IQST CSA_INVERTED_QUESTION
#define CSA_DEAD_OGONEK GR2A(LSFT(KC_EQUAL)) // dead ˛
#define CSA_DOGO CSA_DEAD_OGONEK
#define CSA_INVERTED_QUESTION GR2A(LSFT(KC_MINUS)) // ¿
#define CSA_IQST CSA_INVERTED_QUESTION
#define CSA_DEAD_OGONEK GR2A(LSFT(KC_EQUAL)) // dead ˛
#define CSA_DOGO CSA_DEAD_OGONEK
// Second row
#define CSA_REGISTERED_TRADEMARK GR2A(LSFT(KC_R)) // ®
#define CSA_RTM CSA_REGISTERED_TRADEMARK
#define CSA_YEN GR2A(LSFT(KC_Y)) // ¥
#define CSA_YUAN CSA_YEN
#define CSA_UP_ARROW LSFT(CSA_DOWN_ARROW) // ↑
#define CSA_DOTLESS_I GR2A(LSFT(KC_I)) // ı
#define CSA_DLSI CSA_DOTLESS_I
#define CSA_DEAD_RING GR2A(LSFT(CSA_DCRC)) // dead °
#define CSA_DRNG CSA_DEAD_RING
#define CSA_DEAD_MACRON GR2A(LSFT(CSA_C_CEDILLA)) // dead ¯
#define CSA_DMCR CSA_DEAD_MACRON
#define CSA_REGISTERED_TRADEMARK GR2A(LSFT(KC_R)) // ®
#define CSA_RTM CSA_REGISTERED_TRADEMARK
#define CSA_YEN GR2A(LSFT(KC_Y)) // ¥
#define CSA_YUAN CSA_YEN
#define CSA_UP_ARROW LSFT(CSA_DOWN_ARROW) // ↑
#define CSA_DOTLESS_I GR2A(LSFT(KC_I)) // ı
#define CSA_DLSI CSA_DOTLESS_I
#define CSA_DEAD_RING GR2A(LSFT(CSA_DCRC)) // dead °
#define CSA_DRNG CSA_DEAD_RING
#define CSA_DEAD_MACRON GR2A(LSFT(CSA_C_CEDILLA)) // dead ¯
#define CSA_DMCR CSA_DEAD_MACRON
// Third row
#define CSA_SECTION GR2A(LSFT(KC_S)) // §
#define CSA_SECT CSA_SECTION
#define CSA_ORDINAL_INDICATOR_A GR2A(LSFT(KC_F)) // ª
#define CSA_ORDA CSA_ORDINAL_INDICATOR_A
#define CSA_DEAD_DOUBLE_ACUTE LSFT(CSA_DEAD_ACUTE) // ˝
#define CSA_DDCT CSA_DEAD_DOUBLE_ACUTE
#define CSA_DEAD_CARON GR2A(LSFT(CSA_E_GRAVE)) // dead ˇ
#define CSA_DCAR CSA_DEAD_CARON
#define CSA_DEAD_BREVE GR2A(LSFT(CSA_A_GRAVE)) // dead ˘
#define CSA_DBRV CSA_DEAD_BREVE
#define CSA_SECTION GR2A(LSFT(KC_S)) // §
#define CSA_SECT CSA_SECTION
#define CSA_ORDINAL_INDICATOR_A GR2A(LSFT(KC_F)) // ª
#define CSA_ORDA CSA_ORDINAL_INDICATOR_A
#define CSA_DEAD_DOUBLE_ACUTE LSFT(CSA_DEAD_ACUTE) // ˝
#define CSA_DDCT CSA_DEAD_DOUBLE_ACUTE
#define CSA_DEAD_CARON GR2A(LSFT(CSA_E_GRAVE)) // dead ˇ
#define CSA_DCAR CSA_DEAD_CARON
#define CSA_DEAD_BREVE GR2A(LSFT(CSA_A_GRAVE)) // dead ˘
#define CSA_DBRV CSA_DEAD_BREVE
// Fourth row
#define CSA_BROKEN_PIPE GR2A(LSFT(CSA_U_GRAVE)) // ¦
#define CSA_BPIP CSA_BROKEN_PIPE
#define CSA_COPYRIGHT GR2A(LSFT(KC_C)) // ©
#define CSA_CPRT CSA_COPYRIGHT
#define CSA_LEFT_QUOTE GR2A(LSFT(KC_V)) //
#define CSA_LQOT CSA_LEFT_QUOTE
#define CSA_RIGHT_QUOTE GR2A(LSFT(KC_B)) //
#define CSA_RQOT CSA_RIGHT_QUOTE
#define CSA_EIGHTH_NOTE GR2A(LSFT(KC_N)) // ♪
#define CSA_8NOT CSA_EIGHTH_NOTE
#define CSA_ORDINAL_INDICATOR_O GR2A(LSFT(KC_M)) // º
#define CSA_ORDO CSA_ORDINAL_INDICATOR_O
#define CSA_TIMES GR2A(LSFT(KC_COMMA)) // ×
#define CSA_TIMS CSA_TIMES
#define CSA_OBELUS GR2A(LSFT(KC_DOT)) // ÷
#define CSA_OBEL CSA_OBELUS
#define CSA_BROKEN_PIPE GR2A(LSFT(CSA_U_GRAVE)) // ¦
#define CSA_BPIP CSA_BROKEN_PIPE
#define CSA_COPYRIGHT GR2A(LSFT(KC_C)) // ©
#define CSA_CPRT CSA_COPYRIGHT
#define CSA_LEFT_QUOTE GR2A(LSFT(KC_V)) //
#define CSA_LQOT CSA_LEFT_QUOTE
#define CSA_RIGHT_QUOTE GR2A(LSFT(KC_B)) //
#define CSA_RQOT CSA_RIGHT_QUOTE
#define CSA_EIGHTH_NOTE GR2A(LSFT(KC_N)) // ♪
#define CSA_8NOT CSA_EIGHTH_NOTE
#define CSA_ORDINAL_INDICATOR_O GR2A(LSFT(KC_M)) // º
#define CSA_ORDO CSA_ORDINAL_INDICATOR_O
#define CSA_TIMES GR2A(LSFT(KC_COMMA)) // ×
#define CSA_TIMS CSA_TIMES
#define CSA_OBELUS GR2A(LSFT(KC_DOT)) // ÷
#define CSA_OBEL CSA_OBELUS
// more conventional name of the symbol
#define CSA_DIVISION_SIGN CSA_OBELUS
#define CSA_DVSN CSA_DIVISION_SIGN
#define CSA_DIVISION_SIGN CSA_OBELUS
#define CSA_DVSN CSA_DIVISION_SIGN
// TODO GR2A(LSFT(CSA_E_ACUTE))
#endif

View file

@ -18,73 +18,73 @@
#include "keymap.h"
// For software implementation of colemak
#define CM_Q KC_Q
#define CM_W KC_W
#define CM_F KC_E
#define CM_P KC_R
#define CM_G KC_T
#define CM_J KC_Y
#define CM_L KC_U
#define CM_U KC_I
#define CM_Y KC_O
#define CM_Q KC_Q
#define CM_W KC_W
#define CM_F KC_E
#define CM_P KC_R
#define CM_G KC_T
#define CM_J KC_Y
#define CM_L KC_U
#define CM_U KC_I
#define CM_Y KC_O
#define CM_SCLN KC_P
#define CM_A KC_A
#define CM_R KC_S
#define CM_S KC_D
#define CM_T KC_F
#define CM_D KC_G
#define CM_H KC_H
#define CM_N KC_J
#define CM_E KC_K
#define CM_I KC_L
#define CM_O KC_SCLN
#define CM_A KC_A
#define CM_R KC_S
#define CM_S KC_D
#define CM_T KC_F
#define CM_D KC_G
#define CM_H KC_H
#define CM_N KC_J
#define CM_E KC_K
#define CM_I KC_L
#define CM_O KC_SCLN
#define CM_COLN LSFT(CM_SCLN)
#define CM_Z KC_Z
#define CM_X KC_X
#define CM_C KC_C
#define CM_V KC_V
#define CM_B KC_B
#define CM_K KC_N
#define CM_M KC_M
#define CM_Z KC_Z
#define CM_X KC_X
#define CM_C KC_C
#define CM_V KC_V
#define CM_B KC_B
#define CM_K KC_N
#define CM_M KC_M
#define CM_COMM KC_COMM
#define CM_DOT KC_DOT
#define CM_DOT KC_DOT
#define CM_SLSH KC_SLSH
// Make it easy to support these in macros
// TODO: change macro implementation so these aren't needed
#define KC_CM_Q CM_Q
#define KC_CM_W CM_W
#define KC_CM_F CM_F
#define KC_CM_P CM_P
#define KC_CM_G CM_G
#define KC_CM_J CM_J
#define KC_CM_L CM_L
#define KC_CM_U CM_U
#define KC_CM_Y CM_Y
#define KC_CM_Q CM_Q
#define KC_CM_W CM_W
#define KC_CM_F CM_F
#define KC_CM_P CM_P
#define KC_CM_G CM_G
#define KC_CM_J CM_J
#define KC_CM_L CM_L
#define KC_CM_U CM_U
#define KC_CM_Y CM_Y
#define KC_CM_SCLN CM_SCLN
#define KC_CM_A CM_A
#define KC_CM_R CM_R
#define KC_CM_S CM_S
#define KC_CM_T CM_T
#define KC_CM_D CM_D
#define KC_CM_H CM_H
#define KC_CM_N CM_N
#define KC_CM_E CM_E
#define KC_CM_I CM_I
#define KC_CM_O CM_O
#define KC_CM_A CM_A
#define KC_CM_R CM_R
#define KC_CM_S CM_S
#define KC_CM_T CM_T
#define KC_CM_D CM_D
#define KC_CM_H CM_H
#define KC_CM_N CM_N
#define KC_CM_E CM_E
#define KC_CM_I CM_I
#define KC_CM_O CM_O
#define KC_CM_Z CM_Z
#define KC_CM_X CM_X
#define KC_CM_C CM_C
#define KC_CM_V CM_V
#define KC_CM_B CM_B
#define KC_CM_K CM_K
#define KC_CM_M CM_M
#define KC_CM_Z CM_Z
#define KC_CM_X CM_X
#define KC_CM_C CM_C
#define KC_CM_V CM_V
#define KC_CM_B CM_B
#define KC_CM_K CM_K
#define KC_CM_M CM_M
#define KC_CM_COMM CM_COMM
#define KC_CM_DOT CM_DOT
#define KC_CM_DOT CM_DOT
#define KC_CM_SLSH CM_SLSH
#endif

View file

@ -19,82 +19,82 @@
#include "keymap.h"
// Normal characters
#define DV_GRV KC_GRV
#define DV_1 KC_1
#define DV_2 KC_2
#define DV_3 KC_3
#define DV_4 KC_4
#define DV_5 KC_5
#define DV_6 KC_6
#define DV_7 KC_7
#define DV_8 KC_8
#define DV_9 KC_9
#define DV_0 KC_0
#define DV_LBRC KC_MINS
#define DV_RBRC KC_EQL
#define DV_GRV KC_GRV
#define DV_1 KC_1
#define DV_2 KC_2
#define DV_3 KC_3
#define DV_4 KC_4
#define DV_5 KC_5
#define DV_6 KC_6
#define DV_7 KC_7
#define DV_8 KC_8
#define DV_9 KC_9
#define DV_0 KC_0
#define DV_LBRC KC_MINS
#define DV_RBRC KC_EQL
#define DV_QUOT KC_Q
#define DV_COMM KC_W
#define DV_DOT KC_E
#define DV_P KC_R
#define DV_Y KC_T
#define DV_F KC_Y
#define DV_G KC_U
#define DV_C KC_I
#define DV_R KC_O
#define DV_L KC_P
#define DV_SLSH KC_LBRC
#define DV_EQL KC_RBRC
#define DV_BSLS KC_BSLS
#define DV_QUOT KC_Q
#define DV_COMM KC_W
#define DV_DOT KC_E
#define DV_P KC_R
#define DV_Y KC_T
#define DV_F KC_Y
#define DV_G KC_U
#define DV_C KC_I
#define DV_R KC_O
#define DV_L KC_P
#define DV_SLSH KC_LBRC
#define DV_EQL KC_RBRC
#define DV_BSLS KC_BSLS
#define DV_A KC_A
#define DV_O KC_S
#define DV_E KC_D
#define DV_U KC_F
#define DV_I KC_G
#define DV_D KC_H
#define DV_H KC_J
#define DV_T KC_K
#define DV_N KC_L
#define DV_S KC_SCLN
#define DV_MINS KC_QUOT
#define DV_A KC_A
#define DV_O KC_S
#define DV_E KC_D
#define DV_U KC_F
#define DV_I KC_G
#define DV_D KC_H
#define DV_H KC_J
#define DV_T KC_K
#define DV_N KC_L
#define DV_S KC_SCLN
#define DV_MINS KC_QUOT
#define DV_SCLN KC_Z
#define DV_Q KC_X
#define DV_J KC_C
#define DV_K KC_V
#define DV_X KC_B
#define DV_B KC_N
#define DV_M KC_M
#define DV_W KC_COMM
#define DV_V KC_DOT
#define DV_Z KC_SLSH
#define DV_SCLN KC_Z
#define DV_Q KC_X
#define DV_J KC_C
#define DV_K KC_V
#define DV_X KC_B
#define DV_B KC_N
#define DV_M KC_M
#define DV_W KC_COMM
#define DV_V KC_DOT
#define DV_Z KC_SLSH
// Shifted characters
#define DV_TILD LSFT(DV_GRV)
#define DV_EXLM LSFT(DV_1)
#define DV_AT LSFT(DV_2)
#define DV_HASH LSFT(DV_3)
#define DV_DLR LSFT(DV_4)
#define DV_PERC LSFT(DV_5)
#define DV_CIRC LSFT(DV_6)
#define DV_AMPR LSFT(DV_7)
#define DV_ASTR LSFT(DV_8)
#define DV_LPRN LSFT(DV_9)
#define DV_RPRN LSFT(DV_0)
#define DV_LCBR LSFT(DV_LBRC)
#define DV_RCBR LSFT(DV_RBRC)
#define DV_TILD LSFT(DV_GRV)
#define DV_EXLM LSFT(DV_1)
#define DV_AT LSFT(DV_2)
#define DV_HASH LSFT(DV_3)
#define DV_DLR LSFT(DV_4)
#define DV_PERC LSFT(DV_5)
#define DV_CIRC LSFT(DV_6)
#define DV_AMPR LSFT(DV_7)
#define DV_ASTR LSFT(DV_8)
#define DV_LPRN LSFT(DV_9)
#define DV_RPRN LSFT(DV_0)
#define DV_LCBR LSFT(DV_LBRC)
#define DV_RCBR LSFT(DV_RBRC)
#define DV_DQUO LSFT(DV_QUOT)
#define DV_LABK LSFT(DV_COMM)
#define DV_RABK LSFT(DV_DOT)
#define DV_DQUO LSFT(DV_QUOT)
#define DV_LABK LSFT(DV_COMM)
#define DV_RABK LSFT(DV_DOT)
#define DV_QUES LSFT(DV_SLSH)
#define DV_PLUS LSFT(DV_EQL)
#define DV_PIPE LSFT(DV_BSLS)
#define DV_QUES LSFT(DV_SLSH)
#define DV_PLUS LSFT(DV_EQL)
#define DV_PIPE LSFT(DV_BSLS)
#define DV_UNDS LSFT(DV_MINS)
#define DV_UNDS LSFT(DV_MINS)
#define DV_COLN LSFT(DV_SCLN)
#define DV_COLN LSFT(DV_SCLN)
#endif

View file

@ -20,79 +20,79 @@
#include "keymap.h"
// Normal characters
#define DP_DLR KC_GRV
#define DP_AMPR KC_1
#define DP_LBRC KC_2
#define DP_LCBR KC_3
#define DP_RCBR KC_4
#define DP_LPRN KC_5
#define DP_EQL KC_6
#define DP_ASTR KC_7
#define DP_RPRN KC_8
#define DP_PLUS KC_9
#define DP_RBRC KC_0
#define DP_EXLM KC_MINS
#define DP_HASH KC_EQL
#define DP_DLR KC_GRV
#define DP_AMPR KC_1
#define DP_LBRC KC_2
#define DP_LCBR KC_3
#define DP_RCBR KC_4
#define DP_LPRN KC_5
#define DP_EQL KC_6
#define DP_ASTR KC_7
#define DP_RPRN KC_8
#define DP_PLUS KC_9
#define DP_RBRC KC_0
#define DP_EXLM KC_MINS
#define DP_HASH KC_EQL
#define DP_SCLN KC_Q
#define DP_COMM KC_W
#define DP_DOT KC_E
#define DP_P KC_R
#define DP_Y KC_T
#define DP_F KC_Y
#define DP_G KC_U
#define DP_C KC_I
#define DP_R KC_O
#define DP_L KC_P
#define DP_SLSH KC_LBRC
#define DP_AT KC_RBRC
#define DP_BSLS KC_BSLS
#define DP_SCLN KC_Q
#define DP_COMM KC_W
#define DP_DOT KC_E
#define DP_P KC_R
#define DP_Y KC_T
#define DP_F KC_Y
#define DP_G KC_U
#define DP_C KC_I
#define DP_R KC_O
#define DP_L KC_P
#define DP_SLSH KC_LBRC
#define DP_AT KC_RBRC
#define DP_BSLS KC_BSLS
#define DP_A KC_A
#define DP_O KC_S
#define DP_E KC_D
#define DP_U KC_F
#define DP_I KC_G
#define DP_D KC_H
#define DP_H KC_J
#define DP_T KC_K
#define DP_N KC_L
#define DP_S KC_SCLN
#define DP_MINS KC_QUOT
#define DP_A KC_A
#define DP_O KC_S
#define DP_E KC_D
#define DP_U KC_F
#define DP_I KC_G
#define DP_D KC_H
#define DP_H KC_J
#define DP_T KC_K
#define DP_N KC_L
#define DP_S KC_SCLN
#define DP_MINS KC_QUOT
#define DP_QUOT KC_Z
#define DP_Q KC_X
#define DP_J KC_C
#define DP_K KC_V
#define DP_X KC_B
#define DP_B KC_N
#define DP_M KC_M
#define DP_W KC_COMM
#define DP_V KC_DOT
#define DP_Z KC_SLSH
#define DP_QUOT KC_Z
#define DP_Q KC_X
#define DP_J KC_C
#define DP_K KC_V
#define DP_X KC_B
#define DP_B KC_N
#define DP_M KC_M
#define DP_W KC_COMM
#define DP_V KC_DOT
#define DP_Z KC_SLSH
// Shifted characters
#define DP_TILD LSFT(DP_DLR)
#define DP_PERC LSFT(DP_AMPR)
#define DP_7 LSFT(DP_LBRC)
#define DP_5 LSFT(DP_LCBR)
#define DP_3 LSFT(DP_RCBR)
#define DP_1 LSFT(DP_LPRN)
#define DP_9 LSFT(DP_EQL)
#define DP_0 LSFT(DP_ASTR)
#define DP_2 LSFT(DP_RPRN)
#define DP_4 LSFT(DP_PLUS)
#define DP_6 LSFT(DP_RBRC)
#define DP_8 LSFT(DP_EXLM)
#define DP_GRV LSFT(DP_HASH)
#define DP_TILD LSFT(DP_DLR)
#define DP_PERC LSFT(DP_AMPR)
#define DP_7 LSFT(DP_LBRC)
#define DP_5 LSFT(DP_LCBR)
#define DP_3 LSFT(DP_RCBR)
#define DP_1 LSFT(DP_LPRN)
#define DP_9 LSFT(DP_EQL)
#define DP_0 LSFT(DP_ASTR)
#define DP_2 LSFT(DP_RPRN)
#define DP_4 LSFT(DP_PLUS)
#define DP_6 LSFT(DP_RBRC)
#define DP_8 LSFT(DP_EXLM)
#define DP_GRV LSFT(DP_HASH)
#define DP_COLN LSFT(DP_SCLN)
#define DP_LABK LSFT(DP_COMM)
#define DP_RABK LSFT(DP_DOT)
#define DP_QUES LSFT(DP_SLSH)
#define DP_CIRC LSFT(DP_AT)
#define DP_PIPE LSFT(DP_BSLS)
#define DP_UNDS LSFT(DP_MINS)
#define DP_DQUO LSFT(DP_QUOT)
#define DP_COLN LSFT(DP_SCLN)
#define DP_LABK LSFT(DP_COMM)
#define DP_RABK LSFT(DP_DOT)
#define DP_QUES LSFT(DP_SLSH)
#define DP_CIRC LSFT(DP_AT)
#define DP_PIPE LSFT(DP_BSLS)
#define DP_UNDS LSFT(DP_MINS)
#define DP_DQUO LSFT(DP_QUOT)
#endif

View file

@ -66,44 +66,44 @@
#define FR_CH_UE KC_LBRC
#define FR_CH_OE KC_SCLN
#define FR_CH_CIRC KC_EQL // accent circumflex ^ and grave ` and ~
#define FR_CH_LESS KC_NUBS // < and > and backslash
#define FR_CH_MINS KC_SLSH // - and _
#define FR_CH_DLR KC_BSLS // $, £ and }
#define FR_CH_PARA KC_GRV // § and ring °
#define FR_CH_DIAE KC_RBRC // accent ¨
#define FR_CH_CIRC KC_EQL // accent circumflex ^ and grave ` and ~
#define FR_CH_LESS KC_NUBS // < and > and backslash
#define FR_CH_MINS KC_SLSH // - and _
#define FR_CH_DLR KC_BSLS // $, £ and }
#define FR_CH_PARA KC_GRV // § and ring °
#define FR_CH_DIAE KC_RBRC // accent ¨
// shifted characters
#define FR_CH_RING LSFT(KC_GRV) // °
#define FR_CH_EXLM LSFT(KC_RBRC) // !
#define FR_CH_PLUS LSFT(KC_1) // +
#define FR_CH_DQOT LSFT(KC_2) // "
#define FR_CH_ASTR LSFT(KC_3) // *
#define FR_CH_PERC LSFT(KC_5) // %
#define FR_CH_AMPR LSFT(KC_6) // &
#define FR_CH_SLSH LSFT(KC_7) // /
#define FR_CH_LPRN LSFT(KC_8) // (
#define FR_CH_RPRN LSFT(KC_9) // )
#define FR_CH_EQL LSFT(KC_0) // =
#define FR_CH_QST LSFT(FR_CH_QUOT) // ?
#define FR_CH_MORE LSFT(FR_CH_LESS) // >
#define FR_CH_COLN LSFT(KC_DOT) // :
#define FR_CH_SCLN LSFT(KC_COMM) // ;
#define FR_CH_UNDS LSFT(FR_CH_MINS) // _
#define FR_CH_CCED LSFT(KC_4) // ç
#define FR_CH_GRV LSFT(FR_CH_CIRC) // accent grave `
#define FR_CH_RING LSFT(KC_GRV) // °
#define FR_CH_EXLM LSFT(KC_RBRC) // !
#define FR_CH_PLUS LSFT(KC_1) // +
#define FR_CH_DQOT LSFT(KC_2) // "
#define FR_CH_ASTR LSFT(KC_3) // *
#define FR_CH_PERC LSFT(KC_5) // %
#define FR_CH_AMPR LSFT(KC_6) // &
#define FR_CH_SLSH LSFT(KC_7) // /
#define FR_CH_LPRN LSFT(KC_8) // (
#define FR_CH_RPRN LSFT(KC_9) // )
#define FR_CH_EQL LSFT(KC_0) // =
#define FR_CH_QST LSFT(FR_CH_QUOT) // ?
#define FR_CH_MORE LSFT(FR_CH_LESS) // >
#define FR_CH_COLN LSFT(KC_DOT) // :
#define FR_CH_SCLN LSFT(KC_COMM) // ;
#define FR_CH_UNDS LSFT(FR_CH_MINS) // _
#define FR_CH_CCED LSFT(KC_4) // ç
#define FR_CH_GRV LSFT(FR_CH_CIRC) // accent grave `
// Alt Gr-ed characters
#define FR_CH_LCBR ALGR(KC_QUOT) // {
#define FR_CH_LBRC ALGR(KC_LBRC) // [
#define FR_CH_RBRC ALGR(KC_9) // ]
#define FR_CH_RCBR ALGR(KC_0) // }
#define FR_CH_BSLS ALGR(FR_CH_LESS) // backslash
#define FR_CH_AT ALGR(KC_2) // @
#define FR_CH_EURO ALGR(KC_E) // €
#define FR_CH_TILD ALGR(FR_CH_CIRC) // ~
#define FR_CH_PIPE ALGR(KC_1) // |
#define FR_CH_HASH ALGR(KC_3) // #
#define FR_CH_ACUT ALGR(FR_CH_QUOT) // accent acute ´
#define FR_CH_LCBR ALGR(KC_QUOT) // {
#define FR_CH_LBRC ALGR(KC_LBRC) // [
#define FR_CH_RBRC ALGR(KC_9) // ]
#define FR_CH_RCBR ALGR(KC_0) // }
#define FR_CH_BSLS ALGR(FR_CH_LESS) // backslash
#define FR_CH_AT ALGR(KC_2) // @
#define FR_CH_EURO ALGR(KC_E) // €
#define FR_CH_TILD ALGR(FR_CH_CIRC) // ~
#define FR_CH_PIPE ALGR(KC_1) // |
#define FR_CH_HASH ALGR(KC_3) // #
#define FR_CH_ACUT ALGR(FR_CH_QUOT) // accent acute ´
#endif

View file

@ -19,76 +19,76 @@
#include "keymap.h"
// Normal characters
#define FR_SUP2 KC_GRV
#define FR_AMP KC_1
#define FR_EACU KC_2
#define FR_QUOT KC_3
#define FR_APOS KC_4
#define FR_LPRN KC_5
#define FR_MINS KC_6
#define FR_EGRV KC_7
#define FR_UNDS KC_8
#define FR_CCED KC_9
#define FR_AGRV KC_0
#define FR_RPRN KC_MINS
#define FR_EQL KC_EQL
#define FR_SUP2 KC_GRV
#define FR_AMP KC_1
#define FR_EACU KC_2
#define FR_QUOT KC_3
#define FR_APOS KC_4
#define FR_LPRN KC_5
#define FR_MINS KC_6
#define FR_EGRV KC_7
#define FR_UNDS KC_8
#define FR_CCED KC_9
#define FR_AGRV KC_0
#define FR_RPRN KC_MINS
#define FR_EQL KC_EQL
#define FR_A KC_Q
#define FR_Z KC_W
#define FR_CIRC KC_LBRC
#define FR_DLR KC_RBRC
#define FR_A KC_Q
#define FR_Z KC_W
#define FR_CIRC KC_LBRC
#define FR_DLR KC_RBRC
#define FR_Q KC_A
#define FR_M KC_SCLN
#define FR_UGRV KC_QUOT
#define FR_ASTR KC_NUHS
#define FR_Q KC_A
#define FR_M KC_SCLN
#define FR_UGRV KC_QUOT
#define FR_ASTR KC_NUHS
#define FR_LESS KC_NUBS
#define FR_W KC_Z
#define FR_COMM KC_M
#define FR_SCLN KC_COMM
#define FR_COLN KC_DOT
#define FR_EXLM KC_SLSH
#define FR_LESS KC_NUBS
#define FR_W KC_Z
#define FR_COMM KC_M
#define FR_SCLN KC_COMM
#define FR_COLN KC_DOT
#define FR_EXLM KC_SLSH
// Shifted characters
#define FR_1 LSFT(KC_1)
#define FR_2 LSFT(KC_2)
#define FR_3 LSFT(KC_3)
#define FR_4 LSFT(KC_4)
#define FR_5 LSFT(KC_5)
#define FR_6 LSFT(KC_6)
#define FR_7 LSFT(KC_7)
#define FR_8 LSFT(KC_8)
#define FR_9 LSFT(KC_9)
#define FR_0 LSFT(KC_0)
#define FR_OVRR LSFT(FR_RPRN)
#define FR_1 LSFT(KC_1)
#define FR_2 LSFT(KC_2)
#define FR_3 LSFT(KC_3)
#define FR_4 LSFT(KC_4)
#define FR_5 LSFT(KC_5)
#define FR_6 LSFT(KC_6)
#define FR_7 LSFT(KC_7)
#define FR_8 LSFT(KC_8)
#define FR_9 LSFT(KC_9)
#define FR_0 LSFT(KC_0)
#define FR_OVRR LSFT(FR_RPRN)
#define FR_PLUS LSFT(FR_EQL)
#define FR_UMLT LSFT(FR_CIRC)
#define FR_PND LSFT(FR_DLR)
#define FR_PERC LSFT(FR_UGRV)
#define FR_MU LSFT(FR_ASTR)
#define FR_UMLT LSFT(FR_CIRC)
#define FR_PND LSFT(FR_DLR)
#define FR_PERC LSFT(FR_UGRV)
#define FR_MU LSFT(FR_ASTR)
#define FR_GRTR LSFT(FR_LESS)
#define FR_QUES LSFT(FR_COMM)
#define FR_DOT LSFT(FR_SCLN)
#define FR_SLSH LSFT(FR_COLN)
#define FR_SECT LSFT(FR_EXLM)
#define FR_GRTR LSFT(FR_LESS)
#define FR_QUES LSFT(FR_COMM)
#define FR_DOT LSFT(FR_SCLN)
#define FR_SLSH LSFT(FR_COLN)
#define FR_SECT LSFT(FR_EXLM)
// Alt Gr-ed characters
#define FR_TILD ALGR(KC_2)
#define FR_HASH ALGR(KC_3)
#define FR_TILD ALGR(KC_2)
#define FR_HASH ALGR(KC_3)
#define FR_LCBR ALGR(KC_4)
#define FR_LBRC ALGR(KC_5)
#define FR_LBRC ALGR(KC_5)
#define FR_PIPE ALGR(KC_6)
#define FR_GRV ALGR(KC_7)
#define FR_BSLS ALGR(KC_8)
#define FR_CCIRC ALGR(KC_9)
#define FR_AT ALGR(KC_0)
#define FR_RBRC ALGR(FR_RPRN)
#define FR_GRV ALGR(KC_7)
#define FR_BSLS ALGR(KC_8)
#define FR_CCIRC ALGR(KC_9)
#define FR_AT ALGR(KC_0)
#define FR_RBRC ALGR(FR_RPRN)
#define FR_RCBR ALGR(FR_EQL)
#define FR_EURO ALGR(KC_E)
#define FR_BULT ALGR(FR_DLR)
#define FR_EURO ALGR(KC_E)
#define FR_BULT ALGR(FR_DLR)
#endif

View file

@ -19,74 +19,74 @@
#include "keymap.h"
// Normal characters
#define FR_AT KC_GRV
#define FR_AMP KC_1
#define FR_EACU KC_2
#define FR_QUOT KC_3
#define FR_APOS KC_4
#define FR_LPRN KC_5
#define FR_SECT KC_6
#define FR_EGRV KC_7
#define FR_EXLM KC_8
#define FR_CCED KC_9
#define FR_AGRV KC_0
#define FR_RPRN KC_MINS
#define FR_MINS KC_EQL
#define FR_AT KC_GRV
#define FR_AMP KC_1
#define FR_EACU KC_2
#define FR_QUOT KC_3
#define FR_APOS KC_4
#define FR_LPRN KC_5
#define FR_SECT KC_6
#define FR_EGRV KC_7
#define FR_EXLM KC_8
#define FR_CCED KC_9
#define FR_AGRV KC_0
#define FR_RPRN KC_MINS
#define FR_MINS KC_EQL
#define FR_A KC_Q
#define FR_Z KC_W
#define FR_CIRC KC_LBRC
#define FR_DLR KC_RBRC
#define FR_A KC_Q
#define FR_Z KC_W
#define FR_CIRC KC_LBRC
#define FR_DLR KC_RBRC
#define FR_Q KC_A
#define FR_M KC_SCLN
#define FR_UGRV KC_QUOT
#define FR_GRV KC_NUHS
#define FR_Q KC_A
#define FR_M KC_SCLN
#define FR_UGRV KC_QUOT
#define FR_GRV KC_NUHS
#define FR_LESS KC_NUBS
#define FR_W KC_Z
#define FR_COMM KC_M
#define FR_SCLN KC_COMM
#define FR_COLN KC_DOT
#define FR_EQL KC_SLSH
#define FR_LESS KC_NUBS
#define FR_W KC_Z
#define FR_COMM KC_M
#define FR_SCLN KC_COMM
#define FR_COLN KC_DOT
#define FR_EQL KC_SLSH
// Shifted characters
#define FR_HASH LSFT(KC_GRV)
#define FR_1 LSFT(KC_1)
#define FR_2 LSFT(KC_2)
#define FR_3 LSFT(KC_3)
#define FR_4 LSFT(KC_4)
#define FR_5 LSFT(KC_5)
#define FR_6 LSFT(KC_6)
#define FR_7 LSFT(KC_7)
#define FR_8 LSFT(KC_8)
#define FR_9 LSFT(KC_9)
#define FR_0 LSFT(KC_0)
#define FR_UNDS LSFT(FR_MINS)
#define FR_HASH LSFT(KC_GRV)
#define FR_1 LSFT(KC_1)
#define FR_2 LSFT(KC_2)
#define FR_3 LSFT(KC_3)
#define FR_4 LSFT(KC_4)
#define FR_5 LSFT(KC_5)
#define FR_6 LSFT(KC_6)
#define FR_7 LSFT(KC_7)
#define FR_8 LSFT(KC_8)
#define FR_9 LSFT(KC_9)
#define FR_0 LSFT(KC_0)
#define FR_UNDS LSFT(FR_MINS)
#define FR_UMLT LSFT(FR_CIRC)
#define FR_ASTR LSFT(FR_DLR)
#define FR_UMLT LSFT(FR_CIRC)
#define FR_ASTR LSFT(FR_DLR)
#define FR_PERC LSFT(FR_UGRV)
#define FR_PND LSFT(FR_GRV)
#define FR_PERC LSFT(FR_UGRV)
#define FR_PND LSFT(FR_GRV)
#define FR_GRTR LSFT(FR_LESS)
#define FR_QUES LSFT(FR_COMM)
#define FR_DOT LSFT(FR_SCLN)
#define FR_SLSH LSFT(FR_COLN)
#define FR_PLUS LSFT(FR_EQL)
#define FR_GRTR LSFT(FR_LESS)
#define FR_QUES LSFT(FR_COMM)
#define FR_DOT LSFT(FR_SCLN)
#define FR_SLSH LSFT(FR_COLN)
#define FR_PLUS LSFT(FR_EQL)
// Alted characters
#define FR_LCBR LALT(KC_5)
#define FR_RCBR LALT(FR_RPRN)
#define FR_EURO LALT(KC_E)
#define FR_BULT LALT(FR_DLR)
#define FR_TILD LALT(KC_N)
#define FR_LCBR LALT(KC_5)
#define FR_RCBR LALT(FR_RPRN)
#define FR_EURO LALT(KC_E)
#define FR_BULT LALT(FR_DLR)
#define FR_TILD LALT(KC_N)
// Shift+Alt-ed characters
#define FR_LBRC LSFT(LALT(KC_5))
#define FR_RBRC LSFT(LALT(FR_RPRN))
#define FR_PIPE LSFT(LALT(KC_L))
#define FR_BSLS LSFT(LALT(FR_COLN))
#define FR_LBRC LSFT(LALT(KC_5))
#define FR_RBRC LSFT(LALT(FR_RPRN))
#define FR_PIPE LSFT(LALT(KC_L))
#define FR_BSLS LSFT(LALT(FR_COLN))
#endif

View file

@ -67,45 +67,45 @@
#define DE_UE KC_LBRC
#define DE_OE KC_SCLN
#define DE_CIRC KC_GRAVE // accent circumflex ^ and ring °
#define DE_ACUT KC_EQL // accent acute ´ and grave `
#define DE_PLUS KC_RBRC // + and * and ~
#define DE_HASH KC_BSLS // # and '
#define DE_LESS KC_NUBS // < and > and |
#define DE_MINS KC_SLSH // - and _
#define DE_CIRC KC_GRAVE // accent circumflex ^ and ring °
#define DE_ACUT KC_EQL // accent acute ´ and grave `
#define DE_PLUS KC_RBRC // + and * and ~
#define DE_HASH KC_BSLS // # and '
#define DE_LESS KC_NUBS // < and > and |
#define DE_MINS KC_SLSH // - and _
// shifted characters
#define DE_RING LSFT(DE_CIRC) // °
#define DE_EXLM LSFT(KC_1) // !
#define DE_DQOT LSFT(KC_2) // "
#define DE_PARA LSFT(KC_3) // §
#define DE_DLR LSFT(KC_4) // $
#define DE_PERC LSFT(KC_5) // %
#define DE_AMPR LSFT(KC_6) // &
#define DE_SLSH LSFT(KC_7) // /
#define DE_LPRN LSFT(KC_8) // (
#define DE_RPRN LSFT(KC_9) // )
#define DE_EQL LSFT(KC_0) // =
#define DE_QST LSFT(DE_SS) // ?
#define DE_GRV LSFT(DE_ACUT) // `
#define DE_ASTR LSFT(DE_PLUS) // *
#define DE_QUOT LSFT(DE_HASH) // '
#define DE_MORE LSFT(DE_LESS) // >
#define DE_COLN LSFT(KC_DOT) // :
#define DE_SCLN LSFT(KC_COMM) // ;
#define DE_UNDS LSFT(DE_MINS) // _
#define DE_RING LSFT(DE_CIRC) // °
#define DE_EXLM LSFT(KC_1) // !
#define DE_DQOT LSFT(KC_2) // "
#define DE_PARA LSFT(KC_3) // §
#define DE_DLR LSFT(KC_4) // $
#define DE_PERC LSFT(KC_5) // %
#define DE_AMPR LSFT(KC_6) // &
#define DE_SLSH LSFT(KC_7) // /
#define DE_LPRN LSFT(KC_8) // (
#define DE_RPRN LSFT(KC_9) // )
#define DE_EQL LSFT(KC_0) // =
#define DE_QST LSFT(DE_SS) // ?
#define DE_GRV LSFT(DE_ACUT) // `
#define DE_ASTR LSFT(DE_PLUS) // *
#define DE_QUOT LSFT(DE_HASH) // '
#define DE_MORE LSFT(DE_LESS) // >
#define DE_COLN LSFT(KC_DOT) // :
#define DE_SCLN LSFT(KC_COMM) // ;
#define DE_UNDS LSFT(DE_MINS) // _
// Alt Gr-ed characters
#define DE_SQ2 ALGR(KC_2) // ²
#define DE_SQ3 ALGR(KC_3) // ³
#define DE_LCBR ALGR(KC_7) // {
#define DE_LBRC ALGR(KC_8) // [
#define DE_RBRC ALGR(KC_9) // ]
#define DE_RCBR ALGR(KC_0) // }
#define DE_BSLS ALGR(DE_SS) // backslash
#define DE_AT ALGR(KC_Q) // @
#define DE_EURO ALGR(KC_E) // €
#define DE_TILD ALGR(DE_PLUS) // ~
#define DE_PIPE ALGR(DE_LESS) // |
#define DE_SQ2 ALGR(KC_2) // ²
#define DE_SQ3 ALGR(KC_3) // ³
#define DE_LCBR ALGR(KC_7) // {
#define DE_LBRC ALGR(KC_8) // [
#define DE_RBRC ALGR(KC_9) // ]
#define DE_RCBR ALGR(KC_0) // }
#define DE_BSLS ALGR(DE_SS) // backslash
#define DE_AT ALGR(KC_Q) // @
#define DE_EURO ALGR(KC_E) // €
#define DE_TILD ALGR(DE_PLUS) // ~
#define DE_PIPE ALGR(DE_LESS) // |
#endif

View file

@ -31,7 +31,7 @@
#define CH_G KC_G
#ifdef CH_H
// The ChibiOS ch.h file defines this...
#undef CH_H
# undef CH_H
#endif
#define CH_H KC_H
#define CH_I KC_I
@ -65,53 +65,53 @@
#define CH_DOT KC_DOT
#define CH_COMM KC_COMM
#define CH_QUOT KC_MINS // ' ? ´
#define CH_QUOT KC_MINS // ' ? ´
#define CH_AE KC_QUOT
#define CH_UE KC_LBRC
#define CH_OE KC_SCLN
#define CH_PARA KC_GRAVE // secction sign § and °
#define CH_CARR KC_EQL // carret ^ ` ~
#define CH_DIER KC_RBRC // dieresis ¨ ! ]
#define CH_DLR KC_BSLS // $ £ }
#define CH_LESS KC_NUBS // < and > and backslash
#define CH_MINS KC_SLSH // - and _
#define CH_PARA KC_GRAVE // secction sign § and °
#define CH_CARR KC_EQL // carret ^ ` ~
#define CH_DIER KC_RBRC // dieresis ¨ ! ]
#define CH_DLR KC_BSLS // $ £ }
#define CH_LESS KC_NUBS // < and > and backslash
#define CH_MINS KC_SLSH // - and _
// shifted characters
#define CH_RING LSFT(CH_PARA) // °
#define CH_PLUS LSFT(KC_1) // +
#define CH_DQOT LSFT(KC_2) // "
#define CH_PAST LSFT(KC_3) // *
#define CH_CELA LSFT(KC_4) // ç
#define CH_PERC LSFT(KC_5) // %
#define CH_AMPR LSFT(KC_6) // &
#define CH_SLSH LSFT(KC_7) // /
#define CH_LPRN LSFT(KC_8) // (
#define CH_RPRN LSFT(KC_9) // )
#define CH_EQL LSFT(KC_0) // =
#define CH_QST LSFT(CH_QUOT) // ?
#define CH_GRV LSFT(CH_CARR) // `
#define CH_EXLM LSFT(CH_DIER) // !
#define CH_POND LSFT(CH_DLR) // £
#define CH_MORE LSFT(CH_LESS) // >
#define CH_COLN LSFT(KC_DOT) // :
#define CH_SCLN LSFT(KC_COMM) // ;
#define CH_UNDS LSFT(CH_MINS) // _
#define CH_RING LSFT(CH_PARA) // °
#define CH_PLUS LSFT(KC_1) // +
#define CH_DQOT LSFT(KC_2) // "
#define CH_PAST LSFT(KC_3) // *
#define CH_CELA LSFT(KC_4) // ç
#define CH_PERC LSFT(KC_5) // %
#define CH_AMPR LSFT(KC_6) // &
#define CH_SLSH LSFT(KC_7) // /
#define CH_LPRN LSFT(KC_8) // (
#define CH_RPRN LSFT(KC_9) // )
#define CH_EQL LSFT(KC_0) // =
#define CH_QST LSFT(CH_QUOT) // ?
#define CH_GRV LSFT(CH_CARR) // `
#define CH_EXLM LSFT(CH_DIER) // !
#define CH_POND LSFT(CH_DLR) // £
#define CH_MORE LSFT(CH_LESS) // >
#define CH_COLN LSFT(KC_DOT) // :
#define CH_SCLN LSFT(KC_COMM) // ;
#define CH_UNDS LSFT(CH_MINS) // _
// Alt Gr-ed characters
#define CH_BRBR ALGR(KC_1) // ¦ brocken bar
#define CH_AT ALGR(KC_2) // @
#define CH_HASH ALGR(KC_3) // #
#define CH_NOTL ALGR(KC_6) // ¬ negative logic
#define CH_PIPE ALGR(KC_7) // |
#define CH_CENT ALGR(KC_8) // ¢ cent
#define CH_ACUT ALGR(CH_QUOT) // ´
#define CH_TILD ALGR(CH_CARR) // ~
#define CH_EURO ALGR(KC_E) // €
#define CH_LBRC ALGR(CH_UE) // [
#define CH_RBRC ALGR(CH_DIER) // ]
#define CH_LCBR ALGR(CH_AE) // {
#define CH_RCBR ALGR(CH_DLR) // }
#define CH_BSLS ALGR(CH_LESS) // backslash
#define CH_BRBR ALGR(KC_1) // ¦ brocken bar
#define CH_AT ALGR(KC_2) // @
#define CH_HASH ALGR(KC_3) // #
#define CH_NOTL ALGR(KC_6) // ¬ negative logic
#define CH_PIPE ALGR(KC_7) // |
#define CH_CENT ALGR(KC_8) // ¢ cent
#define CH_ACUT ALGR(CH_QUOT) // ´
#define CH_TILD ALGR(CH_CARR) // ~
#define CH_EURO ALGR(KC_E) // €
#define CH_LBRC ALGR(CH_UE) // [
#define CH_RBRC ALGR(CH_DIER) // ]
#define CH_LCBR ALGR(CH_AE) // {
#define CH_RCBR ALGR(CH_DLR) // }
#define CH_BSLS ALGR(CH_LESS) // backslash
#endif

View file

@ -68,45 +68,45 @@
#define DE_OSX_UE KC_LBRC
#define DE_OSX_OE KC_SCLN
#define DE_OSX_CIRC KC_NUBS // accent circumflex ^ and ring °
#define DE_OSX_ACUT KC_EQL // accent acute ´ and grave `
#define DE_OSX_PLUS KC_RBRC // + and * and ~
#define DE_OSX_HASH KC_BSLS // # and '
#define DE_OSX_LESS KC_GRV // < and > and |
#define DE_OSX_MINS KC_SLSH // - and _
#define DE_OSX_CIRC KC_NUBS // accent circumflex ^ and ring °
#define DE_OSX_ACUT KC_EQL // accent acute ´ and grave `
#define DE_OSX_PLUS KC_RBRC // + and * and ~
#define DE_OSX_HASH KC_BSLS // # and '
#define DE_OSX_LESS KC_GRV // < and > and |
#define DE_OSX_MINS KC_SLSH // - and _
// shifted characters
#define DE_OSX_RING LSFT(DE_OSX_CIRC) // °
#define DE_OSX_EXLM LSFT(KC_1) // !
#define DE_OSX_DQOT LSFT(KC_2) // "
#define DE_OSX_PARA LSFT(KC_3) // §
#define DE_OSX_DLR LSFT(KC_4) // $
#define DE_OSX_PERC LSFT(KC_5) // %
#define DE_OSX_AMPR LSFT(KC_6) // &
#define DE_OSX_SLSH LSFT(KC_7) // /
#define DE_OSX_LPRN LSFT(KC_8) // (
#define DE_OSX_RPRN LSFT(KC_9) // )
#define DE_OSX_EQL LSFT(KC_0) // =
#define DE_OSX_QST LSFT(DE_OSX_SS) // ?
#define DE_OSX_GRV LSFT(DE_OSX_ACUT) // `
#define DE_OSX_ASTR LSFT(DE_OSX_PLUS) // *
#define DE_OSX_QUOT LSFT(DE_OSX_HASH) // '
#define DE_OSX_MORE LSFT(DE_OSX_LESS) // >
#define DE_OSX_COLN LSFT(KC_DOT) // :
#define DE_OSX_SCLN LSFT(KC_COMM) // ;
#define DE_OSX_UNDS LSFT(DE_OSX_MINS) // _
#define DE_OSX_RING LSFT(DE_OSX_CIRC) // °
#define DE_OSX_EXLM LSFT(KC_1) // !
#define DE_OSX_DQOT LSFT(KC_2) // "
#define DE_OSX_PARA LSFT(KC_3) // §
#define DE_OSX_DLR LSFT(KC_4) // $
#define DE_OSX_PERC LSFT(KC_5) // %
#define DE_OSX_AMPR LSFT(KC_6) // &
#define DE_OSX_SLSH LSFT(KC_7) // /
#define DE_OSX_LPRN LSFT(KC_8) // (
#define DE_OSX_RPRN LSFT(KC_9) // )
#define DE_OSX_EQL LSFT(KC_0) // =
#define DE_OSX_QST LSFT(DE_OSX_SS) // ?
#define DE_OSX_GRV LSFT(DE_OSX_ACUT) // `
#define DE_OSX_ASTR LSFT(DE_OSX_PLUS) // *
#define DE_OSX_QUOT LSFT(DE_OSX_HASH) // '
#define DE_OSX_MORE LSFT(DE_OSX_LESS) // >
#define DE_OSX_COLN LSFT(KC_DOT) // :
#define DE_OSX_SCLN LSFT(KC_COMM) // ;
#define DE_OSX_UNDS LSFT(DE_OSX_MINS) // _
// Alt-ed characters
//#define DE_OSX_SQ2 LALT(KC_2) // ²
//#define DE_OSX_SQ3 LALT(KC_3) // ³
#define DE_OSX_LCBR LALT(KC_8) // {
#define DE_OSX_LBRC LALT(KC_5) // [
#define DE_OSX_RBRC LALT(KC_6) // ]
#define DE_OSX_RCBR LALT(KC_9) // }
#define DE_OSX_BSLS LALT(LSFT(KC_7)) // backslash
#define DE_OSX_AT LALT(DE_OSX_L) // @
#define DE_OSX_EURO LALT(KC_E) // €
#define DE_OSX_TILD LALT(DE_OSX_N) // ~
#define DE_OSX_PIPE LALT(DE_OSX_7) // |
#define DE_OSX_LCBR LALT(KC_8) // {
#define DE_OSX_LBRC LALT(KC_5) // [
#define DE_OSX_RBRC LALT(KC_6) // ]
#define DE_OSX_RCBR LALT(KC_9) // }
#define DE_OSX_BSLS LALT(LSFT(KC_7)) // backslash
#define DE_OSX_AT LALT(DE_OSX_L) // @
#define DE_OSX_EURO LALT(KC_E) // €
#define DE_OSX_TILD LALT(DE_OSX_N) // ~
#define DE_OSX_PIPE LALT(DE_OSX_7) // |
#endif

View file

@ -73,64 +73,64 @@
#define HU_AA KC_QUOT
#define HU_UEE KC_NUHS
#define HU_MINS KC_SLSH // -
#define HU_MINS KC_SLSH // -
#define HU_DOT KC_DOT
#define HU_COMM KC_COMM
// shifted characters
// num row
#define HU_PARA LSFT(HU_0) // §
#define HU_QUOT LSFT(HU_1) // '
#define HU_DQOT LSFT(HU_2) // "
#define HU_PLUS LSFT(HU_3) // +
#define HU_EXLM LSFT(HU_4) // !
#define HU_PERC LSFT(HU_5) // %
#define HU_SLSH LSFT(HU_6) // /
#define HU_EQL LSFT(HU_7) // =
#define HU_LPRN LSFT(HU_8) // (
#define HU_RPRN LSFT(HU_9) // )
#define HU_PARA LSFT(HU_0) // §
#define HU_QUOT LSFT(HU_1) // '
#define HU_DQOT LSFT(HU_2) // "
#define HU_PLUS LSFT(HU_3) // +
#define HU_EXLM LSFT(HU_4) // !
#define HU_PERC LSFT(HU_5) // %
#define HU_SLSH LSFT(HU_6) // /
#define HU_EQL LSFT(HU_7) // =
#define HU_LPRN LSFT(HU_8) // (
#define HU_RPRN LSFT(HU_9) // )
// í,y row
#define HU_II KC_NUBS
#define HU_QST LSFT(HU_COMM) // ?
#define HU_COLN LSFT(HU_DOT) // :
#define HU_UNDS LSFT(HU_MINS) // _
#define HU_II KC_NUBS
#define HU_QST LSFT(HU_COMM) // ?
#define HU_COLN LSFT(HU_DOT) // :
#define HU_UNDS LSFT(HU_MINS) // _
// Alt Gr'd characters
// num row
#define HU_TILD ALGR(HU_1) // ~
#define HU_TILD ALGR(HU_1) // ~
//#define HU_?? ALGR(HU_2) // ˇ (proper name?)
#define HU_CIRC ALGR(HU_3) // ^
#define HU_BRV ALGR(HU_4) // ˘
#define HU_RING ALGR(HU_5) // °
#define HU_CIRC ALGR(HU_3) // ^
#define HU_BRV ALGR(HU_4) // ˘
#define HU_RING ALGR(HU_5) // °
//#define HU_?? ALGR(HU_6) // ˛ (proper name?)
#define HU_GRV ALGR(HU_7) // `
#define HU_GRV ALGR(HU_7) // `
//#define HU_?? ALGR(HU_8) // ˙ (proper name?)
#define HU_ACUT ALGR(HU_9) // ´
#define HU_ACUT ALGR(HU_9) // ´
// q row
#define HU_BSLS ALGR(HU_Q) // \ backslash
#define HU_PIPE ALGR(HU_W) // |
#define HU_DIV ALGR(HU_OEE) // ÷
#define HU_CRSS ALGR(HU_UU) // ×
#define HU_EURO ALGR(HU_U) // €
#define HU_BSLS ALGR(HU_Q) // \ backslash
#define HU_PIPE ALGR(HU_W) // |
#define HU_DIV ALGR(HU_OEE) // ÷
#define HU_CRSS ALGR(HU_UU) // ×
#define HU_EURO ALGR(HU_U) // €
// a row
#define HU_LBRC ALGR(HU_F) // [
#define HU_RBRC ALGR(HU_G) // ]
#define HU_DLR ALGR(HU_EE) // $
#define HU_SS ALGR(HU_AA) // ß
#define HU_LBRC ALGR(HU_F) // [
#define HU_RBRC ALGR(HU_G) // ]
#define HU_DLR ALGR(HU_EE) // $
#define HU_SS ALGR(HU_AA) // ß
// í,y row
#define HU_LESS ALGR(KC_NUBS) // <
#define HU_MORE ALGR(HU_Y) // >
#define HU_HASH ALGR(HU_X) // #
#define HU_AMPR ALGR(HU_C) // &
#define HU_AT ALGR(HU_V) // @
#define HU_LCBR ALGR(HU_B)// {
#define HU_RCBR ALGR(HU_N) // }
#define HU_SCLN ALGR(HU_COMM) // ;
#define HU_ASTR ALGR(HU_MINS) // *
#define HU_LESS ALGR(KC_NUBS) // <
#define HU_MORE ALGR(HU_Y) // >
#define HU_HASH ALGR(HU_X) // #
#define HU_AMPR ALGR(HU_C) // &
#define HU_AT ALGR(HU_V) // @
#define HU_LCBR ALGR(HU_B) // {
#define HU_RCBR ALGR(HU_N) // }
#define HU_SCLN ALGR(HU_COMM) // ;
#define HU_ASTR ALGR(HU_MINS) // *
#endif

View file

@ -70,46 +70,43 @@
#define IT_APOS KC_MINS // ', ?, ,
#define IT_BKSL KC_GRAVE // backslash \, |
#define IT_BKSL KC_GRAVE // backslash \, |
#define IT_ACUT // accent acute ´ and grave `
#define IT_LESS KC_NUBS // < and > and |
#define IT_MINS KC_SLSH // - and _
#define IT_LESS KC_NUBS // < and > and |
#define IT_MINS KC_SLSH // - and _
// shifted characters
#define IT_PIPE LSFT(IT_BKSL) // °
#define IT_EXLM LSFT(KC_1) // !
#define IT_DQOT LSFT(KC_2) // "
#define IT_STRL LSFT(KC_3) // £
#define IT_DLR LSFT(KC_4) // $
#define IT_PERC LSFT(KC_5) // %
#define IT_AMPR LSFT(KC_6) // &
#define IT_SLSH LSFT(KC_7) // /
#define IT_LPRN LSFT(KC_8) // (
#define IT_RPRN LSFT(KC_9) // )
#define IT_EQL LSFT(KC_0) // =
#define IT_QST LSFT(IT_APOS) // ?
#define IT_CRC LSFT(IT_IACC) // ^
#define IT_ASTR LSFT(IT_PLUS) // *
#define IT_MORE LSFT(IT_LESS) // >
#define IT_COLN LSFT(IT_DOT) // :
#define IT_SCLN LSFT(IT_COMM) // ;
#define IT_UNDS LSFT(IT_MINS) // _
#define IT_PIPE LSFT(IT_BKSL) // °
#define IT_EXLM LSFT(KC_1) // !
#define IT_DQOT LSFT(KC_2) // "
#define IT_STRL LSFT(KC_3) // £
#define IT_DLR LSFT(KC_4) // $
#define IT_PERC LSFT(KC_5) // %
#define IT_AMPR LSFT(KC_6) // &
#define IT_SLSH LSFT(KC_7) // /
#define IT_LPRN LSFT(KC_8) // (
#define IT_RPRN LSFT(KC_9) // )
#define IT_EQL LSFT(KC_0) // =
#define IT_QST LSFT(IT_APOS) // ?
#define IT_CRC LSFT(IT_IACC) // ^
#define IT_ASTR LSFT(IT_PLUS) // *
#define IT_MORE LSFT(IT_LESS) // >
#define IT_COLN LSFT(IT_DOT) // :
#define IT_SCLN LSFT(IT_COMM) // ;
#define IT_UNDS LSFT(IT_MINS) // _
// Alt Gr-ed characters
#define IT_LCBR ALGR(KC_7) // {
#define IT_LBRC ALGR(IT_EACC) // [
#define IT_RBRC ALGR(IT_PLUS) // ]
#define IT_RCBR ALGR(KC_0) // }
#define IT_AT ALGR(IT_OACC) // @
#define IT_EURO ALGR(KC_E) // €
#define IT_PIPE LSFT(IT_BKSL) // |
#define IT_SHRP ALGR(IT_AACC) // #
#define IT_LCBR ALGR(KC_7) // {
#define IT_LBRC ALGR(IT_EACC) // [
#define IT_RBRC ALGR(IT_PLUS) // ]
#define IT_RCBR ALGR(KC_0) // }
#define IT_AT ALGR(IT_OACC) // @
#define IT_EURO ALGR(KC_E) // €
#define IT_PIPE LSFT(IT_BKSL) // |
#define IT_SHRP ALGR(IT_AACC) // #
#define IT_X_PLUS X_RBRACKET // #
#define IT_X_PLUS X_RBRACKET // #
#endif

View file

@ -20,61 +20,55 @@
* note: This website is written in Japanese.
*/
#ifndef KEYMAP_JP_H
#define KEYMAP_JP_H
#include "keymap.h"
#define JP_ZHTG KC_GRV // hankaku/zenkaku|kanzi
#define JP_YEN KC_INT3 // yen, |
#define JP_CIRC KC_EQL // ^, ~
#define JP_AT KC_LBRC // @, `
#define JP_LBRC KC_RBRC // [, {
#define JP_COLN KC_QUOT // :, *
#define JP_RBRC KC_NUHS // ], }
#define JP_BSLS KC_INT1 // \, _
#define JP_MHEN KC_INT5 // muhenkan
#define JP_HENK KC_INT4 // henkan
#define JP_KANA KC_INT2 // katakana/hiragana|ro-mazi
#define JP_ZHTG KC_GRV // hankaku/zenkaku|kanzi
#define JP_YEN KC_INT3 // yen, |
#define JP_CIRC KC_EQL // ^, ~
#define JP_AT KC_LBRC // @, `
#define JP_LBRC KC_RBRC // [, {
#define JP_COLN KC_QUOT // :, *
#define JP_RBRC KC_NUHS // ], }
#define JP_BSLS KC_INT1 // \, _
#define JP_MHEN KC_INT5 // muhenkan
#define JP_HENK KC_INT4 // henkan
#define JP_KANA KC_INT2 // katakana/hiragana|ro-mazi
#define JP_MKANA KC_LANG1 //kana on MacOSX
#define JP_MEISU KC_LANG2 //eisu on MacOSX
//Aliases for shifted symbols
#define JP_DQT LSFT(KC_2) // "
#define JP_AMPR LSFT(KC_6) // &
#define JP_QUOT LSFT(KC_7) // '
#define JP_LPRN LSFT(KC_8) // (
#define JP_RPRN LSFT(KC_9) // )
#define JP_EQL LSFT(KC_MINS) // =
#define JP_TILD LSFT(JP_CIRC) // ~
#define JP_PIPE LSFT(JP_YEN) // |
#define JP_GRV LSFT(JP_AT) // `
#define JP_LCBR LSFT(JP_LBRC) // {
#define JP_PLUS LSFT(KC_SCLN) // +
#define JP_ASTR LSFT(JP_COLN) // *
#define JP_RCBR LSFT(JP_RBRC) // }
#define JP_UNDS LSFT(JP_BSLS) // _
#define JP_MKANA KC_LANG1 // kana on MacOSX
#define JP_MEISU KC_LANG2 // eisu on MacOSX
// Aliases for shifted symbols
#define JP_DQT LSFT(KC_2) // "
#define JP_AMPR LSFT(KC_6) // &
#define JP_QUOT LSFT(KC_7) // '
#define JP_LPRN LSFT(KC_8) // (
#define JP_RPRN LSFT(KC_9) // )
#define JP_EQL LSFT(KC_MINS) // =
#define JP_TILD LSFT(JP_CIRC) // ~
#define JP_PIPE LSFT(JP_YEN) // |
#define JP_GRV LSFT(JP_AT) // `
#define JP_LCBR LSFT(JP_LBRC) // {
#define JP_PLUS LSFT(KC_SCLN) // +
#define JP_ASTR LSFT(JP_COLN) // *
#define JP_RCBR LSFT(JP_RBRC) // }
#define JP_UNDS LSFT(JP_BSLS) // _
// These symbols are correspond to US101-layout.
#define JP_MINS KC_MINS // -
#define JP_SCLN KC_SCLN // ;
#define JP_COMM KC_COMM // ,
#define JP_DOT KC_DOT // .
#define JP_SLSH KC_SLSH // /
#define JP_MINS KC_MINS // -
#define JP_SCLN KC_SCLN // ;
#define JP_COMM KC_COMM // ,
#define JP_DOT KC_DOT // .
#define JP_SLSH KC_SLSH // /
// shifted
#define JP_EXLM KC_EXLM // !
#define JP_HASH KC_HASH // #
#define JP_DLR KC_DLR // $
#define JP_PERC KC_PERC // %
#define JP_LT KC_LT // <
#define JP_GT KC_GT // >
#define JP_QUES KC_QUES // ?
#define JP_EXLM KC_EXLM // !
#define JP_HASH KC_HASH // #
#define JP_DLR KC_DLR // $
#define JP_PERC KC_PERC // %
#define JP_LT KC_LT // <
#define JP_GT KC_GT // >
#define JP_QUES KC_QUES // ?
#endif

View file

@ -19,52 +19,52 @@
#include "keymap.h"
// Normal characters
#define NO_HALF KC_GRV
#define NO_PLUS KC_MINS
#define NO_ACUT KC_EQL
#define NO_HALF KC_GRV
#define NO_PLUS KC_MINS
#define NO_ACUT KC_EQL
#define NO_AM KC_LBRC
#define NO_QUOT KC_RBRC // this is the "umlaut" char on Nordic keyboards, Apple layout
#define NO_AE KC_SCLN
#define NO_OSLH KC_QUOT
#define NO_APOS KC_NUHS
#define NO_AM KC_LBRC
#define NO_QUOT KC_RBRC // this is the "umlaut" char on Nordic keyboards, Apple layout
#define NO_AE KC_SCLN
#define NO_OSLH KC_QUOT
#define NO_APOS KC_NUHS
#define NO_LESS KC_NUBS
#define NO_LESS KC_NUBS
#define NO_MINS KC_SLSH
// Shifted characters
#define NO_SECT LSFT(NO_HALF)
#define NO_QUO2 LSFT(KC_2)
#define NO_QUO2 LSFT(KC_2)
#define NO_BULT LSFT(KC_4)
#define NO_AMPR LSFT(KC_6)
#define NO_AMPR LSFT(KC_6)
#define NO_SLSH LSFT(KC_7)
#define NO_LPRN LSFT(KC_8)
#define NO_RPRN LSFT(KC_9)
#define NO_EQL LSFT(KC_0)
#define NO_QUES LSFT(NO_PLUS)
#define NO_GRV LSFT(NO_ACUT)
#define NO_LPRN LSFT(KC_8)
#define NO_RPRN LSFT(KC_9)
#define NO_EQL LSFT(KC_0)
#define NO_QUES LSFT(NO_PLUS)
#define NO_GRV LSFT(NO_ACUT)
#define NO_CIRC LSFT(NO_QUOT)
#define NO_GRTR LSFT(NO_LESS)
#define NO_GRTR LSFT(NO_LESS)
#define NO_SCLN LSFT(KC_COMM)
#define NO_COLN LSFT(KC_DOT)
#define NO_UNDS LSFT(NO_MINS)
// Alt Gr-ed characters
#define NO_AT ALGR(KC_2)
#define NO_PND ALGR(KC_3)
#define NO_DLR ALGR(KC_4)
#define NO_AT ALGR(KC_2)
#define NO_PND ALGR(KC_3)
#define NO_DLR ALGR(KC_4)
#define NO_LCBR ALGR(KC_7)
#define NO_LBRC ALGR(KC_8)
#define NO_RBRC ALGR(KC_9)
#define NO_RCBR ALGR(KC_0)
#define NO_RCBR ALGR(KC_0)
#define NO_PIPE ALGR(KC_NUBS)
#define NO_EURO ALGR(KC_E)
#define NO_TILD ALGR(NO_QUOT)
#define NO_BSLS ALGR(KC_MINS)
#define NO_MU ALGR(KC_M)
#define NO_MU ALGR(KC_M)
#endif

View file

@ -18,37 +18,36 @@
#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_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_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_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_DOT KC_DOT
#define NM_SLSH KC_SLSH

View file

@ -22,35 +22,35 @@
// Norwegian redifinitions from the nordic keyset
#undef NO_ACUT
#define NO_ACUT ALGR(NO_BSLS) // ´
#define NO_ACUT ALGR(NO_BSLS) // ´
#undef NO_AE
#define NO_AE KC_QUOT // æ
#define NO_AE KC_QUOT // æ
#undef NO_BSLS
#define NO_BSLS KC_EQL // '\'
#undef NO_CIRC
#define NO_CIRC LSFT(KC_RBRC) // ^
#undef NO_GRV
#define NO_GRV LSFT(NO_BSLS) //
#define NO_GRV LSFT(NO_BSLS) //
#undef NO_OSLH
#define NO_OSLH KC_SCLN // ø
#define NO_OSLH KC_SCLN // ø
#undef NO_PIPE
#define NO_PIPE KC_GRV // |
// Additional norwegian keys not defined in the nordic keyset
#define NO_AA KC_LBRC // å
#define NO_AA KC_LBRC // å
#define NO_ASTR LSFT(KC_BSLS) // *
// Norwegian unique MAC characters
#define NO_ACUT_MAC KC_EQL // =
#define NO_APOS_MAC KC_NUBS // '
#define NO_AT_MAC KC_BSLS // @
#define NO_BSLS_MAC ALGR(LSFT(KC_7)) // '\'
#define NO_DLR_MAC LSFT(KC_4) // $
#define NO_GRV_MAC ALGR(NO_BSLS) // `
#define NO_GRTR_MAC LSFT(KC_GRV) // >
#define NO_ACUT_MAC KC_EQL // =
#define NO_APOS_MAC KC_NUBS // '
#define NO_AT_MAC KC_BSLS // @
#define NO_BSLS_MAC ALGR(LSFT(KC_7)) // '\'
#define NO_DLR_MAC LSFT(KC_4) // $
#define NO_GRV_MAC ALGR(NO_BSLS) // `
#define NO_GRTR_MAC LSFT(KC_GRV) // >
#define NO_LCBR_MAC ALGR(LSFT(KC_8)) // }
#define NO_LESS_MAC KC_GRV // >
#define NO_PIPE_MAC ALGR(KC_7) // |
#define NO_LESS_MAC KC_GRV // >
#define NO_PIPE_MAC ALGR(KC_7) // |
#define NO_RCBR_MAC ALGR(LSFT(KC_9)) // }
#endif

View file

@ -18,30 +18,30 @@
#include "keymap.h"
#define PV_NUM KC_1
#define PV_LS KC_Q
#define PV_LT KC_W
#define PV_LP KC_E
#define PV_LH KC_R
#define PV_LK KC_S
#define PV_LW KC_D
#define PV_LR KC_F
#define PV_NUM KC_1
#define PV_LS KC_Q
#define PV_LT KC_W
#define PV_LP KC_E
#define PV_LH KC_R
#define PV_LK KC_S
#define PV_LW KC_D
#define PV_LR KC_F
#define PV_STAR KC_Y
#define PV_RF KC_U
#define PV_RP KC_I
#define PV_RL KC_O
#define PV_RT KC_P
#define PV_RD KC_LBRC
#define PV_RR KC_J
#define PV_RB KC_K
#define PV_RG KC_L
#define PV_RS KC_SCLN
#define PV_RZ KC_QUOT
#define PV_RF KC_U
#define PV_RP KC_I
#define PV_RL KC_O
#define PV_RT KC_P
#define PV_RD KC_LBRC
#define PV_RR KC_J
#define PV_RB KC_K
#define PV_RG KC_L
#define PV_RS KC_SCLN
#define PV_RZ KC_QUOT
#define PV_A KC_C
#define PV_O KC_V
#define PV_E KC_N
#define PV_U KC_M
#define PV_A KC_C
#define PV_O KC_V
#define PV_E KC_N
#define PV_U KC_M
#endif

View file

@ -18,30 +18,30 @@
#include "keymap_dvorak.h"
#define PD_NUM DV_1
#define PD_LS DV_Q
#define PD_LT DV_W
#define PD_LP DV_E
#define PD_LH DV_R
#define PD_LK DV_S
#define PD_LW DV_D
#define PD_LR DV_F
#define PD_NUM DV_1
#define PD_LS DV_Q
#define PD_LT DV_W
#define PD_LP DV_E
#define PD_LH DV_R
#define PD_LK DV_S
#define PD_LW DV_D
#define PD_LR DV_F
#define PD_STAR DV_Y
#define PD_RF DV_U
#define PD_RP DV_I
#define PD_RL DV_O
#define PD_RT DV_P
#define PD_RD DV_LBRC
#define PD_RR DV_J
#define PD_RB DV_K
#define PD_RG DV_L
#define PD_RS DV_SCLN
#define PD_RZ DV_QUOT
#define PD_RF DV_U
#define PD_RP DV_I
#define PD_RL DV_O
#define PD_RT DV_P
#define PD_RD DV_LBRC
#define PD_RR DV_J
#define PD_RB DV_K
#define PD_RG DV_L
#define PD_RS DV_SCLN
#define PD_RZ DV_QUOT
#define PD_A DV_C
#define PD_O DV_V
#define PD_E DV_N
#define PD_U DV_M
#define PD_A DV_C
#define PD_O DV_V
#define PD_E DV_N
#define PD_U DV_M
#endif

View file

@ -20,11 +20,11 @@
#include "keymap.h"
//Swapped Z and Y
// Swapped Z and Y
#define SI_Z KC_Y
#define SI_Y KC_Z
//Special characters
// Special characters
#define SI_CV KC_SCLN
#define SI_SV KC_LBRC
#define SI_ZV KC_BSLS
@ -68,40 +68,40 @@
#define SI_DOT KC_DOT
#define SI_COMM KC_COMM
#define SI_PLUS KC_EQL // + and * and ~
#define SI_QOT KC_MINS // Single quote
#define SI_MINS KC_SLSH // - and _
#define SI_PLUS KC_EQL // + and * and ~
#define SI_QOT KC_MINS // Single quote
#define SI_MINS KC_SLSH // - and _
// shifted characters
#define SI_EXLM LSFT(KC_1) // !
#define SI_DQOT LSFT(KC_2) // "
#define SI_HASH LSFT(KC_3) // #
#define SI_DLR LSFT(KC_4) // $
#define SI_PERC LSFT(KC_5) // %
#define SI_AMPR LSFT(KC_6) // &
#define SI_SLSH LSFT(KC_7) // /
#define SI_LPRN LSFT(KC_8) // (
#define SI_RPRN LSFT(KC_9) // )
#define SI_EQL LSFT(KC_0) // =
#define SI_QST LSFT(SI_QOT) // ?
#define SI_ASTR LSFT(SI_PLUS) // *
#define SI_COLN LSFT(KC_DOT) // :
#define SI_SCLN LSFT(KC_COMM) // ;
#define SI_UNDS LSFT(SI_MINS) // _
#define SI_EXLM LSFT(KC_1) // !
#define SI_DQOT LSFT(KC_2) // "
#define SI_HASH LSFT(KC_3) // #
#define SI_DLR LSFT(KC_4) // $
#define SI_PERC LSFT(KC_5) // %
#define SI_AMPR LSFT(KC_6) // &
#define SI_SLSH LSFT(KC_7) // /
#define SI_LPRN LSFT(KC_8) // (
#define SI_RPRN LSFT(KC_9) // )
#define SI_EQL LSFT(KC_0) // =
#define SI_QST LSFT(SI_QOT) // ?
#define SI_ASTR LSFT(SI_PLUS) // *
#define SI_COLN LSFT(KC_DOT) // :
#define SI_SCLN LSFT(KC_COMM) // ;
#define SI_UNDS LSFT(SI_MINS) // _
// Alt Gr-ed characters
#define SI_CIRC 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) // |
#define SI_CIRC ALGR(KC_3) // ^
#define SI_DEG ALGR(KC_5) // °
#define SI_GRV ALGR(KC_7) // `
#define SI_ACCU ALGR(KC_9) // ´
#define SI_LCBR ALGR(KC_B) // {
#define SI_RCBR ALGR(KC_N) // }
#define SI_LBRC ALGR(KC_F) // [
#define SI_RBRC ALGR(KC_G) // ]
#define SI_BSLS ALGR(KC_Q) // backslash
#define SI_AT ALGR(KC_V) // @
#define SI_EURO ALGR(KC_E) // €
#define SI_TILD ALGR(KC_1) // ~
#define SI_PIPE ALGR(KC_W) // |
#endif

View file

@ -20,54 +20,54 @@
// Normal characters
#define ES_OVRR KC_GRV
#define ES_APOS KC_MINS
#define ES_IEXL KC_EQL
#define ES_APOS KC_MINS
#define ES_IEXL KC_EQL
#define ES_GRV KC_LBRC
#define ES_PLUS KC_RBRC
#define ES_GRV KC_LBRC
#define ES_PLUS KC_RBRC
#define ES_NTIL KC_SCLN
#define ES_ACUT KC_QUOT
#define ES_CCED KC_NUHS
#define ES_NTIL KC_SCLN
#define ES_ACUT KC_QUOT
#define ES_CCED KC_NUHS
#define ES_LESS KC_NUBS
#define ES_MINS KC_SLSH
#define ES_LESS KC_NUBS
#define ES_MINS KC_SLSH
// Shifted characters
#define ES_ASML LSFT(ES_OVRR)
#define ES_QUOT LSFT(KC_2)
#define ES_OVDT LSFT(KC_3)
#define ES_AMPR LSFT(KC_6)
#define ES_ASML LSFT(ES_OVRR)
#define ES_QUOT LSFT(KC_2)
#define ES_OVDT LSFT(KC_3)
#define ES_AMPR LSFT(KC_6)
#define ES_SLSH LSFT(KC_7)
#define ES_LPRN LSFT(KC_8)
#define ES_RPRN LSFT(KC_9)
#define ES_EQL LSFT(KC_0)
#define ES_QUES LSFT(ES_APOS)
#define ES_IQUE LSFT(ES_IEXL)
#define ES_EQL LSFT(KC_0)
#define ES_QUES LSFT(ES_APOS)
#define ES_IQUE LSFT(ES_IEXL)
#define ES_CIRC LSFT(ES_GRV)
#define ES_ASTR LSFT(ES_PLUS)
#define ES_CIRC LSFT(ES_GRV)
#define ES_ASTR LSFT(ES_PLUS)
#define ES_UMLT LSFT(ES_GRV)
#define ES_UMLT LSFT(ES_GRV)
#define ES_GRTR LSFT(ES_LESS)
#define ES_SCLN LSFT(KC_COMM)
#define ES_COLN LSFT(KC_DOT)
#define ES_UNDS LSFT(ES_MINS)
#define ES_GRTR LSFT(ES_LESS)
#define ES_SCLN LSFT(KC_COMM)
#define ES_COLN LSFT(KC_DOT)
#define ES_UNDS LSFT(ES_MINS)
// Alt Gr-ed characters
#define ES_BSLS ALGR(ES_OVRR)
#define ES_PIPE ALGR(KC_1)
#define ES_AT ALGR(KC_2)
#define ES_HASH ALGR(KC_3)
#define ES_TILD ALGR(ES_NTIL)
#define ES_EURO ALGR(KC_5)
#define ES_NOT ALGR(KC_6)
#define ES_BSLS ALGR(ES_OVRR)
#define ES_PIPE ALGR(KC_1)
#define ES_AT ALGR(KC_2)
#define ES_HASH ALGR(KC_3)
#define ES_TILD ALGR(ES_NTIL)
#define ES_EURO ALGR(KC_5)
#define ES_NOT ALGR(KC_6)
#define ES_LBRC ALGR(ES_GRV)
#define ES_LBRC ALGR(ES_GRV)
#define ES_RBRC ALGR(ES_PLUS)
#define ES_LCBR ALGR(ES_ACUT)
#define ES_RCBR ALGR(ES_CCED)
#define ES_LCBR ALGR(ES_ACUT)
#define ES_RCBR ALGR(ES_CCED)
#endif

View file

@ -22,55 +22,55 @@
// errors, this must be <= 42 total entries in order to
// support the GeminiPR protocol.
enum steno_keycodes {
STN__MIN = QK_STENO,
STN_FN = STN__MIN,
STN_NUM,
STN_N1 = STN_NUM,
STN_N2,
STN_N3,
STN_N4,
STN_N5,
STN_N6,
STN_SL,
STN_S1 = STN_SL,
STN_S2,
STN_TL,
STN_KL,
STN_PL,
STN_WL,
STN_HL,
STN_RL,
STN_A,
STN_O,
STN_STR,
STN_ST1 = STN_STR,
STN_ST2,
STN_RES1,
STN_RE1 = STN_RES1,
STN_RES2,
STN_RE2 = STN_RES2,
STN_PWR,
STN_ST3,
STN_ST4,
STN_E,
STN_U,
STN_FR,
STN_RR,
STN_PR,
STN_BR,
STN_LR,
STN_GR,
STN_TR,
STN_SR,
STN_DR,
STN_N7,
STN_N8,
STN_N9,
STN_NA,
STN_NB,
STN_NC,
STN_ZR,
STN__MAX = STN_ZR, // must be less than QK_STENO_BOLT
STN__MIN = QK_STENO,
STN_FN = STN__MIN,
STN_NUM,
STN_N1 = STN_NUM,
STN_N2,
STN_N3,
STN_N4,
STN_N5,
STN_N6,
STN_SL,
STN_S1 = STN_SL,
STN_S2,
STN_TL,
STN_KL,
STN_PL,
STN_WL,
STN_HL,
STN_RL,
STN_A,
STN_O,
STN_STR,
STN_ST1 = STN_STR,
STN_ST2,
STN_RES1,
STN_RE1 = STN_RES1,
STN_RES2,
STN_RE2 = STN_RES2,
STN_PWR,
STN_ST3,
STN_ST4,
STN_E,
STN_U,
STN_FR,
STN_RR,
STN_PR,
STN_BR,
STN_LR,
STN_GR,
STN_TR,
STN_SR,
STN_DR,
STN_N7,
STN_N8,
STN_N9,
STN_NA,
STN_NB,
STN_NC,
STN_ZR,
STN__MAX = STN_ZR, // must be less than QK_STENO_BOLT
};
#endif

View file

@ -20,68 +20,68 @@
#include "keymap.h"
// Normal characters
#define SE_HALF KC_GRV
#define SE_PLUS KC_MINS
#define SE_ACUT KC_EQL
#define SE_HALF KC_GRV
#define SE_PLUS KC_MINS
#define SE_ACUT KC_EQL
#define SE_AM KC_LBRC
#define SE_QUOT KC_RBRC // this is the "umlaut" char on Nordic keyboards, Apple layout
#define SE_AE KC_QUOT // ä
#define SE_AM KC_LBRC
#define SE_QUOT KC_RBRC // this is the "umlaut" char on Nordic keyboards, Apple layout
#define SE_AE KC_QUOT // ä
#define SE_OSLH KC_SCLN // ö
#define SE_APOS KC_NUHS
#define SE_APOS KC_NUHS
#define SE_LESS KC_NUBS
#define SE_LESS KC_NUBS
#define SE_MINS KC_SLSH
// Shifted characters
#define SE_SECT LSFT(SE_HALF)
#define SE_QUO2 LSFT(KC_2)
#define SE_QUO2 LSFT(KC_2)
#define SE_BULT LSFT(KC_4)
#define SE_AMPR LSFT(KC_6)
#define SE_AMPR LSFT(KC_6)
#define SE_SLSH LSFT(KC_7)
#define SE_LPRN LSFT(KC_8)
#define SE_RPRN LSFT(KC_9)
#define SE_EQL LSFT(KC_0)
#define SE_QUES LSFT(SE_PLUS)
#define SE_GRV LSFT(SE_ACUT)
#define SE_LPRN LSFT(KC_8)
#define SE_RPRN LSFT(KC_9)
#define SE_EQL LSFT(KC_0)
#define SE_QUES LSFT(SE_PLUS)
#define SE_GRV LSFT(SE_ACUT)
#define SE_CIRC LSFT(KC_RBRC) // ^
#define SE_GRTR LSFT(SE_LESS)
#define SE_GRTR LSFT(SE_LESS)
#define SE_SCLN LSFT(KC_COMM)
#define SE_COLN LSFT(KC_DOT)
#define SE_UNDS LSFT(SE_MINS)
// Alt Gr-ed characters
#define SE_AT ALGR(KC_2)
#define SE_PND ALGR(KC_3)
#define SE_DLR ALGR(KC_4)
#define SE_AT ALGR(KC_2)
#define SE_PND ALGR(KC_3)
#define SE_DLR ALGR(KC_4)
#define SE_LCBR ALGR(KC_7)
#define SE_LBRC ALGR(KC_8)
#define SE_RBRC ALGR(KC_9)
#define SE_RCBR ALGR(KC_0)
#define SE_RCBR ALGR(KC_0)
#define SE_PIPE ALGR(KC_NUBS)
#define SE_EURO ALGR(KC_E)
#define SE_TILD ALGR(SE_QUOT)
#define SE_BSLS ALGR(KC_MINS)
#define SE_MU ALGR(KC_M)
#define SE_MU ALGR(KC_M)
#define SE_AA KC_LBRC // å
#define SE_AA KC_LBRC // å
#define SE_ASTR LSFT(KC_BSLS) // *
// Norwegian unique MAC characters (not vetted for Swedish)
#define SE_ACUT_MAC KC_EQL // =
#define SE_APOS_MAC KC_NUBS // '
#define SE_AT_MAC KC_BSLS // @
#define SE_BSLS_MAC ALGR(LSFT(KC_7)) // '\'
#define SE_DLR_MAC ALGR(KC_4) // $
#define SE_GRV_MAC ALGR(SE_BSLS) // `
#define SE_GRTR_MAC LSFT(KC_GRV) // >
#define SE_ACUT_MAC KC_EQL // =
#define SE_APOS_MAC KC_NUBS // '
#define SE_AT_MAC KC_BSLS // @
#define SE_BSLS_MAC ALGR(LSFT(KC_7)) // '\'
#define SE_DLR_MAC ALGR(KC_4) // $
#define SE_GRV_MAC ALGR(SE_BSLS) // `
#define SE_GRTR_MAC LSFT(KC_GRV) // >
#define SE_LCBR_MAC ALGR(LSFT(KC_8)) // {
#define SE_LESS_MAC KC_GRV // <
#define SE_PIPE_MAC ALGR(KC_7) // |
#define SE_LESS_MAC KC_GRV // <
#define SE_PIPE_MAC ALGR(KC_7) // |
#define SE_RCBR_MAC ALGR(LSFT(KC_9)) // }
#endif

View file

@ -20,21 +20,21 @@
// Normal characters
#define UK_HASH KC_NUHS
#define UK_BSLS KC_NUBS
#define UK_BSLS KC_NUBS
// Shifted characters
#define UK_NOT LSFT(KC_GRV)
#define UK_DQUO LSFT(KC_2)
#define UK_PND LSFT(KC_3)
#define UK_AT LSFT(KC_QUOT)
#define UK_TILD LSFT(KC_NUHS)
#define UK_PIPE LSFT(KC_NUBS)
#define UK_NOT LSFT(KC_GRV)
#define UK_DQUO LSFT(KC_2)
#define UK_PND LSFT(KC_3)
#define UK_AT LSFT(KC_QUOT)
#define UK_TILD LSFT(KC_NUHS)
#define UK_PIPE LSFT(KC_NUBS)
// Alt Gr-ed characters
#define UK_BRKP ALGR(KC_GRV)
#define UK_EURO ALGR(KC_4)
#define UK_EACT ALGR(KC_E)
#define UK_UACT ALGR(KC_U)
#define UK_BRKP ALGR(KC_GRV)
#define UK_EURO ALGR(KC_4)
#define UK_EACT ALGR(KC_E)
#define UK_UACT ALGR(KC_U)
#define UK_IACT ALGR(KC_I)
#define UK_OACT ALGR(KC_O)
#define UK_AACT ALGR(KC_A)

View file

@ -18,66 +18,66 @@
#include "keymap.h"
// For software implementation of workman
#define WK_Q KC_Q
#define WK_D KC_W
#define WK_R KC_E
#define WK_W KC_R
#define WK_B KC_T
#define WK_J KC_Y
#define WK_F KC_U
#define WK_U KC_I
#define WK_P KC_O
#define WK_Q KC_Q
#define WK_D KC_W
#define WK_R KC_E
#define WK_W KC_R
#define WK_B KC_T
#define WK_J KC_Y
#define WK_F KC_U
#define WK_U KC_I
#define WK_P KC_O
#define WK_SCLN KC_P
#define WK_A KC_A
#define WK_S KC_S
#define WK_H KC_D
#define WK_T KC_F
#define WK_G KC_G
#define WK_Y KC_H
#define WK_N KC_J
#define WK_E KC_K
#define WK_O KC_L
#define WK_I KC_SCLN
#define WK_A KC_A
#define WK_S KC_S
#define WK_H KC_D
#define WK_T KC_F
#define WK_G KC_G
#define WK_Y KC_H
#define WK_N KC_J
#define WK_E KC_K
#define WK_O KC_L
#define WK_I KC_SCLN
#define WK_Z KC_Z
#define WK_X KC_X
#define WK_M KC_C
#define WK_C KC_V
#define WK_V KC_B
#define WK_K KC_N
#define WK_L KC_M
#define WK_Z KC_Z
#define WK_X KC_X
#define WK_M KC_C
#define WK_C KC_V
#define WK_V KC_B
#define WK_K KC_N
#define WK_L KC_M
// Make it easy to support these in macros
// TODO: change macro implementation so these aren't needed
#define KC_WK_Q WK_Q
#define KC_WK_D WK_D
#define KC_WK_R WK_R
#define KC_WK_W WK_W
#define KC_WK_B WK_B
#define KC_WK_J WK_J
#define KC_WK_F WK_F
#define KC_WK_U WK_U
#define KC_WK_P WK_P
#define KC_WK_Q WK_Q
#define KC_WK_D WK_D
#define KC_WK_R WK_R
#define KC_WK_W WK_W
#define KC_WK_B WK_B
#define KC_WK_J WK_J
#define KC_WK_F WK_F
#define KC_WK_U WK_U
#define KC_WK_P WK_P
#define KC_WK_SCLN WK_SCLN
#define KC_WK_A WK_A
#define KC_WK_S WK_S
#define KC_WK_H WK_H
#define KC_WK_T WK_T
#define KC_WK_G WK_G
#define KC_WK_Y WK_Y
#define KC_WK_N WK_N
#define KC_WK_E WK_E
#define KC_WK_O WK_O
#define KC_WK_I WK_I
#define KC_WK_A WK_A
#define KC_WK_S WK_S
#define KC_WK_H WK_H
#define KC_WK_T WK_T
#define KC_WK_G WK_G
#define KC_WK_Y WK_Y
#define KC_WK_N WK_N
#define KC_WK_E WK_E
#define KC_WK_O WK_O
#define KC_WK_I WK_I
#define KC_WK_Z WK_Z
#define KC_WK_X WK_X
#define KC_WK_M WK_M
#define KC_WK_C WK_C
#define KC_WK_V WK_V
#define KC_WK_K WK_K
#define KC_WK_L WK_L
#define KC_WK_Z WK_Z
#define KC_WK_X WK_X
#define KC_WK_M WK_M
#define KC_WK_C WK_C
#define KC_WK_V WK_V
#define KC_WK_K WK_K
#define KC_WK_L WK_L
#endif

View file

@ -20,78 +20,45 @@
#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,
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
};
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,
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
};
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
KC_X, KC_Y, BE_Z, BE_CCED, BE_AMP, BE_AGRV, BE_EQL, KC_DEL};

View file

@ -20,78 +20,45 @@
#include "keymap_bepo.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,
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
};
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};
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,
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
};
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
BP_X, BP_Y, BP_Z, BP_Y, BP_B, BP_X, BP_K, KC_DEL};

View file

@ -24,34 +24,33 @@ 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,
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,
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_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_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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
CM_X, CM_Y, CM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL};

View file

@ -24,34 +24,33 @@ 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,
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,
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// ! " # $ % & '
KC_SPC, DV_1, DV_QUOT, DV_3, DV_4, DV_5, DV_7, DV_QUOT,
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_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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
DV_X, DV_Y, DV_Z, DV_LBRC, DV_BSLS, DV_RBRC, DV_GRV, KC_DEL};

View file

@ -20,78 +20,45 @@
#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,
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
};
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,
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
};
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
KC_X, KC_Y, FR_Z, FR_APOS, FR_MINS, FR_EQL, FR_EACU, KC_DEL};

View file

@ -20,78 +20,45 @@
#include "keymap_german.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,
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,
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
};
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, 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,
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
};
0, 0, 0, 0, 0, 0, 0, 0, 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};
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,
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,
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// ! " # $ % & '
KC_SPC, DE_1, DE_2, DE_HASH, DE_4, DE_5, DE_6, DE_HASH,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
DE_X, DE_Y, DE_Z, DE_7, DE_LESS, DE_0, DE_PLUS, KC_DEL};

View file

@ -20,58 +20,41 @@
#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,
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,
0, 0, 0, 0, 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, 1, 1, 1, 1, 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, 0, 0, 0, 0, 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, 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,
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,
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// ! " # $ % & '
KC_SPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
KC_X, KC_Y, KC_Z, JP_LBRC, JP_YEN, JP_RBRC, JP_CIRC, KC_DEL};

View file

@ -24,34 +24,33 @@ 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,
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,
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_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_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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
NM_X, NM_Y, NM_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL};

View file

@ -20,78 +20,45 @@
#include "keymap_spanish.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,
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, 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, 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
};
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, 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,
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
};
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};
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,
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,
XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// ! " # $ % & '
KC_SPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, ES_APOS,
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_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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
KC_X, KC_Y, KC_Z, ES_ACUT, KC_1, ES_CCED, ES_NTIL, KC_DEL};

View file

@ -20,58 +20,41 @@
#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,
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
};
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,
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,
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_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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
UK_X, UK_Y, UK_Z, UK_LBRC, UK_BSLS, UK_RBRC, UK_HASH, KC_DEL};

View file

@ -24,34 +24,33 @@ 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,
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,
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_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_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,
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,
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,
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,
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,
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,
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,
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,
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,
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
};
WK_X, WK_Y, WK_Z, KC_LBRC, KC_BSLS, KC_RBRC, KC_GRV, KC_DEL};

View file

@ -30,27 +30,27 @@
led_config_t led_matrix_config;
#ifndef MAX
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
# define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#endif
#ifndef MIN
#define MIN(a,b) ((a) < (b)? (a): (b))
# define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifndef LED_DISABLE_AFTER_TIMEOUT
#define LED_DISABLE_AFTER_TIMEOUT 0
# define LED_DISABLE_AFTER_TIMEOUT 0
#endif
#ifndef LED_DISABLE_WHEN_USB_SUSPENDED
#define LED_DISABLE_WHEN_USB_SUSPENDED false
# define LED_DISABLE_WHEN_USB_SUSPENDED false
#endif
#ifndef EECONFIG_LED_MATRIX
#define EECONFIG_LED_MATRIX EECONFIG_RGBLIGHT
# define EECONFIG_LED_MATRIX EECONFIG_RGBLIGHT
#endif
#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > 255
#define LED_MATRIX_MAXIMUM_BRIGHTNESS 255
# define LED_MATRIX_MAXIMUM_BRIGHTNESS 255
#endif
bool g_suspend_state = false;
@ -64,37 +64,33 @@ 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);
}
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(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);
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);
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
# 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;
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;
@ -110,17 +106,11 @@ void map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i, uint8_t
}
}
void led_matrix_update_pwm_buffers(void) {
led_matrix_driver.flush();
}
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(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);
}
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) {
@ -131,37 +121,29 @@ bool process_led_matrix(uint16_t keycode, keyrecord_t *record) {
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);
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;
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
#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;
for (uint8_t i = 0; i < led_count; i++) g_key_hit[led[i]] = 255;
g_any_key_hit = 255;
#endif
#endif
}
return true;
}
void led_matrix_set_suspend_state(bool state) {
g_suspend_state = state;
}
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);
}
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_uniform_brightness(void) { led_matrix_set_index_value_all(LED_MATRIX_MAXIMUM_BRIGHTNESS / BACKLIGHT_LEVELS * led_matrix_config.val); }
void led_matrix_custom(void) {}
@ -180,17 +162,15 @@ void led_matrix_task(void) {
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);
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;
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
@ -217,12 +197,9 @@ void led_matrix_indicators(void) {
led_matrix_indicators_user();
}
__attribute__((weak))
void led_matrix_indicators_kb(void) {}
__attribute__((weak))
void led_matrix_indicators_user(void) {}
__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)
// {
@ -248,7 +225,7 @@ void led_matrix_init(void) {
wait_ms(500);
// clear the key hits
for (int led=0; led<LED_DRIVER_LED_COUNT; led++) {
for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) {
g_key_hit[led] = 255;
}
@ -266,7 +243,7 @@ void led_matrix_init(void) {
led_matrix_config.raw = eeconfig_read_led_matrix();
}
eeconfig_debug_led_matrix(); // display current eeprom values
eeconfig_debug_led_matrix(); // display current eeprom values
}
// Deals with the messy details of incrementing an integer
@ -303,32 +280,26 @@ static uint8_t decrement(uint8_t value, uint8_t step, uint8_t min, uint8_t max)
// }
// }
uint32_t led_matrix_get_tick(void) {
return g_tick;
}
uint32_t led_matrix_get_tick(void) { return g_tick; }
void led_matrix_toggle(void) {
led_matrix_config.enable ^= 1;
led_matrix_config.enable ^= 1;
eeconfig_update_led_matrix(led_matrix_config.raw);
}
void led_matrix_enable(void) {
led_matrix_config.enable = 1;
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_enable_noeeprom(void) { led_matrix_config.enable = 1; }
void led_matrix_disable(void) {
led_matrix_config.enable = 0;
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_disable_noeeprom(void) { led_matrix_config.enable = 0; }
void led_matrix_step(void) {
led_matrix_config.mode++;
@ -358,12 +329,12 @@ void led_matrix_decrease_val(void) {
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
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
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) {
@ -373,19 +344,13 @@ void led_matrix_mode(uint8_t mode, bool eeprom_write) {
}
}
uint8_t led_matrix_get_mode(void) {
return led_matrix_config.mode;
}
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_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);
}
void backlight_set(uint8_t val) { led_matrix_set_value(val); }

View file

@ -30,120 +30,119 @@
#if defined(IS31FL3731) || defined(IS31FL3733)
#if defined(IS31FL3731)
#include "is31fl3731-simple.h"
#endif
# if defined(IS31FL3731)
# include "is31fl3731-simple.h"
# endif
#include "i2c_master.h"
# 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
# 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
# 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
// 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
# 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,
.init = init,
.flush = flush,
#ifdef IS31FL3731
.set_value = IS31FL3731_set_value,
# ifdef IS31FL3731
.set_value = IS31FL3731_set_value,
.set_value_all = IS31FL3731_set_value_all,
#else
# else
.set_value = IS31FL3733_set_value,
.set_value_all = IS31FL3733_set_value_all,
#endif
# endif
};
#endif

View file

@ -15,47 +15,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "led_tables.h"
#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[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
};
// Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm
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[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,
79, 82, 85, 88, 90, 93, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124,
127, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 162, 165, 167, 170, 173,
176, 179, 182, 185, 188, 190, 193, 196, 198, 201, 203, 206, 208, 211, 213, 215,
218, 220, 222, 224, 226, 228, 230, 232, 234, 235, 237, 238, 240, 241, 243, 244,
245, 246, 248, 249, 250, 250, 251, 252, 253, 253, 254, 254, 254, 255, 255, 255,
255, 255, 255, 255, 254, 254, 254, 253, 253, 252, 251, 250, 250, 249, 248, 246,
245, 244, 243, 241, 240, 238, 237, 235, 234, 232, 230, 228, 226, 224, 222, 220,
218, 215, 213, 211, 208, 206, 203, 201, 198, 196, 193, 190, 188, 185, 182, 179,
176, 173, 170, 167, 165, 162, 158, 155, 152, 149, 146, 143, 140, 137, 134, 131,
128, 124, 121, 118, 115, 112, 109, 106, 103, 100, 97, 93, 90, 88, 85, 82,
79, 76, 73, 70, 67, 65, 62, 59, 57, 54, 52, 49, 47, 44, 42, 40,
37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11,
10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0
};
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, 79, 82, 85, 88, 90, 93, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 162, 165, 167, 170, 173, 176, 179, 182, 185, 188, 190, 193, 196, 198, 201, 203, 206, 208, 211, 213, 215, 218, 220, 222, 224, 226, 228, 230, 232, 234, 235, 237, 238, 240, 241, 243, 244, 245, 246, 248, 249, 250, 250, 251, 252, 253, 253, 254, 254, 254, 255, 255, 255,
255, 255, 255, 255, 254, 254, 254, 253, 253, 252, 251, 250, 250, 249, 248, 246, 245, 244, 243, 241, 240, 238, 237, 235, 234, 232, 230, 228, 226, 224, 222, 220, 218, 215, 213, 211, 208, 206, 203, 201, 198, 196, 193, 190, 188, 185, 182, 179, 176, 173, 170, 167, 165, 162, 158, 155, 152, 149, 146, 143, 140, 137, 134, 131, 128, 124, 121, 118, 115, 112, 109, 106, 103, 100, 97, 93, 90, 88, 85, 82, 79, 76, 73, 70, 67, 65, 62, 59, 57, 54, 52, 49, 47, 44, 42, 40, 37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11, 10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0};
#endif

View file

@ -20,46 +20,44 @@
#ifndef LED_MATRIX_H
#define LED_MATRIX_H
#ifndef BACKLIGHT_ENABLE
#error You must define BACKLIGHT_ENABLE with LED_MATRIX_ENABLE
# error You must define BACKLIGHT_ENABLE with LED_MATRIX_ENABLE
#endif
typedef struct Point {
uint8_t x;
uint8_t y;
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;
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;
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
};
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 {
@ -95,22 +93,22 @@ 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);
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);
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. */

View file

@ -25,24 +25,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum.h"
#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))
# define matrix_bitpop(i) bitpop(matrix[i])
# define print_matrix_header() print("\nr/c 01234567\n")
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
# define matrix_bitpop(i) bitpop(matrix[i])
# define ROW_SHIFTER ((uint8_t)1)
#elif (MATRIX_COLS <= 16)
# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
# define matrix_bitpop(i) bitpop16(matrix[i])
# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
# define matrix_bitpop(i) bitpop16(matrix[i])
# define ROW_SHIFTER ((uint16_t)1)
#elif (MATRIX_COLS <= 32)
# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
# define matrix_bitpop(i) bitpop32(matrix[i])
# define ROW_SHIFTER ((uint32_t)1)
# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
# define matrix_bitpop(i) bitpop32(matrix[i])
# define ROW_SHIFTER ((uint32_t)1)
#endif
#ifdef MATRIX_MASKED
extern const matrix_row_t matrix_mask[];
extern const matrix_row_t matrix_mask[];
#endif
#ifdef DIRECT_PINS
@ -53,63 +53,34 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
#endif
/* matrix state(1:on, 0:off) */
static matrix_row_t raw_matrix[MATRIX_ROWS]; //raw values
static matrix_row_t matrix[MATRIX_ROWS]; //debounced values
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) {
matrix_init_kb();
}
__attribute__((weak)) void matrix_init_quantum(void) { matrix_init_kb(); }
__attribute__ ((weak))
void matrix_scan_quantum(void) {
matrix_scan_kb();
}
__attribute__((weak)) void matrix_scan_quantum(void) { matrix_scan_kb(); }
__attribute__ ((weak))
void matrix_init_kb(void) {
matrix_init_user();
}
__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); }
__attribute__ ((weak))
void matrix_scan_kb(void) {
matrix_scan_user();
}
__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); }
__attribute__ ((weak))
void matrix_init_user(void) {
}
__attribute__((weak)) void matrix_init_user(void) {}
__attribute__ ((weak))
void matrix_scan_user(void) {
}
__attribute__((weak)) void matrix_scan_user(void) {}
inline
uint8_t matrix_rows(void) {
return MATRIX_ROWS;
}
inline uint8_t matrix_rows(void) { return MATRIX_ROWS; }
inline
uint8_t matrix_cols(void) {
return MATRIX_COLS;
}
inline uint8_t matrix_cols(void) { return MATRIX_COLS; }
//Deprecated.
bool matrix_is_modified(void)
{
// Deprecated.
bool matrix_is_modified(void) {
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));
}
inline bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & ((matrix_row_t)1 << col)); }
inline
matrix_row_t matrix_get_row(uint8_t row)
{
inline matrix_row_t matrix_get_row(uint8_t row) {
// Matrix mask lets you disable switches in the returned matrix data. For example, if you have a
// switch blocker installed and the switch is always pressed.
#ifdef MATRIX_MASKED
@ -119,19 +90,18 @@ matrix_row_t matrix_get_row(uint8_t row)
#endif
}
void matrix_print(void)
{
void matrix_print(void) {
print_matrix_header();
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
phex(row); print(": ");
phex(row);
print(": ");
print_matrix_row(row);
print("\n");
}
}
uint8_t matrix_key_count(void)
{
uint8_t matrix_key_count(void) {
uint8_t count = 0;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
count += matrix_bitpop(i);
@ -139,63 +109,56 @@ uint8_t matrix_key_count(void)
return count;
}
#ifdef DIRECT_PINS
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);
}
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;
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);
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]);
return (last_row_value != current_matrix[current_row]);
}
#elif (DIODE_DIRECTION == COL2ROW)
static void select_row(uint8_t 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_row(uint8_t row) { setPinInputHigh(row_pins[row]); }
static void unselect_rows(void)
{
for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
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]);
}
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)
{
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
// Store last value of row prior to reading
matrix_row_t last_row_value = current_matrix[current_row];
@ -207,13 +170,12 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
wait_us(30);
// For each col...
for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
// Select the col pin to read (active low)
uint8_t pin_state = readPin(col_pins[col_index]);
// Populate the matrix row with the state of the col pin
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
}
// Unselect row
@ -224,33 +186,27 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
#elif (DIODE_DIRECTION == ROW2COL)
static void select_col(uint8_t col)
{
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_col(uint8_t col) { setPinInputHigh(col_pins[col]); }
static void unselect_cols(void)
{
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
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]);
}
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)
{
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
bool matrix_changed = false;
// Select col and wait for col selecton to stabilize
@ -258,27 +214,21 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
wait_us(30);
// For each row...
for(uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++)
{
for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
// Store last value of row prior to reading
matrix_row_t last_row_value = current_matrix[row_index];
// Check row pin state
if (readPin(row_pins[row_index]) == 0)
{
if (readPin(row_pins[row_index]) == 0) {
// Pin LO, set col bit
current_matrix[row_index] |= (ROW_SHIFTER << current_col);
}
else
{
} else {
// Pin HI, clear col bit
current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
}
// Determine if the matrix changed state
if ((last_row_value != current_matrix[row_index]) && !(matrix_changed))
{
if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) {
matrix_changed = true;
}
}
@ -292,14 +242,13 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
#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++) {
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
raw_matrix[i] = 0;
matrix[i] = 0;
matrix[i] = 0;
}
debounce_init(MATRIX_ROWS);
@ -307,24 +256,23 @@ void matrix_init(void) {
matrix_init_quantum();
}
uint8_t matrix_scan(void)
{
bool changed = false;
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);
}
// 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);
}
// 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);
debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
matrix_scan_quantum();
return (uint8_t)changed;
matrix_scan_quantum();
return (uint8_t)changed;
}

View file

@ -18,35 +18,33 @@
#include <avr/io.h>
enum {
PinDirectionInput = 0,
PinDirectionOutput = 1,
PinLevelHigh = 1,
PinLevelLow = 0,
PinDirectionInput = 0,
PinDirectionOutput = 1,
PinLevelHigh = 1,
PinLevelLow = 0,
};
// ex: pinMode(B0, PinDirectionOutput);
static inline void pinMode(uint8_t pin, int mode) {
uint8_t bv = _BV(pin & 0xf);
if (mode == PinDirectionOutput) {
_SFR_IO8((pin >> 4) + 1) |= bv;
} else {
_SFR_IO8((pin >> 4) + 1) &= ~bv;
_SFR_IO8((pin >> 4) + 2) &= ~bv;
}
uint8_t bv = _BV(pin & 0xf);
if (mode == PinDirectionOutput) {
_SFR_IO8((pin >> 4) + 1) |= bv;
} else {
_SFR_IO8((pin >> 4) + 1) &= ~bv;
_SFR_IO8((pin >> 4) + 2) &= ~bv;
}
}
// ex: digitalWrite(B0, PinLevelHigh);
static inline void digitalWrite(uint8_t pin, int mode) {
uint8_t bv = _BV(pin & 0xf);
if (mode == PinLevelHigh) {
_SFR_IO8((pin >> 4) + 2) |= bv;
} else {
_SFR_IO8((pin >> 4) + 2) &= ~bv;
}
uint8_t bv = _BV(pin & 0xf);
if (mode == PinLevelHigh) {
_SFR_IO8((pin >> 4) + 2) |= bv;
} else {
_SFR_IO8((pin >> 4) + 2) &= ~bv;
}
}
// Return true if the pin is HIGH
// digitalRead(B0)
static inline bool digitalRead(uint8_t pin) {
return _SFR_IO8(pin >> 4) & _BV(pin & 0xf);
}
static inline bool digitalRead(uint8_t pin) { return _SFR_IO8(pin >> 4) & _BV(pin & 0xf); }

View file

@ -25,38 +25,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static report_mouse_t mouseReport = {};
__attribute__ ((weak))
void pointing_device_init(void){
//initialize device, if that needs to be done.
__attribute__((weak)) void pointing_device_init(void) {
// initialize device, if that needs to be done.
}
__attribute__ ((weak))
void pointing_device_send(void){
//If you need to do other things, like debugging, this is the place to do it.
__attribute__((weak)) void pointing_device_send(void) {
// If you need to do other things, like debugging, this is the place to do it.
host_mouse_send(&mouseReport);
//send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device
mouseReport.x = 0;
mouseReport.y = 0;
mouseReport.v = 0;
mouseReport.h = 0;
// send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device
mouseReport.x = 0;
mouseReport.y = 0;
mouseReport.v = 0;
mouseReport.h = 0;
}
__attribute__ ((weak))
void pointing_device_task(void){
//gather info and put it in:
//mouseReport.x = 127 max -127 min
//mouseReport.y = 127 max -127 min
//mouseReport.v = 127 max -127 min (scroll vertical)
//mouseReport.h = 127 max -127 min (scroll horizontal)
//mouseReport.buttons = 0x1F (decimal 31, binary 00011111) max (bitmask for mouse buttons 1-5, 1 is rightmost, 5 is leftmost) 0x00 min
//send the report
__attribute__((weak)) void pointing_device_task(void) {
// gather info and put it in:
// mouseReport.x = 127 max -127 min
// mouseReport.y = 127 max -127 min
// mouseReport.v = 127 max -127 min (scroll vertical)
// mouseReport.h = 127 max -127 min (scroll horizontal)
// mouseReport.buttons = 0x1F (decimal 31, binary 00011111) max (bitmask for mouse buttons 1-5, 1 is rightmost, 5 is leftmost) 0x00 min
// send the report
pointing_device_send();
}
report_mouse_t pointing_device_get_report(void){
return mouseReport;
}
report_mouse_t pointing_device_get_report(void) { return mouseReport; }
void pointing_device_set_report(report_mouse_t newMouseReport){
mouseReport = newMouseReport;
}
void pointing_device_set_report(report_mouse_t newMouseReport) { mouseReport = newMouseReport; }

View file

@ -22,10 +22,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "host.h"
#include "report.h"
void pointing_device_init(void);
void pointing_device_task(void);
void pointing_device_send(void);
void pointing_device_init(void);
void pointing_device_task(void);
void pointing_device_send(void);
report_mouse_t pointing_device_get_report(void);
void pointing_device_set_report(report_mouse_t newMouseReport);
void pointing_device_set_report(report_mouse_t newMouseReport);
#endif

View file

@ -2,30 +2,28 @@
#include "process_audio.h"
#ifndef VOICE_CHANGE_SONG
#define VOICE_CHANGE_SONG SONG(VOICE_CHANGE_SOUND)
# define VOICE_CHANGE_SONG SONG(VOICE_CHANGE_SOUND)
#endif
float voice_change_song[][2] = VOICE_CHANGE_SONG;
#ifndef PITCH_STANDARD_A
#define PITCH_STANDARD_A 440.0f
# define PITCH_STANDARD_A 440.0f
#endif
float compute_freq_for_midi_note(uint8_t note)
{
float compute_freq_for_midi_note(uint8_t note) {
// https://en.wikipedia.org/wiki/MIDI_tuning_standard
return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A;
}
bool process_audio(uint16_t keycode, keyrecord_t *record) {
if (keycode == AU_ON && record->event.pressed) {
audio_on();
return false;
audio_on();
return false;
}
if (keycode == AU_OFF && record->event.pressed) {
audio_off();
return false;
audio_off();
return false;
}
if (keycode == AU_TOG && record->event.pressed) {
@ -52,17 +50,10 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) {
return true;
}
void process_audio_noteon(uint8_t note) {
play_note(compute_freq_for_midi_note(note), 0xF);
}
void process_audio_noteon(uint8_t note) { play_note(compute_freq_for_midi_note(note), 0xF); }
void process_audio_noteoff(uint8_t note) {
stop_note(compute_freq_for_midi_note(note));
}
void process_audio_noteoff(uint8_t note) { stop_note(compute_freq_for_midi_note(note)); }
void process_audio_all_notes_off(void) {
stop_all_notes();
}
void process_audio_all_notes_off(void) { stop_all_notes(); }
__attribute__ ((weak))
void audio_on_user() {}
__attribute__((weak)) void audio_on_user() {}

View file

@ -16,195 +16,185 @@
#ifdef AUTO_SHIFT_ENABLE
#include <stdio.h>
# include <stdio.h>
#include "process_auto_shift.h"
# include "process_auto_shift.h"
#define TAP(key) \
register_code(key); \
unregister_code(key)
# define TAP(key) \
register_code(key); \
unregister_code(key)
#define TAP_WITH_MOD(mod, key) \
register_code(mod); \
register_code(key); \
unregister_code(key); \
unregister_code(mod)
# define TAP_WITH_MOD(mod, key) \
register_code(mod); \
register_code(key); \
unregister_code(key); \
unregister_code(mod)
uint16_t autoshift_time = 0;
uint16_t autoshift_time = 0;
uint16_t autoshift_timeout = AUTO_SHIFT_TIMEOUT;
uint16_t autoshift_lastkey = KC_NO;
void autoshift_timer_report(void) {
char display[8];
char display[8];
snprintf(display, 8, "\n%d\n", autoshift_timeout);
snprintf(display, 8, "\n%d\n", autoshift_timeout);
send_string((const char *)display);
send_string((const char *)display);
}
void autoshift_on(uint16_t keycode) {
autoshift_time = timer_read();
autoshift_lastkey = keycode;
autoshift_time = timer_read();
autoshift_lastkey = keycode;
}
void autoshift_flush(void) {
if (autoshift_lastkey != KC_NO) {
uint16_t elapsed = timer_elapsed(autoshift_time);
if (autoshift_lastkey != KC_NO) {
uint16_t elapsed = timer_elapsed(autoshift_time);
if (elapsed > autoshift_timeout) {
register_code(KC_LSFT);
if (elapsed > autoshift_timeout) {
register_code(KC_LSFT);
}
register_code(autoshift_lastkey);
unregister_code(autoshift_lastkey);
if (elapsed > autoshift_timeout) {
unregister_code(KC_LSFT);
}
autoshift_time = 0;
autoshift_lastkey = KC_NO;
}
register_code(autoshift_lastkey);
unregister_code(autoshift_lastkey);
if (elapsed > autoshift_timeout) {
unregister_code(KC_LSFT);
}
autoshift_time = 0;
autoshift_lastkey = KC_NO;
}
}
bool autoshift_enabled = true;
void autoshift_enable(void) {
autoshift_enabled = true;
}
void autoshift_enable(void) { autoshift_enabled = true; }
void autoshift_disable(void) {
autoshift_enabled = false;
autoshift_flush();
autoshift_enabled = false;
autoshift_flush();
}
void autoshift_toggle(void) {
if (autoshift_enabled) {
autoshift_enabled = false;
autoshift_flush();
}
else {
autoshift_enabled = true;
}
if (autoshift_enabled) {
autoshift_enabled = false;
autoshift_flush();
} else {
autoshift_enabled = true;
}
}
bool autoshift_state(void) {
return autoshift_enabled;
}
bool autoshift_state(void) { return autoshift_enabled; }
bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
#ifndef AUTO_SHIFT_MODIFIERS
static uint8_t any_mod_pressed;
#endif
# ifndef AUTO_SHIFT_MODIFIERS
static uint8_t any_mod_pressed;
# endif
if (record->event.pressed) {
switch (keycode) {
case KC_ASUP:
autoshift_timeout += 5;
return false;
if (record->event.pressed) {
switch (keycode) {
case KC_ASUP:
autoshift_timeout += 5;
return false;
case KC_ASDN:
autoshift_timeout -= 5;
return false;
case KC_ASDN:
autoshift_timeout -= 5;
return false;
case KC_ASRP:
autoshift_timer_report();
return false;
case KC_ASRP:
autoshift_timer_report();
return false;
case KC_ASTG:
autoshift_toggle();
return false;
case KC_ASON:
autoshift_enable();
return false;
case KC_ASOFF:
autoshift_disable();
return false;
case KC_ASTG:
autoshift_toggle();
return false;
case KC_ASON:
autoshift_enable();
return false;
case KC_ASOFF:
autoshift_disable();
return false;
#ifndef NO_AUTO_SHIFT_ALPHA
case KC_A:
case KC_B:
case KC_C:
case KC_D:
case KC_E:
case KC_F:
case KC_G:
case KC_H:
case KC_I:
case KC_J:
case KC_K:
case KC_L:
case KC_M:
case KC_N:
case KC_O:
case KC_P:
case KC_Q:
case KC_R:
case KC_S:
case KC_T:
case KC_U:
case KC_V:
case KC_W:
case KC_X:
case KC_Y:
case KC_Z:
#endif
#ifndef NO_AUTO_SHIFT_NUMERIC
case KC_1:
case KC_2:
case KC_3:
case KC_4:
case KC_5:
case KC_6:
case KC_7:
case KC_8:
case KC_9:
case KC_0:
#endif
#ifndef NO_AUTO_SHIFT_SPECIAL
case KC_MINUS:
case KC_EQL:
case KC_TAB:
case KC_LBRC:
case KC_RBRC:
case KC_BSLS:
case KC_SCLN:
case KC_QUOT:
case KC_COMM:
case KC_DOT:
case KC_SLSH:
case KC_GRAVE:
case KC_NONUS_BSLASH:
case KC_NONUS_HASH:
#endif
# ifndef NO_AUTO_SHIFT_ALPHA
case KC_A:
case KC_B:
case KC_C:
case KC_D:
case KC_E:
case KC_F:
case KC_G:
case KC_H:
case KC_I:
case KC_J:
case KC_K:
case KC_L:
case KC_M:
case KC_N:
case KC_O:
case KC_P:
case KC_Q:
case KC_R:
case KC_S:
case KC_T:
case KC_U:
case KC_V:
case KC_W:
case KC_X:
case KC_Y:
case KC_Z:
# endif
# ifndef NO_AUTO_SHIFT_NUMERIC
case KC_1:
case KC_2:
case KC_3:
case KC_4:
case KC_5:
case KC_6:
case KC_7:
case KC_8:
case KC_9:
case KC_0:
# endif
# ifndef NO_AUTO_SHIFT_SPECIAL
case KC_MINUS:
case KC_EQL:
case KC_TAB:
case KC_LBRC:
case KC_RBRC:
case KC_BSLS:
case KC_SCLN:
case KC_QUOT:
case KC_COMM:
case KC_DOT:
case KC_SLSH:
case KC_GRAVE:
case KC_NONUS_BSLASH:
case KC_NONUS_HASH:
# endif
autoshift_flush();
if (!autoshift_enabled) return true;
autoshift_flush();
if (!autoshift_enabled) return true;
#ifndef AUTO_SHIFT_MODIFIERS
any_mod_pressed = get_mods() & (
MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)|
MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)|
MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTL)|
MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)
);
# ifndef AUTO_SHIFT_MODIFIERS
any_mod_pressed = get_mods() & (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI) | MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT) | MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL) | MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT));
if (any_mod_pressed) {
return true;
if (any_mod_pressed) {
return true;
}
# endif
autoshift_on(keycode);
return false;
default:
autoshift_flush();
return true;
}
#endif
autoshift_on(keycode);
return false;
default:
} else {
autoshift_flush();
return true;
}
} else {
autoshift_flush();
}
return true;
return true;
}
#endif

View file

@ -20,7 +20,7 @@
#include "quantum.h"
#ifndef AUTO_SHIFT_TIMEOUT
#define AUTO_SHIFT_TIMEOUT 175
# define AUTO_SHIFT_TIMEOUT 175
#endif
bool process_auto_shift(uint16_t keycode, keyrecord_t *record);

View file

@ -3,104 +3,111 @@
#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
#ifndef AUDIO_CLICKY_FREQ_MIN
#define AUDIO_CLICKY_FREQ_MIN 65.0f
#endif // !AUDIO_CLICKY_FREQ_MIN
#ifndef AUDIO_CLICKY_FREQ_MAX
#define AUDIO_CLICKY_FREQ_MAX 1500.0f
#endif // !AUDIO_CLICKY_FREQ_MAX
#ifndef AUDIO_CLICKY_FREQ_FACTOR
#define AUDIO_CLICKY_FREQ_FACTOR 1.18921f
#endif // !AUDIO_CLICKY_FREQ_FACTOR
#ifndef AUDIO_CLICKY_FREQ_RANDOMNESS
#define AUDIO_CLICKY_FREQ_RANDOMNESS 0.05f
#endif // !AUDIO_CLICKY_FREQ_RANDOMNESS
# 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
# ifndef AUDIO_CLICKY_FREQ_MIN
# define AUDIO_CLICKY_FREQ_MIN 65.0f
# endif // !AUDIO_CLICKY_FREQ_MIN
# ifndef AUDIO_CLICKY_FREQ_MAX
# define AUDIO_CLICKY_FREQ_MAX 1500.0f
# endif // !AUDIO_CLICKY_FREQ_MAX
# ifndef AUDIO_CLICKY_FREQ_FACTOR
# define AUDIO_CLICKY_FREQ_FACTOR 1.18921f
# endif // !AUDIO_CLICKY_FREQ_FACTOR
# ifndef AUDIO_CLICKY_FREQ_RANDOMNESS
# define AUDIO_CLICKY_FREQ_RANDOMNESS 0.05f
# endif // !AUDIO_CLICKY_FREQ_RANDOMNESS
float clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
float clicky_rand = AUDIO_CLICKY_FREQ_RANDOMNESS;
// 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
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;
#ifndef NO_MUSIC_MODE
# ifndef NO_MUSIC_MODE
extern bool music_activated;
extern bool midi_activated;
#endif // !NO_MUSIC_MODE
# endif // !NO_MUSIC_MODE
void clicky_play(void) {
#ifndef NO_MUSIC_MODE
if (music_activated || midi_activated || !audio_config.enable) return;
#endif // !NO_MUSIC_MODE
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);
# ifndef NO_MUSIC_MODE
if (music_activated || midi_activated || !audio_config.enable) return;
# endif // !NO_MUSIC_MODE
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);
}
void clicky_freq_up(void) {
float new_freq = clicky_freq * AUDIO_CLICKY_FREQ_FACTOR;
if (new_freq < AUDIO_CLICKY_FREQ_MAX) {
clicky_freq = new_freq;
}
float new_freq = clicky_freq * AUDIO_CLICKY_FREQ_FACTOR;
if (new_freq < AUDIO_CLICKY_FREQ_MAX) {
clicky_freq = new_freq;
}
}
void clicky_freq_down(void) {
float new_freq = clicky_freq / AUDIO_CLICKY_FREQ_FACTOR;
if (new_freq > AUDIO_CLICKY_FREQ_MIN) {
clicky_freq = new_freq;
}
float new_freq = clicky_freq / AUDIO_CLICKY_FREQ_FACTOR;
if (new_freq > AUDIO_CLICKY_FREQ_MIN) {
clicky_freq = new_freq;
}
}
void clicky_freq_reset(void) {
clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
}
void clicky_freq_reset(void) { clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT; }
void clicky_toggle(void) {
audio_config.clicky_enable ^= 1;
eeconfig_update_audio(audio_config.raw);
audio_config.clicky_enable ^= 1;
eeconfig_update_audio(audio_config.raw);
}
void clicky_on(void) {
audio_config.clicky_enable = 1;
eeconfig_update_audio(audio_config.raw);
audio_config.clicky_enable = 1;
eeconfig_update_audio(audio_config.raw);
}
void clicky_off(void) {
audio_config.clicky_enable = 0;
eeconfig_update_audio(audio_config.raw);
audio_config.clicky_enable = 0;
eeconfig_update_audio(audio_config.raw);
}
bool is_clicky_on(void) {
return (audio_config.clicky_enable != 0);
}
bool is_clicky_on(void) { return (audio_config.clicky_enable != 0); }
bool process_clicky(uint16_t keycode, keyrecord_t *record) {
if (keycode == CLICKY_TOGGLE && record->event.pressed) { clicky_toggle(); }
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_UP && record->event.pressed) { clicky_freq_up(); }
if (keycode == CLICKY_DOWN && record->event.pressed) { clicky_freq_down(); }
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();
}
if (keycode == CLICKY_TOGGLE && record->event.pressed) {
clicky_toggle();
}
}
return true;
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_UP && record->event.pressed) {
clicky_freq_up();
}
if (keycode == CLICKY_DOWN && record->event.pressed) {
clicky_freq_down();
}
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;
}
#endif //AUDIO_CLICKY
#endif // AUDIO_CLICKY

View file

@ -21,14 +21,13 @@ __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 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 uint8_t buffer_size = 0;
#ifdef COMBO_ALLOW_ACTION_KEYS
@ -38,171 +37,163 @@ 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);
if (action) {
if (pressed) {
register_code16(action);
} else {
unregister_code16(action);
}
} else {
unregister_code16(action);
process_combo_event(current_combo_index, pressed);
}
} else {
process_combo_event(current_combo_index, pressed);
}
}
static inline void dump_key_buffer(bool emit) {
if (buffer_size == 0) {
return;
}
if (emit) {
for (uint8_t i = 0; i < buffer_size; i++) {
#ifdef COMBO_ALLOW_ACTION_KEYS
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
register_code16(key_buffer[i]);
send_keyboard_report();
#endif
if (buffer_size == 0) {
return;
}
}
buffer_size = 0;
if (emit) {
for (uint8_t i = 0; i < buffer_size; i++) {
#ifdef COMBO_ALLOW_ACTION_KEYS
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
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)
#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;
}
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;
}
} else {
if (ALL_COMBO_KEYS_ARE_DOWN) { /* Combo was released */
send_combo(combo->keycode, false);
/* 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 {
/* continue processing without immediately returning */
is_combo_active = false;
if (ALL_COMBO_KEYS_ARE_DOWN) { /* Combo was released */
send_combo(combo->keycode, false);
} else {
/* continue processing without immediately returning */
is_combo_active = false;
}
KEY_STATE_UP(index);
}
KEY_STATE_UP(index);
}
return is_combo_active;
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;
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;
if (keycode == CMB_ON && record->event.pressed) {
combo_enable();
return 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) {
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
key_buffer[buffer_size++] = *record;
key_buffer[buffer_size++] = *record;
#else
key_buffer[buffer_size++] = keycode;
key_buffer[buffer_size++] = keycode;
#endif
}
}
}
return !is_combo_key;
return !is_combo_key;
}
void matrix_scan_combo(void) {
if (b_combo_enable && is_active && timer && timer_elapsed(timer) > COMBO_TERM) {
/* 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);
}
if (b_combo_enable && is_active && timer && timer_elapsed(timer) > COMBO_TERM) {
/* 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 combo_enable(void) {
b_combo_enable = true;
}
void combo_enable(void) { b_combo_enable = true; }
void combo_disable(void) {
b_combo_enable = is_active = false;
timer = 0;
timer = 0;
dump_key_buffer(true);
}
void combo_toggle(void) {
@ -213,6 +204,4 @@ void combo_toggle(void) {
}
}
bool is_combo_enabled(void) {
return b_combo_enable;
}
bool is_combo_enabled(void) { return b_combo_enable; }

View file

@ -22,36 +22,36 @@
#include <stdint.h>
#ifdef EXTRA_EXTRA_LONG_COMBOS
#define MAX_COMBO_LENGTH 32
# define MAX_COMBO_LENGTH 32
#elif EXTRA_LONG_COMBOS
#define MAX_COMBO_LENGTH 16
# define MAX_COMBO_LENGTH 16
#else
#define MAX_COMBO_LENGTH 8
# define MAX_COMBO_LENGTH 8
#endif
typedef struct {
const uint16_t *keys;
uint16_t keycode;
const uint16_t *keys;
uint16_t keycode;
#ifdef EXTRA_EXTRA_LONG_COMBOS
uint32_t state;
uint32_t state;
#elif EXTRA_LONG_COMBOS
uint16_t state;
uint16_t state;
#else
uint8_t state;
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
#define COMBO_COUNT 0
# define COMBO_COUNT 0
#endif
#ifndef COMBO_TERM
#define COMBO_TERM TAPPING_TERM
# define COMBO_TERM TAPPING_TERM
#endif
bool process_combo(uint16_t keycode, keyrecord_t *record);

View file

@ -19,36 +19,33 @@
#include "process_key_lock.h"
#define BV_64(shift) (((uint64_t)1) << (shift))
#define GET_KEY_ARRAY(code) (((code) < 0x40) ? key_state[0] : \
((code) < 0x80) ? key_state[1] : \
((code) < 0xC0) ? key_state[2] : key_state[3])
#define GET_CODE_INDEX(code) (((code) < 0x40) ? (code) : \
((code) < 0x80) ? (code) - 0x40 : \
((code) < 0xC0) ? (code) - 0x80 : (code) - 0xC0)
#define KEY_STATE(code) (GET_KEY_ARRAY(code) & BV_64(GET_CODE_INDEX(code))) == BV_64(GET_CODE_INDEX(code))
#define SET_KEY_ARRAY_STATE(code, val) do { \
switch (code) { \
case 0x00 ... 0x3F: \
key_state[0] = (val); \
break; \
case 0x40 ... 0x7F: \
key_state[1] = (val); \
break; \
case 0x80 ... 0xBF: \
key_state[2] = (val); \
break; \
case 0xC0 ... 0xFF: \
key_state[3] = (val); \
break; \
} \
} while(0)
#define GET_KEY_ARRAY(code) (((code) < 0x40) ? key_state[0] : ((code) < 0x80) ? key_state[1] : ((code) < 0xC0) ? key_state[2] : key_state[3])
#define GET_CODE_INDEX(code) (((code) < 0x40) ? (code) : ((code) < 0x80) ? (code)-0x40 : ((code) < 0xC0) ? (code)-0x80 : (code)-0xC0)
#define KEY_STATE(code) (GET_KEY_ARRAY(code) & BV_64(GET_CODE_INDEX(code))) == BV_64(GET_CODE_INDEX(code))
#define SET_KEY_ARRAY_STATE(code, val) \
do { \
switch (code) { \
case 0x00 ... 0x3F: \
key_state[0] = (val); \
break; \
case 0x40 ... 0x7F: \
key_state[1] = (val); \
break; \
case 0x80 ... 0xBF: \
key_state[2] = (val); \
break; \
case 0xC0 ... 0xFF: \
key_state[3] = (val); \
break; \
} \
} while (0)
#define SET_KEY_STATE(code) SET_KEY_ARRAY_STATE(code, (GET_KEY_ARRAY(code) | BV_64(GET_CODE_INDEX(code))))
#define UNSET_KEY_STATE(code) SET_KEY_ARRAY_STATE(code, (GET_KEY_ARRAY(code)) & ~(BV_64(GET_CODE_INDEX(code))))
#define IS_STANDARD_KEYCODE(code) ((code) <= 0xFF)
// Locked key state. This is an array of 256 bits, one for each of the standard keys supported qmk.
uint64_t key_state[4] = { 0x0, 0x0, 0x0, 0x0 };
bool watching = false;
uint64_t key_state[4] = {0x0, 0x0, 0x0, 0x0};
bool watching = false;
// Translate any OSM keycodes back to their unmasked versions.
static inline uint16_t translate_keycode(uint16_t keycode) {
@ -135,4 +132,3 @@ bool process_key_lock(uint16_t *keycode, keyrecord_t *record) {
return !(IS_STANDARD_KEYCODE(translated_keycode) && KEY_STATE(translated_keycode));
}
}

View file

@ -21,4 +21,4 @@
bool process_key_lock(uint16_t *keycode, keyrecord_t *record);
#endif // PROCESS_KEY_LOCK_H
#endif // PROCESS_KEY_LOCK_H

View file

@ -16,64 +16,64 @@
#ifdef LEADER_ENABLE
#include "process_leader.h"
#include <string.h>
# include "process_leader.h"
# include <string.h>
#ifndef LEADER_TIMEOUT
#define LEADER_TIMEOUT 300
#endif
# ifndef LEADER_TIMEOUT
# define LEADER_TIMEOUT 300
# endif
__attribute__ ((weak))
void leader_start(void) {}
__attribute__((weak)) void leader_start(void) {}
__attribute__ ((weak))
void leader_end(void) {}
__attribute__((weak)) void leader_end(void) {}
// Leader key stuff
bool leading = false;
bool leading = false;
uint16_t leader_time = 0;
uint16_t leader_sequence[5] = {0, 0, 0, 0, 0};
uint8_t leader_sequence_size = 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));
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) {
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++;
// Leader key set-up
if (record->event.pressed) {
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 {
leading = false;
leader_end();
if (keycode == KC_LEAD) {
qk_leader_start();
}
}
#ifdef LEADER_PER_KEY_TIMING
leader_time = timer_read();
#endif
return false;
}
} else {
if (keycode == KC_LEAD) {
qk_leader_start();
}
}
}
return true;
return true;
}
#endif

View file

@ -19,7 +19,6 @@
#include "quantum.h"
bool process_leader(uint16_t keycode, keyrecord_t *record);
void leader_start(void);
@ -32,7 +31,11 @@ void qk_leader_start(void);
#define SEQ_FOUR_KEYS(key1, key2, key3, key4) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == (key4) && leader_sequence[4] == 0)
#define SEQ_FIVE_KEYS(key1, key2, key3, key4, key5) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == (key3) && leader_sequence[3] == (key4) && leader_sequence[4] == (key5))
#define LEADER_EXTERNS() extern bool leading; extern uint16_t leader_time; extern uint16_t leader_sequence[5]; extern uint8_t leader_sequence_size
#define LEADER_EXTERNS() \
extern bool leading; \
extern uint16_t leader_time; \
extern uint16_t leader_sequence[5]; \
extern uint8_t leader_sequence_size
#define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT)
#endif

View file

@ -16,86 +16,65 @@
#include "process_midi.h"
#ifdef MIDI_ENABLE
#include <LUFA/Drivers/USB/USB.h>
#include "midi.h"
#include "qmk_midi.h"
# include <LUFA/Drivers/USB/USB.h>
# include "midi.h"
# include "qmk_midi.h"
#ifdef MIDI_BASIC
# ifdef MIDI_BASIC
void process_midi_basic_noteon(uint8_t note)
{
midi_send_noteon(&midi_device, 0, note, 127);
}
void process_midi_basic_noteon(uint8_t note) { midi_send_noteon(&midi_device, 0, note, 127); }
void process_midi_basic_noteoff(uint8_t note)
{
midi_send_noteoff(&midi_device, 0, note, 0);
}
void process_midi_basic_noteoff(uint8_t note) { midi_send_noteoff(&midi_device, 0, note, 0); }
void process_midi_all_notes_off(void)
{
midi_send_cc(&midi_device, 0, 0x7B, 0);
}
void process_midi_all_notes_off(void) { midi_send_cc(&midi_device, 0, 0x7B, 0); }
#endif // MIDI_BASIC
# endif // MIDI_BASIC
#ifdef MIDI_ADVANCED
# ifdef MIDI_ADVANCED
#include "timer.h"
# include "timer.h"
static uint8_t tone_status[MIDI_TONE_COUNT];
static uint8_t midi_modulation;
static int8_t midi_modulation_step;
static uint8_t midi_modulation;
static int8_t midi_modulation_step;
static uint16_t midi_modulation_timer;
midi_config_t midi_config;
midi_config_t midi_config;
inline uint8_t compute_velocity(uint8_t setting)
{
return (setting + 1) * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN + 1));
}
inline uint8_t compute_velocity(uint8_t setting) { return (setting + 1) * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN + 1)); }
void midi_init(void)
{
midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN;
midi_config.transpose = 0;
midi_config.velocity = (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN);
midi_config.channel = 0;
void midi_init(void) {
midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN;
midi_config.transpose = 0;
midi_config.velocity = (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN);
midi_config.channel = 0;
midi_config.modulation_interval = 8;
for (uint8_t i = 0; i < MIDI_TONE_COUNT; i++)
{
for (uint8_t i = 0; i < MIDI_TONE_COUNT; i++) {
tone_status[i] = MIDI_INVALID_NOTE;
}
midi_modulation = 0;
midi_modulation_step = 0;
midi_modulation = 0;
midi_modulation_step = 0;
midi_modulation_timer = 0;
}
uint8_t midi_compute_note(uint16_t keycode)
{
return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose;
}
uint8_t midi_compute_note(uint16_t keycode) { return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose; }
bool process_midi(uint16_t keycode, keyrecord_t *record)
{
bool process_midi(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case MIDI_TONE_MIN ... MIDI_TONE_MAX:
{
uint8_t channel = midi_config.channel;
uint8_t tone = keycode - MIDI_TONE_MIN;
case MIDI_TONE_MIN ... MIDI_TONE_MAX: {
uint8_t channel = midi_config.channel;
uint8_t tone = keycode - MIDI_TONE_MIN;
uint8_t velocity = compute_velocity(midi_config.velocity);
if (record->event.pressed) {
uint8_t note = midi_compute_note(keycode);
midi_send_noteon(&midi_device, channel, note, velocity);
dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity);
tone_status[tone] = note;
}
else {
} else {
uint8_t note = tone_status[tone];
if (note != MIDI_INVALID_NOTE)
{
if (note != MIDI_INVALID_NOTE) {
midi_send_noteoff(&midi_device, channel, note, velocity);
dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
}
@ -137,8 +116,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
if (record->event.pressed && midi_config.transpose < (MIDI_TRANSPOSE_MAX - MI_TRNS_0)) {
const bool positive = midi_config.transpose > 0;
midi_config.transpose++;
if (positive && midi_config.transpose < 0)
midi_config.transpose--;
if (positive && midi_config.transpose < 0) midi_config.transpose--;
dprintf("midi transpose %d\n", midi_config.transpose);
}
return false;
@ -211,8 +189,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
if (record->event.pressed) {
midi_config.modulation_interval++;
// prevent overflow
if (midi_config.modulation_interval == 0)
midi_config.modulation_interval--;
if (midi_config.modulation_interval == 0) midi_config.modulation_interval--;
dprintf("midi modulation interval %d\n", midi_config.modulation_interval);
}
return false;
@ -226,8 +203,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
if (record->event.pressed) {
midi_send_pitchbend(&midi_device, midi_config.channel, -0x2000);
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, -0x2000);
}
else {
} else {
midi_send_pitchbend(&midi_device, midi_config.channel, 0);
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0);
}
@ -236,8 +212,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
if (record->event.pressed) {
midi_send_pitchbend(&midi_device, midi_config.channel, 0x1fff);
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0x1fff);
}
else {
} else {
midi_send_pitchbend(&midi_device, midi_config.channel, 0);
dprintf("midi pitchbend channel:%d amount:%d\n", midi_config.channel, 0);
}
@ -247,35 +222,29 @@ bool process_midi(uint16_t keycode, keyrecord_t *record)
return true;
}
#endif // MIDI_ADVANCED
# endif // MIDI_ADVANCED
void midi_task(void)
{
void midi_task(void) {
midi_device_process(&midi_device);
#ifdef MIDI_ADVANCED
if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval)
return;
# ifdef MIDI_ADVANCED
if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval) return;
midi_modulation_timer = timer_read();
if (midi_modulation_step != 0)
{
if (midi_modulation_step != 0) {
dprintf("midi modulation %d\n", midi_modulation);
midi_send_cc(&midi_device, midi_config.channel, 0x1, midi_modulation);
if (midi_modulation_step < 0 && midi_modulation < -midi_modulation_step) {
midi_modulation = 0;
midi_modulation = 0;
midi_modulation_step = 0;
return;
}
midi_modulation += midi_modulation_step;
if (midi_modulation > 127)
midi_modulation = 127;
if (midi_modulation > 127) midi_modulation = 127;
}
#endif
# endif
}
#endif // MIDI_ENABLE
#endif // MIDI_ENABLE

View file

@ -21,24 +21,24 @@
#ifdef MIDI_ENABLE
#ifdef MIDI_BASIC
# ifdef MIDI_BASIC
void process_midi_basic_noteon(uint8_t note);
void process_midi_basic_noteoff(uint8_t note);
void process_midi_all_notes_off(void);
#endif
# endif
void midi_task(void);
#ifdef MIDI_ADVANCED
# ifdef MIDI_ADVANCED
typedef union {
uint32_t raw;
struct {
uint8_t octave :4;
int8_t transpose :4;
uint8_t velocity :4;
uint8_t channel :4;
uint8_t modulation_interval :4;
};
uint32_t raw;
struct {
uint8_t octave : 4;
int8_t transpose : 4;
uint8_t velocity : 4;
uint8_t channel : 4;
uint8_t modulation_interval : 4;
};
} midi_config_t;
extern midi_config_t midi_config;
@ -46,12 +46,12 @@ extern midi_config_t midi_config;
void midi_init(void);
bool process_midi(uint16_t keycode, keyrecord_t *record);
#define MIDI_INVALID_NOTE 0xFF
#define MIDI_TONE_COUNT (MIDI_TONE_MAX - MIDI_TONE_MIN + 1)
# define MIDI_INVALID_NOTE 0xFF
# define MIDI_TONE_COUNT (MIDI_TONE_MAX - MIDI_TONE_MIN + 1)
uint8_t midi_compute_note(uint16_t keycode);
#endif // MIDI_ADVANCED
# endif // MIDI_ADVANCED
#endif // MIDI_ENABLE
#endif // MIDI_ENABLE
#endif

View file

@ -16,103 +16,91 @@
#include "process_music.h"
#ifdef AUDIO_ENABLE
#include "process_audio.h"
# include "process_audio.h"
#endif
#if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
#include "process_midi.h"
# include "process_midi.h"
#endif
#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
bool music_activated = false;
bool midi_activated = false;
bool music_activated = false;
bool midi_activated = false;
uint8_t music_starting_note = 0x0C;
int music_offset = 7;
uint8_t music_mode = MUSIC_MODE_MAJOR;
int music_offset = 7;
uint8_t music_mode = MUSIC_MODE_MAJOR;
// music sequencer
static bool music_sequence_recording = false;
static bool music_sequence_recorded = false;
static bool music_sequence_playing = false;
static uint8_t music_sequence[16] = {0};
static uint8_t music_sequence_count = 0;
static uint8_t music_sequence_position = 0;
static bool music_sequence_recording = false;
static bool music_sequence_recorded = false;
static bool music_sequence_playing = false;
static uint8_t music_sequence[16] = {0};
static uint8_t music_sequence_count = 0;
static uint8_t music_sequence_position = 0;
static uint16_t music_sequence_timer = 0;
static uint16_t music_sequence_timer = 0;
static uint16_t music_sequence_interval = 100;
#ifdef AUDIO_ENABLE
#ifndef MUSIC_ON_SONG
#define MUSIC_ON_SONG SONG(MUSIC_ON_SOUND)
#endif
#ifndef MUSIC_OFF_SONG
#define MUSIC_OFF_SONG SONG(MUSIC_OFF_SOUND)
#endif
#ifndef MIDI_ON_SONG
#define MIDI_ON_SONG SONG(MUSIC_ON_SOUND)
#endif
#ifndef MIDI_OFF_SONG
#define MIDI_OFF_SONG SONG(MUSIC_OFF_SOUND)
#endif
#ifndef CHROMATIC_SONG
#define CHROMATIC_SONG SONG(CHROMATIC_SOUND)
#endif
#ifndef GUITAR_SONG
#define GUITAR_SONG SONG(GUITAR_SOUND)
#endif
#ifndef VIOLIN_SONG
#define VIOLIN_SONG SONG(VIOLIN_SOUND)
#endif
#ifndef MAJOR_SONG
#define MAJOR_SONG SONG(MAJOR_SOUND)
#endif
float music_mode_songs[NUMBER_OF_MODES][5][2] = {
CHROMATIC_SONG,
GUITAR_SONG,
VIOLIN_SONG,
MAJOR_SONG
};
float music_on_song[][2] = MUSIC_ON_SONG;
float music_off_song[][2] = MUSIC_OFF_SONG;
float midi_on_song[][2] = MIDI_ON_SONG;
float midi_off_song[][2] = MIDI_OFF_SONG;
#endif
# ifdef AUDIO_ENABLE
# ifndef MUSIC_ON_SONG
# define MUSIC_ON_SONG SONG(MUSIC_ON_SOUND)
# endif
# ifndef MUSIC_OFF_SONG
# define MUSIC_OFF_SONG SONG(MUSIC_OFF_SOUND)
# endif
# ifndef MIDI_ON_SONG
# define MIDI_ON_SONG SONG(MUSIC_ON_SOUND)
# endif
# ifndef MIDI_OFF_SONG
# define MIDI_OFF_SONG SONG(MUSIC_OFF_SOUND)
# endif
# ifndef CHROMATIC_SONG
# define CHROMATIC_SONG SONG(CHROMATIC_SOUND)
# endif
# ifndef GUITAR_SONG
# define GUITAR_SONG SONG(GUITAR_SOUND)
# endif
# ifndef VIOLIN_SONG
# define VIOLIN_SONG SONG(VIOLIN_SOUND)
# endif
# ifndef MAJOR_SONG
# define MAJOR_SONG SONG(MAJOR_SOUND)
# endif
float music_mode_songs[NUMBER_OF_MODES][5][2] = {CHROMATIC_SONG, GUITAR_SONG, VIOLIN_SONG, MAJOR_SONG};
float music_on_song[][2] = MUSIC_ON_SONG;
float music_off_song[][2] = MUSIC_OFF_SONG;
float midi_on_song[][2] = MIDI_ON_SONG;
float midi_off_song[][2] = MIDI_OFF_SONG;
# endif
static void music_noteon(uint8_t note) {
#ifdef AUDIO_ENABLE
if (music_activated)
process_audio_noteon(note);
#endif
#if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
if (midi_activated)
process_midi_basic_noteon(note);
#endif
# ifdef AUDIO_ENABLE
if (music_activated) process_audio_noteon(note);
# endif
# if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
if (midi_activated) process_midi_basic_noteon(note);
# endif
}
static void music_noteoff(uint8_t note) {
#ifdef AUDIO_ENABLE
if (music_activated)
process_audio_noteoff(note);
#endif
#if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
if (midi_activated)
process_midi_basic_noteoff(note);
#endif
# ifdef AUDIO_ENABLE
if (music_activated) process_audio_noteoff(note);
# endif
# if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
if (midi_activated) process_midi_basic_noteoff(note);
# endif
}
void music_all_notes_off(void) {
#ifdef AUDIO_ENABLE
if (music_activated)
process_audio_all_notes_off();
#endif
#if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
if (midi_activated)
process_midi_all_notes_off();
#endif
# ifdef AUDIO_ENABLE
if (music_activated) process_audio_all_notes_off();
# endif
# if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
if (midi_activated) process_midi_all_notes_off();
# endif
}
bool process_music(uint16_t keycode, keyrecord_t *record) {
if (keycode == MU_ON && record->event.pressed) {
music_on();
return false;
@ -152,110 +140,101 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
}
if (keycode == MU_MOD && record->event.pressed) {
music_mode_cycle();
return false;
music_mode_cycle();
return false;
}
if (music_activated || midi_activated) {
if (record->event.pressed) {
if (keycode == KC_LCTL) { // Start recording
music_all_notes_off();
music_sequence_recording = true;
music_sequence_recorded = false;
music_sequence_playing = false;
music_sequence_count = 0;
return false;
if (record->event.pressed) {
if (keycode == KC_LCTL) { // Start recording
music_all_notes_off();
music_sequence_recording = true;
music_sequence_recorded = false;
music_sequence_playing = false;
music_sequence_count = 0;
return false;
}
if (keycode == KC_LALT) { // Stop recording/playing
music_all_notes_off();
if (music_sequence_recording) { // was recording
music_sequence_recorded = true;
}
music_sequence_recording = false;
music_sequence_playing = false;
return false;
}
if (keycode == KC_LGUI && music_sequence_recorded) { // Start playing
music_all_notes_off();
music_sequence_recording = false;
music_sequence_playing = true;
music_sequence_position = 0;
music_sequence_timer = 0;
return false;
}
if (keycode == KC_UP) {
music_sequence_interval -= 10;
return false;
}
if (keycode == KC_DOWN) {
music_sequence_interval += 10;
return false;
}
}
if (keycode == KC_LALT) { // Stop recording/playing
music_all_notes_off();
if (music_sequence_recording) { // was recording
music_sequence_recorded = true;
}
music_sequence_recording = false;
music_sequence_playing = false;
return false;
}
if (keycode == KC_LGUI && music_sequence_recorded) { // Start playing
music_all_notes_off();
music_sequence_recording = false;
music_sequence_playing = true;
music_sequence_position = 0;
music_sequence_timer = 0;
return false;
}
if (keycode == KC_UP) {
music_sequence_interval-=10;
return false;
}
if (keycode == KC_DOWN) {
music_sequence_interval+=10;
return false;
}
}
uint8_t note = 36;
#ifdef MUSIC_MAP
uint8_t note = 36;
# ifdef MUSIC_MAP
if (music_mode == MUSIC_MODE_CHROMATIC) {
note = music_starting_note + music_offset + 36 + music_map[record->event.key.row][record->event.key.col];
note = music_starting_note + music_offset + 36 + music_map[record->event.key.row][record->event.key.col];
} else {
uint8_t position = music_map[record->event.key.row][record->event.key.col];
note = music_starting_note + music_offset + 36 + SCALE[position % 12] + (position / 12)*12;
uint8_t position = music_map[record->event.key.row][record->event.key.col];
note = music_starting_note + music_offset + 36 + SCALE[position % 12] + (position / 12) * 12;
}
#else
# else
if (music_mode == MUSIC_MODE_CHROMATIC)
note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.row);
note = (music_starting_note + record->event.key.col + music_offset - 3) + 12 * (MATRIX_ROWS - record->event.key.row);
else if (music_mode == MUSIC_MODE_GUITAR)
note = (music_starting_note + record->event.key.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.row);
note = (music_starting_note + record->event.key.col + music_offset + 32) + 5 * (MATRIX_ROWS - record->event.key.row);
else if (music_mode == MUSIC_MODE_VIOLIN)
note = (music_starting_note + record->event.key.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.row);
note = (music_starting_note + record->event.key.col + music_offset + 32) + 7 * (MATRIX_ROWS - record->event.key.row);
else if (music_mode == MUSIC_MODE_MAJOR)
note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.row);
note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3) + 12 * (MATRIX_ROWS - record->event.key.row);
else
note = music_starting_note;
#endif
note = music_starting_note;
# endif
if (record->event.pressed) {
music_noteon(note);
if (music_sequence_recording) {
music_sequence[music_sequence_count] = note;
music_sequence_count++;
if (record->event.pressed) {
music_noteon(note);
if (music_sequence_recording) {
music_sequence[music_sequence_count] = note;
music_sequence_count++;
}
} else {
music_noteoff(note);
}
} else {
music_noteoff(note);
}
if (music_mask(keycode))
return false;
if (music_mask(keycode)) return false;
}
return true;
}
bool music_mask(uint16_t keycode) {
#ifdef MUSIC_MASK
# ifdef MUSIC_MASK
return MUSIC_MASK;
#else
# else
return music_mask_kb(keycode);
#endif
# endif
}
__attribute__((weak))
bool music_mask_kb(uint16_t keycode) {
return music_mask_user(keycode);
}
__attribute__((weak)) bool music_mask_kb(uint16_t keycode) { return music_mask_user(keycode); }
__attribute__((weak))
bool music_mask_user(uint16_t keycode) {
return keycode < 0xFF;
}
__attribute__((weak)) bool music_mask_user(uint16_t keycode) { return keycode < 0xFF; }
bool is_music_on(void) {
return (music_activated != 0);
}
bool is_music_on(void) { return (music_activated != 0); }
void music_toggle(void) {
if (!music_activated) {
@ -267,23 +246,21 @@ void music_toggle(void) {
void music_on(void) {
music_activated = 1;
#ifdef AUDIO_ENABLE
PLAY_SONG(music_on_song);
#endif
# ifdef AUDIO_ENABLE
PLAY_SONG(music_on_song);
# endif
music_on_user();
}
void music_off(void) {
music_all_notes_off();
music_activated = 0;
#ifdef AUDIO_ENABLE
PLAY_SONG(music_off_song);
#endif
# ifdef AUDIO_ENABLE
PLAY_SONG(music_off_song);
# endif
}
bool is_midi_on(void) {
return (midi_activated != 0);
}
bool is_midi_on(void) { return (midi_activated != 0); }
void midi_toggle(void) {
if (!midi_activated) {
@ -295,50 +272,47 @@ void midi_toggle(void) {
void midi_on(void) {
midi_activated = 1;
#ifdef AUDIO_ENABLE
PLAY_SONG(midi_on_song);
#endif
# ifdef AUDIO_ENABLE
PLAY_SONG(midi_on_song);
# endif
midi_on_user();
}
void midi_off(void) {
#if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
process_midi_all_notes_off();
#endif
# if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
process_midi_all_notes_off();
# endif
midi_activated = 0;
#ifdef AUDIO_ENABLE
PLAY_SONG(midi_off_song);
#endif
# ifdef AUDIO_ENABLE
PLAY_SONG(midi_off_song);
# endif
}
void music_mode_cycle(void) {
music_all_notes_off();
music_mode = (music_mode + 1) % NUMBER_OF_MODES;
#ifdef AUDIO_ENABLE
music_all_notes_off();
music_mode = (music_mode + 1) % NUMBER_OF_MODES;
# ifdef AUDIO_ENABLE
PLAY_SONG(music_mode_songs[music_mode]);
#endif
# endif
}
void matrix_scan_music(void) {
if (music_sequence_playing) {
if ((music_sequence_timer == 0) || (timer_elapsed(music_sequence_timer) > music_sequence_interval)) {
music_sequence_timer = timer_read();
uint8_t prev_note = music_sequence[(music_sequence_position - 1 < 0)?(music_sequence_position - 1 + music_sequence_count):(music_sequence_position - 1)];
uint8_t next_note = music_sequence[music_sequence_position];
music_noteoff(prev_note);
music_noteon(next_note);
music_sequence_position = (music_sequence_position + 1) % music_sequence_count;
if (music_sequence_playing) {
if ((music_sequence_timer == 0) || (timer_elapsed(music_sequence_timer) > music_sequence_interval)) {
music_sequence_timer = timer_read();
uint8_t prev_note = music_sequence[(music_sequence_position - 1 < 0) ? (music_sequence_position - 1 + music_sequence_count) : (music_sequence_position - 1)];
uint8_t next_note = music_sequence[music_sequence_position];
music_noteoff(prev_note);
music_noteon(next_note);
music_sequence_position = (music_sequence_position + 1) % music_sequence_count;
}
}
}
}
__attribute__ ((weak))
void music_on_user() {}
__attribute__((weak)) void music_on_user() {}
__attribute__ ((weak))
void midi_on_user() {}
__attribute__((weak)) void midi_on_user() {}
__attribute__ ((weak))
void music_scale_user() {}
__attribute__((weak)) void music_scale_user() {}
#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))

View file

@ -21,18 +21,11 @@
#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
enum music_modes {
MUSIC_MODE_CHROMATIC,
MUSIC_MODE_GUITAR,
MUSIC_MODE_VIOLIN,
MUSIC_MODE_MAJOR,
NUMBER_OF_MODES
};
enum music_modes { MUSIC_MODE_CHROMATIC, MUSIC_MODE_GUITAR, MUSIC_MODE_VIOLIN, MUSIC_MODE_MAJOR, NUMBER_OF_MODES };
#ifdef MUSIC_MAP
extern const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS];
#endif
# ifdef MUSIC_MAP
extern const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS];
# endif
bool process_music(uint16_t keycode, keyrecord_t *record);
@ -58,14 +51,11 @@ bool music_mask(uint16_t keycode);
bool music_mask_kb(uint16_t keycode);
bool music_mask_user(uint16_t keycode);
#ifndef SCALE
#define SCALE (int8_t []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
#endif
# ifndef SCALE
# define SCALE \
(int8_t[]) { 0 + (12 * 0), 2 + (12 * 0), 4 + (12 * 0), 5 + (12 * 0), 7 + (12 * 0), 9 + (12 * 0), 11 + (12 * 0), 0 + (12 * 1), 2 + (12 * 1), 4 + (12 * 1), 5 + (12 * 1), 7 + (12 * 1), 9 + (12 * 1), 11 + (12 * 1), 0 + (12 * 2), 2 + (12 * 2), 4 + (12 * 2), 5 + (12 * 2), 7 + (12 * 2), 9 + (12 * 2), 11 + (12 * 2), 0 + (12 * 3), 2 + (12 * 3), 4 + (12 * 3), 5 + (12 * 3), 7 + (12 * 3), 9 + (12 * 3), 11 + (12 * 3), 0 + (12 * 4), 2 + (12 * 4), 4 + (12 * 4), 5 + (12 * 4), 7 + (12 * 4), 9 + (12 * 4), 11 + (12 * 4), }
# endif
#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
#endif

View file

@ -17,17 +17,15 @@
#include "process_printer.h"
#include "action_util.h"
bool printing_enabled = false;
uint8_t character_shift = 0;
bool printing_enabled = false;
uint8_t character_shift = 0;
void enable_printing(void) {
printing_enabled = true;
serial_init();
printing_enabled = true;
serial_init();
}
void disable_printing(void) {
printing_enabled = false;
}
void disable_printing(void) { printing_enabled = false; }
uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29};
@ -36,235 +34,232 @@ uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0
// keycode_to_ascii[KC_MINS] = {0x2D, 0x5F};
void print_char(char c) {
USB_Disable();
serial_send(c);
USB_Init();
USB_Disable();
serial_send(c);
USB_Init();
}
void print_string(char c[]) {
for(uint8_t i = 0; i < strlen(c); i++)
print_char(c[i]);
for (uint8_t i = 0; i < strlen(c); i++) print_char(c[i]);
}
void print_box_string(const char text[]) {
size_t len = strlen(text);
char out[len * 3 + 8];
out[0] = 0xDA;
for (uint8_t i = 0; i < len; i++) {
out[i+1] = 0xC4;
}
out[len + 1] = 0xBF;
out[len + 2] = '\n';
size_t len = strlen(text);
char out[len * 3 + 8];
out[0] = 0xDA;
for (uint8_t i = 0; i < len; i++) {
out[i + 1] = 0xC4;
}
out[len + 1] = 0xBF;
out[len + 2] = '\n';
out[len + 3] = 0xB3;
for (uint8_t i = 0; i < len; i++) {
out[len + 4 + i] = text[i];
}
out[len * 2 + 4] = 0xB3;
out[len * 2 + 5] = '\n';
out[len + 3] = 0xB3;
for (uint8_t i = 0; i < len; i++) {
out[len + 4 + i] = text[i];
}
out[len * 2 + 4] = 0xB3;
out[len * 2 + 5] = '\n';
out[len * 2 + 6] = 0xC0;
for (uint8_t i = 0; i < len; i++) {
out[len * 2 + 7 + i] = 0xC4;
}
out[len * 3 + 7] = 0xD9;
out[len * 3 + 8] = '\n';
out[len * 2 + 6] = 0xC0;
for (uint8_t i = 0; i < len; i++) {
out[len * 2 + 7 + i] = 0xC4;
}
out[len * 3 + 7] = 0xD9;
out[len * 3 + 8] = '\n';
print_string(out);
print_string(out);
}
bool process_printer(uint16_t keycode, keyrecord_t *record) {
if (keycode == PRINT_ON) {
enable_printing();
return false;
}
if (keycode == PRINT_OFF) {
disable_printing();
return false;
}
if (keycode == PRINT_ON) {
enable_printing();
return false;
}
if (keycode == PRINT_OFF) {
disable_printing();
return false;
}
if (printing_enabled) {
switch(keycode) {
case KC_EXLM ... KC_RPRN:
case KC_UNDS:
case KC_PLUS:
case KC_LCBR:
case KC_RCBR:
case KC_PIPE:
case KC_TILD:
keycode &= 0xFF;
case KC_LSFT:
case KC_RSFT:
if (record->event.pressed) {
character_shift++;
} else {
character_shift--;
}
return false;
break;
}
switch(keycode) {
case KC_F1:
if (record->event.pressed) {
print_box_string("This is a line of text!");
}
return false;
case KC_ESC:
if (record->event.pressed) {
print_char(0x1B);
}
return false;
break;
case KC_SPC:
if (record->event.pressed) {
print_char(0x20);
}
return false;
break;
case KC_A ... KC_Z:
if (record->event.pressed) {
if (character_shift) {
print_char(0x41 + (keycode - KC_A));
} else {
print_char(0x61 + (keycode - KC_A));
}
}
return false;
break;
case KC_1 ... KC_0:
if (record->event.pressed) {
if (character_shift) {
print_char(shifted_numbers[keycode - KC_1]);
} else {
print_char(0x30 + ((keycode - KC_1 + 1) % 10));
}
}
return false;
break;
case KC_ENT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x0C);
} else {
print_char(0x0A);
}
}
return false;
break;
case KC_BSPC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x18);
} else {
print_char(0x1A);
}
}
return false;
break;
case KC_DOT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3E);
} else {
print_char(0x2E);
}
}
return false;
break;
case KC_COMM:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3C);
} else {
print_char(0x2C);
}
}
return false;
break;
case KC_SLSH:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3F);
} else {
print_char(0x2F);
}
}
return false;
break;
case KC_QUOT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x22);
} else {
print_char(0x27);
}
}
return false;
break;
case KC_GRV:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7E);
} else {
print_char(0x60);
}
}
return false;
break;
case KC_MINS:
if (record->event.pressed) {
if (character_shift) {
print_char(0x5F);
} else {
print_char(0x2D);
}
}
return false;
break;
case KC_EQL:
if (record->event.pressed) {
if (character_shift) {
print_char(0x2B);
} else {
print_char(0x3D);
}
}
return false;
break;
case KC_LBRC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7B);
} else {
print_char(0x5B);
}
}
return false;
break;
case KC_RBRC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7D);
} else {
print_char(0x5D);
}
}
return false;
break;
case KC_BSLS:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7C);
} else {
print_char(0x5C);
}
}
return false;
break;
}
}
return true;
if (printing_enabled) {
switch (keycode) {
case KC_EXLM ... KC_RPRN:
case KC_UNDS:
case KC_PLUS:
case KC_LCBR:
case KC_RCBR:
case KC_PIPE:
case KC_TILD:
keycode &= 0xFF;
case KC_LSFT:
case KC_RSFT:
if (record->event.pressed) {
character_shift++;
} else {
character_shift--;
}
return false;
break;
}
switch (keycode) {
case KC_F1:
if (record->event.pressed) {
print_box_string("This is a line of text!");
}
return false;
case KC_ESC:
if (record->event.pressed) {
print_char(0x1B);
}
return false;
break;
case KC_SPC:
if (record->event.pressed) {
print_char(0x20);
}
return false;
break;
case KC_A ... KC_Z:
if (record->event.pressed) {
if (character_shift) {
print_char(0x41 + (keycode - KC_A));
} else {
print_char(0x61 + (keycode - KC_A));
}
}
return false;
break;
case KC_1 ... KC_0:
if (record->event.pressed) {
if (character_shift) {
print_char(shifted_numbers[keycode - KC_1]);
} else {
print_char(0x30 + ((keycode - KC_1 + 1) % 10));
}
}
return false;
break;
case KC_ENT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x0C);
} else {
print_char(0x0A);
}
}
return false;
break;
case KC_BSPC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x18);
} else {
print_char(0x1A);
}
}
return false;
break;
case KC_DOT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3E);
} else {
print_char(0x2E);
}
}
return false;
break;
case KC_COMM:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3C);
} else {
print_char(0x2C);
}
}
return false;
break;
case KC_SLSH:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3F);
} else {
print_char(0x2F);
}
}
return false;
break;
case KC_QUOT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x22);
} else {
print_char(0x27);
}
}
return false;
break;
case KC_GRV:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7E);
} else {
print_char(0x60);
}
}
return false;
break;
case KC_MINS:
if (record->event.pressed) {
if (character_shift) {
print_char(0x5F);
} else {
print_char(0x2D);
}
}
return false;
break;
case KC_EQL:
if (record->event.pressed) {
if (character_shift) {
print_char(0x2B);
} else {
print_char(0x3D);
}
}
return false;
break;
case KC_LBRC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7B);
} else {
print_char(0x5B);
}
}
return false;
break;
case KC_RBRC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7D);
} else {
print_char(0x5D);
}
}
return false;
break;
case KC_BSLS:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7C);
} else {
print_char(0x5C);
}
}
return false;
break;
}
}
return true;
}

View file

@ -17,44 +17,29 @@
#include "process_printer.h"
#include "action_util.h"
bool printing_enabled = false;
uint8_t character_shift = 0;
bool printing_enabled = false;
uint8_t character_shift = 0;
#define SERIAL_PIN_DDR DDRD
#define SERIAL_PIN_PORT PORTD
#define SERIAL_PIN_MASK _BV(PD3)
#define SERIAL_DELAY 52
inline static
void serial_delay(void) {
_delay_us(SERIAL_DELAY);
}
inline static void serial_delay(void) { _delay_us(SERIAL_DELAY); }
inline static
void serial_high(void) {
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
inline static void serial_high(void) { SERIAL_PIN_PORT |= SERIAL_PIN_MASK; }
inline static
void serial_low(void) {
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
}
inline static
void serial_output(void) {
SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
}
inline static void serial_low(void) { SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; }
inline static void serial_output(void) { SERIAL_PIN_DDR |= SERIAL_PIN_MASK; }
void enable_printing() {
printing_enabled = true;
serial_output();
serial_high();
printing_enabled = true;
serial_output();
serial_high();
}
void disable_printing() {
printing_enabled = false;
}
void disable_printing() { printing_enabled = false; }
uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29};
@ -63,214 +48,212 @@ uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0
// keycode_to_ascii[KC_MINS] = {0x2D, 0x5F};
void print_char(char c) {
uint8_t b = 8;
serial_output();
while( b-- ) {
if(c & (1 << b)) {
serial_high();
} else {
serial_low();
uint8_t b = 8;
serial_output();
while (b--) {
if (c & (1 << b)) {
serial_high();
} else {
serial_low();
}
serial_delay();
}
serial_delay();
}
}
void print_string(char c[]) {
for(uint8_t i = 0; i < strlen(c); i++)
print_char(c[i]);
for (uint8_t i = 0; i < strlen(c); i++) print_char(c[i]);
}
bool process_printer(uint16_t keycode, keyrecord_t *record) {
if (keycode == PRINT_ON) {
enable_printing();
return false;
}
if (keycode == PRINT_OFF) {
disable_printing();
return false;
}
if (keycode == PRINT_ON) {
enable_printing();
return false;
}
if (keycode == PRINT_OFF) {
disable_printing();
return false;
}
if (printing_enabled) {
switch(keycode) {
case KC_EXLM ... KC_RPRN:
case KC_UNDS:
case KC_PLUS:
case KC_LCBR:
case KC_RCBR:
case KC_PIPE:
case KC_TILD:
keycode &= 0xFF;
case KC_LSFT:
case KC_RSFT:
if (record->event.pressed) {
character_shift++;
} else {
character_shift--;
}
return false;
break;
}
switch(keycode) {
case KC_F1:
if (record->event.pressed) {
print_string("This is a line of text!\n\n\n");
}
return false;
case KC_ESC:
if (record->event.pressed) {
print_char(0x1B);
}
return false;
break;
case KC_SPC:
if (record->event.pressed) {
print_char(0x20);
}
return false;
break;
case KC_A ... KC_Z:
if (record->event.pressed) {
if (character_shift) {
print_char(0x41 + (keycode - KC_A));
} else {
print_char(0x61 + (keycode - KC_A));
}
}
return false;
break;
case KC_1 ... KC_0:
if (record->event.pressed) {
if (character_shift) {
print_char(shifted_numbers[keycode - KC_1]);
} else {
print_char(0x30 + ((keycode - KC_1 + 1) % 10));
}
}
return false;
break;
case KC_ENT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x0C);
} else {
print_char(0x0A);
}
}
return false;
break;
case KC_BSPC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x18);
} else {
print_char(0x1A);
}
}
return false;
break;
case KC_DOT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3E);
} else {
print_char(0x2E);
}
}
return false;
break;
case KC_COMM:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3C);
} else {
print_char(0x2C);
}
}
return false;
break;
case KC_SLSH:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3F);
} else {
print_char(0x2F);
}
}
return false;
break;
case KC_QUOT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x22);
} else {
print_char(0x27);
}
}
return false;
break;
case KC_GRV:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7E);
} else {
print_char(0x60);
}
}
return false;
break;
case KC_MINS:
if (record->event.pressed) {
if (character_shift) {
print_char(0x5F);
} else {
print_char(0x2D);
}
}
return false;
break;
case KC_EQL:
if (record->event.pressed) {
if (character_shift) {
print_char(0x2B);
} else {
print_char(0x3D);
}
}
return false;
break;
case KC_LBRC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7B);
} else {
print_char(0x5B);
}
}
return false;
break;
case KC_RBRC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7D);
} else {
print_char(0x5D);
}
}
return false;
break;
case KC_BSLS:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7C);
} else {
print_char(0x5C);
}
}
return false;
break;
}
}
return true;
if (printing_enabled) {
switch (keycode) {
case KC_EXLM ... KC_RPRN:
case KC_UNDS:
case KC_PLUS:
case KC_LCBR:
case KC_RCBR:
case KC_PIPE:
case KC_TILD:
keycode &= 0xFF;
case KC_LSFT:
case KC_RSFT:
if (record->event.pressed) {
character_shift++;
} else {
character_shift--;
}
return false;
break;
}
switch (keycode) {
case KC_F1:
if (record->event.pressed) {
print_string("This is a line of text!\n\n\n");
}
return false;
case KC_ESC:
if (record->event.pressed) {
print_char(0x1B);
}
return false;
break;
case KC_SPC:
if (record->event.pressed) {
print_char(0x20);
}
return false;
break;
case KC_A ... KC_Z:
if (record->event.pressed) {
if (character_shift) {
print_char(0x41 + (keycode - KC_A));
} else {
print_char(0x61 + (keycode - KC_A));
}
}
return false;
break;
case KC_1 ... KC_0:
if (record->event.pressed) {
if (character_shift) {
print_char(shifted_numbers[keycode - KC_1]);
} else {
print_char(0x30 + ((keycode - KC_1 + 1) % 10));
}
}
return false;
break;
case KC_ENT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x0C);
} else {
print_char(0x0A);
}
}
return false;
break;
case KC_BSPC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x18);
} else {
print_char(0x1A);
}
}
return false;
break;
case KC_DOT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3E);
} else {
print_char(0x2E);
}
}
return false;
break;
case KC_COMM:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3C);
} else {
print_char(0x2C);
}
}
return false;
break;
case KC_SLSH:
if (record->event.pressed) {
if (character_shift) {
print_char(0x3F);
} else {
print_char(0x2F);
}
}
return false;
break;
case KC_QUOT:
if (record->event.pressed) {
if (character_shift) {
print_char(0x22);
} else {
print_char(0x27);
}
}
return false;
break;
case KC_GRV:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7E);
} else {
print_char(0x60);
}
}
return false;
break;
case KC_MINS:
if (record->event.pressed) {
if (character_shift) {
print_char(0x5F);
} else {
print_char(0x2D);
}
}
return false;
break;
case KC_EQL:
if (record->event.pressed) {
if (character_shift) {
print_char(0x2B);
} else {
print_char(0x3D);
}
}
return false;
break;
case KC_LBRC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7B);
} else {
print_char(0x5B);
}
}
return false;
break;
case KC_RBRC:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7D);
} else {
print_char(0x5D);
}
}
return false;
break;
case KC_BSLS:
if (record->event.pressed) {
if (character_shift) {
print_char(0x7C);
} else {
print_char(0x5C);
}
}
return false;
break;
}
}
return true;
}

View file

@ -16,150 +16,149 @@
#include "process_space_cadet.h"
#ifndef TAPPING_TERM
#define TAPPING_TERM 200
# define TAPPING_TERM 200
#endif
// ********** OBSOLETE DEFINES, STOP USING! (pls?) **********
// Shift / paren setup
#ifndef LSPO_KEY
#define LSPO_KEY KC_9
# define LSPO_KEY KC_9
#endif
#ifndef RSPC_KEY
#define RSPC_KEY KC_0
# define RSPC_KEY KC_0
#endif
// Shift / Enter setup
#ifndef SFTENT_KEY
#define SFTENT_KEY KC_ENT
# 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
# 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
# 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
# define LSPO_KEYS KC_LSFT, LSPO_MOD, LSPO_KEY
#endif
#ifndef RSPC_KEYS
#define RSPC_KEYS KC_RSFT, RSPC_MOD, RSPC_KEY
# 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
# define LCPO_KEYS KC_LCTL, KC_LSFT, KC_9
#endif
#ifndef RCPC_KEYS
#define RCPC_KEYS KC_RCTL, KC_RSFT, KC_0
# 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
# define LAPO_KEYS KC_LALT, KC_LSFT, KC_9
#endif
#ifndef RAPC_KEYS
#define RAPC_KEYS KC_RALT, KC_RSFT, KC_0
# 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
# define SFTENT_KEYS KC_RSFT, KC_TRNS, SFTENT_KEY
#endif
static uint8_t sc_last = 0;
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 ();
if (record->event.pressed) {
sc_last = holdMod;
sc_timer = timer_read();
#ifdef SPACE_CADET_MODIFIER_CARRYOVER
sc_mods = get_mods();
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));
register_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));
}
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;
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;
}
}
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;
return true;
}

View file

@ -58,150 +58,136 @@
#define GEMINI_STATE_SIZE 6
#define MAX_STATE_SIZE GEMINI_STATE_SIZE
static uint8_t state[MAX_STATE_SIZE] = {0};
static uint8_t chord[MAX_STATE_SIZE] = {0};
static int8_t pressed = 0;
static uint8_t state[MAX_STATE_SIZE] = {0};
static uint8_t chord[MAX_STATE_SIZE] = {0};
static int8_t pressed = 0;
static steno_mode_t mode;
static const uint8_t boltmap[64] PROGMEM = {
TXB_NUL, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM,
TXB_S_L, TXB_S_L, TXB_T_L, TXB_K_L, TXB_P_L, TXB_W_L, TXB_H_L,
TXB_R_L, TXB_A_L, TXB_O_L, TXB_STR, TXB_STR, TXB_NUL, TXB_NUL,
TXB_NUL, TXB_STR, TXB_STR, TXB_E_R, TXB_U_R, TXB_F_R, TXB_R_R,
TXB_P_R, TXB_B_R, TXB_L_R, TXB_G_R, TXB_T_R, TXB_S_R, TXB_D_R,
TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_Z_R
};
static const uint8_t boltmap[64] PROGMEM = {TXB_NUL, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_S_L, TXB_S_L, TXB_T_L, TXB_K_L, TXB_P_L, TXB_W_L, TXB_H_L, TXB_R_L, TXB_A_L, TXB_O_L, TXB_STR, TXB_STR, TXB_NUL, TXB_NUL, TXB_NUL, TXB_STR, TXB_STR, TXB_E_R, TXB_U_R, TXB_F_R, TXB_R_R, TXB_P_R, TXB_B_R, TXB_L_R, TXB_G_R, TXB_T_R, TXB_S_R, TXB_D_R, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_Z_R};
static void steno_clear_state(void) {
memset(state, 0, sizeof(state));
memset(chord, 0, sizeof(chord));
memset(state, 0, sizeof(state));
memset(chord, 0, sizeof(chord));
}
static void send_steno_state(uint8_t size, bool send_empty) {
for (uint8_t i = 0; i < size; ++i) {
if (chord[i] || send_empty) {
virtser_send(chord[i]);
for (uint8_t i = 0; i < size; ++i) {
if (chord[i] || send_empty) {
virtser_send(chord[i]);
}
}
}
}
void steno_init() {
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
mode = eeprom_read_byte(EECONFIG_STENOMODE);
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
mode = eeprom_read_byte(EECONFIG_STENOMODE);
}
void steno_set_mode(steno_mode_t new_mode) {
steno_clear_state();
mode = new_mode;
eeprom_update_byte(EECONFIG_STENOMODE, mode);
steno_clear_state();
mode = new_mode;
eeprom_update_byte(EECONFIG_STENOMODE, mode);
}
/* override to intercept chords right before they get sent.
* return zero to suppress normal sending behavior.
*/
__attribute__ ((weak))
bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) { return true; }
__attribute__((weak)) bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) { return true; }
__attribute__ ((weak))
bool postprocess_steno_user(uint16_t keycode, keyrecord_t *record, steno_mode_t mode, uint8_t chord[6], int8_t pressed) { return true; }
__attribute__((weak)) bool postprocess_steno_user(uint16_t keycode, keyrecord_t *record, steno_mode_t mode, uint8_t chord[6], int8_t pressed) { return true; }
__attribute__ ((weak))
bool process_steno_user(uint16_t keycode, keyrecord_t *record) { return true; }
__attribute__((weak)) bool process_steno_user(uint16_t keycode, keyrecord_t *record) { return true; }
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;
case STENO_MODE_GEMINI:
chord[0] |= 0x80; // Indicate start of packet
send_steno_state(GEMINI_STATE_SIZE, true);
break;
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;
case STENO_MODE_GEMINI:
chord[0] |= 0x80; // Indicate start of packet
send_steno_state(GEMINI_STATE_SIZE, true);
break;
}
}
}
steno_clear_state();
steno_clear_state();
}
uint8_t *steno_get_state(void) {
return &state[0];
}
uint8_t *steno_get_state(void) { return &state[0]; }
uint8_t *steno_get_chord(void) {
return &chord[0];
}
uint8_t *steno_get_chord(void) { return &chord[0]; }
static bool update_state_bolt(uint8_t key, bool press) {
uint8_t boltcode = pgm_read_byte(boltmap + key);
if (press) {
state[TXB_GET_GROUP(boltcode)] |= boltcode;
chord[TXB_GET_GROUP(boltcode)] |= boltcode;
} else {
state[TXB_GET_GROUP(boltcode)] &= ~boltcode;
}
return false;
uint8_t boltcode = pgm_read_byte(boltmap + key);
if (press) {
state[TXB_GET_GROUP(boltcode)] |= boltcode;
chord[TXB_GET_GROUP(boltcode)] |= boltcode;
} else {
state[TXB_GET_GROUP(boltcode)] &= ~boltcode;
}
return false;
}
static bool update_state_gemini(uint8_t key, bool press) {
int idx = key / 7;
uint8_t bit = 1 << (6 - (key % 7));
if (press) {
state[idx] |= bit;
chord[idx] |= bit;
} else {
state[idx] &= ~bit;
}
return false;
int idx = key / 7;
uint8_t bit = 1 << (6 - (key % 7));
if (press) {
state[idx] |= bit;
chord[idx] |= bit;
} else {
state[idx] &= ~bit;
}
return false;
}
bool process_steno(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QK_STENO_BOLT:
if (!process_steno_user(keycode, record)) {
return false;
}
if (IS_PRESSED(record->event)) {
steno_set_mode(STENO_MODE_BOLT);
}
return false;
switch (keycode) {
case QK_STENO_BOLT:
if (!process_steno_user(keycode, record)) {
return false;
}
if (IS_PRESSED(record->event)) {
steno_set_mode(STENO_MODE_BOLT);
}
return false;
case QK_STENO_GEMINI:
if (!process_steno_user(keycode, record)) {
return false;
}
if (IS_PRESSED(record->event)) {
steno_set_mode(STENO_MODE_GEMINI);
}
return false;
case QK_STENO_GEMINI:
if (!process_steno_user(keycode, record)) {
return false;
}
if (IS_PRESSED(record->event)) {
steno_set_mode(STENO_MODE_GEMINI);
}
return false;
case STN__MIN...STN__MAX:
if (!process_steno_user(keycode, record)) {
return false;
}
switch(mode) {
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();
}
}
}
return false;
}
return true;
case STN__MIN ... STN__MAX:
if (!process_steno_user(keycode, record)) {
return false;
}
switch (mode) {
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();
}
}
}
return false;
}
return true;
}

View file

@ -19,14 +19,14 @@
#include "quantum.h"
#if defined(STENO_ENABLE) && !defined(VIRTSER_ENABLE)
#error "must have virtser enabled to use steno"
# error "must have virtser enabled to use steno"
#endif
typedef enum { STENO_MODE_BOLT, STENO_MODE_GEMINI } steno_mode_t;
bool process_steno(uint16_t keycode, keyrecord_t *record);
void steno_init(void);
void steno_set_mode(steno_mode_t mode);
bool process_steno(uint16_t keycode, keyrecord_t *record);
void steno_init(void);
void steno_set_mode(steno_mode_t mode);
uint8_t *steno_get_state(void);
uint8_t *steno_get_chord(void);

View file

@ -17,7 +17,7 @@
#include "action_tapping.h"
#ifndef TAPPING_TERM
#define TAPPING_TERM 200
# define TAPPING_TERM 200
#endif
#ifndef NO_ACTION_ONESHOT
@ -25,191 +25,173 @@ uint8_t get_oneshot_mods(void);
#endif
static uint16_t last_td;
static int8_t highest_td = -1;
static int8_t highest_td = -1;
void qk_tap_dance_pair_on_each_tap (qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
if (state->count == 2) {
register_code16 (pair->kc2);
state->finished = true;
}
if (state->count == 2) {
register_code16(pair->kc2);
state->finished = true;
}
}
void qk_tap_dance_pair_finished (qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
void qk_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
if (state->count == 1) {
register_code16 (pair->kc1);
} else if (state->count == 2) {
register_code16 (pair->kc2);
}
if (state->count == 1) {
register_code16(pair->kc1);
} else if (state->count == 2) {
register_code16(pair->kc2);
}
}
void qk_tap_dance_pair_reset (qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
if (state->count == 1) {
unregister_code16 (pair->kc1);
} else if (state->count == 2) {
unregister_code16 (pair->kc2);
}
if (state->count == 1) {
unregister_code16(pair->kc1);
} else if (state->count == 2) {
unregister_code16(pair->kc2);
}
}
void qk_tap_dance_dual_role_on_each_tap (qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data;
void qk_tap_dance_dual_role_on_each_tap(qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data;
if (state->count == 2) {
layer_move (pair->layer);
state->finished = true;
}
if (state->count == 2) {
layer_move(pair->layer);
state->finished = true;
}
}
void qk_tap_dance_dual_role_finished (qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data;
void qk_tap_dance_dual_role_finished(qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data;
if (state->count == 1) {
register_code16 (pair->kc);
} else if (state->count == 2) {
layer_move (pair->layer);
}
if (state->count == 1) {
register_code16(pair->kc);
} else if (state->count == 2) {
layer_move(pair->layer);
}
}
void qk_tap_dance_dual_role_reset (qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data;
void qk_tap_dance_dual_role_reset(qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_dual_role_t *pair = (qk_tap_dance_dual_role_t *)user_data;
if (state->count == 1) {
unregister_code16 (pair->kc);
}
if (state->count == 1) {
unregister_code16(pair->kc);
}
}
static inline void _process_tap_dance_action_fn (qk_tap_dance_state_t *state,
void *user_data,
qk_tap_dance_user_fn_t fn)
{
if (fn) {
fn(state, user_data);
}
static inline void _process_tap_dance_action_fn(qk_tap_dance_state_t *state, void *user_data, qk_tap_dance_user_fn_t fn) {
if (fn) {
fn(state, user_data);
}
}
static inline void process_tap_dance_action_on_each_tap (qk_tap_dance_action_t *action)
{
_process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_each_tap);
static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *action) { _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap); }
static inline void process_tap_dance_action_on_dance_finished(qk_tap_dance_action_t *action) {
if (action->state.finished) return;
action->state.finished = true;
add_mods(action->state.oneshot_mods);
add_weak_mods(action->state.weak_mods);
send_keyboard_report();
_process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_dance_finished);
}
static inline void process_tap_dance_action_on_dance_finished (qk_tap_dance_action_t *action)
{
if (action->state.finished)
return;
action->state.finished = true;
add_mods(action->state.oneshot_mods);
add_weak_mods(action->state.weak_mods);
send_keyboard_report();
_process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_dance_finished);
}
static inline void process_tap_dance_action_on_reset (qk_tap_dance_action_t *action)
{
_process_tap_dance_action_fn (&action->state, action->user_data, action->fn.on_reset);
del_mods(action->state.oneshot_mods);
del_weak_mods(action->state.weak_mods);
send_keyboard_report();
static inline void process_tap_dance_action_on_reset(qk_tap_dance_action_t *action) {
_process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_reset);
del_mods(action->state.oneshot_mods);
del_weak_mods(action->state.weak_mods);
send_keyboard_report();
}
void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record) {
qk_tap_dance_action_t *action;
qk_tap_dance_action_t *action;
if (!record->event.pressed)
return;
if (!record->event.pressed) return;
if (highest_td == -1)
return;
if (highest_td == -1) return;
for (int i = 0; i <= highest_td; i++) {
action = &tap_dance_actions[i];
if (action->state.count) {
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);
for (int i = 0; i <= highest_td; i++) {
action = &tap_dance_actions[i];
if (action->state.count) {
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);
}
}
}
}
bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
uint16_t idx = keycode - QK_TAP_DANCE;
qk_tap_dance_action_t *action;
uint16_t idx = keycode - QK_TAP_DANCE;
qk_tap_dance_action_t *action;
switch(keycode) {
case QK_TAP_DANCE ... QK_TAP_DANCE_MAX:
if ((int16_t)idx > highest_td)
highest_td = idx;
action = &tap_dance_actions[idx];
switch (keycode) {
case QK_TAP_DANCE ... QK_TAP_DANCE_MAX:
if ((int16_t)idx > highest_td) highest_td = idx;
action = &tap_dance_actions[idx];
action->state.pressed = record->event.pressed;
if (record->event.pressed) {
action->state.keycode = keycode;
action->state.count++;
action->state.timer = timer_read();
action->state.pressed = record->event.pressed;
if (record->event.pressed) {
action->state.keycode = keycode;
action->state.count++;
action->state.timer = timer_read();
#ifndef NO_ACTION_ONESHOT
action->state.oneshot_mods = get_oneshot_mods();
action->state.oneshot_mods = get_oneshot_mods();
#else
action->state.oneshot_mods = 0;
action->state.oneshot_mods = 0;
#endif
action->state.weak_mods = get_mods();
action->state.weak_mods |= get_weak_mods();
process_tap_dance_action_on_each_tap (action);
action->state.weak_mods = get_mods();
action->state.weak_mods |= get_weak_mods();
process_tap_dance_action_on_each_tap(action);
last_td = keycode;
} else {
if (action->state.count && action->state.finished) {
reset_tap_dance (&action->state);
}
last_td = keycode;
} else {
if (action->state.count && action->state.finished) {
reset_tap_dance(&action->state);
}
}
break;
}
break;
}
return true;
return true;
}
void matrix_scan_tap_dance() {
if (highest_td == -1) return;
uint16_t tap_user_defined;
void matrix_scan_tap_dance () {
if (highest_td == -1)
return;
uint16_t tap_user_defined;
for (uint8_t i = 0; i <= highest_td; i++) {
qk_tap_dance_action_t *action = &tap_dance_actions[i];
if(action->custom_tapping_term > 0 ) {
tap_user_defined = action->custom_tapping_term;
for (uint8_t i = 0; i <= highest_td; i++) {
qk_tap_dance_action_t *action = &tap_dance_actions[i];
if (action->custom_tapping_term > 0) {
tap_user_defined = action->custom_tapping_term;
} else {
tap_user_defined = TAPPING_TERM;
}
if (action->state.count && timer_elapsed(action->state.timer) > tap_user_defined) {
process_tap_dance_action_on_dance_finished(action);
reset_tap_dance(&action->state);
}
}
else{
tap_user_defined = TAPPING_TERM;
}
if (action->state.count && timer_elapsed (action->state.timer) > tap_user_defined) {
process_tap_dance_action_on_dance_finished (action);
reset_tap_dance (&action->state);
}
}
}
void reset_tap_dance (qk_tap_dance_state_t *state) {
qk_tap_dance_action_t *action;
void reset_tap_dance(qk_tap_dance_state_t *state) {
qk_tap_dance_action_t *action;
if (state->pressed)
return;
if (state->pressed) return;
action = &tap_dance_actions[state->keycode - QK_TAP_DANCE];
action = &tap_dance_actions[state->keycode - QK_TAP_DANCE];
process_tap_dance_action_on_reset (action);
process_tap_dance_action_on_reset(action);
state->count = 0;
state->interrupted = false;
state->finished = false;
state->interrupting_keycode = 0;
last_td = 0;
state->count = 0;
state->interrupted = false;
state->finished = false;
state->interrupting_keycode = 0;
last_td = 0;
}

View file

@ -18,75 +18,60 @@
#ifdef TAP_DANCE_ENABLE
#include <stdbool.h>
#include <inttypes.h>
# include <stdbool.h>
# include <inttypes.h>
typedef struct
{
uint8_t count;
uint8_t oneshot_mods;
uint8_t weak_mods;
uint16_t keycode;
uint16_t interrupting_keycode;
uint16_t timer;
bool interrupted;
bool pressed;
bool finished;
typedef struct {
uint8_t count;
uint8_t oneshot_mods;
uint8_t weak_mods;
uint16_t keycode;
uint16_t interrupting_keycode;
uint16_t timer;
bool interrupted;
bool pressed;
bool finished;
} qk_tap_dance_state_t;
#define TD(n) (QK_TAP_DANCE | ((n) & 0xFF))
# define TD(n) (QK_TAP_DANCE | ((n)&0xFF))
typedef void (*qk_tap_dance_user_fn_t) (qk_tap_dance_state_t *state, void *user_data);
typedef void (*qk_tap_dance_user_fn_t)(qk_tap_dance_state_t *state, void *user_data);
typedef struct
{
struct {
qk_tap_dance_user_fn_t on_each_tap;
qk_tap_dance_user_fn_t on_dance_finished;
qk_tap_dance_user_fn_t on_reset;
} fn;
qk_tap_dance_state_t state;
uint16_t custom_tapping_term;
void *user_data;
typedef struct {
struct {
qk_tap_dance_user_fn_t on_each_tap;
qk_tap_dance_user_fn_t on_dance_finished;
qk_tap_dance_user_fn_t on_reset;
} fn;
qk_tap_dance_state_t state;
uint16_t custom_tapping_term;
void * user_data;
} qk_tap_dance_action_t;
typedef struct
{
uint16_t kc1;
uint16_t kc2;
typedef struct {
uint16_t kc1;
uint16_t kc2;
} qk_tap_dance_pair_t;
typedef struct
{
uint16_t kc;
uint8_t layer;
typedef struct {
uint16_t kc;
uint8_t layer;
} qk_tap_dance_dual_role_t;
#define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) { \
.fn = { qk_tap_dance_pair_on_each_tap, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset }, \
.user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }), \
}
# define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \
{ .fn = {qk_tap_dance_pair_on_each_tap, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset}, .user_data = (void *)&((qk_tap_dance_pair_t){kc1, kc2}), }
#define ACTION_TAP_DANCE_DUAL_ROLE(kc, layer) { \
.fn = { qk_tap_dance_dual_role_on_each_tap, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset }, \
.user_data = (void *)&((qk_tap_dance_dual_role_t) { kc, layer }), \
}
# define ACTION_TAP_DANCE_DUAL_ROLE(kc, layer) \
{ .fn = {qk_tap_dance_dual_role_on_each_tap, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset}, .user_data = (void *)&((qk_tap_dance_dual_role_t){kc, layer}), }
#define ACTION_TAP_DANCE_FN(user_fn) { \
.fn = { NULL, user_fn, NULL }, \
.user_data = NULL, \
}
# define ACTION_TAP_DANCE_FN(user_fn) \
{ .fn = {NULL, user_fn, NULL}, .user_data = NULL, }
#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) { \
.fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \
.user_data = NULL, \
}
# define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) \
{ .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, }
#define ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) { \
.fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \
.user_data = NULL, \
.custom_tapping_term = tap_specific_tapping_term, \
}
# define ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term) \
{ .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, .custom_tapping_term = tap_specific_tapping_term, }
extern qk_tap_dance_action_t tap_dance_actions[];
@ -94,20 +79,20 @@ extern qk_tap_dance_action_t tap_dance_actions[];
void preprocess_tap_dance(uint16_t keycode, keyrecord_t *record);
bool process_tap_dance(uint16_t keycode, keyrecord_t *record);
void matrix_scan_tap_dance (void);
void reset_tap_dance (qk_tap_dance_state_t *state);
void matrix_scan_tap_dance(void);
void reset_tap_dance(qk_tap_dance_state_t *state);
void qk_tap_dance_pair_on_each_tap (qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_pair_finished (qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_pair_reset (qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_dual_role_on_each_tap (qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_dual_role_finished (qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_dual_role_reset (qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_dual_role_on_each_tap(qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_dual_role_finished(qk_tap_dance_state_t *state, void *user_data);
void qk_tap_dance_dual_role_reset(qk_tap_dance_state_t *state, void *user_data);
#else
#define TD(n) KC_NO
# define TD(n) KC_NO
#endif

View file

@ -21,62 +21,45 @@
#include <math.h>
#ifndef CMD_BUFF_SIZE
#define CMD_BUFF_SIZE 5
# define CMD_BUFF_SIZE 5
#endif
bool terminal_enabled = false;
char buffer[80] = "";
char buffer[80] = "";
char cmd_buffer[CMD_BUFF_SIZE][80];
bool cmd_buffer_enabled = true; //replace with ifdef?
char newline[2] = "\n";
bool cmd_buffer_enabled = true; // replace with ifdef?
char newline[2] = "\n";
char arguments[6][20];
bool firstTime = true;
short int current_cmd_buffer_pos = 0; //used for up/down arrows - keeps track of where you are in the command buffer
short int current_cmd_buffer_pos = 0; // used for up/down arrows - keeps track of where you are in the command buffer
__attribute__ ((weak))
const char terminal_prompt[8] = "> ";
__attribute__((weak)) const char terminal_prompt[8] = "> ";
#ifdef AUDIO_ENABLE
#ifndef TERMINAL_SONG
#define TERMINAL_SONG SONG(TERMINAL_SOUND)
#endif
float terminal_song[][2] = TERMINAL_SONG;
#define TERMINAL_BELL() PLAY_SONG(terminal_song)
# ifndef TERMINAL_SONG
# define TERMINAL_SONG SONG(TERMINAL_SOUND)
# endif
float terminal_song[][2] = TERMINAL_SONG;
# define TERMINAL_BELL() PLAY_SONG(terminal_song)
#else
#define TERMINAL_BELL()
# define TERMINAL_BELL()
#endif
__attribute__ ((weak))
const char keycode_to_ascii_lut[58] = {
0, 0, 0, 0,
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0, 0, 0, '\t',
' ', '-', '=', '[', ']', '\\', 0, ';', '\'', '`', ',', '.', '/'
};
__attribute__((weak)) const char keycode_to_ascii_lut[58] = {0, 0, 0, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0, 0, 0, '\t', ' ', '-', '=', '[', ']', '\\', 0, ';', '\'', '`', ',', '.', '/'};
__attribute__ ((weak))
const char shifted_keycode_to_ascii_lut[58] = {
0, 0, 0, 0,
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'!', '@', '#', '$', '%', '^', '&', '*', '(', ')', 0, 0, 0, '\t',
' ', '_', '+', '{', '}', '|', 0, ':', '\'', '~', '<', '>', '?'
};
__attribute__((weak)) const char shifted_keycode_to_ascii_lut[58] = {0, 0, 0, 0, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', 0, 0, 0, '\t', ' ', '_', '+', '{', '}', '|', 0, ':', '\'', '~', '<', '>', '?'};
struct stringcase {
char* string;
char *string;
void (*func)(void);
} typedef stringcase;
void enable_terminal(void) {
terminal_enabled = true;
strcpy(buffer, "");
memset(cmd_buffer,0,CMD_BUFF_SIZE * 80);
for (int i = 0; i < 6; i++)
strcpy(arguments[i], "");
memset(cmd_buffer, 0, CMD_BUFF_SIZE * 80);
for (int i = 0; i < 6; i++) strcpy(arguments[i], "");
// select all text to start over
// SEND_STRING(SS_LCTRL("a"));
send_string(terminal_prompt);
@ -88,41 +71,41 @@ void disable_terminal(void) {
}
void push_to_cmd_buffer(void) {
if (cmd_buffer_enabled) {
if (cmd_buffer == NULL) {
return;
} else {
if (firstTime) {
firstTime = false;
strcpy(cmd_buffer[0],buffer);
return;
}
if (cmd_buffer_enabled) {
if (cmd_buffer == NULL) {
return;
} else {
if (firstTime) {
firstTime = false;
strcpy(cmd_buffer[0], buffer);
return;
}
for (int i= CMD_BUFF_SIZE - 1;i > 0 ;--i) {
strncpy(cmd_buffer[i],cmd_buffer[i-1],80);
}
for (int i = CMD_BUFF_SIZE - 1; i > 0; --i) {
strncpy(cmd_buffer[i], cmd_buffer[i - 1], 80);
}
strcpy(cmd_buffer[0],buffer);
strcpy(cmd_buffer[0], buffer);
return;
return;
}
}
}
}
void terminal_about(void) {
SEND_STRING("QMK Firmware\n");
SEND_STRING(" v");
SEND_STRING(QMK_VERSION);
SEND_STRING("\n"SS_TAP(X_HOME)" Built: ");
SEND_STRING("\n" SS_TAP(X_HOME) " Built: ");
SEND_STRING(QMK_BUILDDATE);
send_string(newline);
#ifdef TERMINAL_HELP
if (strlen(arguments[1]) != 0) {
SEND_STRING("You entered: ");
send_string(arguments[1]);
send_string(newline);
}
#endif
#ifdef TERMINAL_HELP
if (strlen(arguments[1]) != 0) {
SEND_STRING("You entered: ");
send_string(arguments[1]);
send_string(newline);
}
#endif
}
void terminal_help(void);
@ -131,11 +114,11 @@ extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
void terminal_keycode(void) {
if (strlen(arguments[1]) != 0 && strlen(arguments[2]) != 0 && strlen(arguments[3]) != 0) {
char keycode_dec[5];
char keycode_hex[5];
uint16_t layer = strtol(arguments[1], (char **)NULL, 10);
uint16_t row = strtol(arguments[2], (char **)NULL, 10);
uint16_t col = strtol(arguments[3], (char **)NULL, 10);
char keycode_dec[5];
char keycode_hex[5];
uint16_t layer = strtol(arguments[1], (char **)NULL, 10);
uint16_t row = strtol(arguments[2], (char **)NULL, 10);
uint16_t col = strtol(arguments[3], (char **)NULL, 10);
uint16_t keycode = pgm_read_word(&keymaps[layer][row][col]);
itoa(keycode, keycode_dec, 10);
itoa(keycode, keycode_hex, 16);
@ -145,9 +128,9 @@ void terminal_keycode(void) {
send_string(keycode_dec);
SEND_STRING(")\n");
} else {
#ifdef TERMINAL_HELP
SEND_STRING("usage: keycode <layer> <row> <col>\n");
#endif
#ifdef TERMINAL_HELP
SEND_STRING("usage: keycode <layer> <row> <col>\n");
#endif
}
}
@ -157,53 +140,44 @@ void terminal_keymap(void) {
for (int r = 0; r < MATRIX_ROWS; r++) {
for (int c = 0; c < MATRIX_COLS; c++) {
uint16_t keycode = pgm_read_word(&keymaps[layer][r][c]);
char keycode_s[8];
char keycode_s[8];
sprintf(keycode_s, "0x%04x,", keycode);
send_string(keycode_s);
}
send_string(newline);
}
} else {
#ifdef TERMINAL_HELP
SEND_STRING("usage: keymap <layer>\n");
#endif
#ifdef TERMINAL_HELP
SEND_STRING("usage: keymap <layer>\n");
#endif
}
}
void print_cmd_buff(void) {
/* without the below wait, a race condition can occur wherein the
buffer can be printed before it has been fully moved */
wait_ms(250);
for(int i=0;i<CMD_BUFF_SIZE;i++){
char tmpChar = ' ';
itoa(i ,&tmpChar,10);
const char * tmpCnstCharStr = &tmpChar; //because sned_string wont take a normal char *
send_string(tmpCnstCharStr);
SEND_STRING(". ");
send_string(cmd_buffer[i]);
SEND_STRING("\n");
}
/* without the below wait, a race condition can occur wherein the
buffer can be printed before it has been fully moved */
wait_ms(250);
for (int i = 0; i < CMD_BUFF_SIZE; i++) {
char tmpChar = ' ';
itoa(i, &tmpChar, 10);
const char *tmpCnstCharStr = &tmpChar; // because sned_string wont take a normal char *
send_string(tmpCnstCharStr);
SEND_STRING(". ");
send_string(cmd_buffer[i]);
SEND_STRING("\n");
}
}
void flush_cmd_buffer(void) {
memset(cmd_buffer,0,CMD_BUFF_SIZE * 80);
SEND_STRING("Buffer Cleared!\n");
memset(cmd_buffer, 0, CMD_BUFF_SIZE * 80);
SEND_STRING("Buffer Cleared!\n");
}
stringcase terminal_cases[] = {
{ "about", terminal_about },
{ "help", terminal_help },
{ "keycode", terminal_keycode },
{ "keymap", terminal_keymap },
{ "flush-buffer" , flush_cmd_buffer},
{ "print-buffer" , print_cmd_buff},
{ "exit", disable_terminal }
};
stringcase terminal_cases[] = {{"about", terminal_about}, {"help", terminal_help}, {"keycode", terminal_keycode}, {"keymap", terminal_keymap}, {"flush-buffer", flush_cmd_buffer}, {"print-buffer", print_cmd_buff}, {"exit", disable_terminal}};
void terminal_help(void) {
SEND_STRING("commands available:\n ");
for( stringcase* case_p = terminal_cases; case_p != terminal_cases + sizeof( terminal_cases ) / sizeof( terminal_cases[0] ); case_p++ ) {
for (stringcase *case_p = terminal_cases; case_p != terminal_cases + sizeof(terminal_cases) / sizeof(terminal_cases[0]); case_p++) {
send_string(case_p->string);
SEND_STRING(" ");
}
@ -211,7 +185,7 @@ void terminal_help(void) {
}
void command_not_found(void) {
wait_ms(50); //sometimes buffer isnt grabbed quick enough
wait_ms(50); // sometimes buffer isnt grabbed quick enough
SEND_STRING("command \"");
send_string(buffer);
SEND_STRING("\" not found\n");
@ -221,9 +195,9 @@ void process_terminal_command(void) {
// we capture return bc of the order of events, so we need to manually send a newline
send_string(newline);
char * pch;
char * pch;
uint8_t i = 0;
pch = strtok(buffer, " ");
pch = strtok(buffer, " ");
while (pch != NULL) {
strcpy(arguments[i], pch);
pch = strtok(NULL, " ");
@ -231,38 +205,32 @@ void process_terminal_command(void) {
}
bool command_found = false;
for( stringcase* case_p = terminal_cases; case_p != terminal_cases + sizeof( terminal_cases ) / sizeof( terminal_cases[0] ); case_p++ ) {
if( 0 == strcmp( case_p->string, buffer ) ) {
for (stringcase *case_p = terminal_cases; case_p != terminal_cases + sizeof(terminal_cases) / sizeof(terminal_cases[0]); case_p++) {
if (0 == strcmp(case_p->string, buffer)) {
command_found = true;
(*case_p->func)();
break;
}
}
if (!command_found)
command_not_found();
if (!command_found) command_not_found();
if (terminal_enabled) {
strcpy(buffer, "");
for (int i = 0; i < 6; i++)
strcpy(arguments[i], "");
for (int i = 0; i < 6; i++) strcpy(arguments[i], "");
SEND_STRING(SS_TAP(X_HOME));
send_string(terminal_prompt);
}
}
void check_pos(void) {
if (current_cmd_buffer_pos >= CMD_BUFF_SIZE) { //if over the top, move it back down to the top of the buffer so you can climb back down...
current_cmd_buffer_pos = CMD_BUFF_SIZE - 1;
} else if (current_cmd_buffer_pos < 0) { //...and if you fall under the bottom of the buffer, reset back to 0 so you can climb back up
current_cmd_buffer_pos = 0;
}
if (current_cmd_buffer_pos >= CMD_BUFF_SIZE) { // if over the top, move it back down to the top of the buffer so you can climb back down...
current_cmd_buffer_pos = CMD_BUFF_SIZE - 1;
} else if (current_cmd_buffer_pos < 0) { //...and if you fall under the bottom of the buffer, reset back to 0 so you can climb back up
current_cmd_buffer_pos = 0;
}
}
bool process_terminal(uint16_t keycode, keyrecord_t *record) {
if (keycode == TERM_ON && record->event.pressed) {
enable_terminal();
return false;
@ -280,59 +248,66 @@ bool process_terminal(uint16_t keycode, keyrecord_t *record) {
if (keycode < 256) {
uint8_t str_len;
char char_to_add;
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();
return false; break;
return false;
break;
case KC_ESC:
SEND_STRING("\n");
enable_terminal();
return false; break;
return false;
break;
case KC_BSPC:
str_len = strlen(buffer);
if (str_len > 0) {
buffer[str_len-1] = 0;
buffer[str_len - 1] = 0;
return true;
} else {
TERMINAL_BELL();
return false;
} break;
}
break;
case KC_LEFT:
return false; break;
return false;
break;
case KC_RIGHT:
return false; break;
case KC_UP: // 0 = recent
check_pos(); //check our current buffer position is valid
if (current_cmd_buffer_pos <= CMD_BUFF_SIZE - 1) { //once we get to the top, dont do anything
str_len = strlen(buffer);
for(int i= 0;i < str_len ;++i) {
send_string(SS_TAP(X_BSPACE)); //clear w/e is on the line already
//process_terminal(KC_BSPC,record);
}
strncpy(buffer,cmd_buffer[current_cmd_buffer_pos],80);
return false;
break;
case KC_UP: // 0 = recent
check_pos(); // check our current buffer position is valid
if (current_cmd_buffer_pos <= CMD_BUFF_SIZE - 1) { // once we get to the top, dont do anything
str_len = strlen(buffer);
for (int i = 0; i < str_len; ++i) {
send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already
// process_terminal(KC_BSPC,record);
}
strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 80);
send_string(buffer);
++current_cmd_buffer_pos; //get ready to access the above cmd if up/down is pressed again
}
return false; break;
send_string(buffer);
++current_cmd_buffer_pos; // get ready to access the above cmd if up/down is pressed again
}
return false;
break;
case KC_DOWN:
check_pos();
if (current_cmd_buffer_pos >= 0) { //once we get to the bottom, dont do anything
str_len = strlen(buffer);
for(int i= 0;i < str_len ;++i) {
send_string(SS_TAP(X_BSPACE)); //clear w/e is on the line already
//process_terminal(KC_BSPC,record);
}
strncpy(buffer,cmd_buffer[current_cmd_buffer_pos],79);
check_pos();
if (current_cmd_buffer_pos >= 0) { // once we get to the bottom, dont do anything
str_len = strlen(buffer);
for (int i = 0; i < str_len; ++i) {
send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already
// process_terminal(KC_BSPC,record);
}
strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 79);
send_string(buffer);
--current_cmd_buffer_pos; //get ready to access the above cmd if down/up is pressed again
send_string(buffer);
--current_cmd_buffer_pos; // get ready to access the above cmd if down/up is pressed again
}
return false; break;
return false;
break;
default:
if (keycode <= 58) {
char_to_add = 0;
@ -344,11 +319,9 @@ bool process_terminal(uint16_t keycode, keyrecord_t *record) {
if (char_to_add != 0) {
strncat(buffer, &char_to_add, 1);
}
} break;
}
break;
}
}
}
return true;

Some files were not shown because too many files have changed in this diff Show more