Since there hasn't been a whole lot of talk about macros, I thought I'd share with you what I've figured out so far. I don't know how to program in C, so the best I have come up with is copying, pasting, and modifying bits of Ben's existing code. Here are my results.
Tutorial
Adding a Shift modifier:
The code for this is already in the firmware, and can be applied to any existing keybinding relatively easily. Navigate to ...\keyboard\ergodox\layout\ and open the .c file that corresponds with your chosen layout. Toward the bottom of the file there should be a section like this:
// ----------------------------------------------------------------------------
// PRESS ----------------------------------------------------------------------
const void_funptr_t PROGMEM _kb_layout_press[KB_LAYERS][KB_ROWS][KB_COLUMNS] = {
// LAYER 0
KB_MATRIX_LAYER(
// unused
NULL,
// left hand
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel, sshprre,
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel, sshprre,
cntprre, cntprre, cntprre, cntprre, kprrel,
kprrel, kprrel,
NULL, NULL, kprrel,
kprrel, kprrel, kprrel,
// right hand
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
sshprre, kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
lpush1, kprrel, kprrel, kprrel, kprrel,
kprrel, kprrel,
kprrel, NULL, NULL,
kprrel, kprrel, kprrel
),
The code should be (more or less) formatted to look like the two halves of your keyboard. This section of the code tells us what sort of signal a key sends when it is pressed down. There is a corresponding section of code to in a minute.
All the "kprrel" represent keys that function normally with no modifiers. Keys labeled "sshprre" represent a key that will behave as if the shift key were being held when you press it. Keys labeled "lpush1" push the first layer to the top. The keys labeled "cntprre" behave as if the control key is being held when they are pressed. I had to add in a couple lines of code to make this work, which I will show you how to do soon.
If you modify any of the press states, you also need to modify their corresponding release states. They are found lower down in the code; this is what mine looks like:
// ----------------------------------------------------------------------------
// RELEASE --------------------------------------------------------------------
const void_funptr_t PROGMEM _kb_layout_release[KB_LAYERS][KB_ROWS][KB_COLUMNS] = {
// LAYER 0
KB_MATRIX_LAYER(
// unused
NULL,
// left hand
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel, sshprre,
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel, sshprre,
cntprre, cntprre, cntprre, cntprre, kprrel,
kprrel, kprrel,
NULL, NULL, kprrel,
kprrel, kprrel, kprrel,
// right hand
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
sshprre, kprrel, kprrel, kprrel, kprrel, kprrel, kprrel,
lpop1, kprrel, kprrel, kprrel, kprrel,
kprrel, kprrel,
kprrel, NULL, NULL,
kprrel, kprrel, kprrel
),
Note that the only difference between this section and the PRESS section is that "lpush1" is now "lpop1". That is because in my layout, this is a layer toggle key. It is only active while held down.
To change a normal key into a key shift-modified version of itself, replace "kprrel" with "sshprre" in both the PRESS and RELEASE section corresponding to that key.
Adding a Control modifier:
Adding a control modifier also requires that you change "kprrel" in both the press and release sections of the code, but they need to be changed to "cntprre", and we need to add in a couple of code snippets. Towards the to of this file is a section of code titled DEFINITIONS. Paste this line of code onto a new line somewhere in this area
#define cntprre &kbfun_control_press_release
Next we need to locate ...\src\lib\key-functions\public\special.c
not too far down you should find some code that looks almost identical to this:
void kbfun_control_press_release(void) {
_kbfun_press_release(IS_PRESSED, KEY_LeftControl);
kbfun_press_release();
}
Paste the above code onto a new line near the very similar code.
Locate ...\lib\key-functions\public.h
Scroll down to the section titled \\special, and paste the following code on a new line:
void kbfun_control_press_release (void);
And that's it! Now any key can be made to act as if the control key is held when pressed. I hope this information is useful to someone.