Compare commits

...
9 Commits
Author SHA1 Message Date
skullydazedandErovia 5780c94423 Improve the functionality of qmk.questions (#8020)
* wip

* tested and working

* remove unused import

* Update lib/python/qmk/questions.py

Co-Authored-By: Erovia <[email protected]>

* fix flake8 errors

Co-authored-by: Erovia <[email protected]>
2020-02-03 09:04:58 -08:00
Mike Rix Wolfe acef512730 [Keymap] Add User Keymap for FC660C (#8062)
* add my keymaps

* tri layer keymap

* update tri layer

* update tri layer

* cleaning up

* formatting

* move to correct location

* lily58: move caps off mod key in sublayer

* Update keyboards/lily58/keymaps/mikefightsbears/rules.mk

* Update keyboards/lily58/keymaps/mikefightsbears/rules.mk

* Update keyboards/lily58/keymaps/mikefightsbears/rules.mk

* Update keyboards/lily58/keymaps/mikefightsbears/rules.mk

* remove unnecessary trailing whacks

* remove unneeded file

* swap spacebar

* update code for comments in PR

* add fc660c keymap

* rm readme

* move layer key

* remove inconvenient alternate keys

* swap format

* add them media keys

* add rules mk

* swap caps and ctrl

* remove unneeded config

* use gesc instead of esc
2020-02-02 13:11:17 -08:00
QMK Bot fa9c74c6a2 format code according to conventions [skip ci] 2020-02-02 20:47:40 +00:00
fauxpark b2ce2f8a34 Dedupe extrakey report struct, and send functions in V-USB & LUFA (#7993)
* Dedupe extrakey report struct, and send functions in V-USB & LUFA

* Doc comment for consistency

* Wrap it in ifdef to prevent unused function error

* Do the same for ATSAM
2020-02-02 12:17:05 -08:00
Joel Challis 5b91c3e0a0 Fix cformat processing files within ignore folders (#8063) 2020-02-02 16:33:17 +00:00
fauxpark 1877736fa4 Update dirty submodule make message (#8065) 2020-02-02 13:24:29 +00:00
James Young c096be3831 [Docs] future branch housekeeping 2020-02-01 21:36:59 -08:00
QMK Bot 4888a118c3 format code according to conventions [skip ci] 2020-02-02 02:40:30 +00:00
fauxpark e036b94a21 Align ATSAM HID descriptors with LUFA/ChibiOS (#7651)
* Align ATSAM HID descriptors with LUFA/ChibiOS

* Don't hardcode raw endpoint size
2020-02-02 13:10:57 +11:00
14 changed files with 331 additions and 227 deletions

No files matched your search

+2 -2
View File
@@ -15,8 +15,8 @@ The next Breaking Change is scheduled for February 29, 2020.
### Important Dates ### Important Dates
* [x] 2019 Sep 21 - `future` is created. It will be rebased weekly. * [x] 2019 Sep 21 - `future` is created. It will be rebased weekly.
* [ ] 2020 Feb 1 - `future` closed to new PR's. * [x] 2020 Feb 1 - `future` closed to new PR's.
* [ ] 2020 Feb 1 - Call for testers. * [x] 2020 Feb 1 - Call for testers.
* [ ] 2020 Feb 26 - `master` is locked, no PR's merged. * [ ] 2020 Feb 26 - `master` is locked, no PR's merged.
* [ ] 2020 Feb 28 - Merge `future` to `master`. * [ ] 2020 Feb 28 - Merge `future` to `master`.
* [ ] 2020 Feb 29 - `master` is unlocked. PR's can be merged again. * [ ] 2020 Feb 29 - `master` is unlocked. PR's can be merged again.
@@ -0,0 +1,34 @@
/*
Copyright 2017 Balz Guenat
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
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_GESC,KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSPC, KC_INS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL,
KC_LCTL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT,
KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, KC_UP,
KC_CAPS,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RCTL,MO(1), KC_LEFT,KC_DOWN,KC_RGHT
),
[1] = LAYOUT(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_PSCR,KC_SLCK,KC_PAUS,_______, _______,
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,_______,_______,KC_MUTE,KC_MPRV,KC_MNXT,KC_MPLY,_______, KC_PGUP,
_______,_______,_______, _______, _______,_______,_______, KC_HOME,KC_PGDN,KC_END
)
};
@@ -0,0 +1,6 @@
# Build Options
# # change to "no" to disable the options, or define them in the Makefile in
# # the appropriate keymap folder that will get included automatically
# #
EXTRAKEY_ENABLE = yes # Audio control and System control
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
@@ -10,10 +10,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
), ),
[1] = LAYOUT_65_ansi_blocker( [1] = LAYOUT_65_ansi_blocker(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_DEL, KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_DEL,
KC_TRNS, KC_TRNS, RGB_VAI, KC_TRNS, KC_TRNS, RGB_SAI, RGB_HUI, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_END, _______, _______, RGB_VAI, _______, _______, RGB_SAI, RGB_HUI, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END,
KC_TRNS, RGB_SPD, RGB_VAD, RGB_SPI, KC_TRNS, RGB_SAD, RGB_HUD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, _______, RGB_SPD, RGB_VAD, RGB_SPI, _______, RGB_SAD, RGB_HUD, _______, _______, _______, _______, _______, _______, KC_VOLU,
KC_TRNS, RGB_RMOD, RGB_TOG, RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_MPRV, KC_MNXT, KC_MPLY, KC_TRNS, KC_PGUP, KC_VOLD, _______, RGB_RMOD, RGB_TOG, RGB_MOD, _______, _______, _______, KC_MUTE, KC_MPRV, KC_MNXT, KC_MPLY, _______, KC_PGUP, KC_VOLD,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END
) )
}; };
+1
View File
@@ -29,6 +29,7 @@ def cformat(cli):
for dirpath, dirnames, filenames in os.walk(dir): for dirpath, dirnames, filenames in os.walk(dir):
if any(i in dirpath for i in ignores): if any(i in dirpath for i in ignores):
dirnames.clear() dirnames.clear()
continue
for name in filenames: for name in filenames:
if name.endswith(('.c', '.h', '.cpp')): if name.endswith(('.c', '.h', '.cpp')):
+89 -8
View File
@@ -16,7 +16,7 @@ def yesno(prompt, *args, default=None, **kwargs):
Arguments: Arguments:
prompt prompt
The prompt to present to the user. Can include ANSI and format strings like milc's `cli.print()`. The prompt to present to the user. Can include ANSI and format strings like milc's `cli.echo()`.
default default
Whether to default to a Yes or No when the user presses enter. Whether to default to a Yes or No when the user presses enter.
@@ -43,9 +43,9 @@ def yesno(prompt, *args, default=None, **kwargs):
prompt = prompt + ' [y/N] ' prompt = prompt + ' [y/N] '
while True: while True:
print() cli.echo('')
answer = input(format_ansi(prompt % args)) answer = input(format_ansi(prompt % args))
print() cli.echo('')
if not answer and prompt is not None: if not answer and prompt is not None:
return default return default
@@ -57,17 +57,26 @@ def yesno(prompt, *args, default=None, **kwargs):
return False return False
def question(prompt, *args, default=None, confirm=False, answer_type=str, **kwargs): def question(prompt, *args, default=None, confirm=False, answer_type=str, validate=None, **kwargs):
"""Prompt the user to answer a question with a free-form input. """Prompt the user to answer a question with a free-form input.
Arguments:
prompt prompt
The prompt to present to the user. Can include ANSI and format strings like milc's `cli.print()`. The prompt to present to the user. Can include ANSI and format strings like milc's `cli.echo()`.
default default
The value to return when the user doesn't enter any value. Use None to prompt until they enter a value. The value to return when the user doesn't enter any value. Use None to prompt until they enter a value.
confirm
Present the user with a confirmation dialog before accepting their answer.
answer_type answer_type
Specify a type function for the answer. Will re-prompt the user if the function raises any errors. Common choices here include int, float, and decimal.Decimal. Specify a type function for the answer. Will re-prompt the user if the function raises any errors. Common choices here include int, float, and decimal.Decimal.
validate
This is an optional function that can be used to validate the answer. It should return True or False and have the following signature:
def function_name(answer, *args, **kwargs):
""" """
if not args and kwargs: if not args and kwargs:
args = kwargs args = kwargs
@@ -76,17 +85,21 @@ def question(prompt, *args, default=None, confirm=False, answer_type=str, **kwar
prompt = '%s [%s] ' % (prompt, default) prompt = '%s [%s] ' % (prompt, default)
while True: while True:
print() cli.echo('')
answer = input(format_ansi(prompt % args)) answer = input(format_ansi(prompt % args))
print() cli.echo('')
if answer: if answer:
if confirm: if validate is not None and not validate(answer, *args, **kwargs):
continue
elif confirm:
if yesno('Is the answer "%s" correct?', answer, default=True): if yesno('Is the answer "%s" correct?', answer, default=True):
try: try:
return answer_type(answer) return answer_type(answer)
except Exception as e: except Exception as e:
cli.log.error('Could not convert answer (%s) to type %s: %s', answer, answer_type.__name__, str(e)) cli.log.error('Could not convert answer (%s) to type %s: %s', answer, answer_type.__name__, str(e))
else: else:
try: try:
return answer_type(answer) return answer_type(answer)
@@ -95,3 +108,71 @@ def question(prompt, *args, default=None, confirm=False, answer_type=str, **kwar
elif default is not None: elif default is not None:
return default return default
def choice(heading, options, *args, default=None, confirm=False, prompt='Please enter your choice: ', **kwargs):
"""Present the user with a list of options and let them pick one.
Users can enter either the number or the text of their choice.
This will return the value of the item they choose, not the numerical index.
Arguments:
heading
The text to place above the list of options.
options
A sequence of items to choose from.
default
The index of the item to return when the user doesn't enter any value. Use None to prompt until they enter a value.
confirm
Present the user with a confirmation dialog before accepting their answer.
prompt
The prompt to present to the user. Can include ANSI and format strings like milc's `cli.echo()`.
"""
if not args and kwargs:
args = kwargs
if prompt and default:
prompt = prompt + ' [%s] ' % (default + 1,)
while True:
# Prompt for an answer.
cli.echo('')
cli.echo(heading % args)
cli.echo('')
for i, option in enumerate(options, 1):
cli.echo('\t{fg_cyan}%d.{fg_reset} %s', i, option)
cli.echo('')
answer = input(format_ansi(prompt))
cli.echo('')
# If the user types in one of the options exactly use that
if answer in options:
return answer
# Massage the answer into a valid integer
if answer == '' and default:
answer = default
else:
try:
answer = int(answer) - 1
except Exception:
# Normally we would log the exception here, but in the interest of clean UI we do not.
cli.log.error('Invalid choice: %s', answer + 1)
continue
# Validate the answer
if answer >= len(options) or answer < 0:
cli.log.error('Invalid choice: %s', answer + 1)
continue
if confirm and not yesno('Is the answer "%s" correct?', answer + 1, default=True):
continue
# Return the answer they chose.
return options[answer]
+2 -5
View File
@@ -54,11 +54,8 @@ MSG_COMPILING_CXX = Compiling:
MSG_ASSEMBLING = Assembling: MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project: MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library: MSG_CREATING_LIBRARY = Creating library:
MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \ MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR) Some git submodules are out of date or modified.\n\
Some git sub-modules are out of date or modified, please consider running:$(BOLD)\n\ Please consider running $(BOLD)make git-submodule$(NO_COLOR).\n\n
make git-submodule\n\
You can ignore this warning if you are not compiling any ChibiOS keyboards,\n\
or if you have modified the ChibiOS libraries yourself. \n\n$(NO_COLOR)
MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR) MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR)
define GENERATE_MSG_MAKE_KB define GENERATE_MSG_MAKE_KB
+5
View File
@@ -150,6 +150,11 @@ typedef union {
#endif #endif
} __attribute__((packed)) report_keyboard_t; } __attribute__((packed)) report_keyboard_t;
typedef struct {
uint8_t report_id;
uint16_t usage;
} __attribute__((packed)) report_extra_t;
typedef struct { typedef struct {
#ifdef MOUSE_SHARED_EP #ifdef MOUSE_SHARED_EP
uint8_t report_id; uint8_t report_id;
+10 -16
View File
@@ -110,40 +110,34 @@ void send_mouse(report_mouse_t *report) {
#endif // MOUSEKEY_ENABLE #endif // MOUSEKEY_ENABLE
} }
void send_system(uint16_t data) {
#ifdef EXTRAKEY_ENABLE #ifdef EXTRAKEY_ENABLE
void send_extra(uint8_t report_id, uint16_t data) {
uint32_t irqflags; uint32_t irqflags;
irqflags = __get_PRIMASK(); irqflags = __get_PRIMASK();
__disable_irq(); __disable_irq();
__DMB(); __DMB();
udi_hid_exk_report.desc.report_id = REPORT_ID_SYSTEM; udi_hid_exk_report.desc.report_id = report_id;
if (data != 0) data = data - SYSTEM_POWER_DOWN + 1;
udi_hid_exk_report.desc.report_data = data; udi_hid_exk_report.desc.report_data = data;
udi_hid_exk_b_report_valid = 1; udi_hid_exk_b_report_valid = 1;
udi_hid_exk_send_report(); udi_hid_exk_send_report();
__DMB(); __DMB();
__set_PRIMASK(irqflags); __set_PRIMASK(irqflags);
}
#endif // EXTRAKEY_ENABLE
void send_system(uint16_t data) {
#ifdef EXTRAKEY_ENABLE
if (data != 0) data = data - SYSTEM_POWER_DOWN + 1;
send_extra(REPORT_ID_SYSTEM, data);
#endif // EXTRAKEY_ENABLE #endif // EXTRAKEY_ENABLE
} }
void send_consumer(uint16_t data) { void send_consumer(uint16_t data) {
#ifdef EXTRAKEY_ENABLE #ifdef EXTRAKEY_ENABLE
uint32_t irqflags; send_extra(REPORT_ID_CONSUMER, data);
irqflags = __get_PRIMASK();
__disable_irq();
__DMB();
udi_hid_exk_report.desc.report_id = REPORT_ID_CONSUMER;
udi_hid_exk_report.desc.report_data = data;
udi_hid_exk_b_report_valid = 1;
udi_hid_exk_send_report();
__DMB();
__set_PRIMASK(irqflags);
#endif // EXTRAKEY_ENABLE #endif // EXTRAKEY_ENABLE
} }
+156 -141
View File
@@ -98,30 +98,36 @@ UDC_DESC_STORAGE udi_hid_kbd_report_desc_t udi_hid_kbd_report_desc = {{
0x05, 0x01, // Usage Page (Generic Desktop) 0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x06, // Usage (Keyboard) 0x09, 0x06, // Usage (Keyboard)
0xA1, 0x01, // Collection (Application) 0xA1, 0x01, // Collection (Application)
// Modifiers (8 bits)
0x05, 0x07, // Usage Page (Keyboard) 0x05, 0x07, // Usage Page (Keyboard)
0x19, 0xE0, // Usage Minimum (224) 0x19, 0xE0, // Usage Minimum (Keyboard Left Control)
0x29, 0xE7, // Usage Maximum (231) 0x29, 0xE7, // Usage Maximum (Keyboard Right GUI)
0x15, 0x00, // Logical Minimum (0) 0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1) 0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x08, // Report Count (8) 0x95, 0x08, // Report Count (8)
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input (Data, Variable, Absolute) 0x81, 0x02, // Input (Data, Variable, Absolute)
// Reserved (1 byte)
0x81, 0x01, // Input (Constant) 0x81, 0x01, // Input (Constant)
// Keycodes (6 bytes)
0x19, 0x00, // Usage Minimum (0) 0x19, 0x00, // Usage Minimum (0)
0x29, 0xFF, // Usage Maximum (255) 0x29, 0xFF, // Usage Maximum (255)
0x15, 0x00, // Logical Minimum (0) 0x15, 0x00, // Logical Minimum (0)
0x25, 0xFF, // Logical Maximum (255) 0x25, 0xFF, // Logical Maximum (255)
0x75, 0x08, // Report Size (8)
0x95, 0x06, // Report Count (6) 0x95, 0x06, // Report Count (6)
0x81, 0x00, // Input (Data, Array) 0x75, 0x08, // Report Size (8)
0x81, 0x00, // Input (Data, Array, Absolute)
// Status LEDs (5 bits)
0x05, 0x08, // Usage Page (LED) 0x05, 0x08, // Usage Page (LED)
0x19, 0x01, // Usage Minimum (1) 0x19, 0x01, // Usage Minimum (Num Lock)
0x29, 0x05, // Usage Maximum (5) 0x29, 0x05, // Usage Maximum (Kana)
0x15, 0x00, // Logical Minimum (0) 0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1) 0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x05, // Report Count (5) 0x95, 0x05, // Report Count (5)
0x75, 0x01, // Report Size (1)
0x91, 0x02, // Output (Data, Variable, Absolute) 0x91, 0x02, // Output (Data, Variable, Absolute)
// LED padding (3 bits)
0x95, 0x03, // Report Count (3) 0x95, 0x03, // Report Count (3)
0x91, 0x01, // Output (Constant) 0x91, 0x01, // Output (Constant)
0xC0 // End Collection 0xC0 // End Collection
@@ -231,43 +237,41 @@ static uint8_t udi_hid_nkro_report_trans[UDI_HID_NKRO_REPORT_SIZE];
COMPILER_WORD_ALIGNED COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE udi_hid_nkro_report_desc_t udi_hid_nkro_report_desc = {{ UDC_DESC_STORAGE udi_hid_nkro_report_desc_t udi_hid_nkro_report_desc = {{
0x05, 0x01, // Usage Page (Generic Desktop), 0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x06, // Usage (Keyboard), 0x09, 0x06, // Usage (Keyboard)
0xA1, 0x01, // Collection (Application) - Keyboard, 0xA1, 0x01, // Collection (Application)
// Mods // Modifiers (8 bits)
0x75, 0x01, // Report Size (1), 0x05, 0x07, // Usage Page (Keyboard/Keypad)
0x95, 0x08, // Report Count (8), 0x19, 0xE0, // Usage Minimum (Keyboard Left Control)
0x15, 0x00, // Logical Minimum (0), 0x29, 0xE7, // Usage Maximum (Keyboard Right GUI)
0x25, 0x01, // Logical Maximum (1), 0x15, 0x00, // Logical Minimum (0)
0x05, 0x07, // Usage Page (Key Codes), 0x25, 0x01, // Logical Maximum (1)
0x19, 0xE0, // Usage Minimum (224), 0x95, 0x08, // Report Count (8)
0x29, 0xE7, // Usage Maximum (231), 0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input (Data, Variable, Absolute), 0x81, 0x02, // Input (Data, Variable, Absolute)
// Keycodes
0x05, 0x07, // Usage Page (Keyboard/Keypad)
0x19, 0x00, // Usage Minimum (0)
0x29, 0xF7, // Usage Maximum (247)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0xF8, // Report Count (248)
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield)
// LED Report // Status LEDs (5 bits)
0x75, 0x01, // Report Size (1), 0x05, 0x08, // Usage Page (LED)
0x95, 0x05, // Report Count (5), 0x19, 0x01, // Usage Minimum (Num Lock)
0x05, 0x08, // Usage Page (LEDs), 0x29, 0x05, // Usage Maximum (Kana)
0x19, 0x01, // Usage Minimum (1), 0x95, 0x05, // Report Count (5)
0x29, 0x05, // Usage Maximum (5), 0x75, 0x01, // Report Size (1)
0x91, 0x02, // Output (Data, Variable, Absolute), 0x91, 0x02, // Output (Data, Variable, Absolute)
// LED padding (3 bits)
// LED Report Padding 0x95, 0x01, // Report Count (1)
0x75, 0x03, // Report Size (3), 0x75, 0x03, // Report Size (3)
0x95, 0x01, // Report Count (1), 0x91, 0x03, // Output (Constant)
0x91, 0x03, // Output (Constant), 0xC0 // End Collection
// Main keys
0x75, 0x01, // Report Size (1),
0x95, 0xF8, // Report Count (248),
0x15, 0x00, // Logical Minimum (0),
0x25, 0x01, // Logical Maximum (1),
0x05, 0x07, // Usage Page (Key Codes),
0x19, 0x00, // Usage Minimum (0),
0x29, 0xF7, // Usage Maximum (247),
0x81, 0x02, // Input (Data, Variable, Absolute, Bitfield),
0xc0, // End Collection - Keyboard
}}; }};
static bool udi_hid_nkro_setreport(void); static bool udi_hid_nkro_setreport(void);
@@ -373,35 +377,39 @@ static uint8_t udi_hid_exk_report_trans[UDI_HID_EXK_REPORT_SIZE];
COMPILER_WORD_ALIGNED COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE udi_hid_exk_report_desc_t udi_hid_exk_report_desc = {{ UDC_DESC_STORAGE udi_hid_exk_report_desc_t udi_hid_exk_report_desc = {{
// System Control Collection (8 bits) 0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x80, // Usage (System Control)
0xA1, 0x01, // Collection (Application)
0x85, REPORT_ID_SYSTEM, // Report ID
0x1A, 0x81,
0x00, // Usage Minimum (81) (System Power Down)
0x2A, 0x83,
0x00, // Usage Maximum (83) (System Wake Up)
0x16, 0x01,
0x00, // Logical Minimum (1)
0x26, 0x03,
0x00, // Logical Maximum (3)
0x95, 0x01, // Report Count (1)
0x75, 0x10, // Report Size (16)
0x81, 0x00, // Input (Data, Array, Absolute)
0xC0, // End Collection
0x05, 0x01, // Usage Page (Generic Desktop), 0x05, 0x0C, // Usage Page (Consumer)
0x09, 0x80, // Usage (System Control), 0x09, 0x01, // Usage (Consumer Control)
0xA1, 0x01, // Collection (Application), 0xA1, 0x01, // Collection (Application)
0x85, REPORT_ID_SYSTEM, // Report ID (2) (System), 0x85, REPORT_ID_CONSUMER, // Report ID
0x16, 0x01, 0x00, // Logical Minimum (1), 0x1A, 0x01,
0x26, 0x03, 0x00, // Logical Maximum (3), 0x00, // Usage Minimum (Consumer Control)
0x1A, 0x81, 0x00, // Usage Minimum (81) (System Power Down), 0x2A, 0x9C,
0x2A, 0x83, 0x00, // Usage Maximum (83) (System Wake Up), 0x02, // Usage Maximum (AC Distribute Vertically)
0x75, 0x10, // Report Size (16), 0x16, 0x01,
0x95, 0x01, // Report Count (1), 0x00, // Logical Minimum
0x81, 0x00, // Input (Data, Array), 0x26, 0x9C,
0xC0, // End Collection - System Control 0x02, // Logical Maximum
0x95, 0x01, // Report Count (1)
// Consumer Control Collection - Media Keys (16 bits) 0x75, 0x10, // Report Size (16)
0x81, 0x00, // Input (Data, Array, Absolute)
0x05, 0x0C, // Usage Page (Consumer), 0xC0 // End Collection
0x09, 0x01, // Usage (Consumer Control),
0xA1, 0x01, // Collection (Application),
0x85, REPORT_ID_CONSUMER, // Report ID (3) (Consumer),
0x16, 0x01, 0x00, // Logical Minimum (1),
0x26, 0x9C, 0x02, // Logical Maximum (668),
0x1A, 0x01, 0x00, // Usage Minimum (1),
0x2A, 0x9C, 0x02, // Usage Maximum (668),
0x75, 0x10, // Report Size (16),
0x95, 0x01, // Report Count (1),
0x81, 0x00, // Input (Data, Array),
0xC0, // End Collection - Consumer Control
}}; }};
static bool udi_hid_exk_setreport(void); static bool udi_hid_exk_setreport(void);
@@ -506,49 +514,53 @@ static uint8_t udi_hid_mou_report_trans[UDI_HID_MOU_REPORT_SIZE];
COMPILER_WORD_ALIGNED COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE udi_hid_mou_report_desc_t udi_hid_mou_report_desc = {{ UDC_DESC_STORAGE udi_hid_mou_report_desc_t udi_hid_mou_report_desc = {{
0x05, 0x01, // Usage Page (Generic Desktop), 0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x02, // Usage (Mouse), 0x09, 0x02, // Usage (Mouse)
0xA1, 0x01, // Collection (Application), 0xA1, 0x01, // Collection (Application)
0x09, 0x01, // Usage (Pointer), 0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical), 0xA1, 0x00, // Collection (Physical)
0x05, 0x09, // Usage Page (Buttons), // Buttons (5 bits)
0x19, 0x01, // Usage Minimum (01), 0x05, 0x09, // Usage Page (Button)
0x29, 0x05, // Usage Maximun (05), 0x19, 0x01, // Usage Minimum (Button 1)
0x15, 0x00, // Logical Minimum (0), 0x29, 0x05, // Usage Maximun (Button 5)
0x25, 0x01, // Logical Maximum (1), 0x15, 0x00, // Logical Minimum (0)
0x95, 0x05, // Report Count (5), 0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1), 0x95, 0x05, // Report Count (5)
0x81, 0x02, // Input (Data, Variable, Absolute), ;5 button bits 0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (1), 0x81, 0x02, // Input (Data, Variable, Absolute)
0x75, 0x03, // Report Size (3), // Button padding (3 bits)
0x81, 0x01, // Input (Constant), ;3 bit padding, 0x95, 0x01, // Report Count (1)
0x75, 0x03, // Report Size (3)
0x81, 0x01, // Input (Constant)
0x05, 0x01, // Usage Page (Generic Desktop), // X/Y position (2 bytes)
0x09, 0x30, // Usage (X), 0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x31, // Usage (Y), 0x09, 0x30, // Usage (X)
0x15, 0x81, // Logical Minimum (-127), 0x09, 0x31, // Usage (Y)
0x25, 0x7F, // Logical Maximum (127), 0x15, 0x81, // Logical Minimum (-127)
0x95, 0x02, // Report Count (2), 0x25, 0x7F, // Logical Maximum (127)
0x75, 0x08, // Report Size (8), 0x95, 0x02, // Report Count (2)
0x81, 0x06, // Input (Data, Variable, Relative), ;2 position bytes (X & Y), 0x75, 0x08, // Report Size (8)
0x81, 0x06, // Input (Data, Variable, Relative)
0x09, 0x38, // Usage (Wheel), // Vertical wheel (1 byte)
0x15, 0x81, // Logical Minimum (-127), 0x09, 0x38, // Usage (Wheel)
0x25, 0x7F, // Logical Maximum (127), 0x15, 0x81, // Logical Minimum (-127)
0x95, 0x01, // Report Count (1), 0x25, 0x7F, // Logical Maximum (127)
0x75, 0x08, // Report Size (8), 0x95, 0x01, // Report Count (1)
0x81, 0x06, // Input (Data, Variable, Relative), 0x75, 0x08, // Report Size (8)
0x81, 0x06, // Input (Data, Variable, Relative)
0x05, 0x0C, // Usage Page (Consumer), // Horizontal wheel (1 byte)
0x0A, 0x38, 0x02, // Usage (AC Pan (Horizontal wheel)), 0x05, 0x0C, // Usage Page (Consumer)
0x15, 0x81, // Logical Minimum (-127), 0x0A, 0x38, 0x02, // Usage (AC Pan)
0x25, 0x7F, // Logical Maximum (127), 0x15, 0x81, // Logical Minimum (-127)
0x95, 0x01, // Report Count (1), 0x25, 0x7F, // Logical Maximum (127)
0x75, 0x08, // Report Size (8), 0x95, 0x01, // Report Count (1)
0x81, 0x06, // Input (Data, Variable, Relative), 0x75, 0x08, // Report Size (8)
0x81, 0x06, // Input (Data, Variable, Relative)
0xC0, // End Collection, 0xC0, // End Collection
0xC0, // End Collection 0xC0 // End Collection
}}; }};
static void udi_hid_mou_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep); static void udi_hid_mou_report_sent(udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep);
@@ -636,20 +648,21 @@ static uint8_t udi_hid_raw_report_trans[UDI_HID_RAW_REPORT_SIZE];
COMPILER_WORD_ALIGNED COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE udi_hid_raw_report_desc_t udi_hid_raw_report_desc = {{ UDC_DESC_STORAGE udi_hid_raw_report_desc_t udi_hid_raw_report_desc = {{
0x06, // Usage Page (Vendor Defined) 0x06, 0x60, 0xFF, // Usage Page (Vendor Defined)
0xFF, 0xFF, 0x09, 0x61, // Usage (Vendor Defined)
0x0A, // Usage (Mouse) 0xA1, 0x01, // Collection (Application)
0xFF, 0xFF, 0xA1, 0x01, // Collection (Application) 0x75, 0x08, // Report Size (8)
0x75, 0x08, // Report Size (8) 0x15, 0x00, // Logical Minimum (0)
0x15, 0x00, // Logical Minimum (0) 0x25, 0xFF, // Logical Maximum (255)
0x25, 0xFF, // Logical Maximum (255) // Data to host
0x95, 0x40, // Report Count 0x09, 0x62, // Usage (Vendor Defined)
0x09, 0x01, // Usage (Input) 0x95, RAW_EPSIZE, // Report Count
0x81, 0x02, // Input (Data 0x81, 0x02, // Input (Data, Variable, Absolute)
0x95, 0x40, // Report Count // Data from host
0x09, 0x02, // Usage (Output) 0x09, 0x63, // Usage (Vendor Defined)
0x91, 0x02, // Output (Data 0x95, RAW_EPSIZE, // Report Count
0xC0, // End Collection - Consumer Control 0x91, 0x02, // Output (Data, Variable, Absolute)
0xC0 // End Collection
}}; }};
static bool udi_hid_raw_setreport(void); static bool udi_hid_raw_setreport(void);
@@ -753,22 +766,24 @@ static uint8_t udi_hid_con_report_trans[UDI_HID_CON_REPORT_SIZE];
COMPILER_WORD_ALIGNED COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE udi_hid_con_report_desc_t udi_hid_con_report_desc = {{ UDC_DESC_STORAGE udi_hid_con_report_desc_t udi_hid_con_report_desc = {{
0x06, 0x31, 0xFF, // Vendor Page (PJRC Teensy compatible) 0x06, 0x31, 0xFF, // Usage Page (Vendor Defined - PJRC Teensy compatible)
0x09, 0x74, // Vendor Usage (PJRC Teensy compatible) 0x09, 0x74, // Usage (Vendor Defined - PJRC Teensy compatible)
0xA1, 0x01, // Collection (Application) 0xA1, 0x01, // Collection (Application)
0x09, 0x75, // Usage (Vendor) // Data to host
0x15, 0x00, // Logical Minimum (0x00) 0x09, 0x75, // Usage (Vendor Defined)
0x26, 0xFF, 0x00, // Logical Maximum (0x00FF) 0x15, 0x00, // Logical Minimum (0x00)
0x95, CONSOLE_EPSIZE, // Report Count 0x26, 0xFF, 0x00, // Logical Maximum (0x00FF)
0x75, 0x08, // Report Size (8) 0x95, CONSOLE_EPSIZE, // Report Count
0x81, 0x02, // Input (Data) 0x75, 0x08, // Report Size (8)
0x09, 0x76, // Usage (Vendor) 0x81, 0x02, // Input (Data, Variable, Absolute)
0x15, 0x00, // Logical Minimum (0x00) // Data from host
0x26, 0xFF, 0x00, // Logical Maximum (0x00FF) 0x09, 0x76, // Usage (Vendor Defined)
0x95, CONSOLE_EPSIZE, // Report Count 0x15, 0x00, // Logical Minimum (0x00)
0x75, 0x08, // Report Size (8) 0x26, 0xFF, 0x00, // Logical Maximum (0x00FF)
0x91, 0x02, // Output (Data) 0x95, CONSOLE_EPSIZE, // Report Count
0xC0, // End Collection 0x75, 0x08, // Report Size (8)
0x91, 0x02, // Output (Data)
0xC0 // End Collection
}}; }};
static bool udi_hid_con_setreport(void); static bool udi_hid_con_setreport(void);
-14
View File
@@ -72,20 +72,6 @@ void mouse_in_cb(USBDriver *usbp, usbep_t ep);
/* shared IN request callback handler */ /* shared IN request callback handler */
void shared_in_cb(USBDriver *usbp, usbep_t ep); void shared_in_cb(USBDriver *usbp, usbep_t ep);
/* ---------------
* Extrakey header
* ---------------
*/
#ifdef EXTRAKEY_ENABLE
/* extra report structure */
typedef struct {
uint8_t report_id;
uint16_t usage;
} __attribute__((packed)) report_extra_t;
#endif /* EXTRAKEY_ENABLE */
/* -------------- /* --------------
* Console header * Console header
* -------------- * --------------
+15 -14
View File
@@ -662,17 +662,17 @@ static void send_mouse(report_mouse_t *report) {
#endif #endif
} }
/** \brief Send System /** \brief Send Extra
* *
* FIXME: Needs doc * FIXME: Needs doc
*/ */
static void send_system(uint16_t data) {
#ifdef EXTRAKEY_ENABLE #ifdef EXTRAKEY_ENABLE
static void send_extra(uint8_t report_id, uint16_t data) {
uint8_t timeout = 255; uint8_t timeout = 255;
if (USB_DeviceState != DEVICE_STATE_Configured) return; if (USB_DeviceState != DEVICE_STATE_Configured) return;
report_extra_t r = {.report_id = REPORT_ID_SYSTEM, .usage = data - SYSTEM_POWER_DOWN + 1}; report_extra_t r = {.report_id = report_id, .usage = data};
Endpoint_SelectEndpoint(SHARED_IN_EPNUM); Endpoint_SelectEndpoint(SHARED_IN_EPNUM);
/* Check if write ready for a polling interval around 10ms */ /* Check if write ready for a polling interval around 10ms */
@@ -681,6 +681,16 @@ static void send_system(uint16_t data) {
Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL); Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL);
Endpoint_ClearIN(); Endpoint_ClearIN();
}
#endif
/** \brief Send System
*
* FIXME: Needs doc
*/
static void send_system(uint16_t data) {
#ifdef EXTRAKEY_ENABLE
send_extra(REPORT_ID_SYSTEM, data - SYSTEM_POWER_DOWN + 1);
#endif #endif
} }
@@ -690,8 +700,7 @@ static void send_system(uint16_t data) {
*/ */
static void send_consumer(uint16_t data) { static void send_consumer(uint16_t data) {
#ifdef EXTRAKEY_ENABLE #ifdef EXTRAKEY_ENABLE
uint8_t timeout = 255; uint8_t where = where_to_send();
uint8_t where = where_to_send();
# ifdef BLUETOOTH_ENABLE # ifdef BLUETOOTH_ENABLE
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) { if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
@@ -729,15 +738,7 @@ static void send_consumer(uint16_t data) {
return; return;
} }
report_extra_t r = {.report_id = REPORT_ID_CONSUMER, .usage = data}; send_extra(REPORT_ID_CONSUMER, data);
Endpoint_SelectEndpoint(SHARED_IN_EPNUM);
/* Check if write ready for a polling interval around 10ms */
while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
if (!Endpoint_IsReadWriteAllowed()) return;
Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL);
Endpoint_ClearIN();
#endif #endif
} }
-6
View File
@@ -58,12 +58,6 @@ extern host_driver_t lufa_driver;
} }
#endif #endif
/* extra report structure */
typedef struct {
uint8_t report_id;
uint16_t usage;
} __attribute__((packed)) report_extra_t;
#ifdef API_ENABLE #ifdef API_ENABLE
# include "api.h" # include "api.h"
#endif #endif
+7 -17
View File
@@ -112,32 +112,22 @@ static void send_mouse(report_mouse_t *report) {
} }
} }
typedef struct { static void send_extra(uint8_t report_id, uint16_t data) {
uint8_t report_id; static uint8_t last_id = 0;
uint16_t usage;
} __attribute__((packed)) report_extra_t;
static void send_system(uint16_t data) {
static uint16_t last_data = 0; static uint16_t last_data = 0;
if (data == last_data) return; if ((report_id == last_id) && (data == last_data)) return;
last_id = report_id;
last_data = data; last_data = data;
report_extra_t report = {.report_id = REPORT_ID_SYSTEM, .usage = data}; report_extra_t report = {.report_id = report_id, .usage = data};
if (usbInterruptIsReady3()) { if (usbInterruptIsReady3()) {
usbSetInterrupt3((void *)&report, sizeof(report)); usbSetInterrupt3((void *)&report, sizeof(report));
} }
} }
static void send_consumer(uint16_t data) { static void send_system(uint16_t data) { send_extra(REPORT_ID_SYSTEM, data); }
static uint16_t last_data = 0;
if (data == last_data) return;
last_data = data;
report_extra_t report = {.report_id = REPORT_ID_CONSUMER, .usage = data}; static void send_consumer(uint16_t data) { send_extra(REPORT_ID_CONSUMER, data); }
if (usbInterruptIsReady3()) {
usbSetInterrupt3((void *)&report, sizeof(report));
}
}
/*------------------------------------------------------------------* /*------------------------------------------------------------------*
* Request from host * * Request from host *