diff options
author | IBNobody <IBNobody@users.noreply.github.com> | 2016-05-03 12:56:40 -0500 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2016-05-03 13:56:40 -0400 |
commit | 83e1cc241e3aabd69f6cdcd2581477d4b85bb8d3 (patch) | |
tree | fd0c9714f93e1afec478ddc42a86a6823136ad5f /keyboard/atomic | |
parent | 2c070163ffffffde546fb00acaa2fbb96b93da64 (diff) |
Clarified audio.c (#302)
* Updated personal layouts
* tweaked personal
* Nightly - Audio Cleanup
Refactored the LUTs. Abstracted some of the registers out of audio to
use more functional names. Split audio into audio and audio_pwm. WIP
* nightly - collapsed code
* Added check for note playing to LEDs
Diffstat (limited to 'keyboard/atomic')
-rw-r--r-- | keyboard/atomic/keymaps/pvc/config.h | 5 | ||||
-rw-r--r-- | keyboard/atomic/keymaps/pvc/keymap.c | 107 |
2 files changed, 60 insertions, 52 deletions
diff --git a/keyboard/atomic/keymaps/pvc/config.h b/keyboard/atomic/keymaps/pvc/config.h index cc92634646..034bc5dc5c 100644 --- a/keyboard/atomic/keymaps/pvc/config.h +++ b/keyboard/atomic/keymaps/pvc/config.h @@ -158,4 +158,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION + +//#define VIBRATO_ENABLE +//#define VIBRATO_STRENGTH_ENABLE + + #endif diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index e17c41e23d..3d604a868e 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -11,8 +11,8 @@ #define LAYER_QWERTY 0 #define LAYER_COLEMAK 1 #define LAYER_DVORAK 2 -#define LAYER_LOWER 3 -#define LAYER_RAISE 4 +#define LAYER_RAISE 3 +#define LAYER_LOWER 4 #define LAYER_FUNCTION 5 #define LAYER_MOUSE 6 #define LAYER_MUSIC 7 @@ -21,8 +21,8 @@ #define MACRO_QWERTY 0 #define MACRO_COLEMAK 1 #define MACRO_DVORAK 2 -#define MACRO_LOWER 3 -#define MACRO_RAISE 4 +#define MACRO_RAISE 3 +#define MACRO_LOWER 4 #define MACRO_FUNCTION 5 #define MACRO_MOUSE 6 #define MACRO_TIMBRE_1 7 @@ -42,8 +42,8 @@ #define M_QWRTY M(MACRO_QWERTY) #define M_COLMK M(MACRO_COLEMAK) #define M_DVORK M(MACRO_DVORAK) -#define M_LOWER M(MACRO_LOWER) #define M_RAISE M(MACRO_RAISE) +#define M_LOWER M(MACRO_LOWER) #define M_FUNCT M(MACRO_FUNCTION) #define M_MOUSE M(MACRO_MOUSE) #define TIMBR_1 M(MACRO_TIMBRE_1) @@ -148,23 +148,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, KC_SPC, M_LOWER, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT }, }, + [LAYER_RAISE] = { /* RAISED */ + { KC_TILD, KC_PSCR, KC_PAUS, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ________________ }, + { _______, KC_F1, KC_F2, KC_F3, KC_F4, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, + { _______, KC_F5, KC_F6, KC_F7, KC_F8, _______, _______, _______, _______, _______, _______, _______, ________________, KC_HOME }, + { _______, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______, _______, ________________, _______, KC_END }, + { _______, _______, _______, _______, _______, ________________, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, [LAYER_LOWER] = { /* LOWERED */ { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ________________ }, - { _______, _______, _______, _______, SC_CCLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, - { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, KC_HOME }, - { _______, SC_REDO, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, _______, KC_END }, + { _______, KC_F13, KC_F14, KC_F15, KC_F16, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, + { _______, KC_F17, KC_F18, KC_F19, KC_F20, _______, _______, _______, _______, _______, _______, _______, ________________, KC_HOME }, + { _______, KC_F21, KC_F22, KC_F23, KC_F24, _______, _______, _______, _______, _______, _______, ________________, _______, KC_END }, { _______, _______, _______, _______, _______, KC_BSPC, KC_BSPC, _______, _______, _______, _______, _______, _______, _______, _______ }, }, - [LAYER_RAISE] = { /* RAISED */ - { KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ________________ }, - { _______, _______, _______, _______, SC_ACLS, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS }, - { _______, SC_SELA, SC_SAVE, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, KC_HOME }, - { _______, SC_UNDO, SC_CUT, SC_COPY, SC_PSTE, _______, _______, _______, _______, _______, _______, ________________, _______, KC_END }, - { _______, _______, _______, _______, _______, ________________, _______, _______, _______, _______, _______, _______, _______, _______ }, - }, - [LAYER_FUNCTION] = { /* FUNCTION */ { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ________________ }, { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, _______, KC_PAUS }, @@ -281,28 +280,28 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } break; - case MACRO_LOWER: + case MACRO_RAISE: if (record->event.pressed) { - layer_on(LAYER_LOWER); + layer_on(LAYER_RAISE); update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); } else { - layer_off(LAYER_LOWER); + layer_off(LAYER_RAISE); update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); } break; - case MACRO_RAISE: + case MACRO_LOWER: if (record->event.pressed) { - layer_on(LAYER_RAISE); + layer_on(LAYER_LOWER); update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); } else { - layer_off(LAYER_RAISE); + layer_off(LAYER_LOWER); update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST); } break; @@ -468,36 +467,40 @@ void led_set_user(uint8_t usb_led) _delay_ms(10); // gets rid of tick - if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) - { - // If CAPS LK LED is turning on... - PLAY_NOTE_ARRAY(tone_caps_on, false, LEGATO); - } - else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) - { - // If CAPS LK LED is turning off... - PLAY_NOTE_ARRAY(tone_caps_off, false, LEGATO); - } - else if ((usb_led & (1<<USB_LED_NUM_LOCK)) && !(old_usb_led & (1<<USB_LED_NUM_LOCK))) - { - // If NUM LK LED is turning on... - PLAY_NOTE_ARRAY(tone_numlk_on, false, LEGATO); - } - else if (!(usb_led & (1<<USB_LED_NUM_LOCK)) && (old_usb_led & (1<<USB_LED_NUM_LOCK))) - { - // If NUM LED is turning off... - PLAY_NOTE_ARRAY(tone_numlk_off, false, LEGATO); - } - else if ((usb_led & (1<<USB_LED_SCROLL_LOCK)) && !(old_usb_led & (1<<USB_LED_SCROLL_LOCK))) - { - // If SCROLL LK LED is turning on... - PLAY_NOTE_ARRAY(tone_scroll_on, false, LEGATO); - } - else if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)) && (old_usb_led & (1<<USB_LED_SCROLL_LOCK))) - { - // If SCROLL LED is turning off... - PLAY_NOTE_ARRAY(tone_scroll_off, false, LEGATO); - } + if (!is_playing_notes()) + { + if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) + { + // If CAPS LK LED is turning on... + PLAY_NOTE_ARRAY(tone_caps_on, false, LEGATO); + } + else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) + { + // If CAPS LK LED is turning off... + PLAY_NOTE_ARRAY(tone_caps_off, false, LEGATO); + } + else if ((usb_led & (1<<USB_LED_NUM_LOCK)) && !(old_usb_led & (1<<USB_LED_NUM_LOCK))) + { + // If NUM LK LED is turning on... + PLAY_NOTE_ARRAY(tone_numlk_on, false, LEGATO); + } + else if (!(usb_led & (1<<USB_LED_NUM_LOCK)) && (old_usb_led & (1<<USB_LED_NUM_LOCK))) + { + // If NUM LED is turning off... + PLAY_NOTE_ARRAY(tone_numlk_off, false, LEGATO); + } + else if ((usb_led & (1<<USB_LED_SCROLL_LOCK)) && !(old_usb_led & (1<<USB_LED_SCROLL_LOCK))) + { + // If SCROLL LK LED is turning on... + PLAY_NOTE_ARRAY(tone_scroll_on, false, LEGATO); + } + else if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)) && (old_usb_led & (1<<USB_LED_SCROLL_LOCK))) + { + // If SCROLL LED is turning off... + PLAY_NOTE_ARRAY(tone_scroll_off, false, LEGATO); + } + } + old_usb_led = usb_led; } |