summaryrefslogtreecommitdiff
path: root/keyboards/nack/keymaps/pastapojken/keymap.h
diff options
context:
space:
mode:
authorpastapojken <6597735+pastapojken@users.noreply.github.com>2020-11-18 17:56:59 +0100
committerGitHub <noreply@github.com>2020-11-18 16:56:59 +0000
commitad5cbe59820ac1f9922f2db2d6d1e7f2a8f50519 (patch)
tree57048e17a912a17724b9e1305d528a5be37813cd /keyboards/nack/keymaps/pastapojken/keymap.h
parent58f2e0439eb372eecaa2e8e2788bb67969e95e16 (diff)
Added new keyboard - nack (#10940)
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/nack/keymaps/pastapojken/keymap.h')
-rw-r--r--keyboards/nack/keymaps/pastapojken/keymap.h122
1 files changed, 122 insertions, 0 deletions
diff --git a/keyboards/nack/keymaps/pastapojken/keymap.h b/keyboards/nack/keymaps/pastapojken/keymap.h
new file mode 100644
index 0000000000..aaeed70706
--- /dev/null
+++ b/keyboards/nack/keymaps/pastapojken/keymap.h
@@ -0,0 +1,122 @@
+/* Copyright 2020 pastapojken <pastapojken@gmail.com>
+ *
+ * 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
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+#include "quantum.h"
+
+#define TAPPING_TOGGLE 2
+
+#ifdef AUDIO_ENABLE
+ #define STARTUP_SONG SONG(NO_SOUND)
+#endif
+
+void add_to_prev(uint16_t kc);
+void unreg_prev(void);
+void timer_timeout_keymap(void);
+bool process_record_user(uint16_t keycode, keyrecord_t *record);
+
+// Normal shift status
+#define SHIFT_NORM(kc1, kc2) \
+if (record->event.pressed) { \
+ timer_timeout_keymap(); \
+ if (lshift) { \
+ register_code(KC_LSFT); \
+ unregister_code(kc2); \
+ register_code(kc2); \
+ add_to_prev(kc2); \
+ } else { \
+ unregister_code(KC_LSFT); \
+ unregister_code(kc1); \
+ register_code(kc1); \
+ } \
+} else { \
+ unregister_code(kc1); \
+ unregister_code(kc2); \
+} \
+return false;
+
+// Always shifted
+#define SHIFT_ALL(kc1, kc2) \
+if (record->event.pressed) { \
+ timer_timeout_keymap(); \
+ register_code(KC_LSFT); \
+ if (lshift) { \
+ unregister_code(kc2); \
+ register_code(kc2); \
+ add_to_prev(kc2); \
+ } else { \
+ unregister_code(kc1); \
+ register_code(kc1); \
+ add_to_prev(kc1); \
+ } \
+} else { \
+ unregister_code(kc1); \
+ unregister_code(kc2); \
+ unreg_prev(); \
+ if (lshift) \
+ register_code(KC_LSFT); \
+ else \
+ unregister_code(KC_LSFT); \
+} \
+return false;
+
+// Never shifted
+#define SHIFT_NO(kc1, kc2) \
+if (record->event.pressed) { \
+ timer_timeout_keymap(); \
+ unregister_code(KC_LSFT); \
+ if (lshift) { \
+ unregister_code(kc2); \
+ register_code(kc2); \
+ add_to_prev(kc2); \
+ } else { \
+ unregister_code(kc1); \
+ register_code(kc1); \
+ } \
+} else { \
+ unregister_code(kc1); \
+ unregister_code(kc2); \
+ unreg_prev(); \
+ if (lshift) \
+ register_code(KC_LSFT); \
+ else \
+ unregister_code(KC_LSFT); \
+} \
+return false;
+
+//Never RALT
+#define RALT_NO(kc1, kc2) \
+if (record->event.pressed) { \
+ timer_timeout_keymap(); \
+ unregister_code(KC_RALT); \
+ if (ralt) { \
+ unregister_code(kc2); \
+ register_code(kc2); \
+ add_to_prev(kc2); \
+ } else { \
+ unregister_code(kc1); \
+ register_code(kc1); \
+ } \
+} else { \
+ unregister_code(kc1); \
+ unregister_code(kc2); \
+ unreg_prev(); \
+ if (ralt) \
+ register_code(KC_RALT); \
+ else \
+ unregister_code(KC_RALT); \
+} \
+return false;