Commit Graph

87 Commits

Author SHA1 Message Date
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
zvecr
a91c0c4765 Run clang-format manually to fix recently changed files 2019-11-17 08:25:58 -08:00
Joel Challis
22812aee5c rgblight_task logic fixes (#7214) 2019-10-30 22:30:21 -07:00
fauxpark
0d94730da0 Adafruit BLE: Set SPI2X bit only when F_CPU is 8MHz (#6671) 2019-09-07 08:18:05 -07:00
bwhelm
fa71c4c91e Fix battery level code in adafruit_ble.cpp (#6648)
* Fix battery level code in adafruit_ble.cpp

The code in tsk_core/protocol/lufa/adafluit_ble.cpp that polls the
battery level for the Adafruit feather BLE controller reads the
regulated voltage, not the raw voltage coming from the battery. To do
that, the Adafruit Feather docs say you should read from pin A9:
https://learn.adafruit.com/adafruit-feather-32u4-basic-proto/power-management#measuring-battery-4-9.
(See also
https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le/pinouts#logic-pins-2-9.)

I'm not sure why, but analogRead(9); doesn't read the correct pin.
Checking all available analog pins experimentally, it turns out that
analogRead(7); returns the correct value. So the code above should read:

    state.vbat = analogRead(7);

* Update tmk_core/protocol/lufa/adafruit_ble.cpp

Co-Authored-By: Drashna Jaelre <drashna@live.com>

* Remove old comment

* Fix linking error

* Remove `#ifdef` around `#include analog.h`.

* Really fix linking error
2019-09-04 04:29:23 +10:00
skullY
b624f32f94 clang-format changes 2019-08-30 15:01:52 -07:00
fauxpark
8dd0ff6c7a Remove keyboard description from Adafruit BLE device name 2019-04-07 16:05:30 -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
Kenneth Aloysius
9303b42e69 Update personal layouts, free up matrix_scan_user for JJ40 (#2319)
* Add NIU Mini keymap from Planck keymap

* Remove old keymap files

* Fix README, removed Planck references

* Add default layout, move Planck layout to separate folder

* Update README

* Add my XD60 keymap

* Change RShift to slash

* Fix keymap: stuck on MO(1)

* Move RESET to Fn+Enter

* Add: RGB saturation cycle

* Add numpad layer to keymap

* Fix last case

* Cleanup Mechmini keymap. Once the custom RGB function is defined, there is no need to manually handle RGB code.

* Change default to KEYMAP_MIT, not KEYMAP_OFFSET

* Add custom RGB code for JJ40

* Reset Mechmini advertised power draw to 500. Will have to test actual maximum power draw later.

* RGB working on JJ40.

* Fix: saturation increase/decrease flipped

* Add new directory for my custom keymap with RGB keycodes

* Swap LAlt and LGUI

* Update JJ40 max power draw with measured value

* Update: fun40 rules.mk to enable underglow; earlier failed Travis CI

* Fix: init RGB LEDs on boot. Also added HHKB-like keymap for XD60.

* Super rudimentary backlight test, init RGB LEDs on boot

* Backlighting works - stays on for now

* Toggling working

* Now can override backlight.c functions. Problem was functions in backlight.c weren't called before due to a lack of matrix_scan_quantum() in matrix.c

* Timers not working

* Delete global.h

* Cleanup

* Compiles

* Good sign: LEDs stop working again

* Handle timer1 overflow

* Progress: fix: forgot to init

* Backlighting fully working now except breathing.

* Revert keymap to original keycodes

* Update XD60 keymap README

* Update JJ40 keymap with backlight toggles

* Breathing working just fine.

* Update references

* Add backlight_set() call

* Cleanup code to disable backlight

* Fix: does not compile

* Fix: missing call to rgblight_task.

* Testing with BACKLIGHT_BREATHING

* Cleanup

* Cleanup comments

* More commenting cleanup.

* Do not enable BACKLIGHT_BREATHING by default

* Update XD60 keymap

* Update: move matrix_scan_kb out from matrix.c to jj40.c (kb-level)

* Cleanup for PR

* Fix conflict in readme.md for NIU mini

* Restore original power consumption figure

* Fix: matrix_scan_user() now has to be defined in the keymaps

* Add weak `matrix_scan_user` so it does not have to be defined in keymap

* Add weak matrix_init_user()
2018-02-02 01:30:47 -05:00
Jack Humbert
f5a9758cea
Adds serial number string to USB descriptors (#1996)
* add serial number string to usb descriptors

* better name for serial number
2017-11-17 11:53:46 -05:00
Benjamin Dengler
ba4b3d9d72 Added BLE support for USB-USB converter. (#1824)
* Added BLE support to USB-USB converter

* Added readme

* Removed images and Makefile
2017-10-15 15:04:03 -10:00
Wilba6582
85c3c5926c Force Raw HID interface number to 1 always (#1669) 2017-09-06 10:33:00 -07:00
Joe Wasson
bdc0880ca5 Add compile error if too many endpoints are defined for the ATmega32U4. 2017-08-20 11:51:57 -04:00
Jack Humbert
4b37030ad0 update lufa implementation 2017-07-07 12:06:59 -04:00
Jack Humbert
39ece81979 delete old lufa 2017-07-07 11:56:51 -04: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
98f9a2e6df Fix wrong include 2017-02-01 20:18:52 +07:00
Priyadi Iman Nurcahyo
2bef8b5b88 Limit outputselect to AVR only for now 2017-02-01 19:37:52 +07:00
Priyadi Iman Nurcahyo
72e95809a1 Move outputselect to parent dir to satisfy non LUFA keyboards 2017-02-01 17:55:13 +07: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
Kyle Smith
83e613ad23 Allow power consumption to be set per-keyboard. 2016-12-14 23:29:33 -05:00
Priyadi Iman Nurcahyo
434b286032 Allow negative values for mouse movements 2016-12-10 19:40:44 +07: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
Jack Humbert
78f8fe361f Merge pull request #915 from wez/ble_3
Add support for Adafruit BLE modules
2016-12-02 13:14:04 -05:00
Wilba6582
fe001d46fd Initial version of Raw HID interface 2016-12-01 00:44:54 +11:00
Wez Furlong
712476cd28 Add support for Adafruit BLE modules
This implements some helper functions that allow sending key reports
to an SPI based Bluetooth Low Energy module, such as the Adafruit
Feather 32u4 Bluefruit LE.

There is some plumbing required in lufa.c to enable this; that
is in a follow-on commit.
2016-11-27 23:49:44 -08: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