You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Kaleidoscope/plugins/Kaleidoscope-MacroSupport
Michael Richters 3976e3dd5b
Add MacroSupport plugin
3 years ago
..
src Add MacroSupport plugin 3 years ago
README.md Add MacroSupport plugin 3 years ago
library.properties Add MacroSupport plugin 3 years ago

README.md

MacroSupport

This plugin provides the supplemental key array used by the Macros and DynamicMacros plugins, and is necessary for the proper functioning of those plugins.

Using the plugin

Any firmware sketch that uses either Macros or DynamicMacros automatically includes this plugin, so there's no need to add it explicitly. If your sketch doesn't require either type of Macros key, however, you can still make use of the MacroSupport plugin's helper methods (tap(), press(), et al). In that case, you should include the MacroSupport header file, and include it in KALEIDOSCOPE_INIT_PLUGINS():

#include <Kaleidoscope.h>
#include <Kaleidoscope-MacroSupport.h>

// Other plugin code that calls `MacroSupport.press()` (for example)

KALEIDOSCOPE_INIT_PLUGINS(
  MacroSupport,
  // Other plugin(s) that make use of MacroSupport
);

void setup() {
  Kaleidoscope.setup ();
}

Plugin methods

The plugin provides a MacroSupport object, which contains a supplemental array of virtual keys that it adds to USB Keyboard reports. Other plugins and user code can interact with it via the following methods:

.press(key)

Sends a key press event for key, and will keep that virtual key active in the supplemental virtual keys array.

.release(key)

Sends a key release event for key, and removes it from the supplemental virtual keys array.

.clear()

Releases all active virtual keys held by MacroSupport. This both empties the supplemental keys array (see above) and sends a release event for each key stored there.

.tap(key)

Sends an immediate press and release event for key with no delay, using an invalid key address. This method doesn't actually use the supplemental keys array, but is provided here for convenience and simplicity.

It is not necessary to use either the Macros (or DynamicMacros) to make use of MacroSupport. When using it with custom code, however, please remember that the supplemental active keys array it provides will be shared by all clients (e.g. Macros, user-defined Leader or TapDance functions), so if you want more than one of those clients to be active simultaneously, be aware that calles to MacroSupport.clear() will affect all of them, not just the caller.