diff options
Diffstat (limited to 'keyboard')
| -rw-r--r-- | keyboard/planck/Makefile | 7 | ||||
| -rw-r--r-- | keyboard/planck/keymaps/keymap_default.c | 8 | ||||
| -rw-r--r-- | keyboard/planck/keymaps/keymap_lock.c | 60 | ||||
| -rw-r--r-- | keyboard/planck/planck.h | 4 |
4 files changed, 25 insertions, 54 deletions
diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index fdf8c1640..7b06446d7 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile | |||
| @@ -50,8 +50,7 @@ TMK_DIR = ../../tmk_core | |||
| 50 | TARGET_DIR = . | 50 | TARGET_DIR = . |
| 51 | 51 | ||
| 52 | # # project specific files | 52 | # # project specific files |
| 53 | SRC = planck.c \ | 53 | SRC = planck.c |
| 54 | backlight.c | ||
| 55 | 54 | ||
| 56 | ifdef KEYMAP | 55 | ifdef KEYMAP |
| 57 | SRC := keymaps/keymap_$(KEYMAP).c $(SRC) | 56 | SRC := keymaps/keymap_$(KEYMAP).c $(SRC) |
| @@ -124,9 +123,13 @@ COMMAND_ENABLE = yes # Commands for debug and configuration | |||
| 124 | # NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 123 | # NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
| 125 | # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | 124 | # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality |
| 126 | MIDI_ENABLE = YES # MIDI controls | 125 | MIDI_ENABLE = YES # MIDI controls |
| 126 | AUDIO_ENABLE = YES # Audio output on port C6 | ||
| 127 | # UNICODE_ENABLE = YES # Unicode | 127 | # UNICODE_ENABLE = YES # Unicode |
| 128 | # BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID | 128 | # BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID |
| 129 | 129 | ||
| 130 | ifdef BACKLIGHT_ENABLE | ||
| 131 | SRC += backlight.c | ||
| 132 | endif | ||
| 130 | 133 | ||
| 131 | # Optimize size but this may cause error "relocation truncated to fit" | 134 | # Optimize size but this may cause error "relocation truncated to fit" |
| 132 | #EXTRALDFLAGS = -Wl,--relax | 135 | #EXTRALDFLAGS = -Wl,--relax |
diff --git a/keyboard/planck/keymaps/keymap_default.c b/keyboard/planck/keymaps/keymap_default.c index 49670dafd..a9c2a0681 100644 --- a/keyboard/planck/keymaps/keymap_default.c +++ b/keyboard/planck/keymaps/keymap_default.c | |||
| @@ -2,7 +2,9 @@ | |||
| 2 | // this is the style you want to emulate. | 2 | // this is the style you want to emulate. |
| 3 | 3 | ||
| 4 | #include "planck.h" | 4 | #include "planck.h" |
| 5 | #include "backlight.h" | 5 | #ifdef BACKLIGHT_ENABLE |
| 6 | #include "backlight.h" | ||
| 7 | #endif | ||
| 6 | 8 | ||
| 7 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | 9 | // Each layer gets a name for readability, which is then used in the keymap matrix below. |
| 8 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | 10 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. |
| @@ -58,7 +60,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | |||
| 58 | case 0: | 60 | case 0: |
| 59 | if (record->event.pressed) { | 61 | if (record->event.pressed) { |
| 60 | register_code(KC_RSFT); | 62 | register_code(KC_RSFT); |
| 61 | backlight_step(); | 63 | #ifdef BACKLIGHT_ENABLE |
| 64 | backlight_step(); | ||
| 65 | #endif | ||
| 62 | } else { | 66 | } else { |
| 63 | unregister_code(KC_RSFT); | 67 | unregister_code(KC_RSFT); |
| 64 | } | 68 | } |
diff --git a/keyboard/planck/keymaps/keymap_lock.c b/keyboard/planck/keymaps/keymap_lock.c index 7a99b57c9..0deb212cc 100644 --- a/keyboard/planck/keymaps/keymap_lock.c +++ b/keyboard/planck/keymaps/keymap_lock.c | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | #include "keymap_common.h" | 1 | #include "keymap_common.h" |
| 2 | // #include "backlight.h" | 2 | #ifdef BACKLIGHT_ENABLE |
| 3 | #include "backlight.h" | ||
| 4 | #endif | ||
| 3 | #include "action_layer.h" | 5 | #include "action_layer.h" |
| 4 | #include "keymap_midi.h" | 6 | #include "keymap_midi.h" |
| 5 | #include "beeps.h" | 7 | #include "audio.h" |
| 6 | #include <avr/boot.h> | 8 | #include <avr/boot.h> |
| 7 | 9 | ||
| 8 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 10 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| @@ -86,7 +88,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | |||
| 86 | play_notes(&walk_up, 3, false); | 88 | play_notes(&walk_up, 3, false); |
| 87 | // play_note(440, 20); | 89 | // play_note(440, 20); |
| 88 | // register_code(KC_RSFT); | 90 | // register_code(KC_RSFT); |
| 89 | // backlight_set(BACKLIGHT_LEVELS); | 91 | #ifdef BACKLIGHT_ENABLE |
| 92 | backlight_set(BACKLIGHT_LEVELS); | ||
| 93 | #endif | ||
| 90 | default_layer_and(0); | 94 | default_layer_and(0); |
| 91 | default_layer_or((1<<5)); | 95 | default_layer_or((1<<5)); |
| 92 | 96 | ||
| @@ -118,17 +122,14 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | |||
| 118 | // register_code(hextokeycode((lock & 0x0F))); | 122 | // register_code(hextokeycode((lock & 0x0F))); |
| 119 | // unregister_code(hextokeycode((lock & 0x0F))); | 123 | // unregister_code(hextokeycode((lock & 0x0F))); |
| 120 | 124 | ||
| 121 | // note(0+12, 20); | ||
| 122 | // note(0+24, 20); | ||
| 123 | } else { | 125 | } else { |
| 124 | unregister_code(KC_RSFT); | 126 | unregister_code(KC_RSFT); |
| 125 | play_notes(&walk_dn, 3, false); | 127 | play_notes(&walk_dn, 3, false); |
| 126 | // backlight_set(0); | 128 | #ifdef BACKLIGHT_ENABLE |
| 129 | backlight_set(0); | ||
| 130 | #endif | ||
| 127 | default_layer_and(0); | 131 | default_layer_and(0); |
| 128 | default_layer_or(0); | 132 | default_layer_or(0); |
| 129 | // note(0+24, 20); | ||
| 130 | // note(0, 20); | ||
| 131 | // play_note(4, 20); | ||
| 132 | } | 133 | } |
| 133 | break; | 134 | break; |
| 134 | } | 135 | } |
| @@ -149,44 +150,5 @@ float start_up[][2] = { | |||
| 149 | 150 | ||
| 150 | void * matrix_init_user(void) { | 151 | void * matrix_init_user(void) { |
| 151 | init_notes(); | 152 | init_notes(); |
| 152 | |||
| 153 | play_notes(&start_up, 9, false); | 153 | play_notes(&start_up, 9, false); |
| 154 | // play_note(((double)261.6*3)*pow(2.0,(36)/12.0), 0xF); | 154 | } \ No newline at end of file |
| 155 | // _delay_ms(50); | ||
| 156 | |||
| 157 | // play_note(((double)261.6*3)*pow(2.0,(48)/12.0), 0xF); | ||
| 158 | // _delay_ms(25); | ||
| 159 | // stop_note(((double)261.6*3)*pow(2.0,(48)/12.0)); | ||
| 160 | |||
| 161 | // play_note(((double)261.6*3)*pow(2.0,(48)/12.0), 0xF); | ||
| 162 | // _delay_ms(25); | ||
| 163 | // stop_note(((double)261.6*3)*pow(2.0,(48)/12.0)); | ||
| 164 | |||
| 165 | |||
| 166 | // stop_note(((double)261.6*3)*pow(2.0,(36)/12.0)); | ||
| 167 | |||
| 168 | |||
| 169 | // play_note(((double)261.6*3)*pow(2.0,(62)/12.0), 0xF); | ||
| 170 | // _delay_ms(50); | ||
| 171 | // stop_note(((double)261.6*3)*pow(2.0,(62)/12.0)); | ||
| 172 | |||
| 173 | |||
| 174 | // play_note(((double)261.6*3)*pow(2.0,(64)/12.0), 0xF); | ||
| 175 | // _delay_ms(50); | ||
| 176 | // stop_note(((double)261.6*3)*pow(2.0,(64)/12.0)); | ||
| 177 | |||
| 178 | } | ||
| 179 | |||
| 180 | |||
| 181 | // void * matrix_scan_user(void) { | ||
| 182 | // if (layer_state & (1<<2)) { | ||
| 183 | // if (!playing_notes) | ||
| 184 | // play_notes(&start_up, 9, true); | ||
| 185 | // } else if (layer_state & (1<<3)) { | ||
| 186 | // if (!playing_notes) | ||
| 187 | // play_notes(&start_up, 9, true); | ||
| 188 | // } else { | ||
| 189 | // if (playing_notes) | ||
| 190 | // stop_all_notes(); | ||
| 191 | // } | ||
| 192 | // } \ No newline at end of file | ||
diff --git a/keyboard/planck/planck.h b/keyboard/planck/planck.h index 32c08f3b0..e775ea7c6 100644 --- a/keyboard/planck/planck.h +++ b/keyboard/planck/planck.h | |||
| @@ -3,7 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | #include "matrix.h" | 4 | #include "matrix.h" |
| 5 | #include "keymap_common.h" | 5 | #include "keymap_common.h" |
| 6 | // #include "backlight.h" | 6 | #ifdef BACKLIGHT_ENABLE |
| 7 | #include "backlight.h" | ||
| 8 | #endif | ||
| 7 | #include <stddef.h> | 9 | #include <stddef.h> |
| 8 | #ifdef MIDI_ENABLE | 10 | #ifdef MIDI_ENABLE |
| 9 | #include <keymap_midi.h> | 11 | #include <keymap_midi.h> |
