mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-04-23 07:31:30 +00:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
commit
8d7131673d
@ -926,10 +926,11 @@ ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
|
|||||||
OPT_DEFS += -DBLUETOOTH_ENABLE
|
OPT_DEFS += -DBLUETOOTH_ENABLE
|
||||||
NO_USB_STARTUP_CHECK := yes
|
NO_USB_STARTUP_CHECK := yes
|
||||||
COMMON_VPATH += $(DRIVER_PATH)/bluetooth
|
COMMON_VPATH += $(DRIVER_PATH)/bluetooth
|
||||||
SRC += outputselect.c bluetooth.c
|
SRC += outputselect.c
|
||||||
|
|
||||||
ifeq ($(strip $(BLUETOOTH_DRIVER)), BluefruitLE)
|
ifeq ($(strip $(BLUETOOTH_DRIVER)), BluefruitLE)
|
||||||
OPT_DEFS += -DBLUETOOTH_BLUEFRUIT_LE -DHAL_USE_SPI=TRUE
|
OPT_DEFS += -DBLUETOOTH_BLUEFRUIT_LE -DHAL_USE_SPI=TRUE
|
||||||
|
SRC += $(DRIVER_PATH)/bluetooth/bluetooth.c
|
||||||
SRC += $(DRIVER_PATH)/bluetooth/bluefruit_le.cpp
|
SRC += $(DRIVER_PATH)/bluetooth/bluefruit_le.cpp
|
||||||
QUANTUM_LIB_SRC += analog.c
|
QUANTUM_LIB_SRC += analog.c
|
||||||
QUANTUM_LIB_SRC += spi_master.c
|
QUANTUM_LIB_SRC += spi_master.c
|
||||||
@ -937,6 +938,7 @@ ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
|
|||||||
|
|
||||||
ifeq ($(strip $(BLUETOOTH_DRIVER)), RN42)
|
ifeq ($(strip $(BLUETOOTH_DRIVER)), RN42)
|
||||||
OPT_DEFS += -DBLUETOOTH_RN42 -DHAL_USE_SERIAL=TRUE
|
OPT_DEFS += -DBLUETOOTH_RN42 -DHAL_USE_SERIAL=TRUE
|
||||||
|
SRC += $(DRIVER_PATH)/bluetooth/bluetooth.c
|
||||||
SRC += $(DRIVER_PATH)/bluetooth/rn42.c
|
SRC += $(DRIVER_PATH)/bluetooth/rn42.c
|
||||||
QUANTUM_LIB_SRC += uart.c
|
QUANTUM_LIB_SRC += uart.c
|
||||||
endif
|
endif
|
||||||
|
@ -146,7 +146,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"driver": {
|
"driver": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["BluefruitLE", "RN42"]
|
"enum": ["BluefruitLE", "RN42", "custom"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -12,35 +12,17 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <avr/pgmspace.h>
|
#include "bluetooth.h"
|
||||||
#include "report.h"
|
|
||||||
#include "host.h"
|
|
||||||
#include "host_driver.h"
|
|
||||||
#include "keyboard.h"
|
|
||||||
#include "action.h"
|
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
#include "sendchar.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#ifdef SLEEP_LED_ENABLE
|
|
||||||
#include "sleep_led.h"
|
|
||||||
#endif
|
|
||||||
#include "suspend.h"
|
|
||||||
|
|
||||||
#include "usb_descriptor.h"
|
|
||||||
#include "lufa.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
#include <util/atomic.h>
|
|
||||||
|
|
||||||
#include "print.h"
|
|
||||||
|
|
||||||
#include "ble.h"
|
#include "ble.h"
|
||||||
#include "usart.h"
|
#include "usart.h"
|
||||||
|
#include "progmem.h"
|
||||||
|
#include "wait.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "usb_descriptor.h"
|
||||||
|
#include "report.h"
|
||||||
|
|
||||||
keyboard_config_t ble_config;
|
keyboard_config_t ble_config;
|
||||||
|
|
||||||
static uint8_t bluefruit_keyboard_leds = 0;
|
|
||||||
|
|
||||||
static void bluefruit_serial_send(uint8_t);
|
static void bluefruit_serial_send(uint8_t);
|
||||||
|
|
||||||
void send_str(const char *str)
|
void send_str(const char *str)
|
||||||
@ -89,30 +71,13 @@ static void bluefruit_serial_send(uint8_t data)
|
|||||||
serial_send(data);
|
serial_send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------*
|
void bluetooth_init(void) {
|
||||||
* Host driver
|
usart_init();
|
||||||
*------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
static uint8_t keyboard_leds(void);
|
|
||||||
static void send_keyboard(report_keyboard_t *report);
|
|
||||||
static void send_mouse(report_mouse_t *report);
|
|
||||||
static void send_extra(report_extra_t *report);
|
|
||||||
|
|
||||||
host_driver_t bluefruit_driver = {
|
|
||||||
keyboard_leds,
|
|
||||||
send_keyboard,
|
|
||||||
send_mouse,
|
|
||||||
send_extra
|
|
||||||
};
|
|
||||||
|
|
||||||
host_driver_t null_driver = {};
|
|
||||||
|
|
||||||
static uint8_t keyboard_leds(void)
|
|
||||||
{
|
|
||||||
return bluefruit_keyboard_leds;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_keyboard(report_keyboard_t *report)
|
void bluetooth_task(void) {}
|
||||||
|
|
||||||
|
void bluetooth_send_keyboard(report_keyboard_t *report)
|
||||||
{
|
{
|
||||||
#ifdef BLUEFRUIT_TRACE_SERIAL
|
#ifdef BLUEFRUIT_TRACE_SERIAL
|
||||||
bluefruit_trace_header();
|
bluefruit_trace_header();
|
||||||
@ -136,7 +101,7 @@ static void send_keyboard(report_keyboard_t *report)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_mouse(report_mouse_t *report)
|
void bluetooth_send_mouse(report_mouse_t *report)
|
||||||
{
|
{
|
||||||
#ifdef BLUEFRUIT_TRACE_SERIAL
|
#ifdef BLUEFRUIT_TRACE_SERIAL
|
||||||
bluefruit_trace_header();
|
bluefruit_trace_header();
|
||||||
@ -177,10 +142,9 @@ static void send_mouse(report_mouse_t *report)
|
|||||||
#define CONSUMER2BLUEFRUIT(usage) \
|
#define CONSUMER2BLUEFRUIT(usage) \
|
||||||
(usage == AUDIO_MUTE ? 0x00e2 : (usage == AUDIO_VOL_UP ? 0x00e9 : (usage == AUDIO_VOL_DOWN ? 0x00ea : (usage == TRANSPORT_NEXT_TRACK ? 0x00b5 : (usage == TRANSPORT_PREV_TRACK ? 0x00b6 : (usage == TRANSPORT_STOP ? 0x00b7 : (usage == TRANSPORT_STOP_EJECT ? 0x00b8 : (usage == TRANSPORT_PLAY_PAUSE ? 0x00b1 : (usage == AL_CC_CONFIG ? 0x0183 : (usage == AL_EMAIL ? 0x018c : (usage == AL_CALCULATOR ? 0x0192 : (usage == AL_LOCAL_BROWSER ? 0x0196 : (usage == AC_SEARCH ? 0x021f : (usage == AC_HOME ? 0x0223 : (usage == AC_BACK ? 0x0224 : (usage == AC_FORWARD ? 0x0225 : (usage == AC_STOP ? 0x0226 : (usage == AC_REFRESH ? 0x0227 : (usage == AC_BOOKMARKS ? 0x022a : 0)))))))))))))))))))
|
(usage == AUDIO_MUTE ? 0x00e2 : (usage == AUDIO_VOL_UP ? 0x00e9 : (usage == AUDIO_VOL_DOWN ? 0x00ea : (usage == TRANSPORT_NEXT_TRACK ? 0x00b5 : (usage == TRANSPORT_PREV_TRACK ? 0x00b6 : (usage == TRANSPORT_STOP ? 0x00b7 : (usage == TRANSPORT_STOP_EJECT ? 0x00b8 : (usage == TRANSPORT_PLAY_PAUSE ? 0x00b1 : (usage == AL_CC_CONFIG ? 0x0183 : (usage == AL_EMAIL ? 0x018c : (usage == AL_CALCULATOR ? 0x0192 : (usage == AL_LOCAL_BROWSER ? 0x0196 : (usage == AC_SEARCH ? 0x021f : (usage == AC_HOME ? 0x0223 : (usage == AC_BACK ? 0x0224 : (usage == AC_FORWARD ? 0x0225 : (usage == AC_STOP ? 0x0226 : (usage == AC_REFRESH ? 0x0227 : (usage == AC_BOOKMARKS ? 0x022a : 0)))))))))))))))))))
|
||||||
|
|
||||||
static void send_extra(report_extra_t *report)
|
void bluetooth_send_consumer(uint16_t usage)
|
||||||
{
|
{
|
||||||
if (report->report_id == REPORT_ID_CONSUMER) {
|
uint16_t bitmap = CONSUMER2BLUEFRUIT(usage);
|
||||||
uint16_t bitmap = CONSUMER2BLUEFRUIT(report->usage);
|
|
||||||
|
|
||||||
#ifdef BLUEFRUIT_TRACE_SERIAL
|
#ifdef BLUEFRUIT_TRACE_SERIAL
|
||||||
dprintf("\nData: ");
|
dprintf("\nData: ");
|
||||||
@ -198,7 +162,6 @@ static void send_extra(report_extra_t *report)
|
|||||||
bluefruit_trace_footer();
|
bluefruit_trace_footer();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void usart_init(void)
|
void usart_init(void)
|
||||||
{
|
{
|
||||||
|
@ -15,9 +15,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "host_driver.h"
|
|
||||||
#include "host.h"
|
|
||||||
|
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
uint32_t raw;
|
uint32_t raw;
|
||||||
@ -28,9 +25,6 @@ typedef union {
|
|||||||
|
|
||||||
extern keyboard_config_t ble_config;
|
extern keyboard_config_t ble_config;
|
||||||
|
|
||||||
extern host_driver_t bluefruit_driver;
|
|
||||||
extern host_driver_t null_driver;
|
|
||||||
|
|
||||||
void send_str(const char *str);
|
void send_str(const char *str);
|
||||||
void usart_init(void);
|
void usart_init(void);
|
||||||
void module_reset(void);
|
void module_reset(void);
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
# Processor frequency
|
# Processor frequency
|
||||||
F_CPU = 8000000
|
F_CPU = 8000000
|
||||||
|
|
||||||
SRC += usart.c \
|
|
||||||
ble.c \
|
|
||||||
main.c
|
|
||||||
|
|
||||||
OPT_DEFS += -DPROTOCOL_BLE
|
|
||||||
OPT_DEFS += -DUART_RX1_BUFFER_SIZE=16 -DUART_TX1_BUFFER_SIZE=16
|
|
||||||
OPT_DEFS += -DUSART1_ENABLED
|
|
||||||
|
|
||||||
# Build Options
|
# Build Options
|
||||||
# change yes to no to disable
|
# change yes to no to disable
|
||||||
#
|
#
|
||||||
@ -22,5 +14,12 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
|||||||
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||||
AUDIO_ENABLE = no # Audio output
|
AUDIO_ENABLE = no # Audio output
|
||||||
LTO_ENABLE = yes # Reduce firmware size
|
LTO_ENABLE = yes # Reduce firmware size
|
||||||
|
BLUETOOTH_ENABLE = yes
|
||||||
|
BLUETOOTH_DRIVER = custom
|
||||||
|
|
||||||
VIA_ENABLE = yes # VIA support should be enabled here due to the main() loop will be compiled first.
|
VIA_ENABLE = yes # VIA support should be enabled here due to the main() loop will be compiled first.
|
||||||
|
|
||||||
|
SRC += usart.c ble.c
|
||||||
|
|
||||||
|
OPT_DEFS += -DUART_RX1_BUFFER_SIZE=16 -DUART_TX1_BUFFER_SIZE=16
|
||||||
|
OPT_DEFS += -DUSART1_ENABLED
|
||||||
|
@ -1,388 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 Basic I/O Instruments(Scott Wei) <scot.wei@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 <avr/pgmspace.h>
|
|
||||||
#include <util/delay.h>
|
|
||||||
|
|
||||||
#include "report.h"
|
|
||||||
#include "host.h"
|
|
||||||
#include "host_driver.h"
|
|
||||||
#include "keyboard.h"
|
|
||||||
#include "action.h"
|
|
||||||
#include "led.h"
|
|
||||||
#include "sendchar.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "print.h"
|
|
||||||
#ifdef SLEEP_LED_ENABLE
|
|
||||||
#include "sleep_led.h"
|
|
||||||
#endif
|
|
||||||
#include "suspend.h"
|
|
||||||
|
|
||||||
#include "usb_descriptor.h"
|
|
||||||
#include "lufa.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
#include <util/atomic.h>
|
|
||||||
|
|
||||||
#ifdef NKRO_ENABLE
|
|
||||||
#include "keycode_config.h"
|
|
||||||
|
|
||||||
extern keymap_config_t keymap_config;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef AUDIO_ENABLE
|
|
||||||
#include <audio.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BLUETOOTH_ENABLE
|
|
||||||
#ifdef BLUETOOTH_BLUEFRUIT_LE
|
|
||||||
#include "bluefruit_le.h"
|
|
||||||
#else
|
|
||||||
#include "bluetooth.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VIRTSER_ENABLE
|
|
||||||
#include "virtser.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(RGBLIGHT_ENABLE)
|
|
||||||
#include "rgblight.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MIDI_ENABLE
|
|
||||||
#include "qmk_midi.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RAW_ENABLE
|
|
||||||
#include "raw_hid.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ble.h"
|
|
||||||
#include "usart.h"
|
|
||||||
|
|
||||||
#include <avr/power.h>
|
|
||||||
#include <avr/sleep.h>
|
|
||||||
|
|
||||||
bool force_usb = false; //Reserved for FORCE USB Mode function.
|
|
||||||
bool force_ble = false; //Reserved for FORCE USB Mode function.
|
|
||||||
|
|
||||||
bool usb_connected = false;
|
|
||||||
bool ble_enabled = false;
|
|
||||||
|
|
||||||
uint32_t kb_idle_timer = 0;
|
|
||||||
|
|
||||||
bool usb_state_sent = false;
|
|
||||||
|
|
||||||
uint8_t USB_DeviceLastState = 0;
|
|
||||||
|
|
||||||
#ifdef RAW_ENABLE
|
|
||||||
/** \brief Raw HID Task
|
|
||||||
*
|
|
||||||
* FIXME: Needs doc
|
|
||||||
*/
|
|
||||||
static void raw_hid_task(void)
|
|
||||||
{
|
|
||||||
// Create a temporary buffer to hold the read in data from the host
|
|
||||||
uint8_t data[RAW_EPSIZE];
|
|
||||||
bool data_read = false;
|
|
||||||
|
|
||||||
// Device must be connected and configured for the task to run
|
|
||||||
if (USB_DeviceState != DEVICE_STATE_Configured)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Endpoint_SelectEndpoint(RAW_OUT_EPNUM);
|
|
||||||
|
|
||||||
// Check to see if a packet has been sent from the host
|
|
||||||
if (Endpoint_IsOUTReceived())
|
|
||||||
{
|
|
||||||
// Check to see if the packet contains data
|
|
||||||
if (Endpoint_IsReadWriteAllowed())
|
|
||||||
{
|
|
||||||
/* Read data */
|
|
||||||
Endpoint_Read_Stream_LE(data, sizeof(data), NULL);
|
|
||||||
data_read = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finalize the stream transfer to receive the last packet
|
|
||||||
Endpoint_ClearOUT();
|
|
||||||
|
|
||||||
if (data_read)
|
|
||||||
{
|
|
||||||
raw_hid_receive(data, sizeof(data));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void setup_mcu(void)
|
|
||||||
{
|
|
||||||
/* Disable watchdog if enabled by bootloader/fuses */
|
|
||||||
MCUSR &= ~(1 << WDRF);
|
|
||||||
wdt_disable();
|
|
||||||
|
|
||||||
CLKPR = (1 << CLKPCE);
|
|
||||||
CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setup_usb(void)
|
|
||||||
{
|
|
||||||
// Leonardo needs. Without this USB device is not recognized.
|
|
||||||
USB_Disable();
|
|
||||||
|
|
||||||
USB_Init();
|
|
||||||
|
|
||||||
// for Console_Task
|
|
||||||
USB_Device_EnableSOFEvents();
|
|
||||||
print_set_sendchar(sendchar);
|
|
||||||
}
|
|
||||||
|
|
||||||
void power_saving(void)
|
|
||||||
{
|
|
||||||
power_adc_disable();
|
|
||||||
power_usart0_disable();
|
|
||||||
power_spi_disable();
|
|
||||||
power_twi_disable();
|
|
||||||
|
|
||||||
USBCON |= (1 << FRZCLK); // Freeze the USB Clock
|
|
||||||
PLLCSR &= ~(1 << PLLE); // Disable the USB Clock (PPL)
|
|
||||||
USBCON &= ~(1 << USBE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void power_recover(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
USBCON |= (1 << USBE);
|
|
||||||
PLLCSR |= (1 << PLLE); // Resume the USB Clock (PPL)
|
|
||||||
USBCON &= ~(1 << FRZCLK); // Resume the USB Clock
|
|
||||||
|
|
||||||
power_adc_enable();
|
|
||||||
power_usart0_enable();
|
|
||||||
power_spi_enable();
|
|
||||||
power_twi_enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ble_task_init(void)
|
|
||||||
{
|
|
||||||
kb_idle_timer = timer_read32(); //Mark current time, reserved for further usage;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ble_task(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (USB_DeviceLastState != USB_DeviceState)
|
|
||||||
{
|
|
||||||
usb_state_sent = false;
|
|
||||||
#ifdef BLE_DEBUG
|
|
||||||
send_str(PSTR("USB State Changed\r\n"));
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
||||||
{
|
|
||||||
send_str(PSTR("USB State Unattached\r\n"));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Powered)
|
|
||||||
{
|
|
||||||
#ifdef BLE_DEBUG
|
|
||||||
send_str(PSTR("USB State Powered\r\n"));
|
|
||||||
#endif
|
|
||||||
power_recover();
|
|
||||||
host_set_driver(&null_driver);
|
|
||||||
}
|
|
||||||
#ifdef BLE_DEBUG
|
|
||||||
if ((USB_DeviceState == DEVICE_STATE_Default))
|
|
||||||
{
|
|
||||||
send_str(PSTR("USB State Default\r\n"));
|
|
||||||
}
|
|
||||||
if ((USB_DeviceState == DEVICE_STATE_Addressed))
|
|
||||||
{
|
|
||||||
send_str(PSTR("USB State Addressed\r\n"));
|
|
||||||
}
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Configured)
|
|
||||||
{
|
|
||||||
send_str(PSTR("USB State Configured\r\n"));
|
|
||||||
}
|
|
||||||
if (USB_DeviceState > DEVICE_STATE_Unattached)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef BLE_DEBUG
|
|
||||||
if (!usb_state_sent)
|
|
||||||
{
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
||||||
{
|
|
||||||
send_str(PSTR("USB State Stopped at Unattached\r\n"));
|
|
||||||
}
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Powered)
|
|
||||||
{
|
|
||||||
send_str(PSTR("USB State Stopped at Powered\r\n"));
|
|
||||||
}
|
|
||||||
if ((USB_DeviceState == DEVICE_STATE_Default))
|
|
||||||
{
|
|
||||||
send_str(PSTR("USB State Stopped at Default\r\n"));
|
|
||||||
}
|
|
||||||
if ((USB_DeviceState == DEVICE_STATE_Addressed))
|
|
||||||
{
|
|
||||||
send_str(PSTR("USB State Stopped at Addressed\r\n"));
|
|
||||||
}
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Configured)
|
|
||||||
{
|
|
||||||
send_str(PSTR("USB State Stopped at Configured\r\n"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
|
||||||
{
|
|
||||||
if (host_get_driver() && host_get_driver() != &bluefruit_driver)
|
|
||||||
{
|
|
||||||
#ifdef BLE_DEBUG
|
|
||||||
send_str(PSTR("USB State stopped at Unattached\r\n"));
|
|
||||||
#endif
|
|
||||||
ble_task_init();
|
|
||||||
|
|
||||||
force_usb = 0;
|
|
||||||
usb_connected = 0;
|
|
||||||
|
|
||||||
//Reinit USB to prepare for next connection.
|
|
||||||
USB_Init();
|
|
||||||
USB_Detach();
|
|
||||||
USB_Attach();
|
|
||||||
|
|
||||||
#ifdef BLE_DEBUG
|
|
||||||
send_str(PSTR("Loading &bluefruit_driver\r\n"));
|
|
||||||
#endif
|
|
||||||
host_set_driver(&bluefruit_driver);
|
|
||||||
clear_keyboard();
|
|
||||||
power_saving();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Do nothing if USB is unattached and the driver is &bluefruit_driver
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (USB_DeviceState == DEVICE_STATE_Configured)
|
|
||||||
{
|
|
||||||
if (host_get_driver() && host_get_driver() != &lufa_driver)
|
|
||||||
{
|
|
||||||
#ifdef BLE_DEBUG
|
|
||||||
send_str(PSTR("USB State stopped at Configured\r\n"));
|
|
||||||
#endif
|
|
||||||
power_recover();
|
|
||||||
|
|
||||||
usb_connected = 1;
|
|
||||||
ble_enabled = 0;
|
|
||||||
#ifdef BLE_DEBUG
|
|
||||||
send_str(PSTR("Loading &lufa_driver\r\n"));
|
|
||||||
#endif
|
|
||||||
host_set_driver(&lufa_driver);
|
|
||||||
clear_keyboard();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Do nothing if the driver is &lufa_driver
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
usb_state_sent = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
USB_DeviceLastState = USB_DeviceState;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use a custom main() function because the task logic is different from the common one.
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
#ifdef MIDI_ENABLE
|
|
||||||
setup_midi();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
setup_mcu();
|
|
||||||
|
|
||||||
keyboard_setup();
|
|
||||||
|
|
||||||
setup_usb();
|
|
||||||
sei();
|
|
||||||
|
|
||||||
#if defined(BLUETOOTH_RN42)
|
|
||||||
serial_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* wait for USB startup to get ready for debug output */
|
|
||||||
uint8_t timeout = 255; // timeout when USB is not available(Bluetooth)
|
|
||||||
while (timeout-- && USB_DeviceState != DEVICE_STATE_Configured)
|
|
||||||
{
|
|
||||||
wait_ms(4);
|
|
||||||
#if defined(INTERRUPT_CONTROL_ENDPOINT)
|
|
||||||
;
|
|
||||||
#else
|
|
||||||
USB_USBTask();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
print("\nUSB init\n");
|
|
||||||
|
|
||||||
keyboard_init();
|
|
||||||
host_set_driver(&lufa_driver);
|
|
||||||
|
|
||||||
backlight_disable();
|
|
||||||
//host_set_driver(&lufa_driver);
|
|
||||||
print("Keyboard initialized.\n");
|
|
||||||
|
|
||||||
//Init Hardware UART
|
|
||||||
usart_init();
|
|
||||||
|
|
||||||
#ifdef BLE_DEBUG
|
|
||||||
send_str(PSTR("Keyboard has been setup up\r\n"));
|
|
||||||
|
|
||||||
if (usb_connected)
|
|
||||||
{
|
|
||||||
send_str(PSTR("usb_connected=1\r\n"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
send_str(PSTR("usb_connected=0\r\n"));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SLEEP_LED_ENABLE
|
|
||||||
sleep_led_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VIRTSER_ENABLE
|
|
||||||
virtser_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
ble_task();
|
|
||||||
keyboard_task();
|
|
||||||
|
|
||||||
#ifdef RAW_ENABLE
|
|
||||||
raw_hid_task();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(RGBLIGHT_ENABLE)
|
|
||||||
rgblight_task();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
|
|
||||||
USB_USBTask();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +1,6 @@
|
|||||||
# Processor frequency
|
# Processor frequency
|
||||||
F_CPU = 8000000
|
F_CPU = 8000000
|
||||||
|
|
||||||
SRC += usart.c \
|
|
||||||
ble.c \
|
|
||||||
main.c
|
|
||||||
|
|
||||||
OPT_DEFS += -DPROTOCOL_BLE
|
|
||||||
OPT_DEFS += -DUART_RX1_BUFFER_SIZE=16 -DUART_TX1_BUFFER_SIZE=16
|
|
||||||
OPT_DEFS += -DUSART1_ENABLED
|
|
||||||
|
|
||||||
# Build Options
|
# Build Options
|
||||||
# change yes to no to disable
|
# change yes to no to disable
|
||||||
#
|
#
|
||||||
@ -22,5 +14,12 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
|||||||
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||||
AUDIO_ENABLE = no # Audio output
|
AUDIO_ENABLE = no # Audio output
|
||||||
LTO_ENABLE = yes # Reduce firmware size
|
LTO_ENABLE = yes # Reduce firmware size
|
||||||
|
BLUETOOTH_ENABLE = yes
|
||||||
|
BLUETOOTH_DRIVER = custom
|
||||||
|
|
||||||
VIA_ENABLE = yes # VIA support should be enabled here due to the main() loop will be compiled first.
|
VIA_ENABLE = yes # VIA support should be enabled here due to the main() loop will be compiled first.
|
||||||
|
|
||||||
|
SRC += usart.c ble.c
|
||||||
|
|
||||||
|
OPT_DEFS += -DUART_RX1_BUFFER_SIZE=16 -DUART_TX1_BUFFER_SIZE=16
|
||||||
|
OPT_DEFS += -DUSART1_ENABLED
|
||||||
|
@ -19,8 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
#ifdef SWAP_HANDS_ENABLE
|
#ifdef SWAP_HANDS_ENABLE
|
||||||
__attribute__ ((weak))
|
__attribute__((weak)) const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
// Left
|
// Left
|
||||||
{{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}},
|
{{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}},
|
||||||
{{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}},
|
{{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}},
|
||||||
@ -33,3 +32,132 @@ const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
{{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}
|
{{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef OLED_ENABLE
|
||||||
|
|
||||||
|
oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
|
||||||
|
if (!is_keyboard_master()) {
|
||||||
|
return OLED_ROTATION_180; // flips the display 180 degrees if offhand
|
||||||
|
}
|
||||||
|
return rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void oled_render_layer_state(void) {
|
||||||
|
oled_write_P(PSTR("Layer: "), false);
|
||||||
|
switch (get_highest_layer(layer_state)) {
|
||||||
|
case 0:
|
||||||
|
oled_write_ln_P(PSTR("Default"), false);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
oled_write_ln_P(PSTR("Lower"), false);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
oled_write_ln_P(PSTR("Raise"), false);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
oled_write_ln_P(PSTR("Adjust"), false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
oled_write_ln_P(PSTR("Undef"), false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char key_name = ' ';
|
||||||
|
uint16_t last_keycode;
|
||||||
|
uint8_t last_row;
|
||||||
|
uint8_t last_col;
|
||||||
|
|
||||||
|
static const char PROGMEM code_to_name[60] = {' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '};
|
||||||
|
|
||||||
|
static void set_keylog(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
key_name = ' ';
|
||||||
|
last_keycode = keycode;
|
||||||
|
if (IS_QK_MOD_TAP(keycode)) {
|
||||||
|
if (record->tap.count) {
|
||||||
|
keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
|
||||||
|
} else {
|
||||||
|
keycode = 0xE0 + biton(QK_MOD_TAP_GET_MODS(keycode) & 0xF) + biton(QK_MOD_TAP_GET_MODS(keycode) & 0x10);
|
||||||
|
}
|
||||||
|
} else if (IS_QK_LAYER_TAP(keycode) && record->tap.count) {
|
||||||
|
keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
|
||||||
|
} else if (IS_QK_MODS(keycode)) {
|
||||||
|
keycode = QK_MODS_GET_BASIC_KEYCODE(keycode);
|
||||||
|
} else if (IS_QK_ONE_SHOT_MOD(keycode)) {
|
||||||
|
keycode = 0xE0 + biton(QK_ONE_SHOT_MOD_GET_MODS(keycode) & 0xF) + biton(QK_ONE_SHOT_MOD_GET_MODS(keycode) & 0x10);
|
||||||
|
}
|
||||||
|
if (keycode > ARRAY_SIZE(code_to_name)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update keylog
|
||||||
|
key_name = code_to_name[keycode];
|
||||||
|
last_row = record->event.key.row;
|
||||||
|
last_col = record->event.key.col;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *depad_str(const char *depad_str, char depad_char) {
|
||||||
|
while (*depad_str == depad_char)
|
||||||
|
++depad_str;
|
||||||
|
return depad_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void oled_render_keylog(void) {
|
||||||
|
const char *last_row_str = get_u8_str(last_row, ' ');
|
||||||
|
oled_write(depad_str(last_row_str, ' '), false);
|
||||||
|
oled_write_P(PSTR("x"), false);
|
||||||
|
const char *last_col_str = get_u8_str(last_col, ' ');
|
||||||
|
oled_write(depad_str(last_col_str, ' '), false);
|
||||||
|
oled_write_P(PSTR(", k"), false);
|
||||||
|
const char *last_keycode_str = get_u16_str(last_keycode, ' ');
|
||||||
|
oled_write(depad_str(last_keycode_str, ' '), false);
|
||||||
|
oled_write_P(PSTR(":"), false);
|
||||||
|
oled_write_char(key_name, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static void render_bootmagic_status(bool status) {
|
||||||
|
// /* Show Ctrl-Gui Swap options */
|
||||||
|
// static const char PROGMEM logo[][2][3] = {
|
||||||
|
// {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
|
||||||
|
// {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
|
||||||
|
// };
|
||||||
|
// if (status) {
|
||||||
|
// oled_write_ln_P(logo[0][0], false);
|
||||||
|
// oled_write_ln_P(logo[0][1], false);
|
||||||
|
// } else {
|
||||||
|
// oled_write_ln_P(logo[1][0], false);
|
||||||
|
// oled_write_ln_P(logo[1][1], false);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
__attribute__((weak)) void oled_render_logo(void) {
|
||||||
|
// clang-format off
|
||||||
|
static const char PROGMEM crkbd_logo[] = {
|
||||||
|
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
|
||||||
|
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
|
||||||
|
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
|
||||||
|
0};
|
||||||
|
// clang-format on
|
||||||
|
oled_write_P(crkbd_logo, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool oled_task_kb(void) {
|
||||||
|
if (!oled_task_user()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (is_keyboard_master()) {
|
||||||
|
oled_render_layer_state();
|
||||||
|
oled_render_keylog();
|
||||||
|
} else {
|
||||||
|
oled_render_logo();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_keylog(keycode, record);
|
||||||
|
}
|
||||||
|
return process_record_user(keycode, record);
|
||||||
|
}
|
||||||
|
#endif // OLED_ENABLE
|
||||||
|
@ -11,11 +11,25 @@
|
|||||||
"rgb_matrix": {
|
"rgb_matrix": {
|
||||||
"driver": "WS2812"
|
"driver": "WS2812"
|
||||||
},
|
},
|
||||||
|
"features": {
|
||||||
|
"bootmagic": true,
|
||||||
|
"extrakey": true,
|
||||||
|
"lto": true,
|
||||||
|
"mousekey": true,
|
||||||
|
"nkro": true,
|
||||||
|
"oled": true
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"lto": true
|
||||||
|
},
|
||||||
"matrix_pins": {
|
"matrix_pins": {
|
||||||
"cols": [ "F4", "F5", "F6", "F7", "B1", "B3" ],
|
"cols": [ "F4", "F5", "F6", "F7", "B1", "B3" ],
|
||||||
"rows": [ "D4", "C6", "D7", "E6" ]
|
"rows": [ "D4", "C6", "D7", "E6" ]
|
||||||
},
|
},
|
||||||
"diode_direction": "COL2ROW",
|
"diode_direction": "COL2ROW",
|
||||||
|
"split": {
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
"processor": "atmega32u4",
|
"processor": "atmega32u4",
|
||||||
"community_layouts": [ "split_3x5_3", "split_3x6_3" ]
|
"community_layouts": [ "split_3x5_3", "split_3x6_3" ]
|
||||||
}
|
}
|
||||||
|
@ -47,5 +47,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define RGBLIGHT_SAT_STEP 17
|
#define RGBLIGHT_SAT_STEP 17
|
||||||
#define RGBLIGHT_VAL_STEP 17
|
#define RGBLIGHT_VAL_STEP 17
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c"
|
|
||||||
|
@ -17,7 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[0] = LAYOUT_split_3x6_3(
|
[0] = LAYOUT_split_3x6_3(
|
||||||
@ -69,108 +68,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
//`--------------------------' `--------------------------'
|
//`--------------------------' `--------------------------'
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef OLED_ENABLE
|
|
||||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
|
||||||
if (!is_keyboard_master()) {
|
|
||||||
return OLED_ROTATION_180; // flips the display 180 degrees if offhand
|
|
||||||
}
|
|
||||||
return rotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define L_BASE 0
|
|
||||||
#define L_LOWER 2
|
|
||||||
#define L_RAISE 4
|
|
||||||
#define L_ADJUST 8
|
|
||||||
|
|
||||||
void oled_render_layer_state(void) {
|
|
||||||
oled_write_P(PSTR("Layer: "), false);
|
|
||||||
switch (layer_state) {
|
|
||||||
case L_BASE:
|
|
||||||
oled_write_ln_P(PSTR("Default"), false);
|
|
||||||
break;
|
|
||||||
case L_LOWER:
|
|
||||||
oled_write_ln_P(PSTR("Lower"), false);
|
|
||||||
break;
|
|
||||||
case L_RAISE:
|
|
||||||
oled_write_ln_P(PSTR("Raise"), false);
|
|
||||||
break;
|
|
||||||
case L_ADJUST:
|
|
||||||
case L_ADJUST|L_LOWER:
|
|
||||||
case L_ADJUST|L_RAISE:
|
|
||||||
case L_ADJUST|L_LOWER|L_RAISE:
|
|
||||||
oled_write_ln_P(PSTR("Adjust"), false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char keylog_str[24] = {};
|
|
||||||
|
|
||||||
const char code_to_name[60] = {
|
|
||||||
' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
|
|
||||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
|
||||||
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
|
||||||
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
|
|
||||||
'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\',
|
|
||||||
'#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '};
|
|
||||||
|
|
||||||
void set_keylog(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
char name = ' ';
|
|
||||||
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
|
|
||||||
(keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; }
|
|
||||||
if (keycode < 60) {
|
|
||||||
name = code_to_name[keycode];
|
|
||||||
}
|
|
||||||
|
|
||||||
// update keylog
|
|
||||||
snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c",
|
|
||||||
record->event.key.row, record->event.key.col,
|
|
||||||
keycode, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void oled_render_keylog(void) {
|
|
||||||
oled_write(keylog_str, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void render_bootmagic_status(bool status) {
|
|
||||||
/* Show Ctrl-Gui Swap options */
|
|
||||||
static const char PROGMEM logo[][2][3] = {
|
|
||||||
{{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
|
|
||||||
{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
|
|
||||||
};
|
|
||||||
if (status) {
|
|
||||||
oled_write_ln_P(logo[0][0], false);
|
|
||||||
oled_write_ln_P(logo[0][1], false);
|
|
||||||
} else {
|
|
||||||
oled_write_ln_P(logo[1][0], false);
|
|
||||||
oled_write_ln_P(logo[1][1], false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void oled_render_logo(void) {
|
|
||||||
static const char PROGMEM crkbd_logo[] = {
|
|
||||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
|
|
||||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
|
|
||||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
|
|
||||||
0};
|
|
||||||
oled_write_P(crkbd_logo, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool oled_task_user(void) {
|
|
||||||
if (is_keyboard_master()) {
|
|
||||||
oled_render_layer_state();
|
|
||||||
oled_render_keylog();
|
|
||||||
} else {
|
|
||||||
oled_render_logo();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
set_keylog(keycode, record);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif // OLED_ENABLE
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
|
||||||
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
|
|
||||||
OLED_ENABLE = yes
|
|
||||||
OLED_DRIVER = SSD1306
|
|
||||||
LTO_ENABLE = yes
|
|
@ -68,110 +68,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
//`--------------------------' `--------------------------'
|
//`--------------------------' `--------------------------'
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef OLED_ENABLE
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
|
||||||
if (!is_keyboard_master()) {
|
|
||||||
return OLED_ROTATION_180; // flips the display 180 degrees if offhand
|
|
||||||
}
|
|
||||||
return rotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define L_BASE 0
|
|
||||||
#define L_LOWER 2
|
|
||||||
#define L_RAISE 4
|
|
||||||
#define L_ADJUST 8
|
|
||||||
|
|
||||||
void oled_render_layer_state(void) {
|
|
||||||
oled_write_P(PSTR("Layer: "), false);
|
|
||||||
switch (layer_state) {
|
|
||||||
case L_BASE:
|
|
||||||
oled_write_ln_P(PSTR("Default"), false);
|
|
||||||
break;
|
|
||||||
case L_LOWER:
|
|
||||||
oled_write_ln_P(PSTR("Lower"), false);
|
|
||||||
break;
|
|
||||||
case L_RAISE:
|
|
||||||
oled_write_ln_P(PSTR("Raise"), false);
|
|
||||||
break;
|
|
||||||
case L_ADJUST:
|
|
||||||
case L_ADJUST|L_LOWER:
|
|
||||||
case L_ADJUST|L_RAISE:
|
|
||||||
case L_ADJUST|L_LOWER|L_RAISE:
|
|
||||||
oled_write_ln_P(PSTR("Adjust"), false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char keylog_str[24] = {};
|
|
||||||
|
|
||||||
const char code_to_name[60] = {
|
|
||||||
' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
|
|
||||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
|
||||||
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
|
||||||
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
|
|
||||||
'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\',
|
|
||||||
'#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '};
|
|
||||||
|
|
||||||
void set_keylog(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
char name = ' ';
|
|
||||||
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
|
|
||||||
(keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; }
|
|
||||||
if (keycode < 60) {
|
|
||||||
name = code_to_name[keycode];
|
|
||||||
}
|
|
||||||
|
|
||||||
// update keylog
|
|
||||||
snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c",
|
|
||||||
record->event.key.row, record->event.key.col,
|
|
||||||
keycode, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void oled_render_keylog(void) {
|
|
||||||
oled_write(keylog_str, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void render_bootmagic_status(bool status) {
|
|
||||||
/* Show Ctrl-Gui Swap options */
|
|
||||||
static const char PROGMEM logo[][2][3] = {
|
|
||||||
{{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
|
|
||||||
{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
|
|
||||||
};
|
|
||||||
if (status) {
|
|
||||||
oled_write_ln_P(logo[0][0], false);
|
|
||||||
oled_write_ln_P(logo[0][1], false);
|
|
||||||
} else {
|
|
||||||
oled_write_ln_P(logo[1][0], false);
|
|
||||||
oled_write_ln_P(logo[1][1], false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void oled_render_logo(void) {
|
|
||||||
static const char PROGMEM crkbd_logo[] = {
|
|
||||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
|
|
||||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
|
|
||||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
|
|
||||||
0};
|
|
||||||
oled_write_P(crkbd_logo, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool oled_task_user(void) {
|
|
||||||
if (is_keyboard_master()) {
|
|
||||||
oled_render_layer_state();
|
|
||||||
oled_render_keylog();
|
|
||||||
} else {
|
|
||||||
oled_render_logo();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
set_keylog(keycode, record);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif // OLED_ENABLE
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
MOUSEKEY_ENABLE = no # Mouse keys
|
MOUSEKEY_ENABLE = no # Mouse keys
|
||||||
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
|
|
||||||
VIA_ENABLE = yes # Enable VIA
|
VIA_ENABLE = yes # Enable VIA
|
||||||
OLED_ENABLE = yes
|
|
||||||
OLED_DRIVER = SSD1306
|
|
||||||
LTO_ENABLE = yes
|
LTO_ENABLE = yes
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "crkbd.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
char host_led_state_str[24];
|
char host_led_state_str[24];
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "crkbd.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
char keylog_str[24] = {};
|
char keylog_str[24] = {};
|
||||||
char keylogs_str[21] = {};
|
char keylogs_str[21] = {};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "crkbd.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
const char *read_logo(void) {
|
const char *read_logo(void) {
|
||||||
static char logo[] = {
|
static char logo[] = {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "crkbd.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
char mode_icon[24];
|
char mode_icon[24];
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
extern rgblight_config_t rgblight_config;
|
extern rgblight_config_t rgblight_config;
|
||||||
char rbf_info_str[24];
|
char rbf_info_str[24];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "crkbd.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
char timelog_str[24] = {};
|
char timelog_str[24] = {};
|
||||||
int last_time = 0;
|
int last_time = 0;
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
"features": {
|
||||||
|
"rgb_matrix": true
|
||||||
|
},
|
||||||
"split": {
|
"split": {
|
||||||
"soft_serial_pin": "D2"
|
"soft_serial_pin": "D2"
|
||||||
},
|
},
|
||||||
@ -110,5 +113,63 @@
|
|||||||
{"matrix": [7, 3], "x": 10, "y": 3.7}
|
{"matrix": [7, 3], "x": 10, "y": 3.7}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"rgb_matrix": {
|
||||||
|
"layout": [
|
||||||
|
{"x": 85, "y": 16, "flags": 2},
|
||||||
|
{"x": 50, "y": 13, "flags": 2},
|
||||||
|
{"x": 16, "y": 20, "flags": 2},
|
||||||
|
{"x": 16, "y": 38, "flags": 2},
|
||||||
|
{"x": 50, "y": 48, "flags": 2},
|
||||||
|
{"x": 85, "y": 52, "flags": 2},
|
||||||
|
{"matrix": [3, 5], "x": 95, "y": 63, "flags": 1},
|
||||||
|
{"matrix": [2, 5], "x": 85, "y": 39, "flags": 4},
|
||||||
|
{"matrix": [1, 5], "x": 85, "y": 21, "flags": 4},
|
||||||
|
{"matrix": [0, 5], "x": 85, "y": 4, "flags": 4},
|
||||||
|
{"matrix": [0, 4], "x": 68, "y": 2, "flags": 4},
|
||||||
|
{"matrix": [1, 4], "x": 68, "y": 19, "flags": 4},
|
||||||
|
{"matrix": [2, 4], "x": 68, "y": 37, "flags": 4},
|
||||||
|
{"matrix": [3, 4], "x": 80, "y": 58, "flags": 1},
|
||||||
|
{"matrix": [3, 3], "x": 60, "y": 55, "flags": 1},
|
||||||
|
{"matrix": [2, 3], "x": 50, "y": 35, "flags": 4},
|
||||||
|
{"matrix": [1, 3], "x": 50, "y": 13, "flags": 4},
|
||||||
|
{"matrix": [0, 3], "x": 50, "y": 0, "flags": 4},
|
||||||
|
{"matrix": [0, 2], "x": 33, "y": 3, "flags": 4},
|
||||||
|
{"matrix": [1, 2], "x": 33, "y": 20, "flags": 4},
|
||||||
|
{"matrix": [2, 2], "x": 33, "y": 37, "flags": 4},
|
||||||
|
{"matrix": [2, 1], "x": 16, "y": 42, "flags": 4},
|
||||||
|
{"matrix": [1, 1], "x": 16, "y": 24, "flags": 4},
|
||||||
|
{"matrix": [0, 1], "x": 16, "y": 7, "flags": 4},
|
||||||
|
{"matrix": [0, 0], "x": 0, "y": 7, "flags": 1},
|
||||||
|
{"matrix": [1, 0], "x": 0, "y": 24, "flags": 1},
|
||||||
|
{"matrix": [2, 0], "x": 0, "y": 41, "flags": 1},
|
||||||
|
{"x": 139, "y": 16, "flags": 2},
|
||||||
|
{"x": 174, "y": 13, "flags": 2},
|
||||||
|
{"x": 208, "y": 20, "flags": 2},
|
||||||
|
{"x": 208, "y": 38, "flags": 2},
|
||||||
|
{"x": 174, "y": 48, "flags": 2},
|
||||||
|
{"x": 139, "y": 52, "flags": 2},
|
||||||
|
{"matrix": [7, 5], "x": 129, "y": 63, "flags": 1},
|
||||||
|
{"matrix": [6, 5], "x": 139, "y": 39, "flags": 4},
|
||||||
|
{"matrix": [5, 5], "x": 139, "y": 21, "flags": 4},
|
||||||
|
{"matrix": [4, 5], "x": 139, "y": 4, "flags": 4},
|
||||||
|
{"matrix": [4, 4], "x": 156, "y": 2, "flags": 4},
|
||||||
|
{"matrix": [5, 4], "x": 156, "y": 19, "flags": 4},
|
||||||
|
{"matrix": [6, 4], "x": 156, "y": 37, "flags": 4},
|
||||||
|
{"matrix": [7, 4], "x": 144, "y": 58, "flags": 1},
|
||||||
|
{"matrix": [7, 3], "x": 164, "y": 55, "flags": 1},
|
||||||
|
{"matrix": [6, 3], "x": 174, "y": 35, "flags": 4},
|
||||||
|
{"matrix": [5, 3], "x": 174, "y": 13, "flags": 4},
|
||||||
|
{"matrix": [4, 3], "x": 174, "y": 0, "flags": 4},
|
||||||
|
{"matrix": [4, 2], "x": 191, "y": 3, "flags": 4},
|
||||||
|
{"matrix": [5, 2], "x": 191, "y": 20, "flags": 4},
|
||||||
|
{"matrix": [6, 2], "x": 191, "y": 37, "flags": 4},
|
||||||
|
{"matrix": [6, 1], "x": 208, "y": 42, "flags": 4},
|
||||||
|
{"matrix": [5, 1], "x": 208, "y": 24, "flags": 4},
|
||||||
|
{"matrix": [4, 1], "x": 208, "y": 7, "flags": 4},
|
||||||
|
{"matrix": [4, 0], "x": 224, "y": 7, "flags": 1},
|
||||||
|
{"matrix": [5, 0], "x": 224, "y": 24, "flags": 1},
|
||||||
|
{"matrix": [6, 0], "x": 224, "y": 41, "flags": 1}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,98 +88,7 @@ led_config_t g_led_config = { {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef OLED_ENABLE
|
#ifdef OLED_ENABLE
|
||||||
|
void oled_render_logo(void) {
|
||||||
oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
|
|
||||||
if (!is_keyboard_master()) {
|
|
||||||
return OLED_ROTATION_180; // flips the display 180 degrees if offhand
|
|
||||||
}
|
|
||||||
return rotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Layers{
|
|
||||||
L_BASE, L_LOWER, L_RAISE, L_ADJUST
|
|
||||||
};
|
|
||||||
|
|
||||||
void oled_render_layer_state_r2g(void) {
|
|
||||||
oled_write_P(PSTR("Layer: "), false);
|
|
||||||
switch (get_highest_layer(layer_state)) {
|
|
||||||
case L_BASE:
|
|
||||||
oled_write_ln_P(PSTR("Default"), false);
|
|
||||||
break;
|
|
||||||
case L_LOWER:
|
|
||||||
oled_write_ln_P(PSTR("Lower"), false);
|
|
||||||
break;
|
|
||||||
case L_RAISE:
|
|
||||||
oled_write_ln_P(PSTR("Raise"), false);
|
|
||||||
break;
|
|
||||||
case L_ADJUST:
|
|
||||||
oled_write_ln_P(PSTR("Adjust"), false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//char keylog_str_r2g[24] = {};
|
|
||||||
|
|
||||||
const char code_to_name_r2g[60] = {
|
|
||||||
' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
|
|
||||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
|
||||||
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
|
||||||
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
|
|
||||||
'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\',
|
|
||||||
'#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '};
|
|
||||||
|
|
||||||
char key_name_r2g = ' ';
|
|
||||||
uint16_t last_keycode_r2g;
|
|
||||||
uint8_t last_row_r2g;
|
|
||||||
uint8_t last_col_r2g;
|
|
||||||
|
|
||||||
void set_keylog_r2g(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
key_name_r2g = ' ';
|
|
||||||
last_keycode_r2g = keycode;
|
|
||||||
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
|
|
||||||
(keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { last_keycode_r2g = keycode & 0xFF; }
|
|
||||||
if (keycode < 60) {
|
|
||||||
key_name_r2g = code_to_name_r2g[keycode];
|
|
||||||
}
|
|
||||||
last_row_r2g = record->event.key.row;
|
|
||||||
last_col_r2g = record->event.key.col;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *depad_str(const char *depad_str, char depad_char) {
|
|
||||||
while (*depad_str == depad_char) ++depad_str;
|
|
||||||
return depad_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
void oled_render_keylog_r2g(void) {
|
|
||||||
//oled_write(keylog_str_r2g, false);
|
|
||||||
const char *last_row_r2g_str = get_u8_str(last_row_r2g, ' ');
|
|
||||||
oled_write(depad_str(last_row_r2g_str, ' '), false);
|
|
||||||
oled_write_P(PSTR("x"), false);
|
|
||||||
const char *last_col_r2g_str = get_u8_str(last_col_r2g, ' ');
|
|
||||||
oled_write(depad_str(last_col_r2g_str, ' '), false);
|
|
||||||
oled_write_P(PSTR(", k"), false);
|
|
||||||
const char *last_keycode_r2g_str = get_u16_str(last_keycode_r2g, ' ');
|
|
||||||
oled_write(depad_str(last_keycode_r2g_str, ' '), false);
|
|
||||||
oled_write_P(PSTR(":"), false);
|
|
||||||
oled_write_char(key_name_r2g, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void render_bootmagic_status_r2g(bool status) {
|
|
||||||
/* Show Ctrl-Gui Swap options */
|
|
||||||
static const char PROGMEM logo[][2][3] = {
|
|
||||||
{{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
|
|
||||||
{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
|
|
||||||
};
|
|
||||||
if (status) {
|
|
||||||
oled_write_ln_P(logo[0][0], false);
|
|
||||||
oled_write_ln_P(logo[0][1], false);
|
|
||||||
} else {
|
|
||||||
oled_write_ln_P(logo[1][0], false);
|
|
||||||
oled_write_ln_P(logo[1][1], false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void oled_render_logo_r2g(void) {
|
|
||||||
static const char PROGMEM mb_logo[] = {
|
static const char PROGMEM mb_logo[] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
@ -218,23 +127,4 @@ void oled_render_logo_r2g(void) {
|
|||||||
//oled_set_cursor(oled_max_chars()/2,oled_max_lines()/2);
|
//oled_set_cursor(oled_max_chars()/2,oled_max_lines()/2);
|
||||||
//oled_write_P(PSTR("R2G"), false);
|
//oled_write_P(PSTR("R2G"), false);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
bool oled_task_kb(void) {
|
|
||||||
if (!oled_task_user()) { return false; }
|
|
||||||
if (is_keyboard_master()) {
|
|
||||||
oled_render_layer_state_r2g();
|
|
||||||
oled_render_keylog_r2g();
|
|
||||||
} else {
|
|
||||||
oled_render_logo_r2g();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
set_keylog_r2g(keycode, record);
|
|
||||||
}
|
|
||||||
return process_record_user(keycode, record);
|
|
||||||
}
|
|
||||||
#endif // OLED_ENABLE
|
|
||||||
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
OLED_ENABLE = yes
|
|
||||||
OLED_DRIVER = SSD1306
|
|
||||||
LTO_ENABLE = yes
|
|
||||||
RGBLIGHT_ENABLE = yes
|
|
||||||
|
|
||||||
SPLIT_KEYBOARD = yes
|
|
@ -1 +0,0 @@
|
|||||||
DEFAULT_FOLDER = crkbd/rev1
|
|
@ -1,11 +1,72 @@
|
|||||||
{
|
{
|
||||||
|
"features": {
|
||||||
|
"rgblight": true
|
||||||
|
},
|
||||||
"split": {
|
"split": {
|
||||||
"soft_serial_pin": "D2"
|
"soft_serial_pin": "D2"
|
||||||
},
|
},
|
||||||
"ws2812": {
|
"ws2812": {
|
||||||
"pin": "D3"
|
"pin": "D3"
|
||||||
},
|
},
|
||||||
"bootloader": "caterina",
|
"rgb_matrix": {
|
||||||
|
"layout": [
|
||||||
|
{"x": 85, "y": 16, "flags": 2},
|
||||||
|
{"x": 50, "y": 13, "flags": 2},
|
||||||
|
{"x": 16, "y": 20, "flags": 2},
|
||||||
|
{"x": 16, "y": 38, "flags": 2},
|
||||||
|
{"x": 50, "y": 48, "flags": 2},
|
||||||
|
{"x": 85, "y": 52, "flags": 2},
|
||||||
|
{"matrix": [3, 5], "x": 95, "y": 63, "flags": 1},
|
||||||
|
{"matrix": [2, 5], "x": 85, "y": 39, "flags": 4},
|
||||||
|
{"matrix": [1, 5], "x": 85, "y": 21, "flags": 4},
|
||||||
|
{"matrix": [0, 5], "x": 85, "y": 4, "flags": 4},
|
||||||
|
{"matrix": [0, 4], "x": 68, "y": 2, "flags": 4},
|
||||||
|
{"matrix": [1, 4], "x": 68, "y": 19, "flags": 4},
|
||||||
|
{"matrix": [2, 4], "x": 68, "y": 37, "flags": 4},
|
||||||
|
{"matrix": [3, 4], "x": 80, "y": 58, "flags": 1},
|
||||||
|
{"matrix": [3, 3], "x": 60, "y": 55, "flags": 1},
|
||||||
|
{"matrix": [2, 3], "x": 50, "y": 35, "flags": 4},
|
||||||
|
{"matrix": [1, 3], "x": 50, "y": 13, "flags": 4},
|
||||||
|
{"matrix": [0, 3], "x": 50, "y": 0, "flags": 4},
|
||||||
|
{"matrix": [0, 2], "x": 33, "y": 3, "flags": 4},
|
||||||
|
{"matrix": [1, 2], "x": 33, "y": 20, "flags": 4},
|
||||||
|
{"matrix": [2, 2], "x": 33, "y": 37, "flags": 4},
|
||||||
|
{"matrix": [2, 1], "x": 16, "y": 42, "flags": 4},
|
||||||
|
{"matrix": [1, 1], "x": 16, "y": 24, "flags": 4},
|
||||||
|
{"matrix": [0, 1], "x": 16, "y": 7, "flags": 4},
|
||||||
|
{"matrix": [0, 0], "x": 0, "y": 7, "flags": 1},
|
||||||
|
{"matrix": [1, 0], "x": 0, "y": 24, "flags": 1},
|
||||||
|
{"matrix": [2, 0], "x": 0, "y": 41, "flags": 1},
|
||||||
|
{"x": 139, "y": 16, "flags": 2},
|
||||||
|
{"x": 174, "y": 13, "flags": 2},
|
||||||
|
{"x": 208, "y": 20, "flags": 2},
|
||||||
|
{"x": 208, "y": 38, "flags": 2},
|
||||||
|
{"x": 174, "y": 48, "flags": 2},
|
||||||
|
{"x": 139, "y": 52, "flags": 2},
|
||||||
|
{"matrix": [7, 5], "x": 129, "y": 63, "flags": 1},
|
||||||
|
{"matrix": [6, 5], "x": 139, "y": 39, "flags": 4},
|
||||||
|
{"matrix": [5, 5], "x": 139, "y": 21, "flags": 4},
|
||||||
|
{"matrix": [4, 5], "x": 139, "y": 4, "flags": 4},
|
||||||
|
{"matrix": [4, 4], "x": 156, "y": 2, "flags": 4},
|
||||||
|
{"matrix": [5, 4], "x": 156, "y": 19, "flags": 4},
|
||||||
|
{"matrix": [6, 4], "x": 156, "y": 37, "flags": 4},
|
||||||
|
{"matrix": [7, 4], "x": 144, "y": 58, "flags": 1},
|
||||||
|
{"matrix": [7, 3], "x": 164, "y": 55, "flags": 1},
|
||||||
|
{"matrix": [6, 3], "x": 174, "y": 35, "flags": 4},
|
||||||
|
{"matrix": [5, 3], "x": 174, "y": 13, "flags": 4},
|
||||||
|
{"matrix": [4, 3], "x": 174, "y": 0, "flags": 4},
|
||||||
|
{"matrix": [4, 2], "x": 191, "y": 3, "flags": 4},
|
||||||
|
{"matrix": [5, 2], "x": 191, "y": 20, "flags": 4},
|
||||||
|
{"matrix": [6, 2], "x": 191, "y": 37, "flags": 4},
|
||||||
|
{"matrix": [6, 1], "x": 208, "y": 42, "flags": 4},
|
||||||
|
{"matrix": [5, 1], "x": 208, "y": 24, "flags": 4},
|
||||||
|
{"matrix": [4, 1], "x": 208, "y": 7, "flags": 4},
|
||||||
|
{"matrix": [4, 0], "x": 224, "y": 7, "flags": 1},
|
||||||
|
{"matrix": [5, 0], "x": 224, "y": 24, "flags": 1},
|
||||||
|
{"matrix": [6, 0], "x": 224, "y": 41, "flags": 1}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"development_board": "promicro",
|
||||||
"layout_aliases": {
|
"layout_aliases": {
|
||||||
"LAYOUT": "LAYOUT_split_3x6_3"
|
"LAYOUT": "LAYOUT_split_3x6_3"
|
||||||
},
|
},
|
||||||
|
@ -1 +0,0 @@
|
|||||||
DEFAULT_FOLDER = crkbd/rev1
|
|
@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 @foostan
|
|
||||||
Copyright 2020 Drashna Jaelre <@drashna>
|
|
||||||
|
|
||||||
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 "quantum.h"
|
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
|
||||||
|
|
||||||
// Logical Layout
|
|
||||||
// Columns
|
|
||||||
// Left
|
|
||||||
// 0 1 2 3 4 5
|
|
||||||
// ROWS
|
|
||||||
// 25 24 19 18 11 10 0
|
|
||||||
// 03 02 01
|
|
||||||
// 26 23 20 17 12 09 1
|
|
||||||
// 04 05 06
|
|
||||||
// 27 22 21 16 13 08 2
|
|
||||||
//
|
|
||||||
// 15 14 07 3
|
|
||||||
//
|
|
||||||
// Right
|
|
||||||
// 0 1 2 3 4 5
|
|
||||||
// ROWS
|
|
||||||
// 25 24 19 18 11 10 4
|
|
||||||
// 03 02 01
|
|
||||||
// 26 23 20 17 12 09 5
|
|
||||||
// 04 05 06
|
|
||||||
// 27 22 21 16 13 08 6
|
|
||||||
//
|
|
||||||
// 15 14 07 7
|
|
||||||
//
|
|
||||||
// Physical Layout
|
|
||||||
// Columns
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
|
|
||||||
// ROWS
|
|
||||||
// 25 24 19 18 11 10 10 11 18 19 24 25 0
|
|
||||||
// 03 02 01 01 02 03
|
|
||||||
// 26 23 20 17 12 09 09 12 17 20 23 26 1
|
|
||||||
// 04 04
|
|
||||||
// 27 22 21 16 13 08 08 13 16 21 22 27 2
|
|
||||||
// 05 06 06 05
|
|
||||||
// 15 14 07 07 14 15 3
|
|
||||||
|
|
||||||
led_config_t g_led_config = { {
|
|
||||||
{ 24, 23, 18, 17, 10, 9 },
|
|
||||||
{ 25, 22, 19, 16, 11, 8 },
|
|
||||||
{ 26, 21, 20, 15, 12, 7 },
|
|
||||||
{ NO_LED, NO_LED, NO_LED, 14, 13, 6 },
|
|
||||||
{ 51, 50, 45, 44, 37, 36 },
|
|
||||||
{ 52, 49, 46, 43, 38, 35 },
|
|
||||||
{ 53, 48, 47, 42, 39, 34 },
|
|
||||||
{ NO_LED, NO_LED, NO_LED, 41, 40, 33 }
|
|
||||||
}, {
|
|
||||||
{ 85, 16 }, { 50, 13 }, { 16, 20 }, { 16, 38 }, { 50, 48 }, { 85, 52 }, { 95, 63 },
|
|
||||||
{ 85, 39 }, { 85, 21 }, { 85, 4 }, { 68, 2 }, { 68, 19 }, { 68, 37 }, { 80, 58 },
|
|
||||||
{ 60, 55 }, { 50, 35 }, { 50, 13 }, { 50, 0 }, { 33, 3 }, { 33, 20 }, { 33, 37 },
|
|
||||||
{ 16, 42 }, { 16, 24 }, { 16, 7 }, { 0, 7 }, { 0, 24 }, { 0, 41 }, { 139, 16 },
|
|
||||||
{ 174, 13 }, { 208, 20 }, { 208, 38 }, { 174, 48 }, { 139, 52 }, { 129, 63 }, { 139, 39 },
|
|
||||||
{ 139, 21 }, { 139, 4 }, { 156, 2 }, { 156, 19 }, { 156, 37 }, { 144, 58 }, { 164, 55 },
|
|
||||||
{ 174, 35 }, { 174, 13 }, { 174, 0 }, { 191, 3 }, { 191, 20 }, { 191, 37 }, { 208, 42 },
|
|
||||||
{ 208, 24 }, { 208, 7 }, { 224, 7 }, { 224, 24 }, { 224, 41 }
|
|
||||||
}, {
|
|
||||||
2, 2, 2, 2, 2, 2, 1,
|
|
||||||
4, 4, 4, 4, 4, 4, 1,
|
|
||||||
1, 4, 4, 4, 4, 4, 4,
|
|
||||||
4, 4, 4, 1, 1, 1, 2,
|
|
||||||
2, 2, 2, 2, 2, 1, 4,
|
|
||||||
4, 4, 4, 4, 4, 1, 1,
|
|
||||||
4, 4, 4, 4, 4, 4, 4,
|
|
||||||
4, 4, 1, 1, 1
|
|
||||||
} };
|
|
||||||
|
|
||||||
void suspend_power_down_kb(void) {
|
|
||||||
rgb_matrix_set_suspend_state(true);
|
|
||||||
suspend_power_down_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void suspend_wakeup_init_kb(void) {
|
|
||||||
rgb_matrix_set_suspend_state(false);
|
|
||||||
suspend_wakeup_init_user();
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1 +0,0 @@
|
|||||||
SPLIT_KEYBOARD = yes
|
|
@ -1,20 +1,6 @@
|
|||||||
# Build Options
|
# Build Options
|
||||||
# change yes to no to disable
|
# change yes to no to disable
|
||||||
#
|
#
|
||||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
|
||||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
|
||||||
CONSOLE_ENABLE = no # Console for debug
|
|
||||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
|
||||||
NKRO_ENABLE = yes # Enable N-Key Rollover
|
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
|
||||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
|
||||||
AUDIO_ENABLE = no # Audio output
|
|
||||||
RGB_MATRIX_ENABLE = no
|
|
||||||
LTO_ENABLE = yes
|
|
||||||
|
|
||||||
# if firmware size over limit, try this option
|
|
||||||
# LTO_ENABLE = yes
|
|
||||||
|
|
||||||
DEFAULT_FOLDER = crkbd/rev1
|
DEFAULT_FOLDER = crkbd/rev1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user