Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Include logic to send solid colors as foreground to shine and add sam…
Browse files Browse the repository at this point in the history
…ple profiles (qmk#14)

Include the logic to send a solid color from qmk to shine. That solid color will act as a foreground (will override the current profile) until reset (witch will reactivate the current profile).
This functionality depends on changes made for shine as well.

Include 3 new profiles:

    default-full-caps -> same as default, but with the logic of using the red foreground color on caps lock.
    default-layer-indicators -> same as default, but with the logic of red foreground on caps lock, green foreground on FN1 and blue foreground on FN2.
    thomazmoura -> my own profile as a sample of an over-engineered advanced case scenario.
  • Loading branch information
thomazmoura authored and shearn89 committed Feb 16, 2022
1 parent f23015f commit 721cc6e
Show file tree
Hide file tree
Showing 7 changed files with 745 additions and 0 deletions.
115 changes: 115 additions & 0 deletions keyboards/annepro2/keymaps/default-full-caps/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#include <stdint.h>
#include "annepro2.h"
#include "qmk_ap2_led.h"

enum anne_pro_layers {
_BASE_LAYER,
_FN1_LAYER,
_FN2_LAYER,
};

/*
* Layer _BASE_LAYER
* ,-----------------------------------------------------------------------------------------.
* | esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bksp |
* |-----------------------------------------------------------------------------------------+
* | Tab | q | w | e | r | t | y | u | i | o | p | [ | ] | \ |
* |-----------------------------------------------------------------------------------------+
* | Caps | a | s | d | f | g | h | j | k | l | ; | ' | Enter |
* |-----------------------------------------------------------------------------------------+
* | Shift | z | x | c | v | b | n | m | , | . | / | Shift |
* |-----------------------------------------------------------------------------------------+
* | Ctrl | L1 | Alt | space | Alt | FN1 | FN2 | Ctrl |
* \-----------------------------------------------------------------------------------------/
* Layer TAP in _BASE_LAYER
* ,-----------------------------------------------------------------------------------------.
* | | | | | | | | | | | | | | |
* |-----------------------------------------------------------------------------------------+
* | | | | | | | | | | | | | | |
* |-----------------------------------------------------------------------------------------+
* | | | | | | | | | | | | | |
* |-----------------------------------------------------------------------------------------+
* | | | | | | | | | | | | UP |
* |-----------------------------------------------------------------------------------------+
* | | | | | | LEFT | DOWN | RIGHT |
* \-----------------------------------------------------------------------------------------/
*/
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE_LAYER] = KEYMAP( /* Base */
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_UP),
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LT(_FN1_LAYER,KC_LEFT), LT(_FN2_LAYER,KC_DOWN), RCTL_T(KC_RGHT)
),
/*
* Layer _FN1_LAYER
* ,-----------------------------------------------------------------------------------------.
* | ` | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE |
* |-----------------------------------------------------------------------------------------+
* | Tab | q | UP | e | r | t | y | u | i | o | PS | HOME | END | \ |
* |-----------------------------------------------------------------------------------------+
* | Esc |LEFT |DOWN |RIGHT| f | g | h | j | k | l | PGUP|PGDN | Enter |
* |-----------------------------------------------------------------------------------------+
* | Shift |V-UP |V-DWN|MUTE | v | b | n | m | , |INSRT| DEL | Shift |
* |-----------------------------------------------------------------------------------------+
* | Ctrl | L1 | Alt | space | Alt | FN1 | FN2 | Ctrl |
* \-----------------------------------------------------------------------------------------/
*
*/
[_FN1_LAYER] = KEYMAP( /* Base */
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL,
KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_HOME, KC_END, KC_TRNS,
KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_TRNS,
KC_TRNS, KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_DEL, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FN2_LAYER), KC_TRNS
),
/*
* Layer _FN2_LAYER
* ,-----------------------------------------------------------------------------------------.
* | ~ | BT1 | BT2 | BT3 | BT4 | F5 | F6 | F7 |LEDOF|LEDON| F10 | F11 | F12 | Bksp |
* |-----------------------------------------------------------------------------------------+
* | Tab | q | UP | e | r | t | y | u | i | o | PS | HOME | END | \ |
* |-----------------------------------------------------------------------------------------+
* | Esc |LEFT |DOWN |RIGHT| f | g | h | j | k | l | PGUP|PGDN | Enter |
* |-----------------------------------------------------------------------------------------+
* | Shift | z | x | c | v | b | n | m | , |INSRT| DEL | Shift |
* |-----------------------------------------------------------------------------------------+
* | Ctrl | L1 | Alt | space | Alt | FN1 | FN2 | Ctrl |
* \-----------------------------------------------------------------------------------------/
*
*/
[_FN2_LAYER] = KEYMAP( /* Base */
KC_TRNS, KC_AP2_BT1, KC_AP2_BT2, KC_AP2_BT3, KC_AP2_BT4, KC_TRNS, KC_TRNS, KC_TRNS, KC_AP_LED_OFF, KC_AP_LED_ON, KC_AP_LED_NEXT_INTENSITY, KC_AP_LED_SPEED, KC_TRNS, KC_TRNS,
MO(_FN2_LAYER), KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_HOME, KC_END, KC_TRNS,
KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_DEL, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FN1_LAYER), MO(_FN2_LAYER), KC_TRNS
),
};
const uint16_t keymaps_size = sizeof(keymaps);


