diff options
Diffstat (limited to 'quantum')
32 files changed, 418 insertions, 518 deletions
diff --git a/quantum/api.c b/quantum/api.c index 52dfe23e17..233f99636d 100644 --- a/quantum/api.c +++ b/quantum/api.c @@ -67,7 +67,7 @@ void process_api(uint16_t length, uint8_t * data) { case DT_RGBLIGHT: { #ifdef RGBLIGHT_ENABLE uint32_t rgblight = bytes_to_dword(data, 2); - rgblight_update_dword(rgblight); + eeconfig_update_rgblight(rgblight); #endif break; } diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c index 6d6833ec11..3da164c736 100644 --- a/quantum/audio/audio.c +++ b/quantum/audio/audio.c @@ -141,7 +141,7 @@ uint16_t notes_count; bool notes_repeat; bool note_resting = false; -uint8_t current_note = 0; +uint16_t current_note = 0; uint8_t rest_counter = 0; #ifdef VIBRATO_ENABLE diff --git a/quantum/audio/audio_arm.c b/quantum/audio/audio_arm.c index a3a4039570..6760015ef4 100644 --- a/quantum/audio/audio_arm.c +++ b/quantum/audio/audio_arm.c @@ -54,7 +54,7 @@ uint16_t notes_count; bool notes_repeat; bool note_resting = false; -uint8_t current_note = 0; +uint16_t current_note = 0; uint8_t rest_counter = 0; #ifdef VIBRATO_ENABLE diff --git a/quantum/audio/audio_pwm.c b/quantum/audio/audio_pwm.c index ded86edeea..ed67136099 100644 --- a/quantum/audio/audio_pwm.c +++ b/quantum/audio/audio_pwm.c @@ -94,7 +94,7 @@ bool notes_repeat; float notes_rest; bool note_resting = false; -uint8_t current_note = 0; +uint16_t current_note = 0; uint8_t rest_counter = 0; #ifdef VIBRATO_ENABLE diff --git a/quantum/audio/musical_notes.h b/quantum/audio/musical_notes.h index ce8d47d1c1..cd54af38d2 100644 --- a/quantum/audio/musical_notes.h +++ b/quantum/audio/musical_notes.h @@ -26,12 +26,14 @@ // Note Types #define MUSICAL_NOTE(note, duration) {(NOTE##note), duration} +#define BREVE_NOTE(note) MUSICAL_NOTE(note, 128) #define WHOLE_NOTE(note) MUSICAL_NOTE(note, 64) #define HALF_NOTE(note) MUSICAL_NOTE(note, 32) #define QUARTER_NOTE(note) MUSICAL_NOTE(note, 16) #define EIGHTH_NOTE(note) MUSICAL_NOTE(note, 8) #define SIXTEENTH_NOTE(note) MUSICAL_NOTE(note, 4) +#define BREVE_DOT_NOTE(note) MUSICAL_NOTE(note, 128+64) #define WHOLE_DOT_NOTE(note) MUSICAL_NOTE(note, 64+32) #define HALF_DOT_NOTE(note) MUSICAL_NOTE(note, 32+16) #define QUARTER_DOT_NOTE(note) MUSICAL_NOTE(note, 16+8) @@ -40,11 +42,13 @@ // Note Type Shortcuts #define M__NOTE(note, duration) MUSICAL_NOTE(note, duration) +#define B__NOTE(n) BREVE_NOTE(n) #define W__NOTE(n) WHOLE_NOTE(n) #define H__NOTE(n) HALF_NOTE(n) #define Q__NOTE(n) QUARTER_NOTE(n) #define E__NOTE(n) EIGHTH_NOTE(n) #define S__NOTE(n) SIXTEENTH_NOTE(n) +#define BD_NOTE(n) BREVE_DOT_NOTE(n) #define WD_NOTE(n) WHOLE_DOT_NOTE(n) #define HD_NOTE(n) HALF_DOT_NOTE(n) #define QD_NOTE(n) QUARTER_DOT_NOTE(n) diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index 9946084977..369e0b4843 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h @@ -501,5 +501,216 @@ H__NOTE(_F4), \ H__NOTE(_F4), \ W__NOTE(_C5), \ - W__NOTE(_BF4), + W__NOTE(_BF4), + +/* Prelude music from Final Fantasy */ +#define FF_PRELUDE \ + M__NOTE(_C3, 20), M__NOTE(_D3, 20), M__NOTE(_E3, 20), M__NOTE(_G3, 20), \ + M__NOTE(_C4, 20), M__NOTE(_D4, 20), M__NOTE(_E4, 20), M__NOTE(_G4, 20), \ + M__NOTE(_C5, 20), M__NOTE(_D5, 20), M__NOTE(_E5, 20), M__NOTE(_G5, 20), \ + M__NOTE(_C6, 20), M__NOTE(_D6, 20), M__NOTE(_E6, 20), M__NOTE(_G6, 20), \ + M__NOTE(_C7, 20), M__NOTE(_G6, 20), M__NOTE(_E6, 20), M__NOTE(_D6, 20), \ + M__NOTE(_C6, 20), M__NOTE(_G5, 20), M__NOTE(_E5, 20), M__NOTE(_D5, 20), \ + M__NOTE(_C5, 20), M__NOTE(_G4, 20), M__NOTE(_E4, 20), M__NOTE(_D4, 20), \ + M__NOTE(_C4, 20), M__NOTE(_G3, 20), M__NOTE(_E3, 20), M__NOTE(_D3, 20), \ + M__NOTE(_A2, 20), M__NOTE(_B2, 20), M__NOTE(_C3, 20), M__NOTE(_E3, 20), \ + M__NOTE(_A3, 20), M__NOTE(_B3, 20), M__NOTE(_C4, 20), M__NOTE(_E4, 20), \ + M__NOTE(_A4, 20), M__NOTE(_B4, 20), M__NOTE(_C5, 20), M__NOTE(_E5, 20), \ + M__NOTE(_A5, 20), M__NOTE(_B5, 20), M__NOTE(_C6, 20), M__NOTE(_E6, 20), \ + M__NOTE(_A6, 20), M__NOTE(_E6, 20), M__NOTE(_C6, 20), M__NOTE(_B5, 20), \ + M__NOTE(_A5, 20), M__NOTE(_E5, 20), M__NOTE(_C5, 20), M__NOTE(_B4, 20), \ + M__NOTE(_A4, 20), M__NOTE(_E4, 20), M__NOTE(_C4, 20), M__NOTE(_B3, 20), \ + M__NOTE(_A3, 20), M__NOTE(_E3, 20), M__NOTE(_C3, 20), M__NOTE(_B2, 20), + +/* Melody from the main themes of Star Trek TNG and the original series */ +#define TO_BOLDLY_GO \ + W__NOTE(_BF3 ), \ + Q__NOTE(_EF4 ), \ + WD_NOTE(_AF4 ), \ + W__NOTE(_REST), \ + H__NOTE(_G4 ), \ + Q__NOTE(_EF4 ), \ + H__NOTE(_C4 ), \ + W__NOTE(_REST), \ + QD_NOTE(_F4 ), \ + M__NOTE(_BF4, 128), + +#define KATAWARE_DOKI \ + W__NOTE(_G5), HD_NOTE(_G5), Q__NOTE(_G5), H__NOTE(_G5), H__NOTE(_E5), H__NOTE(_D5), Q__NOTE(_D5), Q__NOTE(_C5), \ + B__NOTE(_E5), H__NOTE(_C5), W__NOTE(_G5), HD_NOTE(_G5), Q__NOTE(_C5), H__NOTE(_C6), Q__NOTE(_B5), \ + Q__NOTE(_A5), H__NOTE(_G5), Q__NOTE(_G5), Q__NOTE(_A5), W__NOTE(_G5), QD_NOTE(_E5), \ + QD_NOTE(_F5), Q__NOTE(_E5), WD_NOTE(_D5), H__NOTE(_C5), W__NOTE(_G5), HD_NOTE(_G5), Q__NOTE(_G5), \ + H__NOTE(_G5), H__NOTE(_E5), H__NOTE(_D5), Q__NOTE(_D5), Q__NOTE(_C5), B__NOTE(_E5), H__NOTE(_G4), \ + Q__NOTE(_C5), Q__NOTE(_D5), Q__NOTE(_E5), H__NOTE(_D5), Q__NOTE(_C5), Q__NOTE(_C5), \ + Q__NOTE(_A4), H__NOTE(_C5), Q__NOTE(_C5), W__NOTE(_C5), Q__NOTE(_F4), Q__NOTE(_C5), \ + Q__NOTE(_D5), Q__NOTE(_E5), H__NOTE(_D5), H__NOTE(_C5), Q__NOTE(_C5), H__NOTE(_G5), \ + Q__NOTE(_C5), HD_NOTE(_D5), H__NOTE(_G4), Q__NOTE(_C5), Q__NOTE(_D5), Q__NOTE(_E5), \ + H__NOTE(_D5), Q__NOTE(_C5), Q__NOTE(_C5), Q__NOTE(_A4), H__NOTE(_C5), Q__NOTE(_C5), \ + W__NOTE(_C5), Q__NOTE(_F4), Q__NOTE(_C5), Q__NOTE(_D5), Q__NOTE(_E5), H__NOTE(_D5), \ + H__NOTE(_C5), Q__NOTE(_C5), H__NOTE(_G5), Q__NOTE(_C5), HD_NOTE(_D5), \ + HD_NOTE(_G4), Q__NOTE(_C5), Q__NOTE(_D5), BD_NOTE(_C5), + +#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 MEGALOVANIA \ + Q__NOTE(_D4), Q__NOTE(_D4), H__NOTE(_D5), HD_NOTE(_A4), H__NOTE(_AF4), H__NOTE(_G4), H__NOTE(_F4), \ + Q__NOTE(_D4), Q__NOTE(_F4), Q__NOTE(_G4), Q__NOTE(_C4), Q__NOTE(_C4), H__NOTE(_D5), HD_NOTE(_A4), \ + H__NOTE(_AF4), H__NOTE(_G4), H__NOTE(_F4), Q__NOTE(_D4), Q__NOTE(_F4), Q__NOTE(_G4), \ + Q__NOTE(_B3), Q__NOTE(_B3), H__NOTE(_D5), HD_NOTE(_A4), H__NOTE(_AF4), H__NOTE(_G4), H__NOTE(_F4), \ + Q__NOTE(_D4), Q__NOTE(_F4), Q__NOTE(_G4), Q__NOTE(_BF3), Q__NOTE(_BF3), H__NOTE(_D5), \ + HD_NOTE(_A4), H__NOTE(_AF4), H__NOTE(_G4), H__NOTE(_F4), Q__NOTE(_D4), Q__NOTE(_F4), \ + Q__NOTE(_G4), + +#define MICHISHIRUBE \ + W__NOTE(_A5), H__NOTE(_A5), H__NOTE(_A5), W__NOTE(_B5), H__NOTE(_A5), H__NOTE(_B5), BD_NOTE(_CS6), W__NOTE(_E6), \ + W__NOTE(_CS6), WD_NOTE(_B5), H__NOTE(_A5), BD_NOTE(_A5), W__NOTE(_A5), H__NOTE(_A5), H__NOTE(_A5), \ + W__NOTE(_B5), H__NOTE(_A5), H__NOTE(_B5), W__NOTE(_A5), W__NOTE(_A6), W__NOTE(_GS6), H__NOTE(_CS6), \ + Q__NOTE(_E6), Q__NOTE(_CS6), W__NOTE(_B5), H__NOTE(_B5), H__NOTE(_CS6), W__NOTE(_B5), H__NOTE(_A5), \ + Q__NOTE(_B5), BD_NOTE(_A5), \ + H__NOTE(_E6), H__NOTE(_FS6), H__NOTE(_E6), H__NOTE(_B6), \ + W__NOTE(_A6), H__NOTE(_E6), H__NOTE(_B6), W__NOTE(_A6), H__NOTE(_A6), H__NOTE(_B6), \ + B__NOTE(_CS7), H__NOTE(_E6), H__NOTE(_FS6), H__NOTE(_E6), H__NOTE(_B6), W__NOTE(_A6), H__NOTE(_E6), \ + H__NOTE(_B6), W__NOTE(_A6), H__NOTE(_A6), H__NOTE(_GS6), B__NOTE(_E6), H__NOTE(_E6), \ + H__NOTE(_FS6), H__NOTE(_E6), H__NOTE(_B6), W__NOTE(_A6), H__NOTE(_E6), H__NOTE(_B6), \ + W__NOTE(_A6), H__NOTE(_A6), H__NOTE(_B6), H__NOTE(_CS7), B__NOTE(_CS7), H__NOTE(_E6), H__NOTE(_E6), \ + H__NOTE(_E6), H__NOTE(_E6), H__NOTE(_D6), H__NOTE(_D6), H__NOTE(_CS6), H__NOTE(_CS6), Q__NOTE(_B5), \ + BD_NOTE(_B5), W__NOTE(_A5), H__NOTE(_A5), H__NOTE(_A5), W__NOTE(_B5), H__NOTE(_A5), H__NOTE(_B5), \ + BD_NOTE(_CS6), W__NOTE(_E6), W__NOTE(_CS6), WD_NOTE(_B5), H__NOTE(_A5), BD_NOTE(_A5), W__NOTE(_A5), \ + H__NOTE(_A5), H__NOTE(_A5), W__NOTE(_B5), H__NOTE(_A5), H__NOTE(_B5), W__NOTE(_A5), W__NOTE(_A6), \ + W__NOTE(_GS6), H__NOTE(_CS6), Q__NOTE(_E6), Q__NOTE(_CS6), W__NOTE(_B5), H__NOTE(_B5), H__NOTE(_CS6), \ + W__NOTE(_B5), H__NOTE(_A5), Q__NOTE(_B5), BD_NOTE(_A5), + +#define LIEBESLEID \ + Q__NOTE(_E4), Q__NOTE(_DS4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_FS4), Q__NOTE(_EF4), Q__NOTE(_G4), Q__NOTE(_D4), \ + Q__NOTE(_GS4), Q__NOTE(_CS4), W__NOTE(_A4), H__NOTE(_E5), H__NOTE(_E5), HD_NOTE(_G4), Q__NOTE(_E5), E__NOTE(_E5), \ + E__NOTE(_F5), ED_NOTE(_E5), HD_NOTE(_D5), Q__NOTE(_E5), H__NOTE(_F5), H__NOTE(_CS5), H__NOTE(_C5), W__NOTE(_G4), \ + H__NOTE(_D5), H__NOTE(_D5), HD_NOTE(_D5), Q__NOTE(_D5), E__NOTE(_D5), E__NOTE(_E5), E__NOTE(_D5), HD_NOTE(_C5), \ + Q__NOTE(_D5), H__NOTE(_E5), H__NOTE(_B4), H__NOTE(_BF4), W__NOTE(_F4), H__NOTE(_C5), H__NOTE(_C5), HD_NOTE(_EF4), \ + Q__NOTE(_C5), E__NOTE(_C5), E__NOTE(_D5), E__NOTE(_C5), HD_NOTE(_BF4), Q__NOTE(_C5), H__NOTE(_D5), H__NOTE(_FS4), \ + H__NOTE(_F4), HD_NOTE(_E4), Q__NOTE(_A4), HD_NOTE(_FS4), Q__NOTE(_A4), HD_NOTE(_GS4), Q__NOTE(_B4), Q__NOTE(_A4), \ + Q__NOTE(_E4), Q__NOTE(_DS4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_D4), Q__NOTE(_FS4), Q__NOTE(_CS4), Q__NOTE(_G4), \ + Q__NOTE(_C4), Q__NOTE(_GS4), Q__NOTE(_D4), WD_NOTE(_A4), + +#define MELODIES_OF_LIFE \ + H__NOTE(_B5), W__NOTE(_GS6), H__NOTE(_GS6), H__NOTE(_FS6), W__NOTE(_E6), H__NOTE(_E6), H__NOTE(_DS6), H__NOTE(_CS6), H__NOTE(_DS6), \ + H__NOTE(_E6), H__NOTE(_FS6), WD_NOTE(_B5), H__NOTE(_B5), H__NOTE(_CS6), H__NOTE(_DS6), H__NOTE(_E6), H__NOTE(_CS6), \ + H__NOTE(_CS6), H__NOTE(_B5), H__NOTE(_E6), H__NOTE(_GS6), H__NOTE(_A6), H__NOTE(_GS6), H__NOTE(_E6), H__NOTE(_GS6), \ + WD_NOTE(_FS6), H__NOTE(_GS6), WD_NOTE(_B6), H__NOTE(_CS7), H__NOTE(_B6), H__NOTE(_A6), H__NOTE(_A6), H__NOTE(_GS6), \ + H__NOTE(_GS6), H__NOTE(_FS6), H__NOTE(_FS6), H__NOTE(_GS6), WD_NOTE(_A6), Q__NOTE(_GS6), Q__NOTE(_FS6), Q__NOTE(_FS6), \ + Q__NOTE(_E6), W__NOTE(_E6), Q__NOTE(_B5), Q__NOTE(_CS6), WD_NOTE(_E6), Q__NOTE(_E6), Q__NOTE(_FS6), W__NOTE(_GS6), \ + H__NOTE(_A6), B__NOTE(_FS6), + +#define EYES_ON_ME \ + Q__NOTE(_A6), Q__NOTE(_G6), Q__NOTE(_FS6), Q__NOTE(_D6), Q__NOTE(_A5), Q__NOTE(_G5), Q__NOTE(_FS5), Q__NOTE(_D5), \ + W__NOTE(_A4), W__NOTE(_D5), W__NOTE(_E5), W__NOTE(_FS5), H__NOTE(_A5), M__NOTE(_FS5, 256), H__NOTE(_E5), \ + H__NOTE(_FS5), B__NOTE(_D5), H__NOTE(_B4), H__NOTE(_D5), BD_NOTE(_E5), H__NOTE(_A4), W__NOTE(_D5), W__NOTE(_E5), \ + W__NOTE(_FS5), H__NOTE(_A5), BD_NOTE(_CS6), W__NOTE(_A5), H__NOTE(_CS6), H__NOTE(_D6), WD_NOTE(_B5), \ + H__NOTE(_A5), H__NOTE(_B5), B__NOTE(_A5), WD_NOTE(_B4), W__NOTE(_CS5), WD_NOTE(_D6), H__NOTE(_D6), \ + W__NOTE(_CS6), H__NOTE(_B5), H__NOTE(_B5), H__NOTE(_B5), B__NOTE(_A5), H__NOTE(_A5), H__NOTE(_FS5), H__NOTE(_A5), \ + WD_NOTE(_B5), H__NOTE(_B5), H__NOTE(_A5), H__NOTE(_G5), H__NOTE(_D5), W__NOTE(_FS5), WD_NOTE(_E5), \ + H__NOTE(_CS4), H__NOTE(_E4), H__NOTE(_A4), H__NOTE(_CS5), W__NOTE(_D5), W__NOTE(_E5), W__NOTE(_FS5), H__NOTE(_G5), \ + H__NOTE(_A5), B__NOTE(_A5), H__NOTE(_A5), H__NOTE(_G5), H__NOTE(_D5), BD_NOTE(_FS5), W__NOTE(_E5), B__NOTE(_D5), \ + H__NOTE(_G4), H__NOTE(_FS4), W__NOTE(_E4), BD_NOTE(_D4), + +#define SONG_OF_THE_ANCIENTS \ + H__NOTE(_D6), H__NOTE(_EF6), B__NOTE(_EF6), H__NOTE(_EF6), H__NOTE(_D6), H__NOTE(_BF5), H__NOTE(_G5), BD_NOTE(_C6), H__NOTE(_D6), \ + H__NOTE(_EF6), B__NOTE(_EF6), H__NOTE(_EF6), H__NOTE(_D6), H__NOTE(_BF5), H__NOTE(_G5), BD_NOTE(_G6), H__NOTE(_G5), \ + H__NOTE(_AF5), B__NOTE(_G6), H__NOTE(_AF6), H__NOTE(_G6), H__NOTE(_F6), H__NOTE(_D6), H__NOTE(_D6), H__NOTE(_EF6), \ + B__NOTE(_EF6), WD_NOTE(_G5), WD_NOTE(_BF5), H__NOTE(_D6), H__NOTE(_EF6), B__NOTE(_EF6), H__NOTE(_EF6), H__NOTE(_D6), \ + H__NOTE(_BF5), H__NOTE(_G5), BD_NOTE(_C6), WD_NOTE(_B5), WD_NOTE(_G5), WD_NOTE(_G6), W__NOTE(_G6), H__NOTE(_AF6), \ + W__NOTE(_G6), H__NOTE(_AF6), H__NOTE(_G6), H__NOTE(_F6), H__NOTE(_D6), H__NOTE(_D6), H__NOTE(_EF6), B__NOTE(_EF6), \ + WD_NOTE(_E6), H__NOTE(_E6), H__NOTE(_F6), H__NOTE(_G6), H__NOTE(_BF6), H__NOTE(_AF6), W__NOTE(_AF6), H__NOTE(_C6), \ + H__NOTE(_BF6), H__NOTE(_AF6), W__NOTE(_AF6), H__NOTE(_C6), H__NOTE(_AF6), BD_NOTE(_G6), WD_NOTE(_B5), WD_NOTE(_G6), \ + W__NOTE(_G6), H__NOTE(_AF6), W__NOTE(_G6), H__NOTE(_AF6), H__NOTE(_G6), H__NOTE(_F6), H__NOTE(_D6), H__NOTE(_D6), \ + H__NOTE(_EF6), B__NOTE(_EF6), WD_NOTE(_E6), H__NOTE(_E6), H__NOTE(_F6), H__NOTE(_G6), H__NOTE(_BF6), H__NOTE(_AF6), \ + W__NOTE(_AF6), H__NOTE(_C6), H__NOTE(_AF6), H__NOTE(_G6), W__NOTE(_G6), H__NOTE(_F6), H__NOTE(_D6), BD_NOTE(_EF6), \ + WD_NOTE(_F6), WD_NOTE(_G6), BD_NOTE(_C7), + +#define NIER_AMUSEMENT_PARK \ + H__NOTE(_D5), E__NOTE(_G6), E__NOTE(_GF6), Q__NOTE(_F6), Q__NOTE(_E6), Q__NOTE(_EF6), Q__NOTE(_DF6), Q__NOTE(_EF6), WD_NOTE(_D6), \ + Q__NOTE(_G5), Q__NOTE(_A5), H__NOTE(_BF5), H__NOTE(_D6), H__NOTE(_G6), H__NOTE(_A6), W__NOTE(_BF6), W__NOTE(_EF7), \ + H__NOTE(_D5), E__NOTE(_G6), E__NOTE(_GF6), Q__NOTE(_F6), Q__NOTE(_E6), Q__NOTE(_EF6), Q__NOTE(_DF6), Q__NOTE(_EF6), \ + WD_NOTE(_D6), Q__NOTE(_G5), Q__NOTE(_A5), H__NOTE(_BF5), H__NOTE(_D6), H__NOTE(_G6), H__NOTE(_A6), W__NOTE(_BF6), \ + H__NOTE(_EF7), H__NOTE(_D5), HD_NOTE(_A5), HD_NOTE(_BF5), B__NOTE(_D5), H__NOTE(_D5), HD_NOTE(_G5), HD_NOTE(_F5), \ + H__NOTE(_EF5), WD_NOTE(_D5), H__NOTE(_D5), HD_NOTE(_A5), HD_NOTE(_BF5), WD_NOTE(_D5), W__NOTE(_D5), B__NOTE(_G5), \ + H__NOTE(_D5), HD_NOTE(_A5), HD_NOTE(_BF5), B__NOTE(_D5), H__NOTE(_D5), HD_NOTE(_G5), HD_NOTE(_F5), H__NOTE(_EF5), \ + W__NOTE(_D5), W__NOTE(_C5), W__NOTE(_BF4), W__NOTE(_C5), W__NOTE(_D5), W__NOTE(_G5), B__NOTE(_D5), B__NOTE(_E5), \ + W__NOTE(_EF5), QD_NOTE(_C5), QD_NOTE(_D5), Q__NOTE(_EF5), H__NOTE(_G5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_F5), \ + B__NOTE(_D5), B__NOTE(_BF4), W__NOTE(_EF5), QD_NOTE(_C5), QD_NOTE(_D5), Q__NOTE(_EF5), H__NOTE(_G5), H__NOTE(_F5), \ + H__NOTE(_EF5), H__NOTE(_F5), W__NOTE(_D5), W__NOTE(_BF5), W__NOTE(_G5), W__NOTE(_D5), W__NOTE(_EF5), QD_NOTE(_C5), \ + QD_NOTE(_D5), Q__NOTE(_EF5), H__NOTE(_G5), H__NOTE(_F5), H__NOTE(_EF5), H__NOTE(_F5), B__NOTE(_D5), B__NOTE(_BF4), \ + B__NOTE(_C5), H__NOTE(_C5), H__NOTE(_D5), H__NOTE(_EF5), H__NOTE(_F5), WD_NOTE(_G5), H__NOTE(_C5), W__NOTE(_AF5), \ + WD_NOTE(_G5), + +#define COPIED_CITY \ + Q__NOTE(_F6), Q__NOTE(_BF5), Q__NOTE(_EF6), Q__NOTE(_G5), Q__NOTE(_AF5), Q__NOTE(_G6), Q__NOTE(_AF6), Q__NOTE(_EF6), Q__NOTE(_BF5), \ + Q__NOTE(_F6), Q__NOTE(_G5), Q__NOTE(_AF5), Q__NOTE(_EF6), Q__NOTE(_G5), Q__NOTE(_F5), Q__NOTE(_D6), Q__NOTE(_C6), \ + Q__NOTE(_G5), Q__NOTE(_BF5), Q__NOTE(_EF5), Q__NOTE(_AF5), Q__NOTE(_G5), Q__NOTE(_EF5), Q__NOTE(_BF4), H__NOTE(_C5), \ + Q__NOTE(_F5), Q__NOTE(_G5), Q__NOTE(_AF5), Q__NOTE(_EF6), Q__NOTE(_BF5), Q__NOTE(_G6), Q__NOTE(_EF6), Q__NOTE(_BF6), \ + Q__NOTE(_AF6), Q__NOTE(_EF6), Q__NOTE(_BF5), Q__NOTE(_F6), Q__NOTE(_G5), Q__NOTE(_F5), Q__NOTE(_EF6), Q__NOTE(_BF5), \ + Q__NOTE(_B6), Q__NOTE(_DF6), Q__NOTE(_EF6), Q__NOTE(_F6), Q__NOTE(_AF6), Q__NOTE(_EF7), Q__NOTE(_F6), Q__NOTE(_C6), \ + Q__NOTE(_G5), Q__NOTE(_AF5), Q__NOTE(_BF5), Q__NOTE(_C6), Q__NOTE(_EF6), Q__NOTE(_G5), Q__NOTE(_EF5), Q__NOTE(_F5), \ + Q__NOTE(_G5), Q__NOTE(_EF5), Q__NOTE(_F5), Q__NOTE(_C5), Q__NOTE(_EF5), Q__NOTE(_C5), Q__NOTE(_BF4), Q__NOTE(_G4), \ + Q__NOTE(_F4), Q__NOTE(_G4), H__NOTE(_AF4), Q__NOTE(_C5), Q__NOTE(_EF5), Q__NOTE(_F5), Q__NOTE(_C5), Q__NOTE(_EF5), \ + Q__NOTE(_F5), Q__NOTE(_G5), Q__NOTE(_BF5), Q__NOTE(_AF5), Q__NOTE(_G5), Q__NOTE(_EF5), Q__NOTE(_F5), Q__NOTE(_C5), \ + Q__NOTE(_AF4), Q__NOTE(_F5), Q__NOTE(_G5), Q__NOTE(_AF5), Q__NOTE(_G5), Q__NOTE(_F5), Q__NOTE(_EF5), Q__NOTE(_F5), \ + Q__NOTE(_G5), Q__NOTE(_BF5), Q__NOTE(_C6), Q__NOTE(_G6), Q__NOTE(_EF6), WD_NOTE(_F7), + +#define VAGUE_HOPE_COLD_RAIN \ + HD_NOTE(_D6), HD_NOTE(_E6), HD_NOTE(_CS6), HD_NOTE(_D6), HD_NOTE(_B5), Q__NOTE(_B5), Q__NOTE(_CS6), Q__NOTE(_D6), WD_NOTE(_A6), \ + HD_NOTE(_FS6), HD_NOTE(_G6), HD_NOTE(_D6), HD_NOTE(_E6), HD_NOTE(_FS6), Q__NOTE(_D5), Q__NOTE(_CS5), Q__NOTE(_A4), \ + W__NOTE(_FS4), H__NOTE(_D6), HD_NOTE(_E6), HD_NOTE(_FS6), HD_NOTE(_CS6), HD_NOTE(_E6), HD_NOTE(_D6), Q__NOTE(_CS6), \ + Q__NOTE(_D6), Q__NOTE(_E6), W__NOTE(_FS6), H__NOTE(_CS6), WD_NOTE(_D6), HD_NOTE(_D6), Q__NOTE(_D6), H__NOTE(_E6), \ + WD_NOTE(_CS6), HD_NOTE(_AS5), HD_NOTE(_B5), HD_NOTE(_B5), Q__NOTE(_B4), Q__NOTE(_CS5), Q__NOTE(_D5), HD_NOTE(_A5), \ + Q__NOTE(_B5), Q__NOTE(_CS6), Q__NOTE(_A6), HD_NOTE(_FS6), Q__NOTE(_D5), Q__NOTE(_CS5), Q__NOTE(_A4), H__NOTE(_FS4), \ + HD_NOTE(_FS6), HD_NOTE(_D6), HD_NOTE(_E6), HD_NOTE(_A6), HD_NOTE(_FS6), Q__NOTE(_CS5), Q__NOTE(_D5), Q__NOTE(_A5), \ + HD_NOTE(_FS5), Q__NOTE(_FS6), Q__NOTE(_FS6), Q__NOTE(_GS6), HD_NOTE(_A6), Q__NOTE(_B6), H__NOTE(_A6), H__NOTE(_GS6), \ + H__NOTE(_FS6), H__NOTE(_E6), H__NOTE(_CS6), H__NOTE(_FS6), E__NOTE(_FS5), E__NOTE(_CS5), Q__NOTE(_B4), H__NOTE(_AS4), \ + W__NOTE(_FS5), HD_NOTE(_FS6), HD_NOTE(_B5), H__NOTE(_D6), H__NOTE(_CS6), H__NOTE(_E6), HD_NOTE(_A6), HD_NOTE(_E6), \ + W__NOTE(_D6), Q__NOTE(_CS6), Q__NOTE(_D6), HD_NOTE(_E6), HD_NOTE(_FS6), WD_NOTE(_B6), HD_NOTE(_E6), HD_NOTE(_FS6), \ + HD_NOTE(_B5), Q__NOTE(_B5), Q__NOTE(_B5), Q__NOTE(_CS6), H__NOTE(_D6), H__NOTE(_E6), H__NOTE(_FS6), HD_NOTE(_E6), \ + HD_NOTE(_CS6), H__NOTE(_FS6), H__NOTE(_A6), H__NOTE(_B6), W__NOTE(_A6), H__NOTE(_FS6), BD_NOTE(_B6), + +#define KAINE_SALVATION \ + BD_NOTE(_D5), W__NOTE(_BF4), W__NOTE(_C5), W__NOTE(_F5), BD_NOTE(_D5), BD_NOTE(_BF4), BD_NOTE(_C5), W__NOTE(_BF4), W__NOTE(_C5), \ + W__NOTE(_D5), BD_NOTE(_C5), BD_NOTE(_F4), BD_NOTE(_D5), W__NOTE(_BF4), W__NOTE(_C5), W__NOTE(_F5), BD_NOTE(_D5), \ + BD_NOTE(_BF4), WD_NOTE(_EF5), WD_NOTE(_BF4), W__NOTE(_A4), W__NOTE(_BF4), W__NOTE(_C5), B__NOTE(_C5), H__NOTE(_B4), \ + H__NOTE(_C5), BD_NOTE(_D5), WD_NOTE(_G5), W__NOTE(_G5), H__NOTE(_FS5), H__NOTE(_G5), H__NOTE(_A5), H__NOTE(_B5), \ + H__NOTE(_A5), H__NOTE(_G5), H__NOTE(_FS5), WD_NOTE(_G5), W__NOTE(_G5), H__NOTE(_D6), H__NOTE(_C6), H__NOTE(_B5), \ + H__NOTE(_A5), WD_NOTE(_G5), WD_NOTE(_G5), W__NOTE(_G5), H__NOTE(_FS5), H__NOTE(_G5), H__NOTE(_A5), H__NOTE(_B5), \ + H__NOTE(_A5), H__NOTE(_G5), H__NOTE(_FS5), W__NOTE(_G5), H__NOTE(_B5), H__NOTE(_A5), H__NOTE(_G5), H__NOTE(_FS5), \ + BD_NOTE(_E5), WD_NOTE(_G5), W__NOTE(_G5), H__NOTE(_FS5), H__NOTE(_G5), H__NOTE(_A5), H__NOTE(_B5), H__NOTE(_A5), \ + H__NOTE(_G5), H__NOTE(_FS5), WD_NOTE(_G5), W__NOTE(_G5), H__NOTE(_D6), H__NOTE(_C6), H__NOTE(_B5), H__NOTE(_A5), \ + WD_NOTE(_G5), WD_NOTE(_G5), W__NOTE(_G5), H__NOTE(_FS5), H__NOTE(_G5), H__NOTE(_A5), H__NOTE(_B5), H__NOTE(_A5), \ + H__NOTE(_G5), H__NOTE(_FS5), W__NOTE(_G5), H__NOTE(_D6), WD_NOTE(_D6), W__NOTE(_F5), H__NOTE(_C6), H__NOTE(_C6), \ + H__NOTE(_BF5), H__NOTE(_A5), WD_NOTE(_G5), WD_NOTE(_F5), WD_NOTE(_G5), WD_NOTE(_A5), BD_NOTE(_G5), + +#define WEIGHT_OF_THE_WORLD \ + H__NOTE(_B5), Q__NOTE(_C6), Q__NOTE(_C6), Q__NOTE(_B5), H__NOTE(_C6), H__NOTE(_G6), WD_NOTE(_G6), H__NOTE(_B5), Q__NOTE(_C6), \ + Q__NOTE(_C6), Q__NOTE(_B5), H__NOTE(_C6), H__NOTE(_G6), H__NOTE(_G6), Q__NOTE(_A6), W__NOTE(_G6), Q__NOTE(_C6), \ + Q__NOTE(_D6), H__NOTE(_E6), Q__NOTE(_F6), H__NOTE(_E6), H__NOTE(_F6), HD_NOTE(_E6), H__NOTE(_D6), H__NOTE(_C6), \ + H__NOTE(_D6), WD_NOTE(_D6), Q__NOTE(_C6), Q__NOTE(_B5), WD_NOTE(_B5), H__NOTE(_B5), Q__NOTE(_C6), Q__NOTE(_C6), \ + Q__NOTE(_B5), H__NOTE(_C6), H__NOTE(_G6), WD_NOTE(_G6), H__NOTE(_B5), Q__NOTE(_C6), Q__NOTE(_C6), Q__NOTE(_B5), \ + H__NOTE(_C6), H__NOTE(_G6), H__NOTE(_G6), Q__NOTE(_A6), W__NOTE(_G6), Q__NOTE(_C6), Q__NOTE(_D6), H__NOTE(_E6), \ + Q__NOTE(_F6), H__NOTE(_E6), H__NOTE(_F6), HD_NOTE(_E6), H__NOTE(_D6), H__NOTE(_C6), H__NOTE(_D6), BD_NOTE(_D6), \ + Q__NOTE(_E6), Q__NOTE(_D6), Q__NOTE(_C6), Q__NOTE(_B5), H__NOTE(_C6), Q__NOTE(_C6), H__NOTE(_C6), HD_NOTE(_C6), \ + H__NOTE(_B5), H__NOTE(_C6), H__NOTE(_E6), H__NOTE(_G6), WD_NOTE(_G6), Q__NOTE(_C6), B__NOTE(_C6), H__NOTE(_B6), \ + Q__NOTE(_C7), BD_NOTE(_C7), + #endif diff --git a/quantum/config_common.h b/quantum/config_common.h index 0b2e408a43..c489e14073 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -59,6 +59,11 @@ #define PINC_ADDRESS 0x3 #define PINB_ADDRESS 0x6 #define PINA_ADDRESS 0x9 + #elif defined(__AVR_ATmega328P__) + #define ADDRESS_BASE 0x00 + #define PINB_ADDRESS 0x3 + #define PINC_ADDRESS 0x6 + #define PIND_ADDRESS 0x9 #else #error "Pins are not defined" #endif diff --git a/quantum/debounce/debounce_eager_pk.c b/quantum/debounce/eager_pk.c index b8ad09cee3..b8ad09cee3 100644 --- a/quantum/debounce/debounce_eager_pk.c +++ b/quantum/debounce/eager_pk.c diff --git a/quantum/debounce/readme.md b/quantum/debounce/readme.md index 1a77d44df5..5b318d845e 100644 --- a/quantum/debounce/readme.md +++ b/quantum/debounce/readme.md @@ -6,10 +6,10 @@ Here are a few ideas * Per key - one timer per key * Per row - one timer per row -2) Eager vs symmetric vs assymetric +2) Eager vs symmetric vs asymmetric * Eager - any key change is reported immediately. All further inputs for DEBOUNCE ms are ignored. * Symmetric - wait for no changes for DEBOUNCE ms before reporting change - * Assymetric - wait for different times depending on key-down/key-up. E.g. Eager key-down, DEBOUNCE ms key up. + * Asymmetric - wait for different times depending on key-down/key-up. E.g. Eager key-down, DEBOUNCE ms key up. 3) Timestamp vs cycles * old old old code waits n cycles, decreasing count by one each matrix_scan @@ -19,10 +19,10 @@ Here are a few ideas The default algorithm is symmetric and global. Here are a few that could be implemented: -debounce_sym_g.c -debounce_sym_pk.c -debounce_sym_pr.c -debounce_sym_pr_cycles.c //currently used in ergo-dox -debounce_eager_g.c -debounce_eager_pk.c -debounce_eager_pr.c //could be used in ergo-dox! +sym_g.c +sym_pk.c +sym_pr.c +sym_pr_cycles.c //currently used in ergo-dox +eager_g.c +eager_pk.c +eager_pr.c //could be used in ergo-dox! diff --git a/quantum/debounce/debounce_sym_g.c b/quantum/debounce/sym_g.c index c8ab34e1a0..c8ab34e1a0 100644 --- a/quantum/debounce/debounce_sym_g.c +++ b/quantum/debounce/sym_g.c diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 9d2d331ce5..eef739a14a 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -29,10 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "backlight.h" #include "quantum.h" -#ifdef SPLIT_KEYBOARD - #include "split_flags.h" -#endif - #ifdef MIDI_ENABLE #include "process_midi.h" #endif @@ -138,39 +134,21 @@ action_t action_for_key(uint8_t layer, keypos_t key) #ifdef BACKLIGHT_ENABLE case BL_ON: action.code = ACTION_BACKLIGHT_ON(); - #ifdef SPLIT_KEYBOARD - BACKLIT_DIRTY = true; - #endif break; case BL_OFF: action.code = ACTION_BACKLIGHT_OFF(); - #ifdef SPLIT_KEYBOARD - BACKLIT_DIRTY = true; - #endif break; case BL_DEC: action.code = ACTION_BACKLIGHT_DECREASE(); - #ifdef SPLIT_KEYBOARD - BACKLIT_DIRTY = true; - #endif break; case BL_INC: action.code = ACTION_BACKLIGHT_INCREASE(); - #ifdef SPLIT_KEYBOARD - BACKLIT_DIRTY = true; - #endif break; case BL_TOGG: action.code = ACTION_BACKLIGHT_TOGGLE(); - #ifdef SPLIT_KEYBOARD - BACKLIT_DIRTY = true; - #endif break; case BL_STEP: action.code = ACTION_BACKLIGHT_STEP(); - #ifdef SPLIT_KEYBOARD - BACKLIT_DIRTY = true; - #endif break; #endif #ifdef SWAP_HANDS_ENABLE diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index b64feb7003..d0a9cf2324 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -118,6 +118,9 @@ void unicode_input_finish(void) { case UC_WIN: unregister_code(KC_LALT); break; + case UC_WINC: + tap_code(KC_ENTER); + break; } set_mods(saved_mods); // Reregister previously set mods diff --git a/quantum/quantum.c b/quantum/quantum.c index 46d404029f..8316d1f06a 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -360,9 +360,6 @@ bool process_record_quantum(keyrecord_t *record) { if (!record->event.pressed) { #endif rgblight_toggle(); - #ifdef SPLIT_KEYBOARD - RGB_DIRTY = true; - #endif } return false; case RGB_MODE_FORWARD: @@ -374,9 +371,6 @@ bool process_record_quantum(keyrecord_t *record) { else { rgblight_step(); } - #ifdef SPLIT_KEYBOARD - RGB_DIRTY = true; - #endif } return false; case RGB_MODE_REVERSE: @@ -388,9 +382,6 @@ bool process_record_quantum(keyrecord_t *record) { else { rgblight_step_reverse(); } - #ifdef SPLIT_KEYBOARD - RGB_DIRTY = true; - #endif } return false; case RGB_HUI: @@ -401,9 +392,6 @@ bool process_record_quantum(keyrecord_t *record) { if (!record->event.pressed) { #endif rgblight_increase_hue(); - #ifdef SPLIT_KEYBOARD - RGB_DIRTY = true; - #endif } return false; case RGB_HUD: @@ -414,9 +402,6 @@ bool process_record_quantum(keyrecord_t *record) { if (!record->event.pressed) { #endif rgblight_decrease_hue(); - #ifdef SPLIT_KEYBOARD - RGB_DIRTY = true; - #endif } return false; case RGB_SAI: @@ -427,9 +412,6 @@ bool process_record_quantum(keyrecord_t *record) { if (!record->event.pressed) { #endif rgblight_increase_sat(); - #ifdef SPLIT_KEYBOARD - RGB_DIRTY = true; - #endif } return false; case RGB_SAD: @@ -440,9 +422,6 @@ bool process_record_quantum(keyrecord_t *record) { if (!record->event.pressed) { #endif rgblight_decrease_sat(); - #ifdef SPLIT_KEYBOARD - RGB_DIRTY = true; - #endif } return false; case RGB_VAI: @@ -453,9 +432,6 @@ bool process_record_quantum(keyrecord_t *record) { if (!record->event.pressed) { #endif rgblight_increase_val(); - #ifdef SPLIT_KEYBOARD - RGB_DIRTY = true; - #endif } return false; case RGB_VAD: @@ -466,9 +442,6 @@ bool process_record_quantum(keyrecord_t *record) { if (!record->event.pressed) { #endif rgblight_decrease_val(); - #ifdef SPLIT_KEYBOARD - RGB_DIRTY = true; - #endif } return false; case RGB_SPI: @@ -484,9 +457,6 @@ bool process_record_quantum(keyrecord_t *record) { case RGB_MODE_PLAIN: if (record->event.pressed) { rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); - #ifdef SPLIT_KEYBOARD - RGB_DIRTY = true; - #endif } return false; case RGB_MODE_BREATHE: diff --git a/quantum/quantum.h b/quantum/quantum.h index d2c5862f88..c12ac9ab8a 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -44,10 +44,6 @@ #endif #endif -#ifdef SPLIT_KEYBOARD - #include "split_flags.h" -#endif - #ifdef RGB_MATRIX_ENABLE #include "rgb_matrix.h" #endif diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index 2ed36304dc..56a97e3c7d 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c @@ -221,6 +221,20 @@ void rgb_matrix_solid_reactive(void) { } } +void rgb_matrix_solid_reactive_simple(void) +{ + HSV hsv = {.h = rgb_matrix_config.hue, .s = rgb_matrix_config.sat, .v = rgb_matrix_config.val}; + RGB rgb; + + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + uint16_t offset2 = g_key_hit[i] << 2; + offset2 = (offset2 <= 255) ? (255 - offset2) : 0; + hsv.v = offset2 * rgb_matrix_config.val / RGB_MATRIX_MAXIMUM_BRIGHTNESS; + rgb = hsv_to_rgb(hsv); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } +} + // alphas = color1, mods = color2 void rgb_matrix_alphas_mods(void) { @@ -755,6 +769,11 @@ void rgb_matrix_task(void) { rgb_matrix_solid_reactive(); break; #endif + #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE + case RGB_MATRIX_SOLID_REACTIVE_SIMPLE: + rgb_matrix_solid_reactive_simple(); + break; + #endif #ifndef DISABLE_RGB_MATRIX_SPLASH case RGB_MATRIX_SPLASH: rgb_matrix_splash(); diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h index e43532d11e..e6acd2d4b5 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix.h @@ -110,6 +110,9 @@ enum rgb_matrix_effects { #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE RGB_MATRIX_SOLID_REACTIVE, #endif + #ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE + RGB_MATRIX_SOLID_REACTIVE_SIMPLE, + #endif #ifndef DISABLE_RGB_MATRIX_SPLASH RGB_MATRIX_SPLASH, #endif diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 52e0be8ba0..08515564bc 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -51,6 +51,10 @@ static inline int is_static_effect(uint8_t mode) { #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) +#ifdef RGBLIGHT_LED_MAP +const uint8_t led_map[] PROGMEM = RGBLIGHT_LED_MAP; +#endif + #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT __attribute__ ((weak)) const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90}; @@ -62,6 +66,15 @@ bool is_rgblight_initialized = false; LED_TYPE led[RGBLED_NUM]; bool rgblight_timer_enabled = false; +static uint8_t clipping_start_pos = 0; +static uint8_t clipping_num_leds = RGBLED_NUM; + +void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds) { + clipping_start_pos = start_pos; + clipping_num_leds = num_leds; +} + + void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { uint8_t r = 0, g = 0, b = 0, base, color; @@ -225,11 +238,14 @@ void rgblight_init(void) { } +uint32_t rgblight_read_dword(void) { + return rgblight_config.raw; +} + void rgblight_update_dword(uint32_t dword) { rgblight_config.raw = dword; - eeconfig_update_rgblight(rgblight_config.raw); if (rgblight_config.enable) - rgblight_mode(rgblight_config.mode); + rgblight_mode_noeeprom(rgblight_config.mode); else { #ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); @@ -614,7 +630,7 @@ void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index) { || defined(RGBLIGHT_EFFECT_SNAKE) || defined(RGBLIGHT_EFFECT_KNIGHT) static uint8_t get_interval_time(const uint8_t* default_interval_address, uint8_t velocikey_min, uint8_t velocikey_max) { - return + return #ifdef VELOCIKEY_ENABLE velocikey_enabled() ? velocikey_match_speed(velocikey_min, velocikey_max) : #endif @@ -661,11 +677,20 @@ void rgblight_sethsv_slave(uint16_t hue, uint8_t sat, uint8_t val) { #ifndef RGBLIGHT_CUSTOM_DRIVER void rgblight_set(void) { + LED_TYPE *start_led = led + clipping_start_pos; + uint16_t num_leds = clipping_num_leds; if (rgblight_config.enable) { + #ifdef RGBLIGHT_LED_MAP + LED_TYPE led0[RGBLED_NUM]; + for(uint8_t i = 0; i < RGBLED_NUM; i++) { + led0[i] = led[pgm_read_byte(&led_map[i])]; + } + start_led = led0 + clipping_start_pos; + #endif #ifdef RGBW - ws2812_setleds_rgbw(led, RGBLED_NUM); + ws2812_setleds_rgbw(start_led, num_leds); #else - ws2812_setleds(led, RGBLED_NUM); + ws2812_setleds(start_led, num_leds); #endif } else { for (uint8_t i = 0; i < RGBLED_NUM; i++) { @@ -674,9 +699,9 @@ void rgblight_set(void) { led[i].b = 0; } #ifdef RGBW - ws2812_setleds_rgbw(led, RGBLED_NUM); + ws2812_setleds_rgbw(start_led, num_leds); #else - ws2812_setleds(led, RGBLED_NUM); + ws2812_setleds(start_led, num_leds); #endif } } @@ -796,7 +821,7 @@ void rgblight_effect_breathing(uint8_t interval) { float val; uint8_t interval_time = get_interval_time(&RGBLED_BREATHING_INTERVALS[interval], 1, 100); - + if (timer_elapsed(last_timer) < interval_time) { return; } diff --git a/quantum/rgblight.h b/quantum/rgblight.h index f92388c961..1769f719d9 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -174,6 +174,7 @@ void rgblight_step_reverse(void); uint8_t rgblight_get_mode(void); void rgblight_mode(uint8_t mode); void rgblight_set(void); +uint32_t rgblight_read_dword(void); void rgblight_update_dword(uint32_t dword); void rgblight_increase_hue(void); void rgblight_decrease_hue(void); @@ -196,6 +197,7 @@ void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b); void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b); void rgblight_sethsv_master(uint16_t hue, uint8_t sat, uint8_t val); void rgblight_sethsv_slave(uint16_t hue, uint8_t sat, uint8_t val); +void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds); uint32_t eeconfig_read_rgblight(void); void eeconfig_update_rgblight(uint32_t val); diff --git a/quantum/split_common/i2c.c b/quantum/split_common/i2c.c deleted file mode 100644 index 45e958b395..0000000000 --- a/quantum/split_common/i2c.c +++ /dev/null @@ -1,184 +0,0 @@ -#include <util/twi.h> -#include <avr/io.h> -#include <stdlib.h> -#include <avr/interrupt.h> -#include <util/twi.h> -#include <stdbool.h> -#include "i2c.h" -#include "split_flags.h" - -// Limits the amount of we wait for any one i2c transaction. -// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is -// 9 bits, a single transaction will take around 90μs to complete. -// -// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit -// poll loop takes at least 8 clock cycles to execute -#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 - -#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) - -volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -static volatile uint8_t slave_buffer_pos; -static volatile bool slave_has_register_set = false; - -// Wait for an i2c operation to finish -inline static -void i2c_delay(void) { - uint16_t lim = 0; - while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) - lim++; - - // easier way, but will wait slightly longer - // _delay_us(100); -} - -// Setup twi to run at 100kHz -void i2c_master_init(void) { - // no prescaler - TWSR = 0; - // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10. - // Check datasheets for more info. - TWBR = ((F_CPU/SCL_CLOCK)-16)/2; -} - -// Start a transaction with the given i2c slave address. The direction of the -// transfer is set with I2C_READ and I2C_WRITE. -// returns: 0 => success -// 1 => error -uint8_t i2c_master_start(uint8_t address) { - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA); - - i2c_delay(); - - // check that we started successfully - if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) - return 1; - - TWDR = address; - TWCR = (1<<TWINT) | (1<<TWEN); - - i2c_delay(); - - if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) - return 1; // slave did not acknowledge - else - return 0; // success -} - - -// Finish the i2c transaction. -void i2c_master_stop(void) { - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); - - uint16_t lim = 0; - while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) - lim++; -} - -// Write one byte to the i2c slave. -// returns 0 => slave ACK -// 1 => slave NACK -uint8_t i2c_master_write(uint8_t data) { - TWDR = data; - TWCR = (1<<TWINT) | (1<<TWEN); - - i2c_delay(); - - // check if the slave acknowledged us - return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; -} - -uint8_t i2c_master_write_data(void *const TXdata, uint8_t dataLen) { - - uint8_t *data = (uint8_t *)TXdata; - int err = 0; - - for (int i = 0; i < dataLen; i++) { - err = i2c_master_write(data[i]); - - if ( err ) - return err; - } - - return err; - -} - -// Read one byte from the i2c slave. If ack=1 the slave is acknowledged, -// if ack=0 the acknowledge bit is not set. -// returns: byte read from i2c device -uint8_t i2c_master_read(int ack) { - TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); - - i2c_delay(); - return TWDR; -} - -void i2c_reset_state(void) { - TWCR = 0; -} - -void i2c_slave_init(uint8_t address) { - TWAR = address << 0; // slave i2c address - // TWEN - twi enable - // TWEA - enable address acknowledgement - // TWINT - twi interrupt flag - // TWIE - enable the twi interrupt - TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); -} - -ISR(TWI_vect); - -ISR(TWI_vect) { - uint8_t ack = 1; - switch(TW_STATUS) { - case TW_SR_SLA_ACK: - // this device has been addressed as a slave receiver - slave_has_register_set = false; - break; - - case TW_SR_DATA_ACK: - // this device has received data as a slave receiver - // The first byte that we receive in this transaction sets the location - // of the read/write location of the slaves memory that it exposes over - // i2c. After that, bytes will be written at slave_buffer_pos, incrementing - // slave_buffer_pos after each write. - if(!slave_has_register_set) { - slave_buffer_pos = TWDR; - // don't acknowledge the master if this memory loctaion is out of bounds - if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { - ack = 0; - slave_buffer_pos = 0; - } - - slave_has_register_set = true; - } else { - i2c_slave_buffer[slave_buffer_pos] = TWDR; - - if ( slave_buffer_pos == I2C_BACKLIT_START) { - BACKLIT_DIRTY = true; - } else if ( slave_buffer_pos == (I2C_RGB_START+3)) { - RGB_DIRTY = true; - } - - BUFFER_POS_INC(); - } - break; - - case TW_ST_SLA_ACK: - case TW_ST_DATA_ACK: - // master has addressed this device as a slave transmitter and is - // requesting data. - TWDR = i2c_slave_buffer[slave_buffer_pos]; - BUFFER_POS_INC(); - break; - - case TW_BUS_ERROR: // something went wrong, reset twi state - TWCR = 0; - default: - break; - } - // Reset everything, so we are ready for the next TWI interrupt - TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); -} diff --git a/quantum/split_common/i2c.h b/quantum/split_common/i2c.h deleted file mode 100644 index 91e8e96f47..0000000000 --- a/quantum/split_common/i2c.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include <stdint.h> - -#ifndef F_CPU -#define F_CPU 16000000UL -#endif - -#define I2C_READ 1 -#define I2C_WRITE 0 - -#define I2C_ACK 1 -#define I2C_NACK 0 - -// Address location defines (Keymap should be last, as it's size is dynamic) -#define I2C_BACKLIT_START 0x00 -// Need 4 bytes for RGB (32 bit) -#define I2C_RGB_START 0x01 -#define I2C_KEYMAP_START 0x06 - -// Slave buffer (8bit per) -// Rows per hand + backlit space + rgb space -// TODO : Make this dynamically sized -#define SLAVE_BUFFER_SIZE 0x20 - -// i2c SCL clock frequency -#ifndef SCL_CLOCK -#define SCL_CLOCK 100000L -#endif - -// Support 8bits right now (8 cols) will need to edit to take higher (code exists in delta split?) -extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -void i2c_master_init(void); -uint8_t i2c_master_start(uint8_t address); -void i2c_master_stop(void); -uint8_t i2c_master_write(uint8_t data); -uint8_t i2c_master_write_data(void *const TXdata, uint8_t dataLen); -uint8_t i2c_master_read(int); -void i2c_reset_state(void); -void i2c_slave_init(uint8_t address); - - -static inline unsigned char i2c_start_read(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_READ); -} - -static inline unsigned char i2c_start_write(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_WRITE); -} - -// from SSD1306 scrips -extern unsigned char i2c_rep_start(unsigned char addr); -extern void i2c_start_wait(unsigned char addr); -extern unsigned char i2c_readAck(void); -extern unsigned char i2c_readNak(void); -extern unsigned char i2c_read(unsigned char ack); - -#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); diff --git a/quantum/split_common/matrix.c b/quantum/split_common/matrix.c index f2a277c69f..dcb96254f5 100644 --- a/quantum/split_common/matrix.c +++ b/quantum/split_common/matrix.c @@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "matrix.h" #include "split_util.h" #include "config.h" -#include "split_flags.h" #include "quantum.h" #include "debounce.h" #include "transport.h" diff --git a/quantum/split_common/split_flags.c b/quantum/split_common/split_flags.c deleted file mode 100644 index 1f5825d650..0000000000 --- a/quantum/split_common/split_flags.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "split_flags.h" - -volatile bool RGB_DIRTY = false; - -volatile bool BACKLIT_DIRTY = false;
\ No newline at end of file diff --git a/quantum/split_common/split_flags.h b/quantum/split_common/split_flags.h deleted file mode 100644 index aaac474a7d..0000000000 --- a/quantum/split_common/split_flags.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include <stdbool.h> -#include <stdint.h> - -/** -* Global Flags -**/ - -//RGB Stuff -extern volatile bool RGB_DIRTY; - - -//Backlight Stuff -extern volatile bool BACKLIT_DIRTY; diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 5095cb8fdc..09a307b8ed 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c @@ -3,7 +3,6 @@ #include "keyboard.h" #include "config.h" #include "timer.h" -#include "split_flags.h" #include "transport.h" #include "quantum.h" @@ -12,25 +11,25 @@ # include "eeconfig.h" #endif +#if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) +#include "rgblight.h" +#endif + volatile bool isLeftHand = true; __attribute__((weak)) bool is_keyboard_left(void) { - #ifdef SPLIT_HAND_PIN + #if defined(SPLIT_HAND_PIN) // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand setPinInput(SPLIT_HAND_PIN); return readPin(SPLIT_HAND_PIN); - #else - #ifdef EE_HANDS - return eeprom_read_byte(EECONFIG_HANDEDNESS); - #else - #ifdef MASTER_RIGHT - return !is_keyboard_master(); - #else - return is_keyboard_master(); - #endif - #endif + #elif defined(EE_HANDS) + return eeprom_read_byte(EECONFIG_HANDEDNESS); + #elif defined(MASTER_RIGHT) + return !is_keyboard_master(); #endif + + return is_keyboard_master(); } bool is_keyboard_master(void) @@ -60,10 +59,6 @@ static void keyboard_master_setup(void) { #endif #endif transport_master_init(); - - // For master the Backlight info needs to be sent on startup - // Otherwise the salve won't start with the proper info until an update - BACKLIT_DIRTY = true; } static void keyboard_slave_setup(void) @@ -76,6 +71,16 @@ void matrix_setup(void) { isLeftHand = is_keyboard_left(); +#if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) + uint8_t num_rgb_leds_split[2] = RGBLED_SPLIT; + if (isLeftHand) { + rgblight_set_clipping_range(0, num_rgb_leds_split[0]); + } + else { + rgblight_set_clipping_range(num_rgb_leds_split[0], num_rgb_leds_split[1]); + } +#endif + if (is_keyboard_master()) { keyboard_master_setup(); diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index 95738530ec..8d408f6fdc 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -1,148 +1,87 @@ +#include <string.h> #include "config.h" #include "matrix.h" #include "quantum.h" -#define ROWS_PER_HAND (MATRIX_ROWS/2) +#define ROWS_PER_HAND (MATRIX_ROWS / 2) #ifdef RGBLIGHT_ENABLE -# include "rgblight.h" +# include "rgblight.h" #endif #ifdef BACKLIGHT_ENABLE -# include "backlight.h" - extern backlight_config_t backlight_config; +# include "backlight.h" +extern backlight_config_t backlight_config; #endif #if defined(USE_I2C) || defined(EH) -#include "i2c.h" +# include "i2c_master.h" +# include "i2c_slave.h" -#ifndef SLAVE_I2C_ADDRESS -# define SLAVE_I2C_ADDRESS 0x32 -#endif +# define I2C_BACKLIT_START 0x00 +// Need 4 bytes for RGB (32 bit) +# define I2C_RGB_START 0x01 +# define I2C_KEYMAP_START 0x05 -#if (MATRIX_COLS > 8) -# error "Currently only supports 8 COLS" -#endif +# define TIMEOUT 100 + +# ifndef SLAVE_I2C_ADDRESS +# define SLAVE_I2C_ADDRESS 0x32 +# endif // Get rows from other half over i2c bool transport_master(matrix_row_t matrix[]) { - int err = 0; + i2c_readReg(SLAVE_I2C_ADDRESS, I2C_KEYMAP_START, (void *)matrix, ROWS_PER_HAND * sizeof(matrix_row_t), TIMEOUT); // write backlight info -#ifdef BACKLIGHT_ENABLE - if (BACKLIT_DIRTY) { - err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); - if (err) { goto i2c_error; } - - // Backlight location - err = i2c_master_write(I2C_BACKLIT_START); - if (err) { goto i2c_error; } - - // Write backlight - i2c_master_write(get_backlight_level()); - - BACKLIT_DIRTY = false; - } -#endif - - err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); - if (err) { goto i2c_error; } - - // start of matrix stored at I2C_KEYMAP_START - err = i2c_master_write(I2C_KEYMAP_START); - if (err) { goto i2c_error; } - - // Start read - err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); - if (err) { goto i2c_error; } - - if (!err) { - int i; - for (i = 0; i < ROWS_PER_HAND-1; ++i) { - matrix[i] = i2c_master_read(I2C_ACK); +# ifdef BACKLIGHT_ENABLE + static uint8_t prev_level = ~0; + uint8_t level = get_backlight_level(); + if (level != prev_level) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_BACKLIT_START, (void *)&level, sizeof(level), TIMEOUT) >= 0) { + prev_level = level; } - matrix[i] = i2c_master_read(I2C_NACK); - i2c_master_stop(); - } else { -i2c_error: // the cable is disconnceted, or something else went wrong - i2c_reset_state(); - return false; } - -#ifdef RGBLIGHT_ENABLE - if (RGB_DIRTY) { - err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); - if (err) { goto i2c_error; } - - // RGB Location - err = i2c_master_write(I2C_RGB_START); - if (err) { goto i2c_error; } - - uint32_t dword = eeconfig_read_rgblight(); - - // Write RGB - err = i2c_master_write_data(&dword, 4); - if (err) { goto i2c_error; } - - RGB_DIRTY = false; - i2c_master_stop(); +# endif + +# ifdef RGBLIGHT_ENABLE + static uint32_t prev_rgb = ~0; + uint32_t rgb = rgblight_read_dword(); + if (rgb != prev_rgb) { + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_START, (void *)&rgb, sizeof(rgb), TIMEOUT) >= 0) { + prev_rgb = rgb; + } } -#endif +# endif return true; } void transport_slave(matrix_row_t matrix[]) { - - for (int i = 0; i < ROWS_PER_HAND; ++i) - { - i2c_slave_buffer[I2C_KEYMAP_START + i] = matrix[i]; - } - // Read Backlight Info - #ifdef BACKLIGHT_ENABLE - if (BACKLIT_DIRTY) - { - backlight_set(i2c_slave_buffer[I2C_BACKLIT_START]); - BACKLIT_DIRTY = false; - } - #endif - #ifdef RGBLIGHT_ENABLE - if (RGB_DIRTY) - { - // Disable interupts (RGB data is big) - cli(); - // Create new DWORD for RGB data - uint32_t dword; - - // Fill the new DWORD with the data that was sent over - uint8_t * dword_dat = (uint8_t *)(&dword); - for (int i = 0; i < 4; i++) - { - dword_dat[i] = i2c_slave_buffer[I2C_RGB_START + i]; - } - - // Update the RGB now with the new data and set RGB_DIRTY to false - rgblight_update_dword(dword); - RGB_DIRTY = false; - // Re-enable interupts now that RGB is set - sei(); - } - #endif + // Copy matrix to I2C buffer + memcpy((void*)(i2c_slave_reg + I2C_KEYMAP_START), (void *)matrix, ROWS_PER_HAND * sizeof(matrix_row_t) ); + +// Read Backlight Info +# ifdef BACKLIGHT_ENABLE + backlight_set(i2c_slave_reg[I2C_BACKLIT_START]); +# endif + +# ifdef RGBLIGHT_ENABLE + uint32_t rgb = *(uint32_t *)(i2c_slave_reg + I2C_RGB_START); + // Update the RGB with the new data + rgblight_update_dword(rgb); +# endif } -void transport_master_init(void) { - i2c_master_init(); -} +void transport_master_init(void) { i2c_init(); } -void transport_slave_init(void) { - i2c_slave_init(SLAVE_I2C_ADDRESS); -} +void transport_slave_init(void) { i2c_slave_init(SLAVE_I2C_ADDRESS); } -#else // USE_SERIAL +#else // USE_SERIAL -#include "serial.h" +# include "serial.h" typedef struct _Serial_s2m_buffer_t { // TODO: if MATRIX_COLS > 8 change to uint8_t packed_matrix[] for pack/unpack @@ -150,40 +89,41 @@ typedef struct _Serial_s2m_buffer_t { } Serial_s2m_buffer_t; typedef struct _Serial_m2s_buffer_t { -#ifdef BACKLIGHT_ENABLE - uint8_t backlight_level; -#endif -#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) - rgblight_config_t rgblight_config; //not yet use - // - // When MCUs on both sides drive their respective RGB LED chains, - // it is necessary to synchronize, so it is necessary to communicate RGB information. - // In that case, define the RGBLIGHT_SPLIT macro. - // - // Otherwise, if the master side MCU drives both sides RGB LED chains, - // there is no need to communicate. -#endif +# ifdef BACKLIGHT_ENABLE + uint8_t backlight_level; +# endif +# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) + rgblight_config_t rgblight_config; // not yet use + // + // When MCUs on both sides drive their respective RGB LED chains, + // it is necessary to synchronize, so it is necessary to communicate RGB + // information. In that case, define RGBLED_SPLIT with info on the number + // of LEDs on each half. + // + // Otherwise, if the master side MCU drives both sides RGB LED chains, + // there is no need to communicate. +# endif } Serial_m2s_buffer_t; volatile Serial_s2m_buffer_t serial_s2m_buffer = {}; volatile Serial_m2s_buffer_t serial_m2s_buffer = {}; -uint8_t volatile status0 = 0; +uint8_t volatile status0 = 0; SSTD_t transactions[] = { - { (uint8_t *)&status0, - sizeof(serial_m2s_buffer), (uint8_t *)&serial_m2s_buffer, - sizeof(serial_s2m_buffer), (uint8_t *)&serial_s2m_buffer - } + { + (uint8_t *)&status0, + sizeof(serial_m2s_buffer), + (uint8_t *)&serial_m2s_buffer, + sizeof(serial_s2m_buffer), + (uint8_t *)&serial_s2m_buffer, + }, }; -void transport_master_init(void) -{ soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); } +void transport_master_init(void) { soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); } -void transport_slave_init(void) -{ soft_serial_target_init(transactions, TID_LIMIT(transactions)); } +void transport_slave_init(void) { soft_serial_target_init(transactions, TID_LIMIT(transactions)); } bool transport_master(matrix_row_t matrix[]) { - if (soft_serial_transaction()) { return false; } @@ -193,32 +133,35 @@ bool transport_master(matrix_row_t matrix[]) { matrix[i] = serial_s2m_buffer.smatrix[i]; } - #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) - // Code to send RGB over serial goes here (not implemented yet) - #endif - - #ifdef BACKLIGHT_ENABLE - // Write backlight level for slave to read - serial_m2s_buffer.backlight_level = backlight_config.enable ? backlight_config.level : 0; - #endif +# ifdef BACKLIGHT_ENABLE + // Write backlight level for slave to read + serial_m2s_buffer.backlight_level = backlight_config.enable ? backlight_config.level : 0; +# endif + +# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) + static rgblight_config_t prev_rgb = {~0}; + uint32_t rgb = rgblight_read_dword(); + if (rgb != prev_rgb.raw) { + serial_m2s_buffer.rgblight_config.raw = rgb; + prev_rgb.raw = rgb; + } +# endif return true; } void transport_slave(matrix_row_t matrix[]) { - // TODO: if MATRIX_COLS > 8 change to pack() - for (int i = 0; i < ROWS_PER_HAND; ++i) - { + for (int i = 0; i < ROWS_PER_HAND; ++i) { serial_s2m_buffer.smatrix[i] = matrix[i]; } - #ifdef BACKLIGHT_ENABLE - backlight_set(serial_m2s_buffer.backlight_level); - #endif - #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) - // Add serial implementation for RGB here - #endif - +# ifdef BACKLIGHT_ENABLE + backlight_set(serial_m2s_buffer.backlight_level); +# endif +# if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) + // Update RGB config with the new data + rgblight_update_dword(serial_m2s_buffer.rgblight_config.raw); +# endif } #endif diff --git a/quantum/template/avr/config.h b/quantum/template/avr/config.h index 2409ae186c..a9bb754821 100644 --- a/quantum/template/avr/config.h +++ b/quantum/template/avr/config.h @@ -1,5 +1,5 @@ /* -Copyright 2019 REPLACE_WITH_YOUR_NAME +Copyright 2019 %YOUR_NAME% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x0000 #define DEVICE_VER 0x0001 -#define MANUFACTURER You +#define MANUFACTURER %YOUR_NAME% #define PRODUCT %KEYBOARD% #define DESCRIPTION A custom keyboard diff --git a/quantum/template/avr/readme.md b/quantum/template/avr/readme.md index d243c66a94..719222d377 100644 --- a/quantum/template/avr/readme.md +++ b/quantum/template/avr/readme.md @@ -4,7 +4,7 @@ A short description of the keyboard/project -Keyboard Maintainer: [You](https://github.com/yourusername) +Keyboard Maintainer: [%YOUR_NAME%](https://github.com/yourusername) Hardware Supported: The PCBs, controllers supported Hardware Availability: links to where you can find this hardware diff --git a/quantum/template/avr/template.c b/quantum/template/avr/template.c index 3deeae88ba..1e4ce26cd1 100644 --- a/quantum/template/avr/template.c +++ b/quantum/template/avr/template.c @@ -1,4 +1,4 @@ -/* Copyright 2019 REPLACE_WITH_YOUR_NAME +/* Copyright 2019 %YOUR_NAME% * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/quantum/template/base/keymaps/default/config.h b/quantum/template/base/keymaps/default/config.h index c8e4334124..44382016a1 100644 --- a/quantum/template/base/keymaps/default/config.h +++ b/quantum/template/base/keymaps/default/config.h @@ -1,4 +1,4 @@ -/* Copyright 2019 REPLACE_WITH_YOUR_NAME +/* Copyright 2019 %YOUR_NAME% * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/quantum/template/base/keymaps/default/keymap.c b/quantum/template/base/keymaps/default/keymap.c index 11cd134a06..482a445448 100644 --- a/quantum/template/base/keymaps/default/keymap.c +++ b/quantum/template/base/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2019 REPLACE_WITH_YOUR_NAME +/* Copyright 2019 %YOUR_NAME% * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/quantum/template/base/template.h b/quantum/template/base/template.h index caf2abb4c6..5b5076c476 100644 --- a/quantum/template/base/template.h +++ b/quantum/template/base/template.h @@ -1,4 +1,4 @@ -/* Copyright 2019 REPLACE_WITH_YOUR_NAME +/* Copyright 2019 %YOUR_NAME% * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/quantum/template/ps2avrgb/template.c b/quantum/template/ps2avrgb/template.c index 4e35a2c129..08156c562c 100644 --- a/quantum/template/ps2avrgb/template.c +++ b/quantum/template/ps2avrgb/template.c @@ -1,4 +1,4 @@ -/* Copyright 2019 REPLACE_WITH_YOUR_NAME +/* Copyright 2019 %YOUR_NAME% * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |