Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cornia keyboard #24442

Merged
merged 15 commits into from
Dec 3, 2024
Merged
38 changes: 38 additions & 0 deletions keyboards/cornia/cornia.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* Copyright 2024 Vaarai
*
* 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 QMK_KEYBOARD_H
Vaarai marked this conversation as resolved.
Show resolved Hide resolved

#include "./cornia.h"
Vaarai marked this conversation as resolved.
Show resolved Hide resolved

// 'Cornia', 32x32px
#define OLED_LOGO_CORNIA {\
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, \
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xe0, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf8, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xfd, 0xe1, \
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, \
0x00, 0x00, 0xc0, 0xf8, 0xff, 0xff, 0xff, 0x3f, 0x07, 0x00, 0x00, 0x00, 0x07, 0x3f, 0xff, 0xff, \
0xff, 0xf8, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x1e, 0x1f, 0x1f, 0x1f, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, \
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x00 \
}

void cornia_render_logo(void) {
#ifdef OLED_ENABLE
static const char PROGMEM logo[] = OLED_LOGO_CORNIA;
oled_write_raw_P(logo, sizeof(logo));
#endif
}
Vaarai marked this conversation as resolved.
Show resolved Hide resolved
21 changes: 21 additions & 0 deletions keyboards/cornia/cornia.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright 2024 Vaarai
*
* 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 QMK_KEYBOARD_H
Vaarai marked this conversation as resolved.
Show resolved Hide resolved

void cornia_render_logo(void);
11 changes: 11 additions & 0 deletions keyboards/cornia/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"manufacturer": "Vaarai",
"maintainer": "Vaarai",
"url": "https://github.com/Vaarai/Cornia",
"usb": {
"vid": "0xFEED"
},
"split": {
"enabled": true
}
Vaarai marked this conversation as resolved.
Show resolved Hide resolved
}
83 changes: 83 additions & 0 deletions keyboards/cornia/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/* Copyright 2024 Vaarai
*
* 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 QMK_KEYBOARD_H

/* Custom Keycodes (CK_xxx) */
#define CK_LPAR LSFT(KC_9)
#define CK_RPAR LSFT(KC_0)
#define CK_LCBR LSFT(KC_LBRC)
#define CK_RCBR LSFT(KC_RBRC)
#define CK_QMRK LSFT(KC_SLSH)
#define CK_UNSC LSFT(KC_MINS)
Vaarai marked this conversation as resolved.
Show resolved Hide resolved

/* Layers definitions */
enum layers {
_ALPHA,
_NAV,
_NUM,
_ADJUST,
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_ALPHA] = LAYOUT_split_3x6_3(
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RCTL,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LSFT,MO(_NAV), KC_SPC, KC_ENT,MO(_NUM), KC_RSFT
Vaarai marked this conversation as resolved.
Show resolved Hide resolved
//`--------------------------' `--------------------------'
),

[_NAV] = LAYOUT_split_3x6_3(
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_DEL,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP,KC_RIGHT, XXXXXXX,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LALT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_RALT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LGUI, _______, _______, _______,MO(_ADJUST),_______
//`--------------------------' `--------------------------'
),

[_NUM] = LAYOUT_split_3x6_3(
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, KC_SLSH, CK_LCBR, CK_LPAR, KC_LBRC, KC_MINS, CK_UNSC, KC_RBRC, CK_RPAR, CK_RCBR, KC_BSLS, _______,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
_______, XXXXXXX, KC_GRV, CK_QMRK, KC_EQL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,
Vaarai marked this conversation as resolved.
Show resolved Hide resolved
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______,MO(_ADJUST),_______, _______, _______, KC_RGUI
//`--------------------------' `--------------------------'
),

[_ADJUST] = LAYOUT_split_3x6_3(
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
XXXXXXX, RGB_TOG, RGB_HUI, RGB_VAI, XXXXXXX, XXXXXXX, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
//|--------+--------+--------+--------+--------|--------| |--------+--------+--------+--------+--------+--------|
XXXXXXX, RGB_MOD, RGB_HUD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
Vaarai marked this conversation as resolved.
Show resolved Hide resolved
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
_______, _______, _______, _______, _______, _______
//`--------------------------' `--------------------------'
),
};
53 changes: 53 additions & 0 deletions keyboards/cornia/keymaps/fire/callback_oled.c
Vaarai marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* Copyright 2024 Vaarai
*
* 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 QMK_KEYBOARD_H

#include "./keymap.h"
#include "./cornia.h"
Vaarai marked this conversation as resolved.
Show resolved Hide resolved

oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270;
}

bool oled_task_user(void) {
/* Print cornia logo */
cornia_render_logo();

/* Print layer status */
oled_set_cursor(0, 7);
switch (get_highest_layer(layer_state)) {
case _ALPHA:
oled_write_ln("ALPHA", 0);
break;
case _NAV:
oled_write_ln("NAV", 0);
break;
case _NUM:
oled_write_ln("NUM", 0);
break;
case _ADJUST:
oled_write_ln("ADJUS", 0);
break;
case _G0:
oled_write_ln("GAME0", 0);
break;
case _G1:
oled_write_ln("GAME1", 0);
break;
}
return false;
}
51 changes: 51 additions & 0 deletions keyboards/cornia/keymaps/fire/callback_pointing_device.c
Vaarai marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* Copyright 2024 Vaarai
*
* 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 QMK_KEYBOARD_H

#include "./keymap.h"

/* Trackpad srolling speed adjustment */
#define SCROLL_DIVISOR_H 8.0
#define SCROLL_DIVISOR_V 8.0

bool set_scrolling = false;

/* Variables to store accumulated scroll values */
float scroll_accumulated_h = 0;
float scroll_accumulated_v = 0;

report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
/* Check if drag scrolling is active */
if (set_scrolling) {
/* Calculate and accumulate scroll values based on mouse movement and divisors */
scroll_accumulated_h += (float)mouse_report.x / SCROLL_DIVISOR_H;
scroll_accumulated_v += (float)mouse_report.y / SCROLL_DIVISOR_V;

/* Assign integer parts of accumulated scroll values to the mouse report */
mouse_report.h = (int8_t)scroll_accumulated_h;
mouse_report.v = (int8_t)scroll_accumulated_v;

/* Update accumulated scroll values by subtracting the integer parts */
scroll_accumulated_h -= (int8_t)scroll_accumulated_h;
scroll_accumulated_v -= (int8_t)scroll_accumulated_v;

/* Clear the X and Y values of the mouse report */
mouse_report.x = 0;
mouse_report.y = 0;
}
return mouse_report;
}
75 changes: 75 additions & 0 deletions keyboards/cornia/keymaps/fire/callback_record.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* Copyright 2024 Vaarai
*
* 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 QMK_KEYBOARD_H

#include "./keymap.h"
#include "./tap_dances.h"

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case CK_RKJMP: /* Warframe rocket jump */
if (record->event.pressed) {
SEND_STRING(SS_DOWN(X_C));
} else {
SEND_STRING(SS_DOWN(X_SPC) SS_DELAY(50) SS_UP(X_C) SS_DELAY(50) SS_UP(X_SPC));
}
return false;
case CK_DPII: /* Increase trackpad DPI */
if (record->event.pressed) {
pointing_device_set_cpi(pointing_device_get_cpi()+100);
}
return false;
case CK_DPID: /* Decrease trackpad DPI */
if (record->event.pressed) {
pointing_device_set_cpi(pointing_device_get_cpi()-100);
}
return false;
case CK_SCRL: /* Toggle set_scrolling when CK_SCRL key is pressed or released */
set_scrolling = record->event.pressed;
return false;
}
/* Accented letters */
if (accent_state != ACCENT_NONE && record->event.pressed)
{
switch (keycode) {
case KC_A:
SEND_STRING(SS_ACCENT_A_GRAVE);
return false;
case KC_C:
SEND_STRING(SS_ACCENT_C_CEDIL);
return false;
case KC_E:
switch (accent_state) {
case ACCENT_LEFT:
SEND_STRING(SS_ACCENT_E_ACUTE); break;
case ACCENT_RIGHT:
SEND_STRING(SS_ACCENT_E_GRAVE); break;
case ACCENT_NONE:
break;
}
return false;
case KC_O:
SEND_STRING(SS_ACCENT_O_CIRCU);
return false;
case KC_U:
SEND_STRING(SS_ACCENT_U_GRAVE);
return false;
}
accent_state = ACCENT_NONE;
}
return true;
}
31 changes: 31 additions & 0 deletions keyboards/cornia/keymaps/fire/callback_system.c
Vaarai marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* Copyright 2024 Vaarai
*
* 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 QMK_KEYBOARD_H

#include "./keymap.h"

bool shutdown_user(bool jump_to_bootloader) {
oled_clear();
oled_set_cursor(0, 2);
if (jump_to_bootloader) {
oled_write_P(PSTR("FLASH"), false);
} else {
oled_write_P(PSTR("RESET"), false);
}
oled_render_dirty(true);
return false;
}
Loading