2019-03-01 04:20:26 +01:00
|
|
|
#include "process_records.h"
|
2019-06-01 23:39:31 +02:00
|
|
|
#include "custom_keycodes.h"
|
|
|
|
#include "timer_utils.h"
|
2019-03-01 04:20:26 +01:00
|
|
|
|
2019-05-01 05:55:01 +02:00
|
|
|
#if defined(RGB_MATRIX_ENABLE)
|
|
|
|
extern void eeconfig_update_rgb_matrix_default(void);
|
|
|
|
#endif
|
|
|
|
|
2019-05-19 18:15:50 +02:00
|
|
|
#ifdef TRILAYER_ENABLED
|
2019-06-01 23:39:31 +02:00
|
|
|
uint32_t layer_state_set_user(uint32_t state)
|
|
|
|
{
|
|
|
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
2019-05-19 18:15:50 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-06-01 23:39:31 +02:00
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record)
|
|
|
|
{
|
|
|
|
static uint16_t reset_timer;
|
|
|
|
|
|
|
|
#ifndef TAP_DANCE_ENABLE
|
|
|
|
if (!process_tap_dance_double(keycode, record))
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (keycode)
|
|
|
|
{
|
|
|
|
case RGBRST:
|
|
|
|
{
|
2019-05-01 05:55:01 +02:00
|
|
|
#if defined(RGBLIGHT_ENABLE)
|
2019-06-01 23:39:31 +02:00
|
|
|
if (record->event.pressed)
|
|
|
|
{
|
|
|
|
eeconfig_update_rgblight_default();
|
|
|
|
rgblight_enable();
|
|
|
|
}
|
2019-05-01 05:55:01 +02:00
|
|
|
#elif defined(RGB_MATRIX_ENABLE)
|
2019-06-01 23:39:31 +02:00
|
|
|
if (record->event.pressed)
|
|
|
|
eeconfig_update_rgb_matrix_default();
|
2019-05-01 05:55:01 +02:00
|
|
|
#endif
|
2019-06-01 23:39:31 +02:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case RESET:
|
|
|
|
{
|
|
|
|
if (record->event.pressed)
|
|
|
|
reset_timer = timer_read() + 500;
|
|
|
|
else if (timer_expired(reset_timer))
|
|
|
|
reset_keyboard();
|
|
|
|
}
|
|
|
|
return false;
|
2019-03-01 04:20:26 +01:00
|
|
|
}
|
|
|
|
|
2019-05-19 18:15:50 +02:00
|
|
|
return process_record_keymap(keycode, record);
|
2019-03-01 04:20:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
__attribute__ ((weak))
|
2019-06-01 23:39:31 +02:00
|
|
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record)
|
|
|
|
{
|
|
|
|
return true;
|
2019-03-01 04:20:26 +01:00
|
|
|
}
|