Skip to content

Commit

Permalink
fucntion whitespace changes
Browse files Browse the repository at this point in the history
  • Loading branch information
plodah committed Aug 13, 2024
1 parent 2524c26 commit 64b14c5
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 93 deletions.
72 changes: 36 additions & 36 deletions users/plodah/functions/indicators.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#pragma once

bool plodah_indicator_handler( void ) {
bool plodah_indicator_handler(void) {
# ifdef CAPS_LOCK_LED_INDEX
if ( host_keyboard_led_state( ).caps_lock ) {
if (host_keyboard_led_state().caps_lock) {
# ifdef PLODAH_CAPS_INDIC_RGB
rgb_matrix_set_color( CAPS_LOCK_LED_INDEX, PLODAH_CAPS_INDIC_RGB );
rgb_matrix_set_color(CAPS_LOCK_LED_INDEX, PLODAH_CAPS_INDIC_RGB);
# else // PLODAH_CAPS_INDICATOR_R/G/B
rgb_matrix_set_color( CAPS_LOCK_LED_INDEX, RGB_RED );
rgb_matrix_set_color(CAPS_LOCK_LED_INDEX, RGB_RED);
# endif // PLODAH_CAPS_INDICATOR_R/G/B
} else {
if ( !rgb_matrix_get_flags( ) ) {
rgb_matrix_set_color( CAPS_LOCK_LED_INDEX, RGB_OFF );
if (!rgb_matrix_get_flags()) {
rgb_matrix_set_color(CAPS_LOCK_LED_INDEX, RGB_OFF);
}
}
# endif //CAPS_LOCK_LED_INDEX
Expand All @@ -20,74 +20,74 @@ bool plodah_indicator_handler( void ) {
# else
bool onzero = false;
# endif
int highlayer = get_highest_layer( layer_state );
for ( int lindex = 0; lindex < DYNAMIC_KEYMAP_LAYER_COUNT; lindex++ ) {
int thisindex = ( lindex + PLODAH_LAYER_INDIC_INDEX1 );
if ( !rgb_matrix_get_flags( ) ) {
rgb_matrix_set_color( thisindex, RGB_OFF );
int highlayer = get_highest_layer(layer_state);
for (int lindex = 0; lindex < DYNAMIC_KEYMAP_LAYER_COUNT; lindex++) {
int thisindex = (lindex + PLODAH_LAYER_INDIC_INDEX1);
if (!rgb_matrix_get_flags()) {
rgb_matrix_set_color(thisindex, RGB_OFF);
}
if ( highlayer == lindex && ( lindex != 0 || onzero ) ) {
if (highlayer == lindex && (lindex != 0 || onzero)) {
# ifdef PLODAH_LAYER_INDIC_RGB
rgb_matrix_set_color( thisindex, PLODAH_LAYER_INDIC_RGB );
rgb_matrix_set_color(thisindex, PLODAH_LAYER_INDIC_RGB);
# else //PLODAH_LAYER_INDIC_RGB
rgb_matrix_set_color( thisindex, RGB_RED );
rgb_matrix_set_color(thisindex, RGB_RED);
# endif //PLODAH_LAYER_INDIC_RGB
}
else {
# ifdef PLODAH_LAYER_INDIC_BG_RGB
if ( highlayer != lindex && ( lindex != 0 || onzero ) ) {
rgb_matrix_set_color( thisindex, PLODAH_LAYER_INDIC_BG_RGB );
if (highlayer != lindex && (lindex != 0 || onzero)) {
rgb_matrix_set_color(thisindex, PLODAH_LAYER_INDIC_BG_RGB);
}
# endif
}
}
# endif //PLODAH_LAYER_INDIC_INDEX1
# ifdef PLODAH_MODS_INDIC_LALT_INDEX
if ( !rgb_matrix_get_flags( ) ) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_LALT_INDEX, RGB_OFF );
if (!rgb_matrix_get_flags()) {
rgb_matrix_set_color(PLODAH_MODS_INDIC_LALT_INDEX, RGB_OFF);
}
if (alt_pressed) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_LALT_INDEX, PLODAH_MODS_INDIC_RGB );
rgb_matrix_set_color(PLODAH_MODS_INDIC_LALT_INDEX, PLODAH_MODS_INDIC_RGB);
}
# endif
# ifdef PLODAH_MODS_INDIC_RALT_INDEX
if ( !rgb_matrix_get_flags( ) ) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_RALT_INDEX, RGB_OFF );
if (!rgb_matrix_get_flags()) {
rgb_matrix_set_color(PLODAH_MODS_INDIC_RALT_INDEX, RGB_OFF);
}
if (alt_pressed) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_RALT_INDEX, PLODAH_MODS_INDIC_RGB );
rgb_matrix_set_color(PLODAH_MODS_INDIC_RALT_INDEX, PLODAH_MODS_INDIC_RGB);
}
# endif
# ifdef PLODAH_MODS_INDIC_LCTL_INDEX
if ( !rgb_matrix_get_flags( ) ) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_LCTL_INDEX, RGB_OFF );
if (!rgb_matrix_get_flags()) {
rgb_matrix_set_color(PLODAH_MODS_INDIC_LCTL_INDEX, RGB_OFF);
}
if (ctl_pressed) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_LCTL_INDEX, PLODAH_MODS_INDIC_RGB );
rgb_matrix_set_color(PLODAH_MODS_INDIC_LCTL_INDEX, PLODAH_MODS_INDIC_RGB);
}
# endif
# ifdef PLODAH_MODS_INDIC_RCTL_INDEX
if ( !rgb_matrix_get_flags( ) ) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_RCTL_INDEX, RGB_OFF );
if (!rgb_matrix_get_flags()) {
rgb_matrix_set_color(PLODAH_MODS_INDIC_RCTL_INDEX, RGB_OFF);
}
if (ctl_pressed) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_RCTL_INDEX, PLODAH_MODS_INDIC_RGB );
rgb_matrix_set_color(PLODAH_MODS_INDIC_RCTL_INDEX, PLODAH_MODS_INDIC_RGB);
}
# endif
# ifdef PLODAH_MODS_INDIC_LSHIFT_INDEX
if ( !rgb_matrix_get_flags( ) ) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_LSHIFT_INDEX, RGB_OFF );
if (!rgb_matrix_get_flags()) {
rgb_matrix_set_color(PLODAH_MODS_INDIC_LSHIFT_INDEX, RGB_OFF);
}
if ( sft_pressed || sft_held ) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_LSHIFT_INDEX, PLODAH_MODS_INDIC_RGB );
if (sft_pressed || sft_held) {
rgb_matrix_set_color(PLODAH_MODS_INDIC_LSHIFT_INDEX, PLODAH_MODS_INDIC_RGB);
}
# endif
# ifdef PLODAH_MODS_INDIC_RSHIFT_INDEX
if ( !rgb_matrix_get_flags( ) ) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_RSHIFT_INDEX, RGB_OFF );
if (!rgb_matrix_get_flags()) {
rgb_matrix_set_color(PLODAH_MODS_INDIC_RSHIFT_INDEX, RGB_OFF);
}
if ( sft_pressed || sft_held ) {
rgb_matrix_set_color( PLODAH_MODS_INDIC_RSHIFT_INDEX, PLODAH_MODS_INDIC_RGB );
if (sft_pressed || sft_held) {
rgb_matrix_set_color(PLODAH_MODS_INDIC_RSHIFT_INDEX, PLODAH_MODS_INDIC_RGB);
}
# endif
return false;
Expand Down
26 changes: 13 additions & 13 deletions users/plodah/functions/kc_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
#include "functions/mods_on_knob.c"
#endif // PLODAH_KNOB_ENHANCEMENTS_ENABLE

bool kc_handler( uint16_t keycode, keyrecord_t *record ) {
bool kc_handler(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// Static version keycode
# ifdef PLODAH_ALTTAB_ENHANCEMENTS_ENABLE
case PL_ALTTAB:
if ( record->event.pressed ) {
if (record->event.pressed) {
alt_tab_fw();
}
break;
case PL_ALTSTAB:
if ( record->event.pressed ) {
if (record->event.pressed) {
alt_tab_bk();
}
break;
# endif // PLODAH_ALTTAB_ENHANCEMENTS_ENABLE
case PL_VERS:
if ( record->event.pressed ) {
SEND_STRING ( QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE );
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE);
}
break;
case PL_TEST:
if ( record->event.pressed ) {
SEND_STRING ( "Butt with Knobs." );
if (record->event.pressed) {
SEND_STRING ("Butt with Knobs.");
}
break;
# if defined(PLODAH_KNOB_ENHANCEMENTS_ENABLE) || defined(PLODAH_MODS_INDIC_LALT_INDEX) || defined(PLODAH_MODS_INDIC_RALT_INDEX)
Expand All @@ -50,18 +50,18 @@ bool kc_handler( uint16_t keycode, keyrecord_t *record ) {
# if defined(PLODAH_KNOB_ENHANCEMENTS_ENABLE)
/* Encoder Actions */
case PL_ENC_PRS:
if ( record->event.pressed ) {
enc_prs_act( ctl_pressed, sft_pressed, alt_pressed );
if (record->event.pressed) {
enc_prs_act(ctl_pressed, sft_pressed, alt_pressed);
}
break;
case PL_ENC_CCW:
if ( record->event.pressed ) {
enc_ccw_act( ctl_pressed, sft_pressed, alt_pressed );
if (record->event.pressed) {
enc_ccw_act(ctl_pressed, sft_pressed, alt_pressed);
}
break;
case PL_ENC_CW:
if ( record->event.pressed ) {
enc_cw_act( ctl_pressed, sft_pressed, alt_pressed );
if (record->event.pressed) {
enc_cw_act(ctl_pressed, sft_pressed, alt_pressed);
}
break;
# endif // PLODAH_KNOB_ENHANCEMENTS_ENABLE
Expand Down
88 changes: 44 additions & 44 deletions users/plodah/functions/mods_on_knob.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,54 @@ void enc_prs_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
current_layer = get_highest_layer(layer_state);
mod_state = get_mods();

if ( ctl_pressed && alt_pressed && sft_pressed ) {
if (ctl_pressed && alt_pressed && sft_pressed) {
unregister_mods(mod_state);
//CAS
register_mods(mod_state);
}
else if ( ctl_pressed && alt_pressed ) {
else if (ctl_pressed && alt_pressed) {
unregister_mods(mod_state);
tap_code16(C(KC_0));
tap_code16(C(KC_P0));
register_mods(mod_state);
}
else if ( alt_pressed && sft_pressed ) {
else if (alt_pressed && sft_pressed) {
unregister_mods(mod_state);
//AS
register_mods(mod_state);
}
else if ( sft_pressed && ctl_pressed ) {
else if (sft_pressed && ctl_pressed) {
unregister_mods(mod_state);
//CS
register_mods(mod_state);
}
else if ( ctl_pressed ) {
else if (ctl_pressed) {
unregister_mods(mod_state);
tap_code16(C(KC_F4));
register_mods(mod_state);
}
else if ( alt_pressed ) {
else if (alt_pressed) {
unregister_mods(mod_state);
tap_code16(A(KC_F4));
register_mods(mod_state);
}
else if ( sft_pressed ) {
else if (sft_pressed) {
unregister_mods(mod_state);
tap_code(KC_MPLY);
register_mods(mod_state);
}
else if (
( ( current_layer + PLODAH_LAYEROFFSET ) % 2 == 1 )
&& ( current_layer != PLODAH_BORING_LAYER)
) {
rgb_matrix_toggle_noeeprom();
((current_layer + PLODAH_LAYEROFFSET) % 2 == 1)
&& (current_layer != PLODAH_BORING_LAYER)
) {
rgb_matrix_toggle();
}
else if (
( ( current_layer + PLODAH_LAYEROFFSET ) % 2 == 0 )
&& ( current_layer != 0 )
&& ( current_layer != PLODAH_BORING_LAYER )
) {
rgb_matrix_toggle_noeeprom();
((current_layer + PLODAH_LAYEROFFSET) % 2 == 0)
&& (current_layer != 0)
&& (current_layer != PLODAH_BORING_LAYER)
) {
rgb_matrix_toggle();
}
else {
unregister_mods(mod_state);
Expand All @@ -66,22 +66,22 @@ void enc_ccw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
current_layer = get_highest_layer(layer_state);
mod_state = get_mods();

if ( ctl_pressed && alt_pressed && sft_pressed ) {
if (ctl_pressed && alt_pressed && sft_pressed) {
unregister_mods(mod_state);
tap_code16(C(KC_LEFT));
register_mods(mod_state);
}
else if ( ctl_pressed && alt_pressed ) {
else if (ctl_pressed && alt_pressed) {
unregister_mods(mod_state);
tap_code16(C(KC_MINS));
register_mods(mod_state);
}
else if ( alt_pressed && sft_pressed ) {
else if (alt_pressed && sft_pressed) {
unregister_mods(mod_state);
tap_code16(KC_LEFT);
register_mods(mod_state);
}
else if ( sft_pressed && ctl_pressed ) {
else if (sft_pressed && ctl_pressed) {
unregister_mods(mod_state);
tap_code(KC_PGUP);
register_mods(mod_state);
Expand All @@ -91,7 +91,7 @@ void enc_ccw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
tap_code16(C(KC_PGUP));
register_mods(mod_state);
}
else if ( alt_pressed ) {
else if (alt_pressed) {
alt_tab_bk();
}
else if (sft_pressed) {
Expand All @@ -100,17 +100,17 @@ void enc_ccw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
register_mods(mod_state);
}
else if (
( ( current_layer + PLODAH_LAYEROFFSET ) % 2 == 1 )
&& ( current_layer != PLODAH_BORING_LAYER)
) {
rgb_matrix_decrease_sat_noeeprom();
((current_layer + PLODAH_LAYEROFFSET) % 2 == 1)
&& (current_layer != PLODAH_BORING_LAYER)
) {
rgb_matrix_decrease_sat();
}
else if (
( ( current_layer + PLODAH_LAYEROFFSET ) % 2 == 0 )
&& ( current_layer != 0 )
&& ( current_layer != PLODAH_BORING_LAYER )
) {
rgb_matrix_decrease_val_noeeprom();
((current_layer + PLODAH_LAYEROFFSET) % 2 == 0)
&& (current_layer != 0)
&& (current_layer != PLODAH_BORING_LAYER)
) {
rgb_matrix_decrease_val();
}
else {
unregister_mods(mod_state);
Expand All @@ -123,22 +123,22 @@ void enc_cw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
current_layer = get_highest_layer(layer_state);
mod_state = get_mods();

if ( ctl_pressed && alt_pressed && sft_pressed ) {
if (ctl_pressed && alt_pressed && sft_pressed) {
unregister_mods(mod_state);
tap_code16(C(KC_RGHT));
register_mods(mod_state);
}
else if ( ctl_pressed && alt_pressed ) {
else if (ctl_pressed && alt_pressed) {
unregister_mods(mod_state);
tap_code16(C(KC_EQL));
register_mods(mod_state);
}
else if ( alt_pressed && sft_pressed ) {
else if (alt_pressed && sft_pressed) {
unregister_mods(mod_state);
tap_code16(KC_RGHT);
register_mods(mod_state);
}
else if ( sft_pressed && ctl_pressed ) {
else if (sft_pressed && ctl_pressed) {
unregister_mods(mod_state);
tap_code(KC_PGDN);
register_mods(mod_state);
Expand All @@ -148,7 +148,7 @@ void enc_cw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
tap_code16(C(KC_PGDN));
register_mods(mod_state);
}
else if ( alt_pressed ) {
else if (alt_pressed) {
alt_tab_fw();
}
else if (sft_pressed) {
Expand All @@ -157,17 +157,17 @@ void enc_cw_act(bool ctl_pressed, bool sft_pressed, bool alt_pressed) {
register_mods(mod_state);
}
else if (
( ( current_layer + PLODAH_LAYEROFFSET ) % 2 == 1 )
&& ( current_layer != PLODAH_BORING_LAYER)
) {
rgb_matrix_increase_sat_noeeprom();
((current_layer + PLODAH_LAYEROFFSET) % 2 == 1)
&& (current_layer != PLODAH_BORING_LAYER)
) {
rgb_matrix_increase_sat();
}
else if (
( ( current_layer + PLODAH_LAYEROFFSET ) % 2 == 0 )
&& ( current_layer != 0 )
&& ( current_layer != PLODAH_BORING_LAYER )
) {
rgb_matrix_increase_val_noeeprom();
((current_layer + PLODAH_LAYEROFFSET) % 2 == 0)
&& (current_layer != 0)
&& (current_layer != PLODAH_BORING_LAYER)
) {
rgb_matrix_increase_val();
}
else {
unregister_mods(mod_state);
Expand Down

0 comments on commit 64b14c5

Please sign in to comment.