void matrix_init_user(void) {

}

void matrix_scan_user(void) {
}

layer_state_t layer_state_set_user(layer_state_t layer) {
return layer;
}

// The function to handle the caps lock logic
bool led_update_user(led_t leds) {
if (leds.caps_lock) {
// Set the leds to red
annepro2LedSetForegroundColor(0xFF, 0x00, 0x00);
} else {
annepro2LedResetForegroundColor();
}

return true;
}

132 changes: 132 additions & 0 deletions keyboards/annepro2/keymaps/default-layer-indicators/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#include <stdint.h>
#include "annepro2.h"
#include "qmk_ap2_led.h"

enum anne_pro_layers {
_BASE_LAYER,
_FN1_LAYER,
_FN2_LAYER,
};

/*
* Layer _BASE_LAYER
* ,-----------------------------------------------------------------------------------------.
* | esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bksp |
* |-----------------------------------------------------------------------------------------+
* | Tab | q | w | e | r | t | y | u | i | o | p | [ | ] | \ |
* |-----------------------------------------------------------------------------------------+
* | Caps | a | s | d | f | g | h | j | k | l | ; | ' | Enter |
* |-----------------------------------------------------------------------------------------+
* | Shift | z | x | c | v | b | n | m | , | . | / | Shift |
* |-----------------------------------------------------------------------------------------+
* | Ctrl | L1 | Alt | space | Alt | FN1 | FN2 | Ctrl |
* \-----------------------------------------------------------------------------------------/
* Layer TAP in _BASE_LAYER
* ,-----------------------------------------------------------------------------------------.
* | | | | | | | | | | | | | | |
* |-----------------------------------------------------------------------------------------+
* | | | | | | | | | | | | | | |
* |-----------------------------------------------------------------------------------------+
* | | | | | | | | | | | | | |
* |-----------------------------------------------------------------------------------------+
* | | | | | | | | | | | | UP |
* |-----------------------------------------------------------------------------------------+
* | | | | | | LEFT | DOWN | RIGHT |
* \-----------------------------------------------------------------------------------------/
*/
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE_LAYER] = KEYMAP( /* Base */
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_UP),
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, LT(_FN1_LAYER,KC_LEFT), LT(_FN2_LAYER,KC_DOWN), RCTL_T(KC_RGHT)
),
/*
* Layer _FN1_LAYER
* ,-----------------------------------------------------------------------------------------.
* | ` | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | DELETE |
* |-----------------------------------------------------------------------------------------+
* | Tab | q | UP | e | r | t | y | u | i | o | PS | HOME | END | \ |
* |-----------------------------------------------------------------------------------------+
* | Esc |LEFT |DOWN |RIGHT| f | g | h | j | k | l | PGUP|PGDN | Enter |
* |-----------------------------------------------------------------------------------------+
* | Shift |V-UP |V-DWN|MUTE | v | b | n | m | , |INSRT| DEL | Shift |
* |-----------------------------------------------------------------------------------------+
* | Ctrl | L1 | Alt | space | Alt | FN1 | FN2 | Ctrl |
* \-----------------------------------------------------------------------------------------/
*
*/
[_FN1_LAYER] = KEYMAP( /* Base */
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL,
KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_HOME, KC_END, KC_TRNS,
KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_TRNS,
KC_TRNS, KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_DEL, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FN2_LAYER), KC_TRNS
),
/*
* Layer _FN2_LAYER
* ,-----------------------------------------------------------------------------------------.
* | ~ | BT1 | BT2 | BT3 | BT4 | F5 | F6 | F7 |LEDOF|LEDON| F10 | F11 | F12 | Bksp |
* |-----------------------------------------------------------------------------------------+
* | Tab | q | UP | e | r | t | y | u | i | o | PS | HOME | END | \ |
* |-----------------------------------------------------------------------------------------+
* | Esc |LEFT |DOWN |RIGHT| f | g | h | j | k | l | PGUP|PGDN | Enter |
* |-----------------------------------------------------------------------------------------+
* | Shift | z | x | c | v | b | n | m | , |INSRT| DEL | Shift |
* |-----------------------------------------------------------------------------------------+
* | Ctrl | L1 | Alt | space | Alt | FN1 | FN2 | Ctrl |
* \-----------------------------------------------------------------------------------------/
*
*/
[_FN2_LAYER] = KEYMAP( /* Base */
KC_TRNS, KC_AP2_BT1, KC_AP2_BT2, KC_AP2_BT3, KC_AP2_BT4, KC_TRNS, KC_TRNS, KC_TRNS, KC_AP_LED_OFF, KC_AP_LED_ON, KC_AP_LED_NEXT_INTENSITY, KC_AP_LED_SPEED, KC_TRNS, KC_TRNS,
MO(_FN2_LAYER), KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_HOME, KC_END, KC_TRNS,
KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_DEL, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MO(_FN1_LAYER), MO(_FN2_LAYER), KC_TRNS
),
};
const uint16_t keymaps_size = sizeof(keymaps);


