mirror of
https://github.com/openstenoproject/qmk
synced 2024-11-21 16:04:38 +00:00
Merge dnaq's HID protocol changes
This commit is contained in:
commit
10fd5a8aed
19 changed files with 434 additions and 0 deletions
|
@ -92,6 +92,11 @@ ifeq ($(MUSIC_ENABLE), yes)
|
|||
SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(PLOVER_HID_ENABLE)), yes)
|
||||
OPT_DEFS += -DPLOVER_HID_ENABLE
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_plover_hid.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(STENO_ENABLE)), yes)
|
||||
OPT_DEFS += -DSTENO_ENABLE
|
||||
VIRTSER_ENABLE ?= yes
|
||||
|
|
|
@ -66,6 +66,7 @@ OTHER_OPTION_NAMES = \
|
|||
KEYLOGGER_ENABLE \
|
||||
LCD_BACKLIGHT_ENABLE \
|
||||
MACROS_ENABLED \
|
||||
PLOVER_HID_ENABLE \
|
||||
PS2_MOUSE_ENABLE \
|
||||
RAW_ENABLE \
|
||||
SWAP_HANDS_ENABLE \
|
||||
|
|
|
@ -4,7 +4,9 @@ bool i2c_initialized = 0;
|
|||
i2c_status_t mcp23018_status = 0x20;
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
#ifdef STENO_ENABLE
|
||||
steno_set_mode(STENO_MODE_GEMINI); // or STENO_MODE_BOLT
|
||||
#endif
|
||||
|
||||
// (tied to Vcc for hardware convenience)
|
||||
//DDRB &= ~(1<<4); // set B(4) as input
|
||||
|
|
51
keyboards/gboards/georgi/keymaps/plover-hid/keymap.c
Normal file
51
keyboards/gboards/georgi/keymaps/plover-hid/keymap.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Good on you for modifying your layout, this is the most nonQMK layout you will come across
|
||||
* There are three modes, Steno (the default), QWERTY (Toggleable) and a Momentary symbol layer
|
||||
*
|
||||
* Don't modify the steno layer directly, instead add chords using the keycodes and macros
|
||||
* from sten.h to the layout you want to modify.
|
||||
*
|
||||
* Observe the comment above processQWERTY!
|
||||
*
|
||||
* http://docs.gboards.ca
|
||||
*/
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
//#include "sten.h"
|
||||
#include "keymap_plover_hid.h"
|
||||
|
||||
// Proper Layers
|
||||
#define FUNCT (LSD | LK | LP | LH)
|
||||
#define MEDIA (LSD | LK | LW | LR)
|
||||
#define MOVE (ST1 | ST2)
|
||||
|
||||
// QMK Layers
|
||||
#define STENO_LAYER 0
|
||||
|
||||
/* Keyboard Layout
|
||||
* ,---------------------------------. ,------------------------------.
|
||||
* | FN | LSU | LFT | LP | LH | ST1 | | ST3 | RF | RP | RL | RT | RD |
|
||||
* |-----+-----+-----+----+----|-----| |-----|----+----+----+----+----|
|
||||
* | PWR | LSD | LK | LW | LR | ST2 | | ST4 | RR | BB | RG | RS | RZ |
|
||||
* `---------------------------------' `------------------------------'
|
||||
* ,---------------, .---------------.
|
||||
* | LNO | LA | LO | | RE | RU | RNO |
|
||||
* `---------------' `---------------'
|
||||
*/
|
||||
|
||||
// "Layers"
|
||||
// Steno layer should be first in your map.
|
||||
// When PWR | FN | ST3 | ST4 is pressed, the layer is increased to the next map. You must return to STENO_LAYER at the end.
|
||||
// If you need more space for chords, remove the two gaming layers.
|
||||
// Note: If using NO_ACTION_TAPPING, LT will not work!
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
// Main layer, everything goes through here
|
||||
[0] = LAYOUT_georgi(
|
||||
PLV_X1, PLV_SL, PLV_TL, PLV_PL, PLV_HL, PLV_STR, PLV_STR, PLV_FR, PLV_PR, PLV_LR, PLV_TR, PLV_DR,
|
||||
PLV_X2, PLV_SL, PLV_KL, PLV_WL, PLV_RL, PLV_STR, PLV_STR, PLV_RR, PLV_BR, PLV_GR, PLV_SR, PLV_ZR,
|
||||
PLV_NUM, PLV_A, PLV_O, PLV_E, PLV_U, PLV_NUM
|
||||
)
|
||||
};
|
||||
// Don't fuck with this, thanks.
|
||||
size_t keymapsCount = sizeof(keymaps)/sizeof(keymaps[0]);
|
14
keyboards/gboards/georgi/keymaps/plover-hid/readme.md
Normal file
14
keyboards/gboards/georgi/keymaps/plover-hid/readme.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Georgi Plover HID firmware
|
||||
|
||||
This is a steno-only firmware for the Georgi using the (as of now) experimental Plover HID protocol
|
||||
instead of a serial steno protocol.
|
||||
|
||||
This firmware only defines a keymap of the form:
|
||||
|
||||
```
|
||||
X1 S1- T- P- H- S1 S3 -F -P -L -T -D
|
||||
X2 S2- X- W- R- S2 S4 -R -B -G -S -Z
|
||||
#1 A O E U #7
|
||||
```
|
||||
|
||||
and is meant to be used with the [plover-machine-hid](https://github.com/dnaq/plover-machine-hid) plugin.
|
46
keyboards/gboards/georgi/keymaps/plover-hid/rules.mk
Normal file
46
keyboards/gboards/georgi/keymaps/plover-hid/rules.mk
Normal file
|
@ -0,0 +1,46 @@
|
|||
#----------------------------------------------------------------------------
|
||||
# make georgi:default:dfu
|
||||
# Make sure you have dfu-programmer installed!
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
NO_REPEAT = no
|
||||
VERBOSE = yes
|
||||
KEYBOARD_SHARED_EP = yes
|
||||
CUSTOM_MATRIX = yes
|
||||
|
||||
#Firmware reduction options
|
||||
MOUSEKEY_ENABLE = no # 1500 bytes
|
||||
NO_TAPPING = yes # 2000 bytes
|
||||
NO_PRINT = yes
|
||||
|
||||
#Debug options
|
||||
CONSOLE_ENABLE = no
|
||||
DEBUG_MATRIX_SCAN_RATE = no
|
||||
DEBUG_MATRIX = no
|
||||
ONLY_QWERTY = no
|
||||
|
||||
# A bunch of stuff that you shouldn't touch unless you
|
||||
# know what you're doing.
|
||||
#
|
||||
# No touchy, capiche?
|
||||
SRC += matrix.c i2c_master.c
|
||||
ifeq ($(strip $(DEBUG_MATRIX)), yes)
|
||||
OPT_DEFS += -DDEBUG_MATRIX
|
||||
endif
|
||||
ifeq ($(strip $(NO_REPEAT)), yes)
|
||||
OPT_DEFS += -DNO_REPEAT
|
||||
endif
|
||||
ifeq ($(strip $(NO_PRINT)), yes)
|
||||
OPT_DEFS += -DNO_PRINT -DNO_DEBUG
|
||||
endif
|
||||
ifeq ($(strip $(ONLY_QWERTY)), yes)
|
||||
OPT_DEFS += -DONLYQWERTY
|
||||
endif
|
||||
ifeq ($(strip $(NO_TAPPING)), yes)
|
||||
OPT_DEFS += -DNO_ACTION_TAPPING
|
||||
endif
|
||||
|
||||
USER_NAME := notexisting
|
||||
|
||||
PLOVER_HID_ENABLE := yes
|
||||
STENO_ENABLE := no
|
|
@ -50,6 +50,7 @@ uint16_t repTimer = 0;
|
|||
bool inMouse = false;
|
||||
int8_t mousePress;
|
||||
|
||||
#ifdef STENO_ENABLE
|
||||
// All processing done at chordUp goes through here
|
||||
bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) {
|
||||
// Check for mousekeys, this is release
|
||||
|
@ -146,6 +147,7 @@ out:
|
|||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Update Chord State
|
||||
bool process_steno_user(uint16_t keycode, keyrecord_t *record) {
|
||||
|
|
89
quantum/keymap_extras/keymap_plover_hid.h
Normal file
89
quantum/keymap_extras/keymap_plover_hid.h
Normal file
|
@ -0,0 +1,89 @@
|
|||
/* Copyright 2017 Joseph Wasson
|
||||
*
|
||||
* 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 "keymap.h"
|
||||
|
||||
// List of keycodes for the plover HID.
|
||||
enum steno_keycodes {
|
||||
PLV__MIN = QK_PLOVER_HID,
|
||||
PLV_SL = PLV__MIN,
|
||||
PLV_TL,
|
||||
PLV_KL,
|
||||
PLV_PL,
|
||||
PLV_WL,
|
||||
PLV_HL,
|
||||
PLV_RL,
|
||||
PLV_A,
|
||||
PLV_O,
|
||||
PLV_STR,
|
||||
PLV_E,
|
||||
PLV_U,
|
||||
PLV_FR,
|
||||
PLV_RR,
|
||||
PLV_PR,
|
||||
PLV_BR,
|
||||
PLV_LR,
|
||||
PLV_GR,
|
||||
PLV_TR,
|
||||
PLV_SR,
|
||||
PLV_DR,
|
||||
PLV_ZR,
|
||||
PLV_NUM,
|
||||
PLV_X1,
|
||||
PLV_X2,
|
||||
PLV_X3,
|
||||
PLV_X4,
|
||||
PLV_X5,
|
||||
PLV_X6,
|
||||
PLV_X7,
|
||||
PLV_X8,
|
||||
PLV_X9,
|
||||
PLV_X10,
|
||||
PLV_X11,
|
||||
PLV_X12,
|
||||
PLV_X13,
|
||||
PLV_X14,
|
||||
PLV_X15,
|
||||
PLV_X16,
|
||||
PLV_X17,
|
||||
PLV_X18,
|
||||
PLV_X19,
|
||||
PLV_X20,
|
||||
PLV_X21,
|
||||
PLV_X22,
|
||||
PLV_X23,
|
||||
PLV_X24,
|
||||
PLV_X25,
|
||||
PLV_X26,
|
||||
PLV_X27,
|
||||
PLV_X28,
|
||||
PLV_X29,
|
||||
PLV_X30,
|
||||
PLV_X31,
|
||||
PLV_X32,
|
||||
PLV_X33,
|
||||
PLV_X34,
|
||||
PLV_X35,
|
||||
PLV_X36,
|
||||
PLV_X37,
|
||||
PLV_X38,
|
||||
PLV_X39,
|
||||
PLV_X40,
|
||||
PLV_X41,
|
||||
PLV__MAX = PLV_X41,
|
||||
};
|
4
quantum/plover_hid.h
Normal file
4
quantum/plover_hid.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
void plover_hid_update(uint8_t button, bool pressed);
|
||||
void plover_hid_task(void);
|
11
quantum/process_keycode/process_plover_hid.c
Normal file
11
quantum/process_keycode/process_plover_hid.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include "process_plover_hid.h"
|
||||
#include "keymap_plover_hid.h"
|
||||
#include "plover_hid.h"
|
||||
|
||||
bool process_plover_hid(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode < PLV__MIN || keycode > PLV__MAX) {
|
||||
return true;
|
||||
}
|
||||
plover_hid_update(keycode - PLV__MIN, record->event.pressed);
|
||||
return false;
|
||||
}
|
20
quantum/process_keycode/process_plover_hid.h
Normal file
20
quantum/process_keycode/process_plover_hid.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* Copyright 2021 The QMK Project
|
||||
*
|
||||
* 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 "quantum.h"
|
||||
|
||||
bool process_plover_hid(uint16_t keycode, keyrecord_t *record);
|
|
@ -277,6 +277,9 @@ bool process_record_quantum(keyrecord_t *record) {
|
|||
#if defined(BACKLIGHT_ENABLE) || defined(LED_MATRIX_ENABLE)
|
||||
process_backlight(keycode, record) &&
|
||||
#endif
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
process_plover_hid(keycode, record) &&
|
||||
#endif
|
||||
#ifdef STENO_ENABLE
|
||||
process_steno(keycode, record) &&
|
||||
#endif
|
||||
|
|
|
@ -81,6 +81,10 @@ extern layer_state_t layer_state;
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
# include "process_plover_hid.h"
|
||||
#endif
|
||||
|
||||
#ifdef STENO_ENABLE
|
||||
# include "process_steno.h"
|
||||
#endif
|
||||
|
|
|
@ -65,6 +65,8 @@ enum quantum_keycodes {
|
|||
QK_STENO_COMB = 0x5A32,
|
||||
QK_STENO_COMB_MAX = 0x5A3C,
|
||||
QK_STENO_MAX = 0x5A3F,
|
||||
QK_PLOVER_HID = 0x5A40,
|
||||
QK_PLOVER_HID_MAX = 0x5A80,
|
||||
// 0x5C00 - 0x5FFF are reserved, see below
|
||||
QK_MOD_TAP = 0x6000,
|
||||
QK_MOD_TAP_MAX = 0x7FFF,
|
||||
|
|
|
@ -74,6 +74,10 @@ void virtser_task(void);
|
|||
void raw_hid_task(void);
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
void plover_hid_task(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
void console_task(void);
|
||||
#endif
|
||||
|
@ -218,4 +222,7 @@ void protocol_post_task(void) {
|
|||
#ifdef RAW_ENABLE
|
||||
raw_hid_task();
|
||||
#endif
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
plover_hid_task();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -313,6 +313,9 @@ typedef struct {
|
|||
#ifdef RAW_ENABLE
|
||||
usb_driver_config_t raw_driver;
|
||||
#endif
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
usb_driver_config_t plover_hid_driver;
|
||||
#endif
|
||||
#ifdef MIDI_ENABLE
|
||||
usb_driver_config_t midi_driver;
|
||||
#endif
|
||||
|
@ -350,6 +353,14 @@ static usb_driver_configs_t drivers = {
|
|||
.raw_driver = QMK_USB_DRIVER_CONFIG(RAW, 0, false),
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
# define PLOVER_HID_IN_CAPACITY 4
|
||||
# define PLOVER_HID_OUT_CAPACITY 4
|
||||
# define PLOVER_HID_IN_MODE USB_EP_MODE_TYPE_INTR
|
||||
# define PLOVER_HID_OUT_MODE USB_EP_MODE_TYPE_INTR
|
||||
.plover_hid_driver = QMK_USB_DRIVER_CONFIG(PLOVER_HID, 0, false),
|
||||
#endif
|
||||
|
||||
#ifdef MIDI_ENABLE
|
||||
# define MIDI_STREAM_IN_CAPACITY 4
|
||||
# define MIDI_STREAM_OUT_CAPACITY 4
|
||||
|
@ -1087,6 +1098,26 @@ void console_task(void) {
|
|||
|
||||
#endif /* CONSOLE_ENABLE */
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
static bool plover_hid_report_updated = false;
|
||||
static uint8_t plover_hid_current_report[PLOVER_HID_EPSIZE] = {0x50};
|
||||
void plover_hid_update(uint8_t button, bool pressed) {
|
||||
if (pressed) {
|
||||
plover_hid_current_report[1 + button/8] |= (1 << (7 - (button % 8)));
|
||||
} else {
|
||||
plover_hid_current_report[1 + button/8] &= ~(1 << (7 - (button % 8)));
|
||||
}
|
||||
plover_hid_report_updated = true;
|
||||
}
|
||||
|
||||
void plover_hid_task(void) {
|
||||
if (plover_hid_report_updated) {
|
||||
chnWrite(&drivers.plover_hid_driver.driver, plover_hid_current_report, sizeof(plover_hid_current_report));
|
||||
plover_hid_report_updated = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RAW_ENABLE
|
||||
void raw_hid_send(uint8_t *data, uint8_t length) {
|
||||
// TODO: implement variable size packet
|
||||
|
|
|
@ -86,6 +86,10 @@ extern keymap_config_t keymap_config;
|
|||
# include "raw_hid.h"
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
# include "plover_hid.h"
|
||||
#endif
|
||||
|
||||
#ifdef JOYSTICK_ENABLE
|
||||
# include "joystick.h"
|
||||
#endif
|
||||
|
@ -209,6 +213,43 @@ static void raw_hid_task(void) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
static bool plover_hid_report_updated = false;
|
||||
static uint8_t plover_hid_current_report[PLOVER_HID_EPSIZE] = {0x50};
|
||||
void plover_hid_update(uint8_t button, bool pressed) {
|
||||
if (pressed) {
|
||||
plover_hid_current_report[1 + button/8] |= (1 << (7 - (button % 8)));
|
||||
} else {
|
||||
plover_hid_current_report[1 + button/8] &= ~(1 << (7 - (button % 8)));
|
||||
}
|
||||
plover_hid_report_updated = true;
|
||||
}
|
||||
|
||||
void plover_hid_task(void) {
|
||||
if (USB_DeviceState != DEVICE_STATE_Configured) {
|
||||
return;
|
||||
}
|
||||
if (!plover_hid_report_updated) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t ep = Endpoint_GetCurrentEndpoint();
|
||||
|
||||
Endpoint_SelectEndpoint(PLOVER_HID_IN_EPNUM);
|
||||
|
||||
if (Endpoint_IsINReady()) {
|
||||
// Write data
|
||||
Endpoint_Write_Stream_LE(plover_hid_current_report, sizeof(plover_hid_current_report), NULL);
|
||||
// Finalize The stream transfer to send the last packet
|
||||
Endpoint_ClearIN();
|
||||
plover_hid_report_updated = false;
|
||||
}
|
||||
|
||||
Endpoint_SelectEndpoint(ep);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Console
|
||||
******************************************************************************/
|
||||
|
@ -436,6 +477,7 @@ void EVENT_USB_Device_StartOfFrame(void) {
|
|||
if (!console_flush) return;
|
||||
Console_Task();
|
||||
console_flush = false;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -471,6 +513,11 @@ void EVENT_USB_Device_ConfigurationChanged(void) {
|
|||
ConfigSuccess &= Endpoint_ConfigureEndpoint((RAW_OUT_EPNUM | ENDPOINT_DIR_OUT), EP_TYPE_INTERRUPT, RAW_EPSIZE, 1);
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
/* Setup Plover HID endpoint */
|
||||
ConfigSuccess &= Endpoint_ConfigureEndpoint((PLOVER_HID_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, PLOVER_HID_EPSIZE, 1);
|
||||
#endif
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
/* Setup console endpoint */
|
||||
ConfigSuccess &= Endpoint_ConfigureEndpoint((CONSOLE_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_INTERRUPT, CONSOLE_EPSIZE, 1);
|
||||
|
@ -1096,6 +1143,10 @@ void protocol_post_task(void) {
|
|||
raw_hid_task();
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
plover_hid_task();
|
||||
#endif
|
||||
|
||||
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
|
||||
USB_USBTask();
|
||||
#endif
|
||||
|
|
|
@ -322,6 +322,24 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM RawReport[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
const USB_Descriptor_HIDReport_Datatype_t PROGMEM PloverReport[] = {
|
||||
HID_RI_USAGE_PAGE(16, 0xff50), //
|
||||
HID_RI_USAGE(16, 0x4c56), // Vendor Defined (0xff P L V)
|
||||
HID_RI_COLLECTION(8, 0x01), // Application
|
||||
HID_RI_REPORT_ID(8, 80),
|
||||
HID_RI_LOGICAL_MINIMUM(8, 0),
|
||||
HID_RI_LOGICAL_MAXIMUM(8, 1),
|
||||
HID_RI_REPORT_SIZE(8, 1),
|
||||
HID_RI_REPORT_COUNT(8, 64),
|
||||
HID_RI_USAGE_PAGE(8, 0x0a), // Usage Page: Ordinal
|
||||
HID_RI_USAGE_MINIMUM(8, 0),
|
||||
HID_RI_USAGE_MAXIMUM(8, 63),
|
||||
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
|
||||
HID_RI_END_COLLECTION(0),
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] = {
|
||||
HID_RI_USAGE_PAGE(16, 0xFF31), // Vendor Defined (PJRC Teensy compatible)
|
||||
|
@ -554,6 +572,46 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = {
|
|||
},
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
/*
|
||||
* Plover HID
|
||||
*/
|
||||
.Plover_Interface = {
|
||||
.Header = {
|
||||
.Size = sizeof(USB_Descriptor_Interface_t),
|
||||
.Type = DTYPE_Interface
|
||||
},
|
||||
.InterfaceNumber = PLOVER_HID_INTERFACE,
|
||||
.AlternateSetting = 0x00,
|
||||
.TotalEndpoints = 1,
|
||||
.Class = HID_CSCP_HIDClass,
|
||||
.SubClass = HID_CSCP_NonBootSubclass,
|
||||
.Protocol = HID_CSCP_NonBootProtocol,
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
.Plover_HID = {
|
||||
.Header = {
|
||||
.Size = sizeof(USB_HID_Descriptor_HID_t),
|
||||
.Type = HID_DTYPE_HID
|
||||
},
|
||||
.HIDSpec = VERSION_BCD(1, 1, 1),
|
||||
.CountryCode = 0x00,
|
||||
.TotalReportDescriptors = 1,
|
||||
.HIDReportType = HID_DTYPE_Report,
|
||||
.HIDReportLength = sizeof(PloverReport)
|
||||
},
|
||||
.Plover_INEndpoint = {
|
||||
.Header = {
|
||||
.Size = sizeof(USB_Descriptor_Endpoint_t),
|
||||
.Type = DTYPE_Endpoint
|
||||
},
|
||||
.EndpointAddress = (ENDPOINT_DIR_IN | PLOVER_HID_IN_EPNUM),
|
||||
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = RAW_EPSIZE,
|
||||
.PollingIntervalMS = 0x01
|
||||
},
|
||||
#endif
|
||||
|
||||
#if defined(MOUSE_ENABLE) && !defined(MOUSE_SHARED_EP)
|
||||
/*
|
||||
* Mouse
|
||||
|
@ -1148,6 +1206,14 @@ uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const
|
|||
break;
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
case PLOVER_HID_INTERFACE:
|
||||
Address = &ConfigurationDescriptor.Plover_HID;
|
||||
Size = sizeof(USB_HID_Descriptor_HID_t);
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
case CONSOLE_INTERFACE:
|
||||
Address = &ConfigurationDescriptor.Console_HID;
|
||||
|
@ -1205,6 +1271,14 @@ uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const
|
|||
break;
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
case PLOVER_HID_INTERFACE:
|
||||
Address = &PloverReport;
|
||||
Size = sizeof(PloverReport);
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
case CONSOLE_INTERFACE:
|
||||
Address = &ConsoleReport;
|
||||
|
|
|
@ -75,6 +75,13 @@ typedef struct {
|
|||
USB_Descriptor_Endpoint_t Raw_OUTEndpoint;
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
// Plover HID Interface
|
||||
USB_Descriptor_Interface_t Plover_Interface;
|
||||
USB_HID_Descriptor_HID_t Plover_HID;
|
||||
USB_Descriptor_Endpoint_t Plover_INEndpoint;
|
||||
#endif
|
||||
|
||||
#if defined(MOUSE_ENABLE) && !defined(MOUSE_SHARED_EP)
|
||||
// Mouse HID Interface
|
||||
USB_Descriptor_Interface_t Mouse_Interface;
|
||||
|
@ -162,6 +169,10 @@ enum usb_interfaces {
|
|||
RAW_INTERFACE,
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
PLOVER_HID_INTERFACE,
|
||||
#endif
|
||||
|
||||
#if defined(MOUSE_ENABLE) && !defined(MOUSE_SHARED_EP)
|
||||
MOUSE_INTERFACE,
|
||||
#endif
|
||||
|
@ -223,6 +234,11 @@ enum usb_endpoints {
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PLOVER_HID_ENABLE
|
||||
PLOVER_HID_IN_EPNUM = NEXT_EPNUM,
|
||||
PLOVER_HID_OUT_EPNUM = NEXT_EPNUM,
|
||||
#endif
|
||||
|
||||
#ifdef SHARED_EP_ENABLE
|
||||
SHARED_IN_EPNUM = NEXT_EPNUM,
|
||||
#endif
|
||||
|
@ -303,6 +319,7 @@ enum usb_endpoints {
|
|||
#define SHARED_EPSIZE 32
|
||||
#define MOUSE_EPSIZE 8
|
||||
#define RAW_EPSIZE 32
|
||||
#define PLOVER_HID_EPSIZE 9
|
||||
#define CONSOLE_EPSIZE 32
|
||||
#define MIDI_STREAM_EPSIZE 64
|
||||
#define CDC_NOTIFICATION_EPSIZE 8
|
||||
|
|
Loading…
Reference in a new issue