/* Copyright 2020 Jay Greco
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include QMK_KEYBOARD_H
#include "remote_kb.h"
#include "bitc_led.h"
enum custom_keycodes {
PROG = SAFE_RANGE,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Base layer (numpad)
[0] = LAYOUT(
TO(1), PROG, KC_NO, \
LCTL(LALT(KC_TAB)), LGUI(KC_DOWN), KC_NO, KC_AUDIO_VOL_UP, \
KC_MS_BTN1, KC_MS_UP, KC_MS_BTN2, KC_AUDIO_VOL_DOWN, \
KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_MS_BTN3, \
KC_NO, KC_MS_WH_LEFT, KC_MS_WH_RIGHT, KC_ESC \
),
// Function layer (numpad)
[1] = LAYOUT(
TO(0), PROG, KC_KP_SLASH,
KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_ASTERISK,
KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_MINUS,
KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_PLUS,
KC_NO, KC_KP_0, KC_KP_DOT, KC_KP_ENTER
),
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
process_record_remote_kb(keycode, record);
switch(keycode) {
case PROG:
if (record->event.pressed) {
set_bitc_LED(LED_ON);
rgblight_disable_noeeprom();
bootloader_jump(); //jump to bootloader
}
break;
default:
break;
}
return true;
}
void encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
if (layer_state_is(0)) {
tap_code(KC_MS_WH_UP);
}
else if (layer_state_is(1)) {
tap_code(KC_AUDIO_VOL_UP);
}
} else {
if (layer_state_is(0)) {
tap_code(KC_MS_WH_DOWN);
}
else if (layer_state_is(1)) {
tap_code(KC_AUDIO_VOL_DOWN);
}
}
}
void led_set_kb(uint8_t usb_led) {
if (usb_led & (1<