Commit Graph

16 Commits

Author SHA1 Message Date
QMK Bot 5e98eaaaff format code according to conventions [skip ci] 2020-03-13 18:44:56 +00:00
fredizzimo 9e8767917d
Fix pressing two keys with the same keycode but different modifiers (#2710)
* Fix extra keyboard report during test_fixture teardown

* Add tests for pressing two keys with only different modifers

* Fix #1708

When two keys that use the same keycode, but different modifiers were
pressed at the same time, the second keypress wasn't registered. This is
fixed by forcing a key release when we detect a new press for the same
keycode.

* Fix the NKRO version of is_key_pressed

* Fix uninitalized loop variable

Co-authored-by: Jack Humbert <jack.humb@gmail.com>
2020-03-13 14:09:38 -04:00
Ted M Lin d84eb14b3a
Use function for KEYCODE2 routines instead of macro. (#8101)
* Option to use function for KEYCODE2 routines.

Convert the KEYCODE2SYSTEM and KEYCODE2CONSUMER macros to functions,
defaulting to using the macros.  The function form allows the compiler
to optimize the switch statement itself, over the macro nested
ternaries.

To enable this feature, #define USE_KEYCODE2_FUNCTION.

Testing against a random selection of avr-based keyboards, this
increased available flash by ~500 bytes. For arm-based keyboards,
the available flash increased by ~400 bytes.

* Replace macro with function entirely.

As zvecr states, go bold and just commit to using the function instead
of the macro.

* Reformat whitespace now that functional review is done

Verified against clang-format output.
2020-02-07 12:53:43 +11: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
skullY b624f32f94 clang-format changes 2019-08-30 15:01:52 -07:00
Konstantin Đorđević be666b2d8a Add underscores to names of brightness control constants in report.h (#4764) 2019-01-05 08:31:24 -08:00
Giuseppe Rota 8b85ec2a98 Add Extrakey support for Brightness up/down (#4477) 2018-11-28 08:19:07 -08:00
James Laird-Wah 39bd760faf Use a single endpoint for HID reports (#3951)
* Unify multiple HID interfaces into one

This reduces the number of USB endpoints required, which frees them up
for other things.

NKRO and EXTRAKEY always use the shared endpoint.

By default, MOUSEKEY also uses it. This means it won't work as a Boot
Procotol mouse in some BIOSes, etc. If you really think your
keyboard needs to work as a mouse in your BIOS, set
MOUSE_SHARED_EP = no in your rules.mk.

By default, the core keyboard does not use the shared endpoint, as not
all BIOSes are standards compliant and that's one place you don't want
to find out your keyboard doesn't work.. If you are really confident,
you can set KEYBOARD_SHARED_EP = yes to use the shared endpoint here
too.

* unify endpoints: ChibiOS protocol implementation

* fixup: missing #ifdef EXTRAKEY_ENABLEs

broke build on AVR with EXTRAKEY disabled

* endpoints: restore error when too many endpoints required

* lufa: wait up to 10ms to send keyboard input

This avoids packets being dropped when two reports are sent in quick
succession (eg. releasing a dual role key).

* endpoints: fix compile on ARM_ATSAM

* endpoint: ARM_ATSAM fixes

No longer use wrong or unexpected endpoint IDs

* endpoints: accommodate VUSB protocol

V-USB has its own, understandably simple ideas about the report formats.
It already blasts the mouse and extrakeys through one endpoint with
report IDs. We just stay out of its way.

* endpoints: document new endpoint configuration options

* endpoints: respect keyboard_report->mods in NKRO

The caller(s) of host_keyboard_send expect to be able to just drop
modifiers in the mods field and not worry about whether NKRO is in use.
This is a good thing. So we just shift it over if needs be.

* endpoints: report.c: update for new keyboard_report format
2018-11-15 22:22:05 -08:00
patrickmt 30680c6eb3 Massdrop keyboard support (#3780)
* Massdrop SAMD51

Massdrop SAMD51 keyboards initial project upload

* Removing relocated files

Removing files that were relocated and not deleted from previous location

* LED queue fix and cleaning

Cleaned some white space or comments.
Fix for LED I2C command queue.
Cleaned up interrupts.
Added debug function for printing numbers to scope through m15 line.

* Factory programmed serial usage

Ability to use factory programmed serial in hub and keyboard usb descriptors

* USB serial number and bugfix

Added support for factory programmed serial and usage.
Incorporated bootloader's conditional compiling to align project closer.
Fixed issue when USB device attempted to send before enabled.
General white space and comment cleanup.

* Project cleanup

Cleaned up project in terms of white space, commented code, and unecessary files.
NKRO keyboard is now using correct setreport although KBD was fine to use.
Fixed broken linkage to __xprintf for serial debug statements.

* Fix for extra keys

Fixed possible USB hang on extra keys report set missing

* I2C cleanup

I2C cleanup and file renames necessary for master branch merge

* Boot tracing and clocks cleanup

Added optional boot debug trace mode through debug LED codes.
General clock code cleanup.

* Relocate ARM/Atmel headers

Moved ARM/Atmel header folder from drivers to lib and made necessary makefile changes.

* Pull request changes

Pull request changes

* Keymap and compile flag fix

Keymap fix for momentary layer.
Potential compile flag fix for Travis CI failure.

* va_list include fix

Fix for va_list compile failure

* Include file case fixes

Fixes for include files with incorrect case

* ctrl and alt67 keyboard readme

Added ctrl and alt67 keyboard readme files
2018-08-29 15:07:52 -04:00
fredizzimo 53ff8a31b6 Merge ChibiOS and LUFA descriptor support (#2362)
* Move lufa descriptor to protocol/usb_descriptor

* Try to compile usb_descriptor on ChibiOS

* Add lufa_utils for ChibiOS

Lufa USB descriptors for ChibiOS

* More lufa_util compatibility fixes

* First compiling version of shared USB descriptor

* Send the usb descriptors

* Fix the CONSOLE output on ChibiOS

* Add errors for unsupported interfaces

* Enable support for vitual serial port USB descriptors

* Implement virtual serial port for ChibiOS

* Cleanup the lufa_utils

Use the default lufa header files

* Add raw hid support for ChibiOS

This is completely untested

* Enable midi compilation on ChibiOS

* Move midi functionality out of lufa.c

* Don't register sysex callback when not needed

* ChibiOS compilation fixes

* Update ChibiOS submodule

* Fix the Midi USB descriptor

It didn't work properly when both Midi and Virtual serial port was enabled.

* Add MIDI support for ChibiOS

* Fix USB descriptor strings on ChibiOS

* Use serial usb driver for raw hid

* Generalize the ChibiOS stream like drivers

This makes the initialization much more simple and eliminates a lot of
the code duplication.

* Convert console output to chibios stream driver

* Fixes for ChibiOS update

* Update the ChibiOS contrib submodule

To include the usb data toggle synchronization fixes

* Fix duplicate reset enumeration on ChibiOS

* Add missing include

* Add number of endpoints check for ChibiOS

* Enable serial USB driver on all keyboards

* Add missing includes when API is enabled withot midi

* Add another missing inlcude
2018-02-08 15:07:46 -05:00
fauxpark b3bcafcc4b Unsign key argument in add_key_to_report 2017-12-19 09:25:26 -05:00
Fred Sundvik fb95d86b39 Move functions for adding keys from to reports to report.h 2017-06-18 21:22:22 +03:00
Fred Sundvik 017458a07b Move functionality from action_util to report
The functions also takes report_kebyoard_t parameters, so that they can
be used elsewhere.
2017-06-18 21:22:22 +03:00
Nikolaus Wittenstein 06d21009b2 Minor cleanup 2017-02-05 19:55:27 -05:00
fredizzimo 4d4f7684e6 Add ChibiOS support for QMK (#465)
* Modularity and gcc warnings fixes.

* Add ChibiOS support (USB stack + support files).

* Make usb_main more USB_DRIVER #define independent.

* Move chibios to tool.

* Implement jump-to-bootloader.

* Small updates.

* Fix bootloader-jump compiling.

* Move AVR specific sleep_led.c into avr.

* Add basic sleep_led for chibios.

* Update chibios README.

* NKRO fixes.

* Rename some Makefile defines.

* Move STM32 bootloader address config to separate .h file.

* Add ARM Teensies bootloader code.

* Fix chibios/usb_main GET_REPORT handing.

* Add missing #include to keymap.c.

* Make bootmagic.c code portable (_delay_ms -> wait_ms).

* Move declaration of keymap_config.

Should really not declare variables in .h files - since it's included
in different .c files, a proper linker then complains that the same
variable is declared more than once (once for each .c file that the
offending .h is included in).

* Add eeprom support for chibios/kinetis.

* Rename chibios example keyboard.

* Move chibios/cortex selection to local Makefiles.

* Chibios: use WFI in idle. WIP suspend stuff.

* ChibiOS/kinetis: sending remote wakeup.

* ChibiOS/STM32: send remote wakeup.

* Fix report size of boot protocol.

* Fix drop key stroke

Keyboard report should be checked if its transfer finishs successfully.
Otherwise key stroke can be missing when other key event occurs
before the last report transfer is done.

Boot protocol 10ms interval probably causes this problem in case
it receives key events in a row within the period. NKRO protocol
suffers less or nothing due to its interval 1ms.

* Chibios/usb_main: rename a variable for clarity.

* Add correct chibios/bootloader_jump for infinity KB.

* ChibiOS: make reset request more CMSISy.

* Chibios: Add breathing sleep LED on Kinetis MCUs.

* ChibiOS: Update infinity bootloader code to match updated ChibiOS.

* ChibiOS: prettify/document sleep_led code.

* Chibios: Remove the wait in the main loop.

* Add maple mini code.

* Do timeout when writing to CONSOLE EP queue.

Fixes TMK bug #266.

* Chibios: add 'core/protocol' to the makefiles' search path.

* Chibios: Update to new USB API.

* Chibios: add more guards for transmitting (fix a deadlock bug).

* Add update for chibios in README

* Chibios: Fix a HardFault bug (wait after start).

* Chibios: cleanup usb_main code.

* Chibios: Revert common.mk change (fix AVR linking problem).

* core: Fix chibios user compile options

Compile options can be defined in project Makefile such as UDEFS, UADEFS, UINCDIR, ULIBDIR and ULIBS.

* Sysv format for ChibiOS arm-none-eabi-size

Some new patches to ChibiOS puts heap as it's own section. So the
berkeley format is now useless, as the heap will be included in the
BSS report. The sysv format displays the bss size correctly.

* Fix hard-coded path of CHIBIOS

* Add support for new version of ChibiOS and Contrib

The Kinetis support has moved to a separate Contrib repository in
the newest version of Chibios. There has also been some structure
changes. So this adds support for those, while maintaining back-
wards compability.

* Update ChibiOS instructions

* Chibios: implement sleep LED for STM32.

* Chibios: Update the main chibios README.

* Chibios: fix STM32_BOOTLOADER_ADDRESS name.

* Chibios: make the default bootloader_jump redefinable (weak).

* Chibios: disable LTO (link-time optimisation).

With LTO enabled, sometimes things fail for mysterious reasons
(e.g. bootloader jump on WF with LEDs enabled), just because the
linker optimisation is too aggressive.

* Chibios: add default location for chibios-contrib.

* ChibiOS: update mk to match chibios/master.

* ChibiOS: update instructions.md.

* Add chibi_onekey example.

* Add comments to chibi_onekey Makefile.

* Rename some Makefile defines.

* Move STM32 bootloader address config to separate .h file.

* Rename chibios example keyboard.

* Move chibios/cortex selection to local Makefiles.

* Add Teensy LC onekey example.

* Chibios: use WFI in idle. WIP suspend stuff.

* Update chibi/teensy instructions.

* Update chibios/Teensy instructions.

* Add infinity_chibios

* Add keymap_hasu.c

* Infinity_chibios: select correct bootloader_jump.

* Infinity_chibios: improve comments.

* Add generic STM32F103C8T6 example.

* Add maple mini code.

* STM32F103x fixes.

* Add maple mini pinout pic.

* Chibios: updates for 3.0.4 git.

* Chibios: rename example stm32_onekey -> stm32_f072_onekey.

* Chibios: add makefiles for Teensy 3.x examples.

* Chibios: update Teensy 3.x instructions.

* Chibios: Tsy LC is cortex-m0plus.

* Chibios: add more guards for transmitting (fix a deadlock bug).

* Change README for chibios

* Chibios: update examples to current chibios git.

Match the changes in mainline chibios:
 - update chconf.h
 - update supplied ld scripts structure
 - update Teensy instructions (switch to official
    chibios and introduce contrib)

* Add ChibiOS and ChibiOS-Contrib submodules

Also fix the makefile path for them.

* Moves chibios keyboards to keyboards folder

* First version of ChibiOS compilation

Only the stm32_f072_onkey keyboard is ported at the moment. It
compiles, but still doesn't link.

* More chibios fixes

It now compiles without warnings and links

* Move the teensy_lc_onekey to the keyboards folder

* Clean up the make file rule structure

* Remove keymap_fn_to_action

* Update more ChibiOS keyboards to QMK

Most of them does not compile at the moment though.

* Use older version of Chibios libraries

The newest ones have problems with compilation

* Remove USB_UNCONFIGURED event

It isn't present in the older version of ChibiOS

* Fix the infinity_chibios compilation

* Fix potentially uninitialized variable

* Add missing include

* Fix the ChibiOS makefile

* Fix some Chibios keyboard compilation

* Revert the rules.mk file back to master version

* Combine the chibios and AVR makefiles

With just the required overrides in the respective platform
specific one.

* Slight makefile restrucuring

Platform specific compiler options

* Move avr specific targets out of the main rules

* Fix ChibiOS objcopy

The ChibiOS objcopy needs different parameters, so the parameters
are moved to the corresponding platform rule file

* Fix the objcopy for real this time

The comands were moved around, so chibios used avr and the ohter
way around.

Also change the objsize output format

* Fix the thumb flags

* Fix the infinity hasu keymap

* Per platform cpp flags

* Add gcc-arm-none-eabi package to travis

* Add arm-none-eabi-newlib to travis

* Fix the name of the libnewlib-arm-none-eabi lib

* Fix the ChibiOS paths

So that they are properly relative, and builds don't generate
extra folders

* Fix the board path of stm32_f103_onekey

* Only consider folders with Makefiles as subproject
2016-07-01 10:04:53 -04:00
tmk 1a02ebcc61 Merge commit 'a074364c3731d66b56d988c8a6c960a83ea0e0a1' as 'tmk_core' 2015-04-10 01:32:04 +09:00