2019-02-28 19:20:26 -08:00
|
|
|
#include "process_records.h"
|
2019-06-01 14:39:31 -07:00
|
|
|
#include "custom_keycodes.h"
|
2019-02-28 19:20:26 -08:00
|
|
|
|
2019-07-25 11:56:29 -07:00
|
|
|
#ifdef RGB_ENABLE
|
|
|
|
#include "custom_rgb.h"
|
|
|
|
#endif
|
|
|
|
|
2019-05-19 09:15:50 -07:00
|
|
|
#ifdef TRILAYER_ENABLED
|
2021-07-19 09:50:55 -07:00
|
|
|
layer_state_t layer_state_set_user(layer_state_t state)
|
2019-06-01 14:39:31 -07:00
|
|
|
{
|
|
|
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
2019-05-19 09:15:50 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-06-01 14:39:31 -07:00
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record)
|
|
|
|
{
|
|
|
|
static uint16_t reset_timer;
|
|
|
|
|
|
|
|
#ifndef TAP_DANCE_ENABLE
|
2019-07-25 11:56:29 -07:00
|
|
|
if (!process_custom_tap_dance(keycode, record))
|
2019-06-01 14:39:31 -07:00
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (keycode)
|
|
|
|
{
|
|
|
|
case RGBRST:
|
2019-07-25 11:56:29 -07:00
|
|
|
#ifdef RGB_ENABLE
|
|
|
|
if (record->event.pressed)
|
|
|
|
rgb_reset();
|
2019-04-30 20:55:01 -07:00
|
|
|
#endif
|
2019-06-01 14:39:31 -07:00
|
|
|
return false;
|
2022-11-15 08:52:01 -08:00
|
|
|
case QK_BOOT:
|
2019-06-01 14:39:31 -07:00
|
|
|
{
|
|
|
|
if (record->event.pressed)
|
|
|
|
reset_timer = timer_read() + 500;
|
2019-08-25 12:37:55 -07:00
|
|
|
else if (timer_expired(timer_read(), reset_timer))
|
2019-06-01 14:39:31 -07:00
|
|
|
reset_keyboard();
|
|
|
|
}
|
|
|
|
return false;
|
2020-05-05 05:54:26 -07:00
|
|
|
#if defined(RGB_MATRIX_TOG_LAYERS) && defined(RGB_ENABLE)
|
2019-07-25 11:56:29 -07:00
|
|
|
case RGB_TOG:
|
|
|
|
if (record->event.pressed) {
|
2019-09-17 10:28:02 -07:00
|
|
|
rgb_matrix_increase_flags();
|
2019-07-25 11:56:29 -07:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
#endif
|
2019-02-28 19:20:26 -08:00
|
|
|
}
|
|
|
|
|
2019-07-25 11:56:29 -07:00
|
|
|
return process_record_encoder(keycode, record) && process_record_keymap(keycode, record);
|
2019-02-28 19:20:26 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
__attribute__ ((weak))
|
2019-06-01 14:39:31 -07:00
|
|
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record)
|
|
|
|
{
|
|
|
|
return true;
|
2019-02-28 19:20:26 -08:00
|
|
|
}
|
2019-07-25 11:56:29 -07:00
|
|
|
|
|
|
|
__attribute__ ((weak))
|
|
|
|
bool process_record_encoder(uint16_t keycode, keyrecord_t *record)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|