void matrix_init_user(void) {

}

void matrix_scan_user(void) {
}

layer_state_t layer_state_set_user(layer_state_t layer) {
switch(get_highest_layer(layer)) {
case _FN1_LAYER:
// Set the leds to green
annepro2LedSetForegroundColor(0x00, 0xFF, 0x00);
break;
case _FN2_LAYER:
// Set the leds to blue
annepro2LedSetForegroundColor(0x00, 0x00, 0xFF);
break;
default:
// Reset back to the current profile
annepro2LedResetForegroundColor();
break;
}
return layer;
}

// The function to handle the caps lock logic
bool led_update_user(led_t leds) {
if (leds.caps_lock) {
// Set the leds to red
annepro2LedSetForegroundColor(0xFF, 0x00, 0x00);
} else {
// Reset back to the current profile if there is no layer active
if(!layer_state_is(_FN1_LAYER) && !layer_state_is(_FN2_LAYER)) {
annepro2LedResetForegroundColor();
}
}

return true;
}

15 changes: 15 additions & 0 deletions keyboards/annepro2/keymaps/thomazmoura/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#undef TAPPING_TERM
#define TAPPING_TERM 200
#define RETRO_TAPPING

#undef TAPPING_TOGGLE
#define TAPPING_TOGGLE 2

#define MK_3_SPEED
#define MK_MOMENTARY_ACCEL

#define CAPS_LOCATION (MATRIX_COLS * 0 + 0)

#define IDLE_PROFILE_INDEX 0
Loading

0 comments on commit 721cc6e

Please sign in to comment.