summaryrefslogtreecommitdiff
path: root/keyboards/pica40/rev1
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/pica40/rev1')
-rw-r--r--keyboards/pica40/rev1/config.h9
-rw-r--r--keyboards/pica40/rev1/info.json39
-rw-r--r--keyboards/pica40/rev1/rev1.c91
-rw-r--r--keyboards/pica40/rev1/rev1.h6
-rw-r--r--keyboards/pica40/rev1/rules.mk1
5 files changed, 146 insertions, 0 deletions
diff --git a/keyboards/pica40/rev1/config.h b/keyboards/pica40/rev1/config.h
new file mode 100644
index 0000000000..09c481a9ff
--- /dev/null
+++ b/keyboards/pica40/rev1/config.h
@@ -0,0 +1,9 @@
+// Copyright 2022 zzeneg (@zzeneg)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#ifdef RGBLIGHT_ENABLE
+# define RGBLIGHT_DISABLE_KEYCODES // disable keycodes for RGB Light controls, only status LED is supported
+# define PICA40_RGBLIGHT_TIMEOUT 5 // turn RGB off after N minutes
+#endif
diff --git a/keyboards/pica40/rev1/info.json b/keyboards/pica40/rev1/info.json
new file mode 100644
index 0000000000..8e4e64618d
--- /dev/null
+++ b/keyboards/pica40/rev1/info.json
@@ -0,0 +1,39 @@
+{
+ "processor": "atmega32u4",
+ "bootloader": "caterina",
+ "diode_direction": "COL2ROW",
+ "matrix_pins": {
+ "cols": ["D2", "B5", "B4", "E6", "D7"],
+ "rows": ["B1", "B3", "B2", "B6", "F4", "F5", "F6", "F7"]
+ },
+ "features": {
+ "bootmagic": true,
+ "command": false,
+ "console": false,
+ "mousekey": true,
+ "extrakey": true,
+ "encoder": true,
+ "oled": true,
+ "rgblight": true,
+ "nkro": true
+ },
+ "rgblight": {
+ "led_count": 1,
+ "pin": "D3",
+ "layers": {
+ "enabled": true,
+ "max": 3
+ }
+ },
+ "encoder": {
+ "rotary": [{ "pin_a": "C6", "pin_b": "D4" }]
+ },
+ "usb": {
+ "device_version": "1.0.0",
+ "pid": "0x0841",
+ "vid": "0xFEED"
+ },
+ "build": {
+ "lto": true
+ }
+}
diff --git a/keyboards/pica40/rev1/rev1.c b/keyboards/pica40/rev1/rev1.c
new file mode 100644
index 0000000000..f008e4857a
--- /dev/null
+++ b/keyboards/pica40/rev1/rev1.c
@@ -0,0 +1,91 @@
+// Copyright 2022 zzeneg (@zzeneg)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "rev1.h"
+
+#ifdef PICA40_RGBLIGHT_TIMEOUT
+
+uint16_t check_rgblight_timer = 0;
+uint16_t idle_timer = 0;
+uint8_t counter = 0;
+
+void housekeeping_task_kb(void) {
+ if (timer_elapsed(check_rgblight_timer) > 1000) {
+ check_rgblight_timer = timer_read();
+
+ if (rgblight_is_enabled() && timer_elapsed(idle_timer) > 10000) {
+ idle_timer = timer_read();
+ counter++;
+ }
+
+ if (rgblight_is_enabled() && counter > PICA40_RGBLIGHT_TIMEOUT * 6) {
+ counter = 0;
+ rgblight_disable_noeeprom();
+ }
+ }
+
+ housekeeping_task_user();
+}
+
+bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed && timer_elapsed(idle_timer) > 1000) {
+ idle_timer = timer_read();
+ counter = 0;
+ if (!rgblight_is_enabled()) {
+ rgblight_enable_noeeprom();
+ }
+ }
+
+ return process_record_user(keycode, record);
+}
+
+void keyboard_post_init_kb(void) {
+ check_rgblight_timer = timer_read();
+ idle_timer = timer_read();
+ rgblight_enable_noeeprom();
+
+ keyboard_post_init_user();
+}
+
+
+#endif // PICA40_RGBLIGHT_TIMEOUT
+
+#ifdef OLED_ENABLE
+
+oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
+ return OLED_ROTATION_270;
+}
+
+void render_mods(uint8_t modifiers) {
+ oled_write_ln_P((modifiers & MOD_MASK_CTRL) ? PSTR("Ctrl") : PSTR(" "), false);
+ oled_write_ln_P((modifiers & MOD_MASK_ALT) ? PSTR("Alt") : PSTR(" "), false);
+ oled_write_ln_P((modifiers & MOD_MASK_SHIFT) ? PSTR("Shft") : PSTR(" "), false);
+ oled_write_ln_P((modifiers & MOD_MASK_GUI) ? PSTR("GUI") : PSTR(" "), false);
+}
+
+bool oled_task_kb(void) {
+ // display's top is hidden by cover
+ oled_write_ln_P(PSTR(" "), false);
+ oled_write_ln_P(PSTR(" "), false);
+ oled_write_ln_P(PSTR(" "), false);
+
+ if (!oled_task_user()) return false;
+
+ render_mods(get_mods());
+
+ return true;
+}
+
+#endif // OLED_ENABLE
+
+#ifdef ENCODER_ENABLE
+
+bool encoder_update_kb(uint8_t index, bool clockwise) {
+ if (!encoder_update_user(index, clockwise)) return false;
+
+ tap_code(clockwise ? KC_VOLU : KC_VOLD);
+
+ return false;
+}
+
+#endif // ENCODER_ENABLE
diff --git a/keyboards/pica40/rev1/rev1.h b/keyboards/pica40/rev1/rev1.h
new file mode 100644
index 0000000000..964038eefb
--- /dev/null
+++ b/keyboards/pica40/rev1/rev1.h
@@ -0,0 +1,6 @@
+// Copyright 2022 zzeneg (@zzeneg)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "quantum.h"
diff --git a/keyboards/pica40/rev1/rules.mk b/keyboards/pica40/rev1/rules.mk
new file mode 100644
index 0000000000..2e3ef9fb84
--- /dev/null
+++ b/keyboards/pica40/rev1/rules.mk
@@ -0,0 +1 @@
+OLED_DRIVER = SSD1306