mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +00:00
[Cornia/config] Remove unnecessary defines & move all callbacks to keymap.c
This commit is contained in:
parent
71b58e22ee
commit
5849acceae
@ -16,8 +16,6 @@
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "./cornia.h"
|
||||
|
||||
// 'Cornia', 32x32px
|
||||
#define OLED_LOGO_CORNIA {\
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, \
|
||||
@ -36,3 +34,11 @@ void cornia_render_logo(void) {
|
||||
oled_write_raw_P(logo, sizeof(logo));
|
||||
#endif
|
||||
}
|
||||
|
||||
bool oled_task_kb(void) {
|
||||
if (!oled_task_user()) {
|
||||
return false;
|
||||
}
|
||||
cornia_render_logo();
|
||||
return true;
|
||||
}
|
||||
|
@ -16,6 +16,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "quantum.h"
|
||||
|
||||
void cornia_render_logo(void);
|
||||
|
@ -1,53 +0,0 @@
|
||||
/* 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"
|
||||
|
||||
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;
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/* 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;
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/* 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;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/* 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;
|
||||
}
|
@ -19,6 +19,13 @@
|
||||
#include "./keymap.h"
|
||||
#include "./tap_dances.h"
|
||||
|
||||
/* Flag to enable/disable trackpad scroll */
|
||||
bool set_scrolling = false;
|
||||
|
||||
/* Variables to store accumulated scroll values */
|
||||
float scroll_accumulated_h = 0;
|
||||
float scroll_accumulated_v = 0;
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[_ALPHA] = LAYOUT_split_3x6_3( /* Fire (Oxey) : https://bit.ly/layout-doc-v2 */
|
||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||
@ -88,9 +95,132 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||
KC_F, KC_LSFT, KC_A, KC_S, KC_D, KC_3, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||
KC_LGUI, KC_LCTL, KC_Z, KC_C, KC_X, KC_4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
KC_LGUI, KC_LCTL, KC_M, KC_Y, KC_X, KC_4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||
KC_SPC,CK_RKJMP, KC_5, XXXXXXX, TG(_G1), XXXXXXX
|
||||
//`--------------------------' `--------------------------'
|
||||
),
|
||||
};
|
||||
};
|
||||
|
||||
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);
|
||||
break;
|
||||
case KC_C:
|
||||
SEND_STRING(SS_ACCENT_C_CEDIL);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
break;
|
||||
case KC_O:
|
||||
SEND_STRING(SS_ACCENT_O_CIRCU);
|
||||
break;
|
||||
case KC_U:
|
||||
SEND_STRING(SS_ACCENT_U_GRAVE);
|
||||
break;
|
||||
}
|
||||
accent_state = ACCENT_NONE;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
@ -18,6 +18,10 @@
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
/* Trackpad srolling speed adjustment */
|
||||
#define SCROLL_DIVISOR_H 8.0
|
||||
#define SCROLL_DIVISOR_V 8.0
|
||||
|
||||
/* Trackpad srolling enablement flag */
|
||||
extern bool set_scrolling;
|
||||
|
||||
|
@ -13,21 +13,12 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
SRC += callback_oled.c
|
||||
SRC += callback_pointing_device.c
|
||||
SRC += callback_record.c
|
||||
SRC += callback_system.c
|
||||
SRC += tap_dances.c
|
||||
|
||||
MOUSEKEY_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
|
||||
# OLED I²C configuration
|
||||
OLED_ENABLE = yes
|
||||
OLED_DRIVER = ssd1306
|
||||
OLED_TRANSPORT = i2c
|
||||
|
||||
# Cirque Trackpad I²C configuration
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
POINTING_DEVICE_DRIVER = cirque_pinnacle_i2c
|
||||
|
@ -1,17 +0,0 @@
|
||||
# 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/>.
|
||||
|
||||
# Add I²C HAL dependencies
|
||||
OPT_DEFS += -DHAL_USE_I2C=TRUE
|
@ -9,6 +9,7 @@
|
||||
"features": {
|
||||
"extrakey": true,
|
||||
"nkro": true,
|
||||
"oled": true,
|
||||
"rgb_matrix": true
|
||||
},
|
||||
"split": {
|
||||
|
@ -1,17 +0,0 @@
|
||||
# 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/>.
|
||||
|
||||
# Add I²C HAL dependencies
|
||||
OPT_DEFS += -DHAL_USE_I2C=TRUE
|
Loading…
Reference in New Issue
Block a user