summaryrefslogtreecommitdiffstats
path: root/keyboards/z12
diff options
context:
space:
mode:
authorSergi Meseguer <zigotica@gmail.com>2021-10-16 04:02:04 +0200
committerGitHub <noreply@github.com>2021-10-15 19:02:04 -0700
commit40badc4413d97226398302fb7a84c83c5c4f03a8 (patch)
tree521c1f8ccf8aa355b4ad1671425b96283e8abbd7 /keyboards/z12
parentb0d293a841977d393c81bef443f7e28f7764ee30 (diff)
[Keymap] zigotica userspace (#14670)
Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/z12')
-rw-r--r--keyboards/z12/keymaps/zigotica/config.h30
-rw-r--r--keyboards/z12/keymaps/zigotica/encoder.c114
-rw-r--r--keyboards/z12/keymaps/zigotica/encoder.h18
-rw-r--r--keyboards/z12/keymaps/zigotica/keymap.c126
-rw-r--r--keyboards/z12/keymaps/zigotica/oled.c43
-rw-r--r--keyboards/z12/keymaps/zigotica/oled.h18
-rw-r--r--keyboards/z12/keymaps/zigotica/rules.mk4
-rw-r--r--keyboards/z12/z12.c18
8 files changed, 354 insertions, 17 deletions
diff --git a/keyboards/z12/keymaps/zigotica/config.h b/keyboards/z12/keymaps/zigotica/config.h
new file mode 100644
index 0000000000..fbab76d5f0
--- /dev/null
+++ b/keyboards/z12/keymaps/zigotica/config.h
@@ -0,0 +1,30 @@
+/* Copyright 2020 Sergi Meseguer <zigotica@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 "config_common.h"
+
+#ifdef OLED_ENABLE
+ #define OLED_DISPLAY_128X32
+#endif
+
+// EC11 encoders' resolution.
+// Reduce the value to 2 if you feel missing values:
+#define ENCODER_RESOLUTION 4
+
+// Allows correct registered values by rotary encoder:
+#define TAP_CODE_DELAY 10
diff --git a/keyboards/z12/keymaps/zigotica/encoder.c b/keyboards/z12/keymaps/zigotica/encoder.c
new file mode 100644
index 0000000000..49a3d859b6
--- /dev/null
+++ b/keyboards/z12/keymaps/zigotica/encoder.c
@@ -0,0 +1,114 @@
+/* Copyright 2020 Sergi Meseguer <zigotica@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/>.
+*/
+
+#include "zigotica.h"
+
+bool encoder_update_user(uint8_t index, bool clockwise) {
+ switch(get_highest_layer(layer_state)){
+ case _VIM:
+ if (index == 0) { // LEFT
+ // Cycle through buffers
+ if (clockwise) {
+ register_code(KC_ESC);
+ SEND_STRING(":bprevious");
+ register_code(KC_ENT);
+ unregister_code(KC_ESC);
+ unregister_code(KC_ENT);
+ } else {
+ register_code(KC_ESC);
+ SEND_STRING(":bnext");
+ register_code(KC_ENT);
+ unregister_code(KC_ESC);
+ unregister_code(KC_ENT);
+ }
+ } else { // RIGHT
+ // Scroll
+ if (clockwise) {
+ tap_code(KC_PGDN);
+ } else {
+ tap_code(KC_PGUP);
+ }
+ }
+ break;
+ case _BROWSER:
+ if (index == 0) { // LEFT
+ // Cycle through Tabs
+ if (clockwise) {
+ tap_code16(C(KC_TAB));
+ /* register_code16(G(KC_RCBR)); */
+ /* unregister_code16(G(KC_RCBR)); */
+ } else {
+ tap_code16(S(C(KC_TAB)));
+ /* register_code16(G(KC_LCBR)); */
+ /* unregister_code16(G(KC_LCBR)); */
+ }
+ } else { // RIGHT
+ // Scroll up/down
+ if (clockwise) {
+ register_code(KC_WH_U);
+ unregister_code(KC_WH_U);
+ } else {
+ register_code(KC_WH_D);
+ unregister_code(KC_WH_D);
+ }
+ }
+ break;
+ case _FIGMA:
+ if (index == 0) { // LEFT
+ // Volume control.
+ if (clockwise) {
+ tap_code(KC_VOLU);
+ } else {
+ tap_code(KC_VOLD);
+ }
+ } else { // RIGHT
+ // Zoom in/out
+ if (clockwise) {
+ register_code(KC_LGUI);
+ register_code(KC_WH_D);
+ unregister_code(KC_WH_D);
+ unregister_code(KC_LGUI);
+ } else {
+ register_code(KC_LGUI);
+ register_code(KC_WH_U);
+ unregister_code(KC_WH_U);
+ unregister_code(KC_LGUI);
+ }
+ }
+ break;
+ case _TERMINAL:
+ default:
+ if (index == 0) { // LEFT
+ // Volume control.
+ if (clockwise) {
+ tap_code(KC_VOLU);
+ } else {
+ tap_code(KC_VOLD);
+ }
+ } else { // RIGHT
+ // Scroll
+ if (clockwise) {
+ tap_code(KC_PGDN);
+ } else {
+ tap_code(KC_PGUP);
+ }
+ }
+ break;
+ }
+ return false;
+}
+
+
diff --git a/keyboards/z12/keymaps/zigotica/encoder.h b/keyboards/z12/keymaps/zigotica/encoder.h
new file mode 100644
index 0000000000..2422c68f28
--- /dev/null
+++ b/keyboards/z12/keymaps/zigotica/encoder.h
@@ -0,0 +1,18 @@
+/* Copyright 2020 Sergi Meseguer <zigotica@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 "zigotica.h"
diff --git a/keyboards/z12/keymaps/zigotica/keymap.c b/keyboards/z12/keymaps/zigotica/keymap.c
new file mode 100644
index 0000000000..7e969de96e
--- /dev/null
+++ b/keyboards/z12/keymaps/zigotica/keymap.c
@@ -0,0 +1,126 @@
+/* Copyright 2020
+ Sergi Meseguer <zigotica@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/>.
+*/
+
+#include "zigotica.h"
+
+// Custom Keycodes
+#define MODE_1 TO(_TERMINAL)
+#define MODE_2 TO(_FIGMA)
+#define MODE_3 TO(_BROWSER)
+#define MODE_4 TO(_VIM)
+
+enum custom_keycodes {
+ VIM_SIP = SAFE_RANGE
+};
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case VIM_SIP:
+ if (record->event.pressed) {
+ register_code(KC_ESC);
+ SEND_STRING(":Ag ");
+ } else {
+ // released
+ unregister_code(KC_ESC);
+ }
+ break;
+ }
+ return true;
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/*
+ * TERMINAL Layer
+ *
+ * ,-----------------------------.
+ * | | TERM | FIGM | |
+ * |-------+------+------+-------|
+ * | VOL | BROW | VIM | SCROLL|
+ * |-------+------+------+-------|
+ * |-------+-------+-------|
+ * | MEDIA | o | o |
+ * |-------+-------+-------|
+ * | o | o | o |
+ * |-------+-------+-------|
+ */
+ [_TERMINAL] = LAYOUT(
+ MODE_1, MODE_2,
+ ZK_MEDIA, MODE_3, MODE_4, _______,
+ _______, _______, _______,
+ _______, _______, _______
+ ),
+/*
+ * VIM Layer
+ *
+ * ,-----------------------------.
+ * | | TERM | FIGM | |
+ * |-------+------+------+-------|
+ * |BUFFER | BROW | VIM | SCROLL|
+ * |-------+------+------+-------|
+ * |-------+-------+-------|
+ * |SEARCH | o | o |
+ * |-------+-------+-------|
+ * | o | o | o |
+ * |-------+-------+-------|
+ */
+ [_VIM] = LAYOUT(
+ _______, _______,
+ _______, _______, _______, _______,
+ VIM_SIP, _______, _______,
+ _______, _______, _______
+ ),
+/*
+ * FIGMA Layer
+ *
+ * ,-----------------------------.
+ * | | TERM | FIGM | |
+ * |-------+------+------+-------|
+ * | VOL | BROW | VIM | ZOOM |
+ * |-------+------+------+-------|
+ * |-------+-------+-------|
+ * | ZOOM | GRIDS | FULL |
+ * |-------+-------+-------|
+ * | o | o | o |
+ * |-------+-------+-------|
+ */
+ [_FIGMA] = LAYOUT(
+ _______, _______,
+ _______, _______, _______, _______,
+ LSFT(KC_1), LCTL(KC_G), LGUI(KC_BSLS),
+ _______, _______, _______
+ ),
+/*
+ * BROWSER Layer
+ *
+ * ,-----------------------------.
+ * | | TERM | FIGM | |
+ * |-------+------+------+-------|
+ * | TABS | BROW | VIM | SCROLL|
+ * |-------+------+------+-------|
+ * |-------+-------+-------|
+ * |SEARCH | BOOKM | DEVTL |
+ * |-------+-------+-------|
+ * | o | o | o |
+ * |-------+-------+-------|
+ */
+ [_BROWSER] = LAYOUT(
+ _______, _______,
+ _______, _______, _______, _______,
+ G(KC_F), G(KC_D), G(A(KC_I)),
+ _______, _______, _______
+ ),
+};
diff --git a/keyboards/z12/keymaps/zigotica/oled.c b/keyboards/z12/keymaps/zigotica/oled.c
new file mode 100644
index 0000000000..4b428a42b1
--- /dev/null
+++ b/keyboards/z12/keymaps/zigotica/oled.c
@@ -0,0 +1,43 @@
+/* Copyright 2020 Sergi Meseguer <zigotica@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/>.
+*/
+
+#include "zigotica.h"
+
+static void render_status(void) {
+ oled_write_P(PSTR("z12 v1.0\n"), false);
+ oled_write_P(PSTR("Layer: "), false);
+ switch (get_highest_layer(layer_state)) {
+ case _VIM:
+ oled_write_P(PSTR("VIM\n\nBUFFER SCROLL"), false);
+ break;
+ case _FIGMA:
+ oled_write_P(PSTR("FIGMA\n\nVOLUME ZOOM"), false);
+ break;
+ case _BROWSER:
+ oled_write_P(PSTR("BROWSER\n\nTABS SCROLL"), false);
+ break;
+ case _TERMINAL:
+ oled_write_P(PSTR("TERMINAL\n\nVOLUME SCROLL"), false);
+ break;
+ default:
+ oled_write_P(PSTR("Undef\n"), false);
+ }
+}
+
+void oled_task_user(void) {
+ render_status();
+}
+
diff --git a/keyboards/z12/keymaps/zigotica/oled.h b/keyboards/z12/keymaps/zigotica/oled.h
new file mode 100644
index 0000000000..2422c68f28
--- /dev/null
+++ b/keyboards/z12/keymaps/zigotica/oled.h
@@ -0,0 +1,18 @@
+/* Copyright 2020 Sergi Meseguer <zigotica@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 "zigotica.h"
diff --git a/keyboards/z12/keymaps/zigotica/rules.mk b/keyboards/z12/keymaps/zigotica/rules.mk
new file mode 100644
index 0000000000..02e37aa80b
--- /dev/null
+++ b/keyboards/z12/keymaps/zigotica/rules.mk
@@ -0,0 +1,4 @@
+OLED_ENABLE = yes # Enables the use of OLED displays
+RAW_ENABLE = yes
+TAP_DANCE_ENABLE = yes
+MOUSEKEY_ENABLE = yes
diff --git a/keyboards/z12/z12.c b/keyboards/z12/z12.c
index 99fe62ab93..2af8836cab 100644
--- a/keyboards/z12/z12.c
+++ b/keyboards/z12/z12.c
@@ -18,22 +18,6 @@
#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
- if (!encoder_update_user(index, clockwise)) { return false; }
- if (index == 0) { // LEFT
- // Scroll
- if (clockwise) {
- tap_code_delay(KC_PGDN, 10);
- } else {
- tap_code_delay(KC_PGUP, 10);
- }
- } else { // RIGHT
- // Volume control.
- if (clockwise) {
- tap_code_delay(KC_VOLU, 10);
- } else {
- tap_code_delay(KC_VOLD, 10);
- }
- }
- return false;
+ return encoder_update_user(index, clockwise);
}
#endif