Commit Graph

61 Commits

Author SHA1 Message Date
Takeshi ISHII 9dfebb9d67
Remove unnecessary import of rgblight.h in tmk_core/protocol/*/*.c (#8432)
* Remove unnecessary import of rgblight.h in tmk_core/protocol/*/*.c

 * tmk_core/protocol/chibios/main.c
 * tmk_core/protocol/lufa/lufa.c

see #8380 for tmk_core/protocol/vusb/main.c.

* Remove '#include "rgblight.h"' from tmk_core/protocol/vusb/main.c.
2020-03-16 10:26:32 +01:00
Takeshi ISHII dbbab40981
Refactor rgblight_reconfig.h (#7773)
* Moved contents of rgblight_reconfig.h to rgblight_post_config.h.

In #3582, rgblight_reconfig.h had to be newly created. Now, the build system of qmk_firmware has a post_cofig feature, so that what was done in rgblight_reconfig.h can now be realized in rgblight_post_config.h.

**This commit does not change the build result.**

Testing script
```shell
  # build on master
  git checkout master
  echo master > /tmp/master_md5.txt

  # RGBLIGHT_ENABLE = no
  make HELIX=verbose helix/rev2:default:clean
  make HELIX=verbose helix/rev2:default
  md5 helix_rev2_default.hex >> /tmp/master_md5.txt

  # RGBLIGHT_ENABLE = yes, with animations
  make HELIX=verbose helix/rev2/back:default:clean
  make HELIX=verbose helix/rev2/back:default
  md5 helix_rev2_back_default.hex >> /tmp/master_md5.txt

  # RGBLIGHT_ENABLE = yes, without animations
  make HELIX=verbose,no_ani helix/rev2/back:default:clean
  make HELIX=verbose,no_ani helix/rev2/back:default
  md5 helix_rev2_back_default.hex >> /tmp/master_md5.txt

  # build on refactor_rgblight_reconfig.h
  git checkout refactor_rgblight_reconfig.h
  echo refactor_rgblight_reconfig.h > /tmp/branch_md5.txt

  # RGBLIGHT_ENABLE = no
  make HELIX=verbose helix/rev2:default:clean
  make HELIX=verbose helix/rev2:default
  md5 helix_rev2_default.hex >> /tmp/branch_md5.txt

  # RGBLIGHT_ENABLE = yes, with animations
  make HELIX=verbose helix/rev2/back:default:clean
  make HELIX=verbose helix/rev2/back:default
  md5 helix_rev2_back_default.hex >> /tmp/branch_md5.txt

  # RGBLIGHT_ENABLE = yes, without animations
  make HELIX=verbose,no_ani helix/rev2/back:default:clean
  make HELIX=verbose,no_ani helix/rev2/back:default
  md5 helix_rev2_back_default.hex >> /tmp/branch_md5.txt

  diff -u /tmp/master_md5.txt /tmp/branch_md5.txt
```

Test result:
```
--- /tmp/master_md5.txt 2020-01-03 15:42:22.000000000 +0900
+++ /tmp/branch_md5.txt 2020-01-03 15:42:42.000000000 +0900
@@ -1,4 +1,4 @@
-master
+refactor_rgblight_reconfig.h
 MD5 (helix_rev2_default.hex) = f360032edd522448366d471d8f4f8181
 MD5 (helix_rev2_back_default.hex) = 0c663acc6cccc44476b3b969ad22a48f
 MD5 (helix_rev2_back_default.hex) = e66b1195ff6d38e6e22c975b8ae42fd3
```

* Expressions that are too long are difficult to read, so wrap them.

* Edit the expression again

* remove `defined(RGBLIGHT_ANIMATIONS)` in `tmk_core/common/*/suspend.c`, `tmk_core/protocol/*/main.c`

move contents of rgblight_reconfig.h to rgblight.h.

The following changes were made to rgblight.h.

```diff
+#ifdef RGBLIGHT_USE_TIMER
 void rgblight_task(void);

 void rgblight_timer_init(void);
 void rgblight_timer_enable(void);
 void rgblight_timer_disable(void);
 void rgblight_timer_toggle(void);
+#else
+#define rgblight_task()
+#define rgblight_timer_init()
+#define rgblight_timer_enable()
+#define rgblight_timer_disable()
+#define rgblight_timer_toggle()
+#endif
```

The following changes were made to tmk_core/common/avr/suspend.c, tmk_core/common/chibios/suspend.c, tmk_core/protocol/chibios/main.c, tmk_core/protocol/lufa/lufa.c, tmk_core/protocol/vusb/main.c.

```diff
-#    ifdef RGBLIGHT_ANIMATIONS
     rgblight_timer_enable();
-#    endif
```
```diff
-#if defined(RGBLIGHT_ANIMATIONS) && defined(RGBLIGHT_ENABLE)
+#if defined(RGBLIGHT_ENABLE)
         rgblight_task();
 #endif
```

* remove 'defined(RGBLIGHT_ANIMATIONS)' in tmk_core/common/keyboard.c

Co-authored-by: Joel Challis <git@zvecr.com>
2020-03-10 01:46:03 -07:00
Ryan 088b64ab3d
Improvements to extrakey HID descriptors (#8156) 2020-02-25 12:18:11 +11: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
xyzz eb309be6f0
Improve VIRTSER performance (#7528) 2020-01-31 11:30:41 +11:00
Joel Challis ba628a28bc
Move rgblight and backlight task to common location (#7733) 2020-01-19 00:59:09 +00:00
fauxpark 698d0dbda8 Use `clock_prescale_set()` from avr-libc (#7540)
* Use `clock_prescale_set()` from avr-libc

* Remove outdated FAQ info
2019-12-11 01:26:40 +00:00
Joel Challis 22812aee5c rgblight_task logic fixes (#7214) 2019-10-30 22:30:21 -07:00
skullY b624f32f94 clang-format changes 2019-08-30 15:01:52 -07:00
fauxpark ae79b60e6b Always read two bytes from the endpoint if we have two bytes to read
When this if statement is false, it will cause the report ID to be read as the LED state.
We already know there are two bytes in the endpoint, which is a reasonably good indicator that it contains a report ID, so we should always read both.
2019-01-22 09:30:01 -08:00
fauxpark 2c4109394f Fix Caps Lock LEDs once and for all (#4824)
* Check the size of the SET_REPORT packet

If we have two bytes, that probably means the first is a report ID. The 6KRO interface may or may not have one, but the NKRO interface always does, so we need to check this regardless of whether KEYBOARD_SHARED_EP is defined.

* Fix indentation
2019-01-11 17:22:05 -08:00
fauxpark d6b7ca04f2 Only try to read the report ID from SetReport when the keyboard is part of the shared EP
Fixes #4471
Fixes #4517
2018-12-05 08:50:29 -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
Takeshi ISHII 6d6d91c834 rgblight.[ch] more configurable (#3582)
* add temporary test code rgblight-macro-test1.[ch]

* rgblight.h : mode auto numberring and auto generate mode name symbol

No change in build result.

* rgblight.c use RGBLIGHT_MODE_xxx symbols

No change in build result.

* quantum.c use RGBLIGHT_MODE_xxx symbols

No change in build result.

* fix build break. when RGB_MATRIX_ENABLE defined

* add temporary test code rgblight-macro-test2.[ch]

* modify rgblight_mode_eeprom_helper() and rgblight_sethsv_eeprom_helper()

* modify rgblight_task()

* configurable each effect compile on/off in config.h

* update docs/feature_rgblight.md

* fix conflict. docs/feature_rgblight.md

* remove temporary test code rgblight-macro-test*.[ch]

* fix comment typo.

* remove old mode number from comment

* update docs/feature_rgblight.md about effect mode

* Revert "update docs/feature_rgblight.md about effect mode"

This reverts commit 43890663fcc9dda1899df7a37d382fc38b1a6d6d.

* some change docs/feature_rgblight.md

* fix typo

* docs/feature_rgblight.md update: revise mode number table
2018-09-13 10:24:09 -07:00
skullydazed 7c9d5ace14 Generate API docs from source code comments (#2491)
* Generate api docs from source code

* Add a bunch of doxygen comments

* more doxygen comments

* Add the in-progress api docs

* script to generate docs from travis

* Add doc generation to the travis job

* make travis_docs.sh commit the work it does

* make sure the docs script exits cleanly
2018-03-22 02:50:38 -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
Priyadi Iman Nurcahyo f0fc2db4e2 Adafruit Feather BLE / BLE Friend mouse buttons support 2017-05-29 18:17:21 +07:00
yiancar fa1b92fbb1 Use variable to disable usb check at startup
Adds a define variable which when defined disables the usb startup
check. Modified the makefile to separate above define from bluetooth
dependancy
2017-05-26 21:58:43 +01:00
Travis La Marr 71da013995 Add RN42 Bluetooth module support
Added support for sending HID keycodes over the RN42/reflashed HC05 module. Tested on OS X and iOS.
2017-03-29 23:03:04 -04:00
Jack Humbert 7e37daa2ce Merge pull request #1112 from newsboytko/newsboytko/midi-keycodes
Flesh out MIDI support
2017-03-28 09:26:54 -04:00
Travis La Marr 43eee52cba Add BLE and EZKey module defines.
Also restored serial init back to original location. Was getting junk data.
2017-03-24 17:14:57 -04:00
Travis La Marr b4ac0598fa Readd bluetooth output direction on standard key input. 2017-03-24 15:55:02 -04:00
Travis La Marr ddc036b69e Refactor Bluetooth Handling
Refactored Bluetooth support to make adding new Bluetooth modules
easier in the future.

* Remove `OUT_BLE` key from QMK's keymap. `OUT_BT` is all we need now
as there's no difference anymore.
* Made BLUETOOTH_ENABLE build option legacy as not to break existing
keymaps (Falls back to existing EZ Key support if on)
* Removed `ADAFRUIT_BLE_ENABLE` build option
* Created new build option `BLUETOOTH` with module option (Currently
`AdafruitEZKey` & `AdafruitBLE`)
* Moved all LUFA bluetooth key/mouse events under `BLUETOOTH_ENABLE`
ifdef with selected modules output.
2017-03-24 12:53:55 -04:00
Gabriel Young 525be99ee9 Split MIDI functionality into MIDI_BASIC and MIDI_ADVANCED
MIDI_ENABLE = no

   text	   data	    bss	    dec	    hex	filename
      0	  17080	      0	  17080	   42b8	satan_midi.hex

MIDI_ENABLE = yes
MIDI_BASIC undefined
MIDI_ADVANCED undefined

   text	   data	    bss	    dec	    hex	filename
      0	  19494	      0	  19494	   4c26	satan_midi.hex

MIDI_ENABLE = yes
#define MIDI_BASIC
MIDI_ADVANCED undefined

   text	   data	    bss	    dec	    hex	filename
      0	  19788	      0	  19788	   4d4c	satan_midi.hex

MIDI_ENABLE = yes
MIDI_BASIC undefined
#define MIDI_ADVANCED

   text	   data	    bss	    dec	    hex	filename
      0	  20846	      0	  20846	   516e	satan_midi.hex

MIDI_ENABLE = yes
#define MIDI_BASIC
#define MIDI_ADVANCED

   text	   data	    bss	    dec	    hex	filename
      0	  21140	      0	  21140	   5294	satan_midi.hex
2017-02-25 15:02:43 -08:00
Gabriel Young dd8f8e6bae implement modulation 2017-02-19 16:43:02 -08:00
Gabriel Young e405ab4bc6 initial implementation of polyphony using variable length array of notes on 2017-02-19 16:41:59 -08:00
Priyadi Iman Nurcahyo d8a9c63c26 Implement runtime selectable output (USB or BT) 2017-02-01 05:07:05 +07:00
Fred Sundvik dd685eceb2 API Sysex fixes
Fix memory leaks by using stack instead of malloc
Reduce memory usage by having less temporary bufffers
Remove warnings by adding includes
Decrease code size by 608 bytes (mostly due to not linking malloc)
More robust handling of buffer overflows
2016-12-29 12:13:30 +02:00
Wilba6582 a305da2bc9 Fixes issue #900 2016-12-20 02:46:50 +11:00
Jack Humbert c87d039839 Merge pull request #921 from Wilba6582/raw_hid
Initial version of Raw HID interface
2016-12-05 00:13:37 -05:00
Wez Furlong 044fa3ff85 Connect the adafruit ble code to the lufa main loop
There are now 3 potential locations to send HID reports:

1. USB
2. The bluefruit easy key
3. Adafruit BLE

Generally speaking, if USB is connected then we should prefer to
send the reports there; it is generally the best channel for this.

The bluefruit module has no feedback about bluetooth connectivity
so the code must speculatively send reports over both USB and bluetooth.

The BLE module has connectivity feedback.  In general we want to
prefer to send HID reports over USB while connected there, even
if BLE is connected.  Except that it is convenient to force them
over BLE while testing the implementation.

This policy has been extracted out into a where_to_send function
which returns a bitmask of which of the channels should be used.
2016-12-02 22:46:23 -08:00
Wilba6582 fe001d46fd Initial version of Raw HID interface 2016-12-01 00:44:54 +11:00
Jack Humbert 7edac212c8 separated into api files/folder 2016-11-26 15:38:44 -05:00
Jack Humbert f25596b8dc rgblight fixes 2016-11-23 21:28:12 -05:00
Jack Humbert cefa8468fb travis pls 2016-11-23 20:16:38 -05:00
Jack Humbert 2e23689b8e converted to new format 2016-11-23 18:52:02 -05:00
Jack Humbert 3d7aaa31e4 converted to 8bit messages 2016-11-23 00:30:06 -05:00
Jack Humbert 6390033e86 cleaning up midid 2016-11-21 20:14:16 -05:00
Jack Humbert 664c0a036b cleaning up new code 2016-11-21 19:50:55 -05:00
Jack Humbert c1037b1dc0 working with helper, qmk_helper_windows@05b0105 2016-11-21 18:05:06 -05:00
Jack Humbert b57cf3c0c8 more structure to the package 2016-11-21 12:54:06 -05:00
Jack Humbert 161bd5596b midi back and forth 2016-11-18 22:22:24 -05:00
Jack Humbert 3774a7fcda rgb light through midi 2016-11-17 17:42:14 -05:00
Jack Humbert 530dd3377e animations, midi, etc 2016-11-15 13:18:10 -05:00
Jack Humbert e9f7487518 mostly working 2016-11-13 23:02:38 -05:00
IBNobody 558f3ec1eb Use keyboard config for nkro (#7)
* removing nkro references - wip

* changed NKRO to be defined by keymap_config
2016-09-06 23:19:01 -05:00
Jason Green 7009112752 move to ergodox-ez only 2016-08-23 07:04:55 +00:00
Jason Green 80d10bef07 Added USB Virtual Serial support 2016-08-23 04:16:35 +00:00
Jack Humbert d9e4dad0a8 Makefile redo & other features (#395)
* .build containment implemented

* no destructive variable setting - builds in either folder

* make from 3 places

* cleans before each build
* make from root with keyboard=keyboard, keymap=keymap
* make from keyboard/keyboard with keymap=keymap
* make from keymaps/keymap
* only implemented on planck

* adds color diag to avr-gcc

* makefiles for all plancks, clean-up

* quick build-all makefile for plancks

* reformatting of make output (colors)

* color toggle, tmk path corrections

* correct if statement for color

* move config.h to main makefile, updates preonic, atomic

* format update, all keyboards targets

* makefile optional for build all target, alps and arrow_pad updated

* alps updated

* make planck default, trying out travis recipe for all-keyboards

* all-keymaps target, different travis recipe

* updates alps64

* updates keyboards to new format

* updates clue* projects

* all projects updated, specialise EZ .hex, let .hex through

* updates travis

* automatically find root, keyboard, keymap

* silent echo, cleaned-up mass make output

* updates all keyboards' .hex files except EZ

* Rename Bantam44.c to bantam44.c

* Rename Bantam44.h to bantam44.h

* nananana

* adds six key keyboard

* does same to ez as rest

* updates send_string example

* brings ergodox_ez up to date

* updates template/new project script

* adds sixkeyboard

* adds readme for sixkeyboard

* adds sixkeyboard to travis

* filenames, gitignore mess

* define clock prescaler stuff manually

* make quick, size test example

* documentation and dfu-no-build
2016-06-11 13:31:31 -04:00