diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2018-07-16 11:48:31 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-16 11:48:31 -0400 |
| commit | ade22f8e2c272044ea2f80ff6fe5ca9576858939 (patch) | |
| tree | 03c0131fa5982afc10a60e1fdd38a60be750291b /quantum/process_keycode | |
| parent | 96cb9f4661faa80e795b1e6731b7a8e8a50bd0cb (diff) | |
| download | qmk_firmware-ade22f8e2c272044ea2f80ff6fe5ca9576858939.tar.gz qmk_firmware-ade22f8e2c272044ea2f80ff6fe5ca9576858939.zip | |
Adds support for Planck Rev 6 (#2666)
* initial files for rev 6 with encoder
* music map init, dip scan added
* adds ws2812 driver for arm
* flesh out dip and encoder support
* adds default encoder res
* adds default encoder res
* start muse implementation
* muse working with encoder as control
* flip direction
* try mouse wheel again
* dont break other revs
* dont break other revs
* conditional autio
* pwm ws driver (not working)
* update build includes for chibios
* update ws2812 driver/config
* last commit for glasser code
* working example
* remove rgb for now
* finish up rev6
* working encoder keycodes
* add warnings to planck keymaps about the LAYOUT
Diffstat (limited to 'quantum/process_keycode')
| -rw-r--r-- | quantum/process_keycode/process_audio.c | 4 | ||||
| -rw-r--r-- | quantum/process_keycode/process_audio.h | 4 | ||||
| -rw-r--r-- | quantum/process_keycode/process_music.c | 31 | ||||
| -rw-r--r-- | quantum/process_keycode/process_music.h | 5 |
4 files changed, 29 insertions, 15 deletions
diff --git a/quantum/process_keycode/process_audio.c b/quantum/process_keycode/process_audio.c index e9b20512e..0a25aa535 100644 --- a/quantum/process_keycode/process_audio.c +++ b/quantum/process_keycode/process_audio.c | |||
| @@ -10,9 +10,7 @@ float voice_change_song[][2] = VOICE_CHANGE_SONG; | |||
| 10 | #define PITCH_STANDARD_A 440.0f | 10 | #define PITCH_STANDARD_A 440.0f |
| 11 | #endif | 11 | #endif |
| 12 | 12 | ||
| 13 | 13 | float compute_freq_for_midi_note(uint8_t note) | |
| 14 | |||
| 15 | static float compute_freq_for_midi_note(uint8_t note) | ||
| 16 | { | 14 | { |
| 17 | // https://en.wikipedia.org/wiki/MIDI_tuning_standard | 15 | // https://en.wikipedia.org/wiki/MIDI_tuning_standard |
| 18 | return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A; | 16 | return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A; |
diff --git a/quantum/process_keycode/process_audio.h b/quantum/process_keycode/process_audio.h index 7ac15b733..3a84c3d86 100644 --- a/quantum/process_keycode/process_audio.h +++ b/quantum/process_keycode/process_audio.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef PROCESS_AUDIO_H | 1 | #ifndef PROCESS_AUDIO_H |
| 2 | #define PROCESS_AUDIO_H | 2 | #define PROCESS_AUDIO_H |
| 3 | 3 | ||
| 4 | float compute_freq_for_midi_note(uint8_t note); | ||
| 5 | |||
| 4 | bool process_audio(uint16_t keycode, keyrecord_t *record); | 6 | bool process_audio(uint16_t keycode, keyrecord_t *record); |
| 5 | void process_audio_noteon(uint8_t note); | 7 | void process_audio_noteon(uint8_t note); |
| 6 | void process_audio_noteoff(uint8_t note); | 8 | void process_audio_noteoff(uint8_t note); |
| @@ -8,4 +10,4 @@ void process_audio_all_notes_off(void); | |||
| 8 | 10 | ||
| 9 | void audio_on_user(void); | 11 | void audio_on_user(void); |
| 10 | 12 | ||
| 11 | #endif \ No newline at end of file | 13 | #endif |
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c index 742bb08b1..697aa237f 100644 --- a/quantum/process_keycode/process_music.c +++ b/quantum/process_keycode/process_music.c | |||
| @@ -197,17 +197,26 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { | |||
| 197 | } | 197 | } |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | uint8_t note; | 200 | uint8_t note = 36; |
| 201 | if (music_mode == MUSIC_MODE_CHROMATIC) | 201 | #ifdef MUSIC_MAP |
| 202 | note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.row); | 202 | if (music_mode == MUSIC_MODE_CHROMATIC) { |
| 203 | else if (music_mode == MUSIC_MODE_GUITAR) | 203 | note = music_starting_note + music_offset + 36 + music_map[record->event.key.row][record->event.key.col]; |
| 204 | note = (music_starting_note + record->event.key.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.row); | 204 | } else { |
| 205 | else if (music_mode == MUSIC_MODE_VIOLIN) | 205 | uint8_t position = music_map[record->event.key.row][record->event.key.col]; |
| 206 | note = (music_starting_note + record->event.key.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.row); | 206 | note = music_starting_note + music_offset + 36 + SCALE[position % 12] + (position / 12)*12; |
| 207 | else if (music_mode == MUSIC_MODE_MAJOR) | 207 | } |
| 208 | note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.row); | 208 | #else |
| 209 | else | 209 | if (music_mode == MUSIC_MODE_CHROMATIC) |
| 210 | note = music_starting_note; | 210 | note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.row); |
| 211 | else if (music_mode == MUSIC_MODE_GUITAR) | ||
| 212 | note = (music_starting_note + record->event.key.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.row); | ||
| 213 | else if (music_mode == MUSIC_MODE_VIOLIN) | ||
| 214 | note = (music_starting_note + record->event.key.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.row); | ||
| 215 | else if (music_mode == MUSIC_MODE_MAJOR) | ||
| 216 | note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.row); | ||
| 217 | else | ||
| 218 | note = music_starting_note; | ||
| 219 | #endif | ||
| 211 | 220 | ||
| 212 | if (record->event.pressed) { | 221 | if (record->event.pressed) { |
| 213 | music_noteon(note); | 222 | music_noteon(note); |
diff --git a/quantum/process_keycode/process_music.h b/quantum/process_keycode/process_music.h index 8ccb7a3a5..f6753d4f2 100644 --- a/quantum/process_keycode/process_music.h +++ b/quantum/process_keycode/process_music.h | |||
| @@ -29,6 +29,11 @@ enum music_modes { | |||
| 29 | NUMBER_OF_MODES | 29 | NUMBER_OF_MODES |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | |||
| 33 | #ifdef MUSIC_MAP | ||
| 34 | extern const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS]; | ||
| 35 | #endif | ||
| 36 | |||
| 32 | bool process_music(uint16_t keycode, keyrecord_t *record); | 37 | bool process_music(uint16_t keycode, keyrecord_t *record); |
| 33 | 38 | ||
| 34 | bool is_music_on(void); | 39 | bool is_music_on(void); |
