예제 #1
0
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{

    // MACRODOWN only works in this function
    switch(id)
    {

        case MACRO_QWERTY:
            if (record->event.pressed)
            {
                persistant_default_layer_set(1UL<<LAYER_QWERTY);
				#ifdef AUDIO_ENABLE
                	PLAY_NOTE_ARRAY(tone_qwerty, false, STACCATO);
				#endif /* AUDIO_ENABLE */
            }
            break;

        case MACRO_COLEMAK:
            if (record->event.pressed)
            {
                persistant_default_layer_set(1UL<<LAYER_COLEMAK);
				#ifdef AUDIO_ENABLE
                	PLAY_NOTE_ARRAY(tone_colemak, false, STACCATO);
				#endif /* AUDIO_ENABLE */
            }
            break;

        case MACRO_DVORAK:
            if (record->event.pressed)
            {
                persistant_default_layer_set(1UL<<LAYER_DVORAK);
				#ifdef AUDIO_ENABLE
    	            PLAY_NOTE_ARRAY(tone_dvorak, false, STACCATO);
				#endif /* AUDIO_ENABLE */
            }
            break;

        case MACRO_LOWER:
            if (record->event.pressed)
            {
                layer_on(LAYER_LOWER);
                update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
            }
            else
            {
                layer_off(LAYER_LOWER);
                update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
            }
            break;

        case MACRO_RAISE:
            if (record->event.pressed)
            {
                layer_on(LAYER_RAISE);
                update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
            }
            else
            {
                layer_off(LAYER_RAISE);
                update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
            }
            break;

        case MACRO_FUNCTION:
            if (record->event.pressed)
            {
                layer_on(LAYER_FUNCTION);
            }
            else
            {
                layer_off(LAYER_FUNCTION);
            }
            break;

#ifdef MOUSEKEY_ENABLE

        case MACRO_MOUSE:
            if (record->event.pressed)
            {
                layer_invert(LAYER_MOUSE);
            }
            break;

#endif /* MOUSEKEY_ENABLE */

#ifdef AUDIO_ENABLE

        case MACRO_TIMBRE_1:
            if (record->event.pressed) set_timbre(TIMBRE_12);
            break;

        case MACRO_TIMBRE_2:
            if (record->event.pressed) set_timbre(TIMBRE_25);
            break;

        case MACRO_TIMBRE_3:
            if (record->event.pressed) set_timbre(TIMBRE_50);
            break;

        case MACRO_TIMBRE_4:
            if (record->event.pressed) set_timbre(TIMBRE_75);
            break;

        case MACRO_TEMPO_U:
            if (record->event.pressed) increase_tempo(10);
            break;

        case MACRO_TEMPO_D:
            if (record->event.pressed) decrease_tempo(10);
            break;

        case MACRO_TONE_DEFAULT:
            if (record->event.pressed)
            {
                set_timbre(TIMBRE_DEFAULT);
                set_tempo(TEMPO_DEFAULT);
            }
            break;

        case MACRO_AUDIO_OFF:
            if (record->event.pressed)
            {
                #ifdef AUDIO_ENABLE
                    audio_off();
                #endif
            }
            break;

        case MACRO_AUDIO_ON:
            if (record->event.pressed)
            {
                #ifdef AUDIO_ENABLE
                    audio_on();
                PLAY_NOTE_ARRAY(tone_audio_on, false, STACCATO);
                #endif
            }
            break;

        case MACRO_MUSIC_ON:
            if (record->event.pressed)
            {
                #ifdef AUDIO_ENABLE
                    PLAY_NOTE_ARRAY(tone_music_on, false, STACCATO);
                    layer_on(LAYER_MUSIC);
                #endif
            }
            break;

        case MACRO_MUSIC_OFF:
            if (record->event.pressed)
            {
                #ifdef AUDIO_ENABLE
                    layer_off(LAYER_MUSIC);
                    stop_all_notes();
                #endif
            }
            break;

        case MACRO_INC_VOICE:
            if (record->event.pressed)
            {
                #ifdef AUDIO_ENABLE
                    voice_iterate();
                    PLAY_NOTE_ARRAY(music_scale, false, STACCATO);
                #endif
            }
            break;

        case MACRO_DEC_VOICE:
            if (record->event.pressed)
            {
                #ifdef AUDIO_ENABLE
                    voice_deiterate();
                    PLAY_NOTE_ARRAY(music_scale, false, STACCATO);
                #endif
            }
            break;

#endif /* AUDIO_ENABLE */

        default:
            break;

    }
    return MACRO_NONE;
};
예제 #2
0
파일: keymap.c 프로젝트: 0xdec/qmk_firmware
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{

    // MACRODOWN only works in this function
    switch(id)
    {

        case MACRO_HELP_1:
            if (record->event.pressed)
            {
				uprintf("1");
            }
            break;

        case MACRO_HELP_2:
            if (record->event.pressed)
            {
				uprintf("2");
            }
            break;

        case MACRO_HELP_3:
            if (record->event.pressed)
            {
				uprintf("3");
            }
            break;

        case MACRO_HELP_4:
            if (record->event.pressed)
            {
				uprintf("4");
            }
            break;

        case MACRO_HELP_5:
            if (record->event.pressed)
            {
				uprintf("5");
            }
            break;

        case MACRO_HELP_6:
            if (record->event.pressed)
            {
				uprintf("6");
            }
            break;

        case MACRO_HELP_7:
            if (record->event.pressed)
            {
				uprintf("7");
            }
            break;

        case MACRO_HELP_8:
            if (record->event.pressed)
            {
				uprintf("8");
            }
            break;

        case MACRO_HELP_9:
            if (record->event.pressed)
            {
				uprintf("9");
            }
            break;

        case MACRO_BREATH_TOGGLE:
            if (record->event.pressed)
            {
              #ifdef BACKLIGHT_BREATHING
                breathing_toggle();
              #endif
            }
            break;

        case MACRO_BREATH_SPEED_INC:
            if (record->event.pressed)
            {
              #ifdef BACKLIGHT_BREATHING
                breathing_period_inc();
              #endif
            }
            break;

        case MACRO_BREATH_SPEED_DEC:
            if (record->event.pressed)
            {
              #ifdef BACKLIGHT_BREATHING
                breathing_period_dec();
              #endif
            }
            break;

        case MACRO_BREATH_DEFAULT:
            if (record->event.pressed)
            {
              #ifdef BACKLIGHT_BREATHING
                breathing_period_default();
              #endif
            }
            break;

        case MACRO_QWERTY:
            if (record->event.pressed)
            {
                persistent_default_layer_set(1UL<<LAYER_QWERTY);
            }
            break;

        case MACRO_UPPER:
            if (record->event.pressed)
            {
                layer_on(LAYER_UPPER);
                #ifdef BACKLIGHT_BREATHING
                  breathing_period_set(2);
                  breathing_pulse();
                #endif
                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
            }
            else
            {
                layer_off(LAYER_UPPER);
                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
            }
            break;

        case MACRO_LOWER:
            if (record->event.pressed)
            {
                layer_on(LAYER_LOWER);
                #ifdef BACKLIGHT_BREATHING
                  breathing_period_set(2);
                  breathing_pulse();
                #endif
                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
            }
            else
            {
                layer_off(LAYER_LOWER);
                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
            }
            break;

        case MACRO_FUNCTION:
            if (record->event.pressed)
            {
                #ifdef BACKLIGHT_BREATHING
                  breathing_period_set(3);
                  breathing_enable();
                #endif
                layer_on(LAYER_FUNCTION);
            }
            else
            {
                #ifdef BACKLIGHT_BREATHING
                  breathing_period_set(1);
                  breathing_self_disable();
                #endif
                layer_off(LAYER_FUNCTION);
            }
            break;


#ifdef BACKLIGHT_ENABLE
		case MACRO_BACKLIGHT:
			if (record->event.pressed)
			{
				backlight_step();
			}
#endif

#ifdef MOUSEKEY_ENABLE

        case MACRO_MOUSE:
            if (record->event.pressed)
            {
                layer_invert(LAYER_MOUSE);
            }
            break;

        case MACRO_MOUSE_MOVE_UL:
            if (record->event.pressed)
            {
              mousekey_on(KC_MS_UP);
              mousekey_on(KC_MS_LEFT);
            }
            else
            {
              mousekey_off(KC_MS_UP);
              mousekey_off(KC_MS_LEFT);
            }
            break;

        case MACRO_MOUSE_MOVE_UR:
            if (record->event.pressed)
            {
              mousekey_on(KC_MS_UP);
              mousekey_on(KC_MS_RIGHT);
            }
            else
            {
              mousekey_off(KC_MS_UP);
              mousekey_off(KC_MS_RIGHT);
            }
            break;

        case MACRO_MOUSE_MOVE_DL:
            if (record->event.pressed)
            {
              mousekey_on(KC_MS_DOWN);
              mousekey_on(KC_MS_LEFT);
            }
            else
            {
              mousekey_off(KC_MS_DOWN);
              mousekey_off(KC_MS_LEFT);
            }
            break;

        case MACRO_MOUSE_MOVE_DR:
            if (record->event.pressed)
            {
              mousekey_on(KC_MS_DOWN);
              mousekey_on(KC_MS_RIGHT);
            }
            else
            {
              mousekey_off(KC_MS_DOWN);
              mousekey_off(KC_MS_RIGHT);
            }
            break;

#endif /* MOUSEKEY_ENABLE */

#ifdef AUDIO_ENABLE

        case MACRO_TIMBRE_1:
            if (record->event.pressed) set_timbre(TIMBRE_12);
            break;

        case MACRO_TIMBRE_2:
            if (record->event.pressed) set_timbre(TIMBRE_25);
            break;

        case MACRO_TIMBRE_3:
            if (record->event.pressed) set_timbre(TIMBRE_50);
            break;

        case MACRO_TIMBRE_4:
            if (record->event.pressed) set_timbre(TIMBRE_75);
            break;

        case MACRO_TEMPO_U:
            if (record->event.pressed) increase_tempo(10);
            break;

        case MACRO_TEMPO_D:
            if (record->event.pressed) decrease_tempo(10);
            break;

        case MACRO_TONE_DEFAULT:
            if (record->event.pressed)
            {
                set_timbre(TIMBRE_DEFAULT);
                set_tempo(TEMPO_DEFAULT);
            }
            break;

#endif /* AUDIO_ENABLE */

        default:
            break;

    }
    return MACRO_NONE;
};
예제 #3
0
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{

  // MACRODOWN only works in this function
  switch(id)
  {

    case MACRO_COPY_CUT:
        if (record->event.pressed) {
            register_code(KC_LCTL);
            if (record->tap.count == 1) {
                register_code(KC_C);
                unregister_code(KC_C);
            }
            else if (record->tap.count == 2) {
                register_code(KC_X);
                unregister_code(KC_X);
            }
            unregister_code(KC_LCTL);
        }
        break;


  //   case MACRO_HELP_1:
  //     if (record->event.pressed)
  //     {
  //       uprint("H1");
  //     }
  //     break;

  //   case MACRO_HELP_2:
  //     if (record->event.pressed)
  //     {
  //       uprint("H2");
  //     }
  //     break;

  //   case MACRO_HELP_3:
  //     if (record->event.pressed)
  //     {
  //       uprint("H3");
  //     }
  //     break;

  //   case MACRO_HELP_4:
  //     if (record->event.pressed)
  //     {
  //       uprint("H4");
  //     }
  //     break;

  //  case MACRO_HELP_5:
  //    if (record->event.pressed)
  //    {
  //      uprint("H5");
  //    }
  //    break;

  //  case MACRO_HELP_6:
  //    if (record->event.pressed)
  //    {
  //      uprint("H6");
  //    }
  //    break;

  //  case MACRO_HELP_7:
  //     if (record->event.pressed)
  //     {
  //       uprint("H7");
  //     }
  //     break;

  // case MACRO_HELP_8:
  //   if (record->event.pressed)
  //   {
  //     uprint("H8");
  //   }
  //   break;

  // case MACRO_HELP_9:
  //   if (record->event.pressed)
  //   {
  //     uprint("H9");
  //   }
  //   break;

  case MACRO_BREATH_TOGGLE:
    if (record->event.pressed)
    {
      breathing_toggle();
    }
    break;

  case MACRO_BREATH_SPEED_INC:
    if (record->event.pressed)
    {
      breathing_speed_inc(1);
    }
    break;

  case MACRO_BREATH_SPEED_DEC:
    if (record->event.pressed)
    {
      breathing_speed_dec(1);
    }
    break;

  case MACRO_BREATH_DEFAULT:
    if (record->event.pressed)
    {
      breathing_defaults();
    }
    break;

  case MACRO_QWERTY:
    if (record->event.pressed)
    {
      persistent_default_layer_set(1UL<<LAYER_QWERTY);
    }
    break;

  case MACRO_UPPER:
    if (record->event.pressed)
    {
      layer_on(LAYER_UPPER);
      breathing_speed_set(2);
      breathing_pulse();
      update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
    }
    else
    {
      layer_off(LAYER_UPPER);
      update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
    }
    break;

  case MACRO_LOWER:
    if (record->event.pressed)
    {
      layer_on(LAYER_LOWER);
      breathing_speed_set(2);
      breathing_pulse();
      update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
    }
    else
    {
      layer_off(LAYER_LOWER);
      update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
    }
    break;

  case MACRO_FUNCTION:
    if (record->event.pressed)
    {
      breathing_speed_set(3);
      breathing_enable();
      layer_on(LAYER_FUNCTION);
    }
    else
    {
      breathing_speed_set(1);
      breathing_self_disable();
      layer_off(LAYER_FUNCTION);
    }
    break;

#ifdef MOUSEKEY_ENABLE

  case MACRO_MOUSE:
    if (record->event.pressed)
    {
      layer_invert(LAYER_MOUSE);
    }
    break;

#endif /* MOUSEKEY_ENABLE */

#ifdef AUDIO_ENABLE

  case MACRO_TIMBRE_1:
    if (record->event.pressed) set_timbre(TIMBRE_12);
    break;

  case MACRO_TIMBRE_2:
    if (record->event.pressed) set_timbre(TIMBRE_25);
    break;

  case MACRO_TIMBRE_3:
    if (record->event.pressed) set_timbre(TIMBRE_50);
    break;

  case MACRO_TIMBRE_4:
    if (record->event.pressed) set_timbre(TIMBRE_75);
    break;

  case MACRO_TEMPO_U:
    if (record->event.pressed) increase_tempo(10);
    break;

  case MACRO_TEMPO_D:
    if (record->event.pressed) decrease_tempo(10);
    break;

  case MACRO_TONE_DEFAULT:
    if (record->event.pressed)
    {
      set_timbre(TIMBRE_DEFAULT);
      set_tempo(TEMPO_DEFAULT);
    }
    break;

#endif /* AUDIO_ENABLE */

#ifdef BACKLIGHT_ENABLE
  case MACRO_BACKLIGHT:
    if (record->event.pressed)
    {
      backlight_step();
    }
  break;
#endif /* BACKLIGHT_ENABLE */

  default:
    break;

}
return MACRO_NONE;
};
예제 #4
0
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{

    // MACRODOWN only works in this function
    switch(id)
    {

        case MACRO_HELP_1:
            if (record->event.pressed)
            {
        uprintf("1");
            }
            break;

        case MACRO_HELP_2:
            if (record->event.pressed)
            {
        uprintf("2");
            }
            break;

        case MACRO_HELP_3:
            if (record->event.pressed)
            {
        uprintf("3");
            }
            break;

        case MACRO_HELP_4:
            if (record->event.pressed)
            {
        uprintf("4");
            }
            break;

        case MACRO_HELP_5:
            if (record->event.pressed)
            {
        uprintf("5");
            }
            break;

        case MACRO_HELP_6:
            if (record->event.pressed)
            {
        uprintf("6");
            }
            break;

        case MACRO_HELP_7:
            if (record->event.pressed)
            {
        uprintf("7");
            }
            break;

        case MACRO_HELP_8:
            if (record->event.pressed)
            {
        uprintf("8");
            }
            break;

        case MACRO_HELP_9:
            if (record->event.pressed)
            {
        uprintf("9");
            }
            break;

        case MACRO_BREATH_TOGGLE:
            if (record->event.pressed)
            {
                breathing_toggle();
            }
            break;

        case MACRO_BREATH_SPEED_INC:
            if (record->event.pressed)
            {
                breathing_period_inc();
            }
            break;

        case MACRO_BREATH_SPEED_DEC:
            if (record->event.pressed)
            {
                breathing_period_dec();
            }
            break;

        case MACRO_BREATH_DEFAULT:
            if (record->event.pressed)
            {
                breathing_defaults();
            }
            break;

        case MACRO_QWERTY:
            if (record->event.pressed)
            {
                persistent_default_layer_set(1UL<<LAYER_QWERTY);
            }
            break;

        case MACRO_UPPER:
            if (record->event.pressed)
            {
                layer_on(LAYER_UPPER);
                breathing_period_set(2);
                breathing_pulse();
                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
            }
            else
            {
                layer_off(LAYER_UPPER);
                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
            }
            break;

        case MACRO_LOWER:
            if (record->event.pressed)
            {
                layer_on(LAYER_LOWER);
                breathing_period_set(2);
                breathing_pulse();
                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
            }
            else
            {
                layer_off(LAYER_LOWER);
                update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
            }
            break;

        case MACRO_FUNCTION:
            if (record->event.pressed)
            {
                breathing_period_set(3);
                breathing_enable();
                layer_on(LAYER_FUNCTION);
            }
            else
            {
                breathing_period_set(1);
                breathing_self_disable();
                layer_off(LAYER_FUNCTION);
            }
            break;

#ifdef MOUSEKEY_ENABLE

        case MACRO_MOUSE:
            if (record->event.pressed)
            {
                layer_invert(LAYER_MOUSE);
            }
            break;

#endif /* MOUSEKEY_ENABLE */

#ifdef AUDIO_ENABLE

        case MACRO_TIMBRE_1:
            if (record->event.pressed) set_timbre(TIMBRE_12);
            break;

        case MACRO_TIMBRE_2:
            if (record->event.pressed) set_timbre(TIMBRE_25);
            break;

        case MACRO_TIMBRE_3:
            if (record->event.pressed) set_timbre(TIMBRE_50);
            break;

        case MACRO_TIMBRE_4:
            if (record->event.pressed) set_timbre(TIMBRE_75);
            break;

        case MACRO_TEMPO_U:
            if (record->event.pressed) increase_tempo(10);
            break;

        case MACRO_TEMPO_D:
            if (record->event.pressed) decrease_tempo(10);
            break;

        case MACRO_TONE_DEFAULT:
            if (record->event.pressed)
            {
                set_timbre(TIMBRE_DEFAULT);
                set_tempo(TEMPO_DEFAULT);
            }
            break;

/*
        case MACRO_AUDIO_TOGGLE:
            if (record->event.pressed)
            {
                    if (is_audio_on())
                    {
                        audio_off();
                    }
                    else
                    {
                        audio_on();
                        PLAY_SONG(tone_audio_on);
                    }
            }
            break;

        case MACRO_MUSIC_TOGGLE:
            if (record->event.pressed)
            {
                    if (IS_LAYER_ON(LAYER_MUSIC))
                    {
                        layer_off(LAYER_MUSIC);
                        stop_all_notes();
                    }
                    else
                    {
                    PLAY_SONG(tone_music_on);
                    layer_on(LAYER_MUSIC);
                    }
            }
            break;
        case MACRO_INC_VOICE:
            if (record->event.pressed)
            {
                #ifdef AUDIO_ENABLE
                    voice_iterate();
                    PLAY_SONG(music_scale);
                #endif
            }
            break;

        case MACRO_DEC_VOICE:
            if (record->event.pressed)
            {
                #ifdef AUDIO_ENABLE
                    voice_deiterate();
                    PLAY_SONG(music_scale);
                #endif
            }
            break;
*/

#endif /* AUDIO_ENABLE */

#ifdef BACKLIGHT_ENABLE
        case MACRO_BACKLIGHT:
            if (record->event.pressed)
            {
                backlight_step();
            }
#endif

        default:
            break;

    }
    return MACRO_NONE;
};