summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/audio.c362
-rw-r--r--quantum/audio.h (renamed from quantum/beeps.h)7
-rw-r--r--quantum/beeps.c246
-rw-r--r--quantum/keymap_midi.c21
-rw-r--r--quantum/keymap_midi.h2
-rw-r--r--quantum/keymap_unicode.c2
-rwxr-xr-xquantum/light_ws2812.c181
-rwxr-xr-xquantum/light_ws2812.h73
-rw-r--r--quantum/quantum.mk31
-rw-r--r--quantum/rgblight.c505
-rw-r--r--quantum/rgblight.h87
-rw-r--r--quantum/template/Makefile6
-rw-r--r--quantum/template/README.md6
-rw-r--r--quantum/template/config.h8
-rw-r--r--quantum/template/keymaps/keymap_default.c66
-rw-r--r--quantum/template/template.h12
-rw-r--r--quantum/wave.h265
17 files changed, 1531 insertions, 349 deletions
diff --git a/quantum/audio.c b/quantum/audio.c
new file mode 100644
index 0000000000..3a3a1a4910
--- /dev/null
+++ b/quantum/audio.c
@@ -0,0 +1,362 @@
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <avr/pgmspace.h>
+#include <avr/interrupt.h>
+#include <avr/io.h>
+
+#include "audio.h"
+#include "keymap_common.h"
+
+#define PI 3.14159265
+
+// #define PWM_AUDIO
+
+#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
+#endif
+
+void delay_us(int count) {
+ while(count--) {
+ _delay_us(1);
+ }
+}
+
+int voices = 0;
+int voice_place = 0;
+double frequency = 0;
+int volume = 0;
+long position = 0;
+
+double 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 max = 0xFF;
+float sum = 0;
+int value = 128;
+float place = 0;
+float places[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+
+uint16_t place_int = 0;
+bool repeat = true;
+uint8_t * sample;
+uint16_t sample_length = 0;
+
+
+bool notes = false;
+bool note = false;
+float note_frequency = 0;
+float note_length = 0;
+uint16_t note_position = 0;
+float (* notes_pointer)[][2];
+uint8_t notes_length;
+bool notes_repeat;
+uint8_t current_note = 0;
+
+void stop_all_notes() {
+ voices = 0;
+ #ifdef PWM_AUDIO
+ TIMSK3 &= ~_BV(OCIE3A);
+ #else
+ TIMSK3 &= ~_BV(OCIE3A);
+ TCCR3A &= ~_BV(COM3A1);
+ #endif
+ notes = false;
+ note = false;
+ frequency = 0;
+ volume = 0;
+
+ for (int i = 0; i < 8; i++) {
+ frequencies[i] = 0;
+ volumes[i] = 0;
+ }
+}
+
+void stop_note(double freq) {
+ #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;
+ 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;
+ }
+ }
+ }
+ voices--;
+ if (voices < 0)
+ voices = 0;
+ if (voices == 0) {
+ #ifdef PWM_AUDIO
+ TIMSK3 &= ~_BV(OCIE3A);
+ #else
+ TIMSK3 &= ~_BV(OCIE3A);
+ TCCR3A &= ~_BV(COM3A1);
+ #endif
+ frequency = 0;
+ volume = 0;
+ note = false;
+ } else {
+ double freq = frequencies[voices - 1];
+ int vol = volumes[voices - 1];
+ double starting_f = frequency;
+ if (frequency < freq) {
+ sliding = true;
+ for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) {
+ frequency = f;
+ }
+ sliding = false;
+ } else if (frequency > freq) {
+ sliding = true;
+ for (double f = starting_f; f >= freq; f -= ((starting_f - freq) / 2000.0)) {
+ frequency = f;
+ }
+ sliding = false;
+ }
+ frequency = freq;
+ volume = vol;
+ }
+}
+
+void init_notes() {
+
+ #ifdef PWM_AUDIO
+ 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;
+
+ /* Enable the OC4A output */
+ DDRC |= _BV(PORTC6);
+
+ TIMSK3 &= ~_BV(OCIE3A); // 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
+ #else
+ DDRC |= _BV(PORTC6);
+
+ TIMSK3 &= ~_BV(OCIE3A); // Turn off 3A interputs
+
+ TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
+ TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
+ #endif
+}
+
+
+ISR(TIMER3_COMPA_vect) {
+
+ if (note) {
+ #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
+ 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;
+ }
+ #else
+ if (frequency > 0) {
+ // ICR3 = (int)(((double)F_CPU) / frequency); // Set max to the period
+ // OCR3A = (int)(((double)F_CPU) / frequency) >> 1; // Set compare to half the period
+ if (place > 10) {
+ voice_place = (voice_place + 1) % voices;
+ place = 0.0;
+ }
+ ICR3 = (int)(((double)F_CPU) / frequencies[voice_place]); // Set max to the period
+ OCR3A = (int)(((double)F_CPU) / frequencies[voice_place]) >> 1; // Set compare to half the period
+ place++;
+ }
+ #endif
+ }
+
+ // SAMPLE
+ // OCR4A = pgm_read_byte(&sample[(uint16_t)place_int]);
+
+ // place_int++;
+
+ // if (place_int >= sample_length)
+ // if (repeat)
+ // place_int -= sample_length;
+ // else
+ // TIMSK3 &= ~_BV(OCIE3A);
+
+
+ if (notes) {
+ #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) {
+ ICR3 = (int)(((double)F_CPU) / note_frequency); // Set max to the period
+ OCR3A = (int)(((double)F_CPU) / note_frequency) >> 1; // Set compare to half the period
+ }
+ #endif
+
+
+ note_position++;
+ if (note_position >= note_length) {
+ current_note++;
+ if (current_note >= notes_length) {
+ if (notes_repeat) {
+ current_note = 0;
+ } else {
+ #ifdef PWM_AUDIO
+ TIMSK3 &= ~_BV(OCIE3A);
+ #else
+ TIMSK3 &= ~_BV(OCIE3A);
+ TCCR3A &= ~_BV(COM3A1);
+ #endif
+ notes = false;
+ return;
+ }
+ }
+ #ifdef PWM_AUDIO
+ note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE;
+ note_length = (*notes_pointer)[current_note][1];
+ #else
+ note_frequency = (*notes_pointer)[current_note][0];
+ note_length = (*notes_pointer)[current_note][1] / 4;
+ #endif
+ note_position = 0;
+ }
+
+ }
+
+}
+
+void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat) {
+ if (note)
+ stop_all_notes();
+ notes = true;
+
+ notes_pointer = np;
+ notes_length = n_length;
+ notes_repeat = n_repeat;
+
+ place = 0;
+ current_note = 0;
+ #ifdef PWM_AUDIO
+ note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE;
+ note_length = (*notes_pointer)[current_note][1];
+ #else
+ note_frequency = (*notes_pointer)[current_note][0];
+ note_length = (*notes_pointer)[current_note][1] / 4;
+ #endif
+ note_position = 0;
+
+
+ #ifdef PWM_AUDIO
+ TIMSK3 |= _BV(OCIE3A);
+ #else
+ TIMSK3 |= _BV(OCIE3A);
+ TCCR3A |= _BV(COM3A1);
+ #endif
+}
+
+void play_sample(uint8_t * s, uint16_t l, bool r) {
+ stop_all_notes();
+ place_int = 0;
+ sample = s;
+ sample_length = l;
+ repeat = r;
+
+ #ifdef PWM_AUDIO
+ TIMSK3 |= _BV(OCIE3A);
+ #else
+ #endif
+}
+
+void play_note(double freq, int vol) {
+ if (notes)
+ stop_all_notes();
+ note = true;
+ #ifdef PWM_AUDIO
+ freq = freq / SAMPLE_RATE;
+ #endif
+ if (freq > 0) {
+ if (frequency != 0) {
+ double starting_f = frequency;
+ if (frequency < freq) {
+ for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) {
+ frequency = f;
+ }
+ } else if (frequency > freq) {
+ for (double f = starting_f; f >= freq; f -= ((starting_f - freq) / 2000.0)) {
+ frequency = f;
+ }
+ }
+ }
+ frequency = freq;
+ volume = vol;
+
+ frequencies[voices] = frequency;
+ volumes[voices] = volume;
+ voices++;
+ }
+
+ #ifdef PWM_AUDIO
+ TIMSK3 |= _BV(OCIE3A);
+ #else
+ TIMSK3 |= _BV(OCIE3A);
+ TCCR3A |= _BV(COM3A1);
+ #endif
+
+} \ No newline at end of file
diff --git a/quantum/beeps.h b/quantum/audio.h
index 378983c605..99203cea7a 100644
--- a/quantum/beeps.h
+++ b/quantum/audio.h
@@ -3,10 +3,9 @@
#include <avr/io.h>
#include <util/delay.h>
-void note(int x, float length);
-void beeps();
-void true_note(float x, float y, float length);
+void play_sample(uint8_t * s, uint16_t l, bool r);
void play_note(double freq, int vol);
void stop_note(double freq);
void stop_all_notes();
-void init_notes(); \ No newline at end of file
+void init_notes();
+void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat); \ No newline at end of file
diff --git a/quantum/beeps.c b/quantum/beeps.c
deleted file mode 100644
index 8d1f81f210..0000000000
--- a/quantum/beeps.c
+++ /dev/null
@@ -1,246 +0,0 @@
-#include "beeps.h"
-#include <math.h>
-#include <avr/pgmspace.h>
-#include <avr/interrupt.h>
-#include <avr/io.h>
-
-#define PI 3.14159265
-
-void delay_us(int count) {
- while(count--) {
- _delay_us(1);
- }
-}
-
-int voices = 0;
-double frequency = 0;
-int volume = 0;
-int position = 0;
-
-double frequencies[8] = {0, 0, 0, 0, 0, 0, 0, 0};
-int volumes[8] = {0, 0, 0, 0, 0, 0, 0, 0};
-bool sliding = false;
-#define RANGE 1000
-volatile int i=0; //elements of the wave
-
-
-void beeps() {
- play_notes();
-}
-
-void send_freq(double freq, int vol) {
- int duty = (((double)F_CPU) / freq);
- ICR3 = duty; // Set max to the period
- OCR3A = duty >> (0x10 - vol); // Set compare to half the period
-}
-
-void stop_all_notes() {
- voices = 0;
- TCCR3A = 0;
- TCCR3B = 0;
- frequency = 0;
- volume = 0;
-
- for (int i = 0; i < 8; i++) {
- frequencies[i] = 0;
- volumes[i] = 0;
- }
-}
-
-void stop_note(double freq) {
- for (int i = 7; i >= 0; i--) {
- if (frequencies[i] == freq) {
- frequencies[i] = 0;
- volumes[i] = 0;
- for (int j = i; (j < 7); j++) {
- frequencies[j] = frequencies[j+1];
- frequencies[j+1] = 0;
- volumes[j] = volumes[j+1];
- volumes[j+1] = 0;
- }
- }
- }
- voices--;
- if (voices < 0)
- voices = 0;
- if (voices == 0) {
- TCCR3A = 0;
- TCCR3B = 0;
- frequency = 0;
- volume = 0;
- } else {
- double freq = frequencies[voices - 1];
- int vol = volumes[voices - 1];
- if (frequency < freq) {
- sliding = true;
- for (double f = frequency; f <= freq; f += ((freq - frequency) / 500.0)) {
- send_freq(f, vol);
- }
- sliding = false;
- } else if (frequency > freq) {
- sliding = true;
- for (double f = frequency; f >= freq; f -= ((frequency - freq) / 500.0)) {
- send_freq(f, vol);
- }
- sliding = false;
- }
- send_freq(freq, vol);
- frequency = freq;
- volume = vol;
- }
-}
-
-void init_notes() {
- // TCCR1A = (1 << COM1A1) | (0 << COM1A0) | (1 << WGM11) | (1 << WGM10);
- // TCCR1B = (1 << COM1B1) | (0 << COM1A0) | (1 << WGM13) | (1 << WGM12) | (0 << CS12) | (0 << CS11) | (1 << CS10);
-
- // DDRC |= (1<<6);
-
- // TCCR3A = (1 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
- // TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (0 << CS31) | (1 << CS30);
-
- // ICR3 = 0xFFFF;
- // OCR3A = (int)((float)wave[i]*ICR3/RANGE); //go to next array element
-
-
- // cli();
-
- // /* Enable interrupt on timer2 == 127, with clk/8 prescaler. At 16MHz,
- // this gives a timer interrupt at 15625Hz. */
- // TIMSK3 = (1 << OCIE3A);
-
- // /* clear/reset timer on match */
- // // TCCR3A = 1<<WGM31 | 0<<WGM30; CTC mode, reset on match
- // // TCCR3B = 0<<CS32 | 1<<CS31 | 0<<CS30; /* clk, /8 prescaler */
-
- // TCCR3A = (1 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
- // TCCR3B = (0 << WGM33) | (0 << WGM32) | (0 << CS32) | (0 << CS31) | (1 << CS30);
-
-
- // TCCR1A = (1 << COM1A1) | (0 << COM1A0) | (1 << WGM11) | (0 << WGM10);
- // TCCR1B = (1 << WGM12) | (0 << CS12) | (0 << CS11) | (1 << CS10);
- // // SPCR = 0x50;
- // // SPSR = 0x01;
- // DDRC |= (1<<6);
- // // ICR3 = 0xFFFF;
- // // OCR3A=80;
- // PORTC |= (1<<6);
-
- // sei();
-}
-
-// #define highByte(c) ((c >> 8) & 0x00FF)
-// #define lowByte(c) (c & 0x00FF)
-
-ISR(TIMER3_COMPA_vect) {
-
- if (ICR3 > 0 && !sliding) {
- switch (position) {
- case 0: {
- int duty = (((double)F_CPU) / (frequency));
- ICR3 = duty; // Set max to the period
- OCR3A = duty >> 1; // Set compare to half the period
- break;
- }
- case 1: {
- int duty = (((double)F_CPU) / (frequency*2));
- ICR3 = duty; // Set max to the period
- OCR3A = duty >> 1; // Set compare to half the period
- break;
- }
- case 2: {
- int duty = (((double)F_CPU) / (frequency*3));
- ICR3 = duty; // Set max to the period
- OCR3A = duty >> 1; // Set compare to half the period
- break;
- }
- }
- position = (position + 1) % 3;
- }
-// /* OCR2A has been cleared, per TCCR2A above */
-// // OCR3A = 127;
-
-// // pos1 += incr1;
-// // pos2 += incr2;
-// // pos3 += incr3;
-
-// // sample = sinewave[highByte(pos1)] + sinewave[highByte(pos2)] + sinewave[highByte(pos3)];
-
-// // OCR3A = sample;
-
-
-// OCR3A=pgm_read_byte(&sinewave[pos1]);
-// pos1++;
-// // PORTC &= ~(1<<6);
-
-// /* buffered, 1x gain, active mode */
-// // SPDR = highByte(sample) | 0x70;
-// // while (!(SPSR & (1<<SPIF)));
-
-// // SPDR = lowByte(sample);
-// // while (!(SPSR & (1<<SPIF)));
-
-// // PORTC |= (1<<6);
-}
-
-void play_note(double freq, int vol) {
-
- if (freq > 0) {
- DDRC |= (1<<6);
-
- TCCR3A = (1 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
- TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
-
- if (frequency != 0) {
- if (frequency < freq) {
- for (double f = frequency; f <= freq; f += ((freq - frequency) / 500.0)) {
- send_freq(f, vol);
- }
- } else if (frequency > freq) {
- for (double f = frequency; f >= freq; f -= ((frequency - freq) / 500.0)) {
- send_freq(f, vol);
- }
- }
- }
- send_freq(freq, vol);
- frequency = freq;
- volume = vol;
-
- frequencies[voices] = frequency;
- volumes[voices] = volume;
- voices++;
- }
- // ICR3 = 0xFFFF;
- // for (int i = 0; i < 10000; i++) {
- // OCR3A = round((sin(i*freq)*.5)+.5)*0xFFFF;
- // // _delay_us(50);
- // }
-
- // TCCR3A = 0;
- // TCCR3B = 0;
-}
-
-// void note(int x, float length) {
-// DDRC |= (1<<6);
-// int t = (int)(440*pow(2,-x/12.0)); // starting note
-// for (int y = 0; y < length*1000/t; y++) { // note length
-// PORTC |= (1<<6);
-// delay_us(t);
-// PORTC &= ~(1<<6);
-// delay_us(t);
-// }
-// PORTC &= ~(1<<6);
-// }
-
-// void true_note(float x, float y, float length) {
-// for (uint32_t i = 0; i < length * 50; i++) {
-// uint32_t v = (uint32_t) (round(sin(PI*2*i*640000*pow(2, x/12.0))*.5+1 + sin(PI*2*i*640000*pow(2, y/12.0))*.5+1) / 2 * pow(2, 8));
-// for (int u = 0; u < 8; u++) {
-// if (v & (1 << u) && !(PORTC&(1<<6)))
-// PORTC |= (1<<6);
-// else if (PORTC&(1<<6))
-// PORTC &= ~(1<<6);
-// }
-// }
-// PORTC &= ~(1<<6);
-// } \ No newline at end of file
diff --git a/quantum/keymap_midi.c b/quantum/keymap_midi.c
index b7eba3ab76..e37ea31039 100644
--- a/quantum/keymap_midi.c
+++ b/quantum/keymap_midi.c
@@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "keymap_common.h"
#include "keymap_midi.h"
-#include <lufa.h>
uint8_t starting_note = 0x0C;
int offset = 7;
@@ -35,7 +34,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
if (record->event.key.col == (MATRIX_COLS - 1) && record->event.key.row == (MATRIX_ROWS - 1)) {
if (record->event.pressed) {
starting_note++;
- play_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[0 + offset])/12.0+(MATRIX_ROWS - 1)), 0xC);
+ play_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[0 + offset])/12.0+(MATRIX_ROWS - 1)), 0xC);
midi_send_cc(&midi_device, 0, 0x7B, 0);
midi_send_cc(&midi_device, 1, 0x7B, 0);
midi_send_cc(&midi_device, 2, 0x7B, 0);
@@ -43,7 +42,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
midi_send_cc(&midi_device, 4, 0x7B, 0);
return;
} else {
- stop_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[0 + offset])/12.0+(MATRIX_ROWS - 1)));
+ stop_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[0 + offset])/12.0+(MATRIX_ROWS - 1)));
stop_all_notes();
return;
}
@@ -51,7 +50,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
if (record->event.key.col == (MATRIX_COLS - 2) && record->event.key.row == (MATRIX_ROWS - 1)) {
if (record->event.pressed) {
starting_note--;
- play_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[0 + offset])/12.0+(MATRIX_ROWS - 1)), 0xC);
+ play_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[0 + offset])/12.0+(MATRIX_ROWS - 1)), 0xC);
midi_send_cc(&midi_device, 0, 0x7B, 0);
midi_send_cc(&midi_device, 1, 0x7B, 0);
midi_send_cc(&midi_device, 2, 0x7B, 0);
@@ -59,7 +58,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
midi_send_cc(&midi_device, 4, 0x7B, 0);
return;
} else {
- stop_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[0 + offset])/12.0+(MATRIX_ROWS - 1)));
+ stop_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[0 + offset])/12.0+(MATRIX_ROWS - 1)));
stop_all_notes();
return;
}
@@ -74,9 +73,9 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
midi_send_cc(&midi_device, 4, 0x7B, 0);
stop_all_notes();
for (int i = 0; i <= 7; i++) {
- play_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[i + offset])/12.0+(MATRIX_ROWS - 1)), 0xC);
+ play_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[i + offset])/12.0+(MATRIX_ROWS - 1)), 0xC);
_delay_us(80000);
- stop_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[i + offset])/12.0+(MATRIX_ROWS - 1)));
+ stop_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[i + offset])/12.0+(MATRIX_ROWS - 1)));
_delay_us(8000);
}
return;
@@ -90,9 +89,9 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
midi_send_cc(&midi_device, 4, 0x7B, 0);
stop_all_notes();
for (int i = 0; i <= 7; i++) {
- play_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[i + offset])/12.0+(MATRIX_ROWS - 1)), 0xC);
+ play_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[i + offset])/12.0+(MATRIX_ROWS - 1)), 0xC);
_delay_us(80000);
- stop_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[i + offset])/12.0+(MATRIX_ROWS - 1)));
+ stop_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[i + offset])/12.0+(MATRIX_ROWS - 1)));
_delay_us(8000);
}
return;
@@ -101,10 +100,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
if (record->event.pressed) {
// midi_send_noteon(&midi_device, record->event.key.row, starting_note + SCALE[record->event.key.col], 127);
midi_send_noteon(&midi_device, 0, (starting_note + SCALE[record->event.key.col + offset])+12*(MATRIX_ROWS - record->event.key.row), 127);
- play_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF);
+ play_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF);
} else {
// midi_send_noteoff(&midi_device, record->event.key.row, starting_note + SCALE[record->event.key.col], 127);
midi_send_noteoff(&midi_device, 0, (starting_note + SCALE[record->event.key.col + offset])+12*(MATRIX_ROWS - record->event.key.row), 127);
- stop_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)));
+ stop_note(((double)261.626)*pow(2.0, -1.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)));
}
} \ No newline at end of file
diff --git a/quantum/keymap_midi.h b/quantum/keymap_midi.h
index c5917f884e..a89420ce2a 100644
--- a/quantum/keymap_midi.h
+++ b/quantum/keymap_midi.h
@@ -18,6 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef KEYMAP_MIDI_H
#define KEYMAP_MIDI_H
+#include <lufa.h>
+
#define MIDI 0x6000
#define MIDI12 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000
diff --git a/quantum/keymap_unicode.c b/quantum/keymap_unicode.c
index a9357edec7..a44965e611 100644
--- a/quantum/keymap_unicode.c
+++ b/quantum/keymap_unicode.c
@@ -30,6 +30,8 @@ uint16_t hextokeycode(int hex) {
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
+ // For more info on how this works per OS, see here: https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input
+
if (record->event.pressed) {
uint16_t unicode = (opt << 8) | id;
register_code(KC_LALT);
diff --git a/quantum/light_ws2812.c b/quantum/light_ws2812.c
new file mode 100755
index 0000000000..f20043067e
--- /dev/null
+++ b/quantum/light_ws2812.c
@@ -0,0 +1,181 @@
+/*
+* light weight WS2812 lib V2.0b
+*
+* Controls WS2811/WS2812/WS2812B RGB-LEDs
+* Author: Tim (cpldcpu@gmail.com)
+*
+* Jan 18th, 2014 v2.0b Initial Version
+* Nov 29th, 2015 v2.3 Added SK6812RGBW support
+*
+* License: GNU GPL v2 (see License.txt)
+*/
+
+#include "light_ws2812.h"
+#include <avr/interrupt.h>
+#include <avr/io.h>
+#include <util/delay.h>
+#include "debug.h"
+
+// Setleds for standard RGB
+void inline ws2812_setleds(struct cRGB *ledarray, uint16_t leds)
+{
+ ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin));
+}
+
+void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pinmask)
+{
+ ws2812_DDRREG |= pinmask; // Enable DDR
+ ws2812_sendarray_mask((uint8_t*)ledarray,leds+leds+leds,pinmask);
+ _delay_us(50);
+}
+
+// Setleds for SK6812RGBW
+void inline ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t leds)
+{
+ ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR
+ ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(ws2812_pin));
+ _delay_us(80);
+}
+
+void ws2812_sendarray(uint8_t *data,uint16_t datlen)
+{
+ ws2812_sendarray_mask(data,datlen,_BV(ws2812_pin));
+}
+
+/*
+ This routine writes an array of bytes with RGB values to the Dataout pin
+ using the fast 800kHz clockless WS2811/2812 protocol.
+*/
+
+// Timing in ns
+#define w_zeropulse 350
+#define w_onepulse 900
+#define w_totalperiod 1250
+
+// Fixed cycles used by the inner loop
+#define w_fixedlow 2
+#define w_fixedhigh 4
+#define w_fixedtotal 8
+
+// Insert NOPs to match the timing, if possible
+#define w_zerocycles (((F_CPU/1000)*w_zeropulse )/1000000)
+#define w_onecycles (((F_CPU/1000)*w_onepulse +500000)/1000000)
+#define w_totalcycles (((F_CPU/1000)*w_totalperiod +500000)/1000000)
+
+// w1 - nops between rising edge and falling edge - low
+#define w1 (w_zerocycles-w_fixedlow)
+// w2 nops between fe low and fe high
+#define w2 (w_onecycles-w_fixedhigh-w1)
+// w3 nops to complete loop
+#define w3 (w_totalcycles-w_fixedtotal-w1-w2)
+
+#if w1>0
+ #define w1_nops w1
+#else
+ #define w1_nops 0
+#endif
+
+// The only critical timing parameter is the minimum pulse length of the "0"
+// Warn or throw error if this timing can not be met with current F_CPU settings.
+#define w_lowtime ((w1_nops+w_fixedlow)*1000000)/(F_CPU/1000)
+#if w_lowtime>550
+ #error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?"
+#elif w_lowtime>450
+ #warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)."
+ #warning "Please consider a higher clockspeed, if possible"
+#endif
+
+#if w2>0
+#define w2_nops w2
+#else
+#define w2_nops 0
+#endif
+
+#if w3>0
+#define w3_nops w3
+#else
+#define w3_nops 0
+#endif
+
+#define w_nop1 "nop \n\t"
+#define w_nop2 "rjmp .+0 \n\t"
+#define w_nop4 w_nop2 w_nop2
+#define w_nop8 w_nop4 w_nop4
+#define w_nop16 w_nop8 w_nop8
+
+void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi)
+{
+ uint8_t curbyte,ctr,masklo;
+ uint8_t sreg_prev;
+
+ masklo =~maskhi&ws2812_PORTREG;
+ maskhi |= ws2812_PORTREG;
+ sreg_prev=SREG;
+ cli();
+
+ while (datlen--) {
+ curbyte=*data++;
+
+ asm volatile(
+ " ldi %0,8 \n\t"
+ "loop%=: \n\t"
+ " out %2,%3 \n\t" // '1' [01] '0' [01] - re
+#if (w1_nops&1)
+w_nop1
+#endif
+#if (w1_nops&2)
+w_nop2
+#endif
+#if (w1_nops&4)
+w_nop4
+#endif
+#if (w1_nops&8)
+w_nop8
+#endif
+#if (w1_nops&16)
+w_nop16
+#endif
+ " sbrs %1,7 \n\t" // '1' [03] '0' [02]
+ " out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low
+ " lsl %1 \n\t" // '1' [04] '0' [04]
+#if (w2_nops&1)
+ w_nop1
+#endif
+#if (w2_nops&2)
+ w_nop2
+#endif
+#if (w2_nops&4)
+ w_nop4
+#endif
+#if (w2_nops&8)
+ w_nop8
+#endif
+#if (w2_nops&16)
+ w_nop16
+#endif
+ " out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high
+#if (w3_nops&1)
+w_nop1
+#endif
+#if (w3_nops&2)
+w_nop2
+#endif
+#if (w3_nops&4)
+w_nop4
+#endif
+#if (w3_nops&8)
+w_nop8
+#endif
+#if (w3_nops&16)
+w_nop16
+#endif
+
+ " dec %0 \n\t" // '1' [+2] '0' [+2]
+ " brne loop%=\n\t" // '1' [+3] '0' [+4]
+ : "=&d" (ctr)
+ : "r" (curbyte), "I" (_SFR_IO_ADDR(ws2812_PORTREG)), "r" (maskhi), "r" (masklo)
+ );
+ }
+
+ SREG=sreg_prev;
+}
diff --git a/quantum/light_ws2812.h b/quantum/light_ws2812.h
new file mode 100755
index 0000000000..54eef22d9e
--- /dev/null
+++ b/quantum/light_ws2812.h
@@ -0,0 +1,73 @@
+/*
+ * light weight WS2812 lib include
+ *
+ * Version 2.3 - Nev 29th 2015
+ * Author: Tim (cpldcpu@gmail.com)
+ *
+ * Please do not change this file! All configuration is handled in "ws2812_config.h"
+ *
+ * License: GNU GPL v2 (see License.txt)
+ +
+ */
+
+#ifndef LIGHT_WS2812_H_
+#define LIGHT_WS2812_H_
+
+#include <avr/io.h>
+#include <avr/interrupt.h>
+//#include "ws2812_config.h"
+
+/*
+ * Structure of the LED array
+ *
+ * cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106
+ * cRGBW: RGBW for SK6812RGBW
+ */
+
+struct cRGB { uint8_t g; uint8_t r; uint8_t b; };
+struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;};
+
+
+
+/* User Interface
+ *
+ * Input:
+ * ledarray: An array of GRB data describing the LED colors
+ * number_of_leds: The number of LEDs to write
+ * pinmask (optional): Bitmask describing the output bin. e.g. _BV(PB0)
+ *
+ * The functions will perform the following actions:
+ * - Set the data-out pin as output
+ * - Send out the LED data
+ * - Wait 50�s to reset the LEDs
+ */
+
+void ws2812_setleds (struct cRGB *ledarray, uint16_t number_of_leds);
+void ws2812_setleds_pin (struct cRGB *ledarray, uint16_t number_of_leds,uint8_t pinmask);
+void ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t number_of_leds);
+
+/*
+ * Old interface / Internal functions
+ *
+ * The functions take a byte-array and send to the data output as WS2812 bitstream.
+ * The length is the number of bytes to send - three per LED.
+ */
+
+void ws2812_sendarray (uint8_t *array,uint16_t length);
+void ws2812_sendarray_mask(uint8_t *array,uint16_t length, uint8_t pinmask);
+
+
+/*
+ * Internal defines
+ */
+#ifndef CONCAT
+#define CONCAT(a, b) a ## b
+#endif
+#ifndef CONCAT_EXP
+#define CONCAT_EXP(a, b) CONCAT(a, b)
+#endif
+
+// #define ws2812_PORTREG CONCAT_EXP(PORT,ws2812_port)
+// #define ws2812_DDRREG CONCAT_EXP(DDR,ws2812_port)
+
+#endif /* LIGHT_WS2812_H_ */
diff --git a/quantum/quantum.mk b/quantum/quantum.mk
index c82e478725..de93af7e8c 100644
--- a/quantum/quantum.mk
+++ b/quantum/quantum.mk
@@ -2,21 +2,45 @@ QUANTUM_DIR = quantum
# # project specific files
SRC += $(QUANTUM_DIR)/keymap_common.c \
- $(QUANTUM_DIR)/led.c
+ $(QUANTUM_DIR)/led.c
+
+# ifdef KEYMAP_FILE
+# ifneq (,$(shell grep USING_MIDI '$(KEYMAP_FILE)'))
+# MIDI_ENABLE=yes
+# $(info * Overriding MIDI_ENABLE setting - $(KEYMAP_FILE) requires it)
+# endif
+# ifneq (,$(shell grep USING_UNICODE '$(KEYMAP_FILE)'))
+# UNICODE_ENABLE=yes
+# $(info * Overriding UNICODE_ENABLE setting - $(KEYMAP_FILE) requires it)
+# endif
+# ifneq (,$(shell grep USING_BACKLIGHT '$(KEYMAP_FILE)'))
+# BACKLIGHT_ENABLE=yes
+# $(info * Overriding BACKLIGHT_ENABLE setting - $(KEYMAP_FILE) requires it)
+# endif
+# endif
ifndef CUSTOM_MATRIX
SRC += $(QUANTUM_DIR)/matrix.c
endif
ifdef MIDI_ENABLE
- SRC += $(QUANTUM_DIR)/keymap_midi.c \
- $(QUANTUM_DIR)/beeps.c
+ SRC += $(QUANTUM_DIR)/keymap_midi.c
+endif
+
+ifdef AUDIO_ENABLE
+ SRC += $(QUANTUM_DIR)/audio.c
endif
ifdef UNICODE_ENABLE
SRC += $(QUANTUM_DIR)/keymap_unicode.c
endif
+ifdef RGBLIGHT_ENABLE
+ SRC += $(QUANTUM_DIR)/light_ws2812.c
+ SRC += $(QUANTUM_DIR)/rgblight.c
+ OPT_DEFS += -DRGBLIGHT_ENABLE
+endif
+
# Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax
@@ -27,4 +51,3 @@ include $(TMK_DIR)/protocol/lufa.mk
include $(TMK_DIR)/common.mk
include $(TMK_DIR)/rules.mk
-
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
new file mode 100644
index 0000000000..2215cf5cdf
--- /dev/null
+++ b/quantum/rgblight.c
@@ -0,0 +1,505 @@
+#include <avr/eeprom.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include "progmem.h"
+#include "timer.h"
+#include "rgblight.h"
+#include "debug.h"
+
+const uint8_t DIM_CURVE[] PROGMEM = {
+ 0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6,
+ 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
+ 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11,
+ 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15,
+ 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20,
+ 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26,
+ 27, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35,
+ 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 46, 47,
+ 48, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 68, 69, 70, 71, 73, 74, 75, 76, 78, 79, 81, 82,
+ 83, 85, 86, 88, 90, 91, 93, 94, 96, 98, 99, 101, 103, 105, 107, 109,
+ 110, 112, 114, 116, 118, 121, 123, 125, 127, 129, 132, 134, 136, 139, 141, 144,
+ 146, 149, 151, 154, 157, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 190,
+ 193, 196, 200, 203, 207, 211, 214, 218, 222, 226, 230, 234, 238, 242, 248, 255,
+};
+const uint8_t RGBLED_BREATHING_TABLE[] 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 RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
+const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30};
+const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20};
+const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20};
+const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {100, 50, 20};
+
+rgblight_config_t rgblight_config;
+rgblight_config_t inmem_config;
+struct cRGB led[RGBLED_NUM];
+uint8_t rgblight_inited = 0;
+
+
+void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) {
+ /* convert hue, saturation and brightness ( HSB/HSV ) to RGB
+ The DIM_CURVE is used only on brightness/value and on saturation (inverted).
+ This looks the most natural.
+ */
+ uint8_t r, g, b;
+
+ val = pgm_read_byte(&DIM_CURVE[val]);
+ sat = 255 - pgm_read_byte(&DIM_CURVE[255 - sat]);
+
+ uint8_t base;
+
+ if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
+ r = val;
+ g = val;
+ b = val;
+ } else {
+ base = ((255 - sat) * val) >> 8;
+
+ switch (hue / 60) {
+ case 0:
+ r = val;
+ g = (((val - base)*hue) / 60) + base;
+ b = base;
+ break;
+
+ case 1:
+ r = (((val - base)*(60 - (hue % 60))) / 60) + base;
+ g = val;
+ b = base;
+ break;
+
+ case 2:
+ r = base;
+ g = val;
+ b = (((val - base)*(hue % 60)) / 60) + base;
+ break;
+
+ case 3:
+ r = base;
+ g = (((val - base)*(60 - (hue % 60))) / 60) + base;
+ b = val;
+ break;
+
+ case 4:
+ r = (((val - base)*(hue % 60)) / 60) + base;
+ g = base;
+ b = val;
+ break;
+
+ case 5:
+ r = val;
+ g = base;
+ b = (((val - base)*(60 - (hue % 60))) / 60) + base;
+ break;
+ }
+ }
+ setrgb(r,g,b, led1);
+}
+
+void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1) {
+ (*led1).r = r;
+ (*led1).g = g;
+ (*led1).b = b;
+}
+
+
+uint32_t eeconfig_read_rgblight(void) {
+ return eeprom_read_dword(EECONFIG_RGBLIGHT);
+}
+void eeconfig_write_rgblight(uint32_t val) {
+ eeprom_write_dword(EECONFIG_RGBLIGHT, val);
+}
+void eeconfig_write_rgblight_default(void) {
+ dprintf("eeconfig_write_rgblight_default\n");
+ rgblight_config.enable = 1;
+ rgblight_config.mode = 1;
+ rgblight_config.hue = 200;
+ rgblight_config.sat = 204;
+ rgblight_config.val = 204;
+ eeconfig_write_rgblight(rgblight_config.raw);
+}
+void eeconfig_debug_rgblight(void) {
+ dprintf("rgblight_config eprom\n");
+ dprintf("rgblight_config.enable = %d\n", rgblight_config.enable);
+ dprintf("rghlight_config.mode = %d\n", rgblight_config.mode);
+ dprintf("rgblight_config.hue = %d\n", rgblight_config.hue);
+ dprintf("rgblight_config.sat = %d\n", rgblight_config.sat);
+ dprintf("rgblight_config.val = %d\n", rgblight_config.val);
+}
+
+void rgblight_init(void) {
+ debug_enable = 1; // Debug ON!
+ dprintf("rgblight_init called.\n");
+ rgblight_inited = 1;
+ dprintf("rgblight_init start!\n");
+ if (!eeconfig_is_enabled()) {
+ dprintf("rgblight_init eeconfig is not enabled.\n");
+ eeconfig_init();
+ eeconfig_write_rgblight_default();
+ }
+ rgblight_config.raw = eeconfig_read_rgblight();
+ if (!rgblight_config.mode) {
+ dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n");
+ eeconfig_write_rgblight_default();
+ rgblight_config.raw = eeconfig_read_rgblight();
+ }
+ eeconfig_debug_rgblight(); // display current eeprom values
+
+ rgblight_timer_init(); // setup the timer
+
+ if (rgblight_config.enable) {
+ rgblight_mode(rgblight_config.mode);
+ }
+}
+
+void rgblight_increase(void) {
+ uint8_t mode;
+ if (rgblight_config.mode < RGBLIGHT_MODES) {
+ mode = rgblight_config.mode + 1;
+ }
+ rgblight_mode(mode);
+}
+
+void rgblight_decrease(void) {
+ uint8_t mode;
+ if (rgblight_config.mode > 1) { //mode will never < 1, if mode is less than 1, eeprom need to be initialized.
+ mode = rgblight_config.mode-1;
+ }
+ rgblight_mode(mode);
+}
+
+void rgblight_step(void) {
+ uint8_t mode;
+ mode = rgblight_config.mode + 1;
+ if (mode > RGBLIGHT_MODES) {
+ mode = 1;
+ }
+ rgblight_mode(mode);
+}
+
+void rgblight_mode(uint8_t mode) {
+ if (!rgblight_config.enable) {
+ return;
+ }
+ if (mode<1) {
+ rgblight_config.mode = 1;
+ } else if (mode > RGBLIGHT_MODES) {
+ rgblight_config.mode = RGBLIGHT_MODES;
+ } else {
+ rgblight_config.mode = mode;
+ }
+ eeconfig_write_rgblight(rgblight_config.raw);
+ dprintf("rgblight mode: %u\n", rgblight_config.mode);
+ if (rgblight_config.mode == 1) {
+ rgblight_timer_disable();
+ } else if (rgblight_config.mode >=2 && rgblight_config.mode <=23) {
+ // MODE 2-5, breathing
+ // MODE 6-8, rainbow mood
+ // MODE 9-14, rainbow swirl
+ // MODE 15-20, snake
+ // MODE 21-23, knight
+ rgblight_timer_enable();
+ }
+ rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
+}
+
+void rgblight_toggle(void) {
+ rgblight_config.enable ^= 1;
+ eeconfig_write_rgblight(rgblight_config.raw);
+ dprintf("rgblight toggle: rgblight_config.enable = %u\n", rgblight_config.enable);
+ if (rgblight_config.enable) {
+ rgblight_mode(rgblight_config.mode);
+ } else {
+ rgblight_timer_disable();
+ _delay_ms(50);
+ rgblight_set();
+ }
+}
+
+
+void rgblight_increase_hue(void){
+ uint16_t hue;
+ hue = (rgblight_config.hue+RGBLIGHT_HUE_STEP) % 360;
+ rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val);
+}
+void rgblight_decrease_hue(void){
+ uint16_t hue;
+ if (rgblight_config.hue-RGBLIGHT_HUE_STEP <0 ) {
+ hue = (rgblight_config.hue+360-RGBLIGHT_HUE_STEP) % 360;
+ } else {
+ hue = (rgblight_config.hue-RGBLIGHT_HUE_STEP) % 360;
+ }
+ rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val);
+}
+void rgblight_increase_sat(void) {
+ uint8_t sat;
+ if (rgblight_config.sat + RGBLIGHT_SAT_STEP > 255) {
+ sat = 255;
+ } else {
+ sat = rgblight_config.sat+RGBLIGHT_SAT_STEP;
+ }
+ rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val);
+}
+void rgblight_decrease_sat(void){
+ uint8_t sat;
+ if (rgblight_config.sat - RGBLIGHT_SAT_STEP < 0) {
+ sat = 0;
+ } else {
+ sat = rgblight_config.sat-RGBLIGHT_SAT_STEP;
+ }
+ rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val);
+}
+void rgblight_increase_val(void){
+ uint8_t val;
+ if (rgblight_config.val + RGBLIGHT_VAL_STEP > 255) {
+ val = 255;
+ } else {
+ val = rgblight_config.val+RGBLIGHT_VAL_STEP;
+ }
+ rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
+}
+void rgblight_decrease_val(void) {
+ uint8_t val;
+ if (rgblight_config.val - RGBLIGHT_VAL_STEP < 0) {
+ val = 0;
+ } else {
+ val = rgblight_config.val-RGBLIGHT_VAL_STEP;
+ }
+ rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
+}
+
+void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val){
+ inmem_config.raw = rgblight_config.raw;
+ if (rgblight_config.enable) {
+ struct cRGB tmp_led;
+ sethsv(hue, sat, val, &tmp_led);
+ inmem_config.hue = hue;
+ inmem_config.sat = sat;
+ inmem_config.val = val;
+ // dprintf("rgblight set hue [MEMORY]: %u,%u,%u\n", inmem_config.hue, inmem_config.sat, inmem_config.val);
+ rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
+ }
+}
+void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val){
+ if (rgblight_config.enable) {
+ if (rgblight_config.mode == 1) {
+ // same static color
+ rgblight_sethsv_noeeprom(hue, sat, val);
+ } else {
+ // all LEDs in same color
+ if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
+ // breathing mode, ignore the change of val, use in memory value instead
+ val = rgblight_config.val;
+ } else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 14) {
+ // rainbow mood and rainbow swirl, ignore the change of hue
+ hue = rgblight_config.hue;
+ }
+ }
+ rgblight_config.hue = hue;
+ rgblight_config.sat = sat;
+ rgblight_config.val = val;
+ eeconfig_write_rgblight(rgblight_config.raw);
+ dprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
+ }
+}
+
+void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b){
+ // dprintf("rgblight set rgb: %u,%u,%u\n", r,g,b);
+ for (uint8_t i=0;i<RGBLED_NUM;i++) {
+ led[i].r = r;
+ led[i].g = g;
+ led[i].b = b;
+ }
+ rgblight_set();
+
+}
+
+void rgblight_set(void) {
+ if (rgblight_config.enable) {
+ ws2812_setleds(led, RGBLED_NUM);
+ } else {
+ for (uint8_t i=0;i<RGBLED_NUM;i++) {
+ led[i].r = 0;
+ led[i].g = 0;
+ led[i].b = 0;
+ }
+ ws2812_setleds(led, RGBLED_NUM);
+ }
+}
+
+// Animation timer -- AVR Timer3
+void rgblight_timer_init(void) {
+ static uint8_t rgblight_timer_is_init = 0;
+ if (rgblight_timer_is_init) {
+ return;
+ }
+ rgblight_timer_is_init = 1;
+ /* Timer 3 setup */
+ TCCR3B = _BV(WGM32) //CTC mode OCR3A as TOP
+ | _BV(CS30); //Clock selelct: clk/1
+ /* Set TOP value */
+ uint8_t sreg = SREG;
+ cli();
+ OCR3AH = (RGBLED_TIMER_TOP>>8)&0xff;
+ OCR3AL = RGBLED_TIMER_TOP&0xff;
+ SREG = sreg;
+}
+void rgblight_timer_enable(void) {
+ TIMSK3 |= _BV(OCIE3A);
+ dprintf("TIMER3 enabled.\n");
+}
+void rgblight_timer_disable(void) {
+ TIMSK3 &= ~_BV(OCIE3A);
+ dprintf("TIMER3 disabled.\n");
+}
+void rgblight_timer_toggle(void) {
+ TIMSK3 ^= _BV(OCIE3A);
+ dprintf("TIMER3 toggled.\n");
+}
+
+ISR(TIMER3_COMPA_vect) {
+ // Mode = 1, static light, do nothing here
+ if (rgblight_config.mode>=2 && rgblight_config.mode<=5) {
+ // mode = 2 to 5, breathing mode
+ rgblight_effect_breathing(rgblight_config.mode-2);
+
+ } else if (rgblight_config.mode>=6 && rgblight_config.mode<=8) {
+ rgblight_effect_rainbow_mood(rgblight_config.mode-6);
+ } else if (rgblight_config.mode>=9 && rgblight_config.mode<=14) {
+ rgblight_effect_rainbow_swirl(rgblight_config.mode-9);
+ } else if (rgblight_config.mode>=15 && rgblight_config.mode<=20) {
+ rgblight_effect_snake(rgblight_config.mode-15);
+ } else if (rgblight_config.mode>=21 && rgblight_config.mode<=23) {
+ rgblight_effect_knight(rgblight_config.mode-21);
+ }
+}
+
+// effects
+void rgblight_effect_breathing(uint8_t interval) {
+ static uint8_t pos = 0;
+ static uint16_t last_timer = 0;
+
+ if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_BREATHING_INTERVALS[interval])) return;
+ last_timer = timer_read();
+
+ rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, pgm_read_byte(&RGBLED_BREATHING_TABLE[pos]));
+ pos = (pos+1) % 256;
+}
+
+void rgblight_effect_rainbow_mood(uint8_t interval) {
+ static uint16_t current_hue=0;
+ static uint16_t last_timer = 0;
+
+ if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval])) return;
+ last_timer = timer_read();
+ rgblight_sethsv_noeeprom(current_hue, rgblight_config.sat, rgblight_config.val);
+ current_hue = (current_hue+1) % 360;
+}
+
+void rgblight_effect_rainbow_swirl(uint8_t interval) {
+ static uint16_t current_hue=0;
+ static uint16_t last_timer = 0;
+ uint16_t hue;
+ uint8_t i;
+ if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval/2])) return;
+ last_timer = timer_read();
+ for (i=0; i<RGBLED_NUM; i++) {
+ hue = (360/RGBLED_NUM*i+current_hue)%360;
+ sethsv(hue, rgblight_config.sat, rgblight_config.val, &led[i]);
+ }
+ rgblight_set();
+
+ if (interval % 2) {
+ current_hue = (current_hue+1) % 360;
+ } else {
+ if (current_hue -1 < 0) {
+ current_hue = 359;
+ } else {
+ current_hue = current_hue - 1;
+ }
+
+ }
+}
+void rgblight_effect_snake(uint8_t interval) {
+ static uint8_t pos=0;
+ static uint16_t last_timer = 0;
+ uint8_t i,j;
+ int8_t k;
+ int8_t increament = 1;
+ if (interval%2) increament = -1;
+ if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_SNAKE_INTERVALS[interval/2])) return;
+ last_timer = timer_read();
+ for (i=0;i<RGBLED_NUM;i++) {
+ led[i].r=0;
+ led[i].g=0;
+ led[i].b=0;
+ for (j=0;j<RGBLIGHT_EFFECT_SNAKE_LENGTH;j++) {
+ k = pos+j*increament;
+ if (k<0) k = k+RGBLED_NUM;
+ if (i==k) {
+ sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), &led[i]);
+ }
+ }
+ }
+ rgblight_set();
+ if (increament == 1) {
+ if (pos - 1 < 0) {
+ pos = RGBLED_NUM-1;
+ } else {
+ pos -= 1;
+ }
+ } else {
+ pos = (pos+1)%RGBLED_NUM;
+ }
+
+}
+
+void rgblight_effect_knight(uint8_t interval) {
+ static int8_t pos=0;
+ static uint16_t last_timer = 0;
+ uint8_t i,j,cur;
+ int8_t k;
+ struct cRGB preled[RGBLED_NUM];
+ static int8_t increament = -1;
+ if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) return;
+ last_timer = timer_read();
+ for (i=0;i<RGBLED_NUM;i++) {
+ preled[i].r=0;
+ preled[i].g=0;
+ preled[i].b=0;
+ for (j=0;j<RGBLIGHT_EFFECT_KNIGHT_LENGTH;j++) {
+ k = pos+j*increament;
+ if (k<0) k = 0;
+ if (k>=RGBLED_NUM) k=RGBLED_NUM-1;
+ if (i==k) {
+ sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, &preled[i]);
+ }
+ }
+ }
+ if (RGBLIGHT_EFFECT_KNIGHT_OFFSET) {
+ for (i=0;i<RGBLED_NUM;i++) {
+ cur = (i+RGBLIGHT_EFFECT_KNIGHT_OFFSET) % RGBLED_NUM;
+ led[i].r = preled[cur].r;
+ led[i].g = preled[cur].g;
+ led[i].b = preled[cur].b;
+ }
+ }
+ rgblight_set();
+ if (increament == 1) {
+ if (pos - 1 < 0 - RGBLIGHT_EFFECT_KNIGHT_LENGTH) {
+ pos = 0- RGBLIGHT_EFFECT_KNIGHT_LENGTH;
+ increament = -1;
+ } else {
+ pos -= 1;
+ }
+ } else {
+ if (pos+1>RGBLED_NUM+RGBLIGHT_EFFECT_KNIGHT_LENGTH) {
+ pos = RGBLED_NUM+RGBLIGHT_EFFECT_KNIGHT_LENGTH-1;
+ increament = 1;
+ } else {
+ pos += 1;
+ }
+ }
+
+}
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
new file mode 100644
index 0000000000..9e1562328f
--- /dev/null
+++ b/quantum/rgblight.h
@@ -0,0 +1,87 @@
+#ifndef RGBLIGHT_H
+#define RGBLIGHT_H
+
+#ifndef RGBLIGHT_MODES
+#define RGBLIGHT_MODES 23
+#endif
+
+#ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH
+#define RGBLIGHT_EFFECT_SNAKE_LENGTH 7
+#endif
+
+#ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH
+#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 7
+#endif
+#ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET
+#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 9
+#endif
+
+#ifndef RGBLIGHT_EFFECT_DUALKNIGHT_LENGTH
+#define RGBLIGHT_EFFECT_DUALKNIGHT_LENGTH 4
+#endif
+
+#ifndef RGBLIGHT_HUE_STEP
+#define RGBLIGHT_HUE_STEP 10
+#endif
+#ifndef RGBLIGHT_SAT_STEP
+#define RGBLIGHT_SAT_STEP 17
+#endif
+#ifndef RGBLIGHT_VAL_STEP
+#define RGBLIGHT_VAL_STEP 17
+#endif
+
+#define RGBLED_TIMER_TOP F_CPU/(256*64)
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "eeconfig.h"
+#include "light_ws2812.h"
+
+typedef union {
+ uint32_t raw;
+ struct {
+ bool enable :1;
+ uint8_t mode :6;
+ uint16_t hue :9;
+ uint8_t sat :8;
+ uint8_t val :8;
+ };
+} rgblight_config_t;
+
+void rgblight_init(void);
+void rgblight_increase(void);
+void rgblight_decrease(void);
+void rgblight_toggle(void);
+void rgblight_step(void);
+void rgblight_mode(uint8_t mode);
+void rgblight_set(void);
+void rgblight_increase_hue(void);
+void rgblight_decrease_hue(void);
+void rgblight_increase_sat(void);
+void rgblight_decrease_sat(void);
+void rgblight_increase_val(void);
+void rgblight_decrease_val(void);
+void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
+void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b);
+
+#define EECONFIG_RGBLIGHT (uint8_t *)7
+uint32_t eeconfig_read_rgblight(void);
+void eeconfig_write_rgblight(uint32_t val);
+void eeconfig_write_rgblight_default(void);
+void eeconfig_debug_rgblight(void);
+
+void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1);
+void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1);
+void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
+
+void rgblight_timer_init(void);
+void rgblight_timer_enable(void);
+void rgblight_timer_disable(void);
+void rgblight_timer_toggle(void);
+void rgblight_effect_breathing(uint8_t interval);
+void rgblight_effect_rainbow_mood(uint8_t interval);
+void rgblight_effect_rainbow_swirl(uint8_t interval);
+void rgblight_effect_snake(uint8_t interval);
+void rgblight_effect_knight(uint8_t interval);
+
+#endif
diff --git a/quantum/template/Makefile b/quantum/template/Makefile
index 99c97a62cf..2efa691380 100644
--- a/quantum/template/Makefile
+++ b/quantum/template/Makefile
@@ -53,9 +53,9 @@ TARGET_DIR = .
SRC = %KEYBOARD%.c
ifdef KEYMAP
- SRC := keymaps/keymap_$(KEYMAP).c $(SRC)
+ SRC := keymaps/$(KEYMAP).c $(SRC)
else
- SRC := keymaps/keymap_default.c $(SRC)
+ SRC := keymaps/default.c $(SRC)
endif
CONFIG_H = config.h
@@ -107,7 +107,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Atmel DFU loader 4096
# LUFA bootloader 4096
# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=4096
+OPT_DEFS += -DBOOTLOADER_SIZE=512
# Build Options
diff --git a/quantum/template/README.md b/quantum/template/README.md
index ecea7dd698..f34862cd9b 100644
--- a/quantum/template/README.md
+++ b/quantum/template/README.md
@@ -88,7 +88,7 @@ Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` -
## Macro shortcuts: Send a whole string when pressing just one key
-Instead of using the `ACTION_MACRO` function, you can simply use `M(n)` to access macro *n* - *n* will get passed into the `action_get_macro` as the `id`, and you can use a switch statement to trigger it. This gets called on the keydown and keyup, so you'll need to use an if statement testing `record->event.pressed` (see keymap_default.c).
+Instead of using the `ACTION_MACRO` function, you can simply use `M(n)` to access macro *n* - *n* will get passed into the `action_get_macro` as the `id`, and you can use a switch statement to trigger it. This gets called on the keydown and keyup, so you'll need to use an if statement testing `record->event.pressed` (see keymaps/default.c).
```c
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is.
@@ -171,10 +171,10 @@ Depending on which keymap you would like to use, you will have to compile slight
To build with the default keymap, simply run `make`.
### Other Keymaps
-Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document (you can find in top README.md) and existent keymap files.
+Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `<name>.c` and see keymap document (you can find in top README.md) and existent keymap files.
To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like:
```
$ make KEYMAP=[default|jack|<name>]
```
-Keymaps follow the format **__keymap\_\<name\>.c__** and are stored in the `keymaps` folder. \ No newline at end of file
+Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder. \ No newline at end of file
diff --git a/quantum/template/config.h b/quantum/template/config.h
index 9afedbcc07..7d6149f436 100644
--- a/quantum/template/config.h
+++ b/quantum/template/config.h
@@ -29,14 +29,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DESCRIPTION A custom keyboard
/* key matrix size */
-#define MATRIX_ROWS 4
-#define MATRIX_COLS 12
+#define MATRIX_ROWS 2
+#define MATRIX_COLS 3
// Planck PCB default pin-out
// Change this to how you wired your keyboard
// COLS: Left to right, ROWS: Top to bottom
-#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }
-#define ROWS (int []){ D0, D5, B5, B6 }
+#define COLS (int []){ F1, F0, B0 }
+#define ROWS (int []){ D0, D5 }
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
diff --git a/quantum/template/keymaps/keymap_default.c b/quantum/template/keymaps/keymap_default.c
deleted file mode 100644
index 1e6684da7b..0000000000
--- a/quantum/template/keymaps/keymap_default.c
+++ /dev/null
@@ -1,66 +0,0 @@
-// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
-// this is the style you want to emulate.
-
-#include "%KEYBOARD%.h"
-
-// Each layer gets a name for readability, which is then used in the keymap matrix below.
-// The underscores don't mean anything - you can have a layer called STUFF or any other name.
-// Layer names don't all need to be of the same length, obviously, and you can also skip them
-// entirely and just use numbers.
-#define _QW 0
-#define _CM 1
-#define _DV 2
-#define _LW 3
-#define _RS 4
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-[_QW] = { /* Qwerty */
- {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
- {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
- {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
- {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
-},
-[_CM] = { /* Colemak */
- {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
- {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
- {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
- {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
-},
-[_DV] = { /* Dvorak */
- {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
- {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
- {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
- {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
-},
-[_RS] = { /* RAISE */
- {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
- {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
- {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
- {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
-},
-[_LW] = { /* LOWER */
- {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
- {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
- {KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
- {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
-}
-};
-
-const uint16_t PROGMEM fn_actions[] = {
-
-};
-
-const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
-{
- // MACRODOWN only works in this function
- switch(id) {
- case 0:
- if (record->event.pressed) {
- register_code(KC_RSFT);
- } else {
- unregister_code(KC_RSFT);
- }
- break;
- }
- return MACRO_NONE;
-};
diff --git a/quantum/template/template.h b/quantum/template/template.h
index de3edf3242..d4d78e4c91 100644
--- a/quantum/template/template.h
+++ b/quantum/template/template.h
@@ -11,16 +11,12 @@
// The first section contains all of the arguements
// The second converts the arguments into a two-dimensional array
#define KEYMAP( \
- k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
- k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
- k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
- k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \
+ k00, k01, k02, \
+ k10, k11, \
) \
{ \
- { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
- { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
- { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
- { k30, k31, k32, k33, k34, k35, k35, k37, k38, k39, k3a, k3b } \
+ { k00, k01, k02 }, \
+ { k10, KC_NO, k11 }, \
}
void * matrix_init_user(void);
diff --git a/quantum/wave.h b/quantum/wave.h
new file mode 100644
index 0000000000..6ebc348519
--- /dev/null
+++ b/quantum/wave.h
@@ -0,0 +1,265 @@
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <avr/pgmspace.h>
+
+#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,0x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,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,0x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18,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
+}; \ No newline at end of file