示例#1
0
static Key handleMacroEvent(Key mappedKey, byte row, byte col, uint8_t keyState) {
    if (mappedKey.flags != (SYNTHETIC | IS_MACRO))
        return mappedKey;

    if (!key_toggled_on(keyState))
      return Key_NoKey;

    const macro_t *m = macroAction(mappedKey.keyCode, keyState);

    Macros.play(m);
    return Key_NoKey;
}
示例#2
0
EventHandlerResult Macros_::beforeReportingState() {
  for (byte i = 0; i < active_macro_count; ++i) {
    if (active_macros[i].key_id == 0xFF) {
      // i.e. UNKNOWN_KEYSWITCH_LOCATION
      row = 0xFF;
      col = 0xFF;
    } else {
      row = active_macros[i].key_id / COLS;
      col = active_macros[i].key_id % COLS;
    }
    const macro_t *m = macroAction(active_macros[i].key_code,
                                   active_macros[i].key_state);
    Macros.play(m);
  }
  return EventHandlerResult::OK;
}