mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +00:00
[Cornia] Move I2C stuff to keyboard level
This commit is contained in:
parent
018021058a
commit
71b58e22ee
@ -14,10 +14,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "./keymap.h"
|
||||
|
||||
#include "./cornia.h"
|
||||
|
||||
// 'Cornia', 32x32px
|
||||
#define OLED_LOGO_CORNIA {\
|
||||
@ -31,6 +30,9 @@
|
||||
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x00 \
|
||||
}
|
||||
|
||||
void render_logo(void);
|
||||
void render_layer_status(void);
|
||||
void render_boot(bool bootloader);
|
||||
void cornia_render_logo(void) {
|
||||
#ifdef OLED_ENABLE
|
||||
static const char PROGMEM logo[] = OLED_LOGO_CORNIA;
|
||||
oled_write_raw_P(logo, sizeof(logo));
|
||||
#endif
|
||||
}
|
21
keyboards/cornia/cornia.h
Normal file
21
keyboards/cornia/cornia.h
Normal file
@ -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
|
||||
|
||||
void cornia_render_logo(void);
|
@ -17,16 +17,37 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "./keymap.h"
|
||||
#include "./oled_routines.h"
|
||||
#include "./cornia.h"
|
||||
|
||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||
return OLED_ROTATION_270;
|
||||
}
|
||||
|
||||
bool oled_task_user(void) {
|
||||
oled_set_cursor(0, 0);
|
||||
render_logo();
|
||||
/* Print cornia logo */
|
||||
cornia_render_logo();
|
||||
|
||||
/* Print layer status */
|
||||
oled_set_cursor(0, 7);
|
||||
render_layer_status();
|
||||
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;
|
||||
}
|
||||
|
@ -17,9 +17,15 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "./keymap.h"
|
||||
#include "./oled_routines.h"
|
||||
|
||||
bool shutdown_user(bool jump_to_bootloader) {
|
||||
render_boot(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;
|
||||
}
|
||||
|
@ -16,11 +16,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
/* I²C config */
|
||||
#define I2C_DRIVER I2CD1
|
||||
#define I2C1_SDA_PIN GP10
|
||||
#define I2C1_SCL_PIN GP11
|
||||
|
||||
/* Split */
|
||||
#define SPLIT_ACTIVITY_ENABLE
|
||||
#define SPLIT_LAYER_STATE_ENABLE
|
||||
|
@ -1,59 +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 "./oled_routines.h"
|
||||
|
||||
void render_logo(void) {
|
||||
static const char PROGMEM logo[] = OLED_LOGO_CORNIA;
|
||||
oled_write_raw_P(logo, sizeof(logo));
|
||||
}
|
||||
|
||||
void render_layer_status(void) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
void render_boot(bool bootloader) {
|
||||
oled_clear();
|
||||
oled_set_cursor(0, 2);
|
||||
if (bootloader) {
|
||||
oled_write_P(PSTR("FLASH"), false);
|
||||
} else {
|
||||
oled_write_P(PSTR("RESET"), false);
|
||||
}
|
||||
oled_render_dirty(true);
|
||||
}
|
@ -13,7 +13,6 @@
|
||||
# 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 += oled_routines.c
|
||||
SRC += callback_oled.c
|
||||
SRC += callback_pointing_device.c
|
||||
SRC += callback_record.c
|
||||
@ -32,6 +31,3 @@ OLED_TRANSPORT = i2c
|
||||
# Cirque Trackpad I²C configuration
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
POINTING_DEVICE_DRIVER = cirque_pinnacle_i2c
|
||||
|
||||
# Add I²C HAL dependencies
|
||||
OPT_DEFS += -DHAL_USE_I2C=TRUE
|
||||
|
@ -21,5 +21,10 @@
|
||||
#define MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
/* I²C config */
|
||||
#define I2C_DRIVER I2CD1
|
||||
#define I2C1_SDA_PIN GP10
|
||||
#define I2C1_SCL_PIN GP11
|
||||
|
||||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET // Activates the double-tap behavior
|
||||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 200U // Timeout window in ms in which the double tap can occur.
|
||||
|
17
keyboards/cornia/v0_6/rules.mk
Normal file
17
keyboards/cornia/v0_6/rules.mk
Normal file
@ -0,0 +1,17 @@
|
||||
# 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
|
@ -16,5 +16,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
/* I²C config */
|
||||
#define I2C_DRIVER I2CD1
|
||||
#define I2C1_SDA_PIN GP10
|
||||
#define I2C1_SCL_PIN GP11
|
||||
|
||||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET // Activates the double-tap behavior
|
||||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 200U // Timeout window in ms in which the double tap can occur.
|
||||
|
25
keyboards/cornia/v1/mcuconf.h
Normal file
25
keyboards/cornia/v1/mcuconf.h
Normal file
@ -0,0 +1,25 @@
|
||||
/* 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_next <mcuconf.h>
|
||||
|
||||
#undef RP_I2C_USE_I2C0
|
||||
#define RP_I2C_USE_I2C0 FALSE
|
||||
|
||||
#undef RP_I2C_USE_I2C1
|
||||
#define RP_I2C_USE_I2C1 TRUE
|
17
keyboards/cornia/v1/rules.mk
Normal file
17
keyboards/cornia/v1/rules.mk
Normal file
@ -0,0 +1,17 @@
|
||||
# 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