Updated the README and the example with a better example

Instead of a twisted combination, use the palm keys - easy to press, and
otherwise unused in the example. Also, use `Macros.type` instead of
`Serial.println`, because the former is easier to play with as a user.

Fixes #5.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/365/head
Gergely Nagy 7 years ago
parent 58376f486d
commit 61d70b5cac

@ -24,27 +24,28 @@ a special function to handle the combos:
```c++ ```c++
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-Macros.h>
#include <Kaleidoscope-MagicCombo.h> #include <Kaleidoscope-MagicCombo.h>
static const kaleidoscope::MagicCombo::combo_t magic_combos[] PROGMEM = {
{R1C3 | R2C1 | R2C4 | R2C7, // left hand,
R0C11 | R1C12 | R2C14 //right hand
},
{0, 0}
};
void magicComboActions(uint8_t combo_index, uint32_t left_hand, uint32_t right_hand) { void magicComboActions(uint8_t combo_index, uint32_t left_hand, uint32_t right_hand) {
switch (combo_index) { switch (combo_index) {
case 0: case 0:
Serial.println("It's a kind of magic!"); Macros.type(PSTR("It's a kind of magic!"));
break; break;
} }
} }
KALEIDOSCOPE_INIT_PLUGINS(MagicCombo); static const kaleidoscope::MagicCombo::combo_t magic_combos[] PROGMEM = {
{
R3C6, // left palm key
R3C9 // right palm key
},
{0, 0}
};
KALEIDOSCOPE_INIT_PLUGINS(MagicCombo, Macros);
void setup() { void setup() {
Serial.begin(9600);
Kaleidoscope.setup(); Kaleidoscope.setup();
MagicCombo.magic_combos = magic_combos; MagicCombo.magic_combos = magic_combos;

@ -17,20 +17,21 @@
*/ */
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-Macros.h>
#include <Kaleidoscope-MagicCombo.h> #include <Kaleidoscope-MagicCombo.h>
void magicComboActions(uint8_t combo_index, uint32_t left_hand, uint32_t right_hand) { void magicComboActions(uint8_t combo_index, uint32_t left_hand, uint32_t right_hand) {
switch (combo_index) { switch (combo_index) {
case 0: case 0:
Serial.println("It's a kind of magic!"); Macros.type(PSTR("It's a kind of magic!"));
break; break;
} }
} }
static const kaleidoscope::MagicCombo::combo_t magic_combos[] PROGMEM = { static const kaleidoscope::MagicCombo::combo_t magic_combos[] PROGMEM = {
{ {
R1C3 | R2C1 | R2C4 | R2C7, // left hand, R3C6, // left palm key
R0C11 | R1C12 | R2C14 // right hand R3C9 // right palm key
}, },
{0, 0} {0, 0}
}; };
@ -57,10 +58,9 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
}; };
// *INDENT-ON* // *INDENT-ON*
KALEIDOSCOPE_INIT_PLUGINS(MagicCombo); KALEIDOSCOPE_INIT_PLUGINS(MagicCombo, Macros);
void setup() { void setup() {
Serial.begin(9600);
Kaleidoscope.setup(); Kaleidoscope.setup();
MagicCombo.magic_combos = magic_combos; MagicCombo.magic_combos = magic_combos;

Loading…
Cancel
Save