Skip to content

Commit

Permalink
[Display][Menu] Separate features out for menu
Browse files Browse the repository at this point in the history
This is probably the most wrong/horrible way to do this, but if you have a better idea, then feel free to PR it
  • Loading branch information
drashna committed Nov 9, 2024
1 parent 1186e4d commit 8678912
Show file tree
Hide file tree
Showing 12 changed files with 1,786 additions and 1,778 deletions.
1,789 changes: 11 additions & 1,778 deletions users/drashna/display/menu/menu.inc

Large diffs are not rendered by default.

117 changes: 117 additions & 0 deletions users/drashna/display/menu/submenus/audio_options.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Audio

#ifdef AUDIO_ENABLE
static bool menu_handler_audio_enabled(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
if (audio_is_on()) {
audio_off();
} else {
audio_on();
}
return false;
default:
return true;
}
}

void display_handler_audio_enabled(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", audio_is_on() ? "on" : "off");
}

static bool menu_handler_music_enabled(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
music_toggle();
return false;
default:
return true;
}
}

void display_handler_music_enabled(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", is_music_on() ? "on" : "off");
}

static bool menu_handler_audio_clicky_enabled(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
clicky_toggle();
return false;
default:
return true;
}
}

void display_handler_audio_clicky_enabled(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", is_clicky_on() ? "enabled" : "disabled");
}

static bool menu_handler_audio_clicky_freq(menu_input_t input) {
switch (input) {
case menu_input_left:
clicky_freq_down();
return false;
case menu_input_right:
clicky_freq_up();
return false;
default:
return true;
}
}

void display_handler_audio_clicky_freq(char *text_buffer, size_t buffer_len) {
extern float clicky_freq;
snprintf(text_buffer, buffer_len - 1, "%.2f", (float)clicky_freq);
}

static bool menu_handler_gaming_song_enabled(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
userspace_config.gaming.song_enable = !userspace_config.gaming.song_enable;
eeconfig_update_user_datablock(&userspace_config);
void set_doom_song(layer_state_t);
set_doom_song(layer_state);
return false;
default:
return true;
}
}

void display_handler_gaming_song_enabled(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", userspace_config.gaming.song_enable ? "enabled" : "disabled");
}

static bool menu_handler_audio_mouse_clicky(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
userspace_config.pointing.audio_mouse_clicky = !userspace_config.pointing.audio_mouse_clicky;
eeconfig_update_user_datablock(&userspace_config);
return false;
default:
return true;
}
}

void display_handler_audio_mouse_clicky(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", userspace_config.pointing.audio_mouse_clicky ? "enabled" : "disabled");
}

menu_entry_t audio_entries[] = {
MENU_ENTRY_CHILD("Audio", audio_enabled),
MENU_ENTRY_CHILD("Music Mode", music_enabled),
MENU_ENTRY_CHILD("Clicky", audio_clicky_enabled),
MENU_ENTRY_CHILD("Clicky Frequency", audio_clicky_freq),
MENU_ENTRY_CHILD("Gaming Song", gaming_song_enabled),
# ifdef POINTING_DEVICE_ENABLE
MENU_ENTRY_CHILD("Mouse Clicky", audio_mouse_clicky),
# endif
};
#endif // AUDIO_ENABLE
42 changes: 42 additions & 0 deletions users/drashna/display/menu/submenus/backlight_options.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Backlight

#ifdef BACKLIGHT_ENABLE
static bool menu_handler_bl_enabled(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
backlight_toggle();
return false;
default:
return true;
}
}

void display_handler_bl_enabled(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", is_backlight_enabled() ? "on" : "off");
}

static bool menu_handler_bl_level(menu_input_t input) {
switch (input) {
case menu_input_left:
backlight_decrease();
return false;
case menu_input_right:
backlight_increase();
return false;
default:
return true;
}
}

void display_handler_bl_level(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%d", get_backlight_level());
}

menu_entry_t backlight_entries[] = {
MENU_ENTRY_CHILD("Backlight Enabled", bl_enabled),
MENU_ENTRY_CHILD("Backlight Level", bl_level),
};
#endif // BACKLIGHT_ENABLE
136 changes: 136 additions & 0 deletions users/drashna/display/menu/submenus/debugging_options.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Debugging

static bool menu_handler_debugging_enable(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
debug_enable = !debug_enable;
return false;
default:
return true;
}
}

void display_handler_debugging_enable(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", debug_enable ? "enabled" : "disabled");
}

static bool menu_handler_keyboard_debugging(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
debug_keyboard = !debug_keyboard;
return false;
default:
return true;
}
}

void display_handler_keyboard_debugging(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", debug_keyboard ? "enabled" : "disabled");
}

static bool menu_handler_matrix_debugging(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
debug_matrix = !debug_matrix;
return false;
default:
return true;
}
}

void display_handler_matrix_debugging(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", debug_matrix ? "enabled" : "disabled");
}

static bool menu_handler_mouse_debugging(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
debug_mouse = !debug_mouse;
return false;
default:
return true;
}
}

void display_handler_mouse_debugging(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", debug_mouse ? "enabled" : "disabled");
}

static bool menu_handler_pointing_debugging(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
debug_pointing = !debug_pointing;
return false;
default:
return true;
}
}

void display_handler_pointing_debugging(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", debug_pointing ? "enabled" : "disabled");
}

static bool menu_handler_action_debugging(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
debug_action = !debug_action;
return false;
default:
return true;
}
}

void display_handler_action_debugging(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", debug_action ? "enabled" : "disabled");
}

static bool menu_handler_split_serial_debugging(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
debug_serial = !debug_serial;
return false;
default:
return true;
}
}

void display_handler_split_serial_debugging(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", debug_serial ? "enabled" : "disabled");
}

static bool menu_handler_quantum_painter_debugging(menu_input_t input) {
switch (input) {
case menu_input_left:
case menu_input_right:
debug_quantum_painter = !debug_quantum_painter;
return false;
default:
return true;
}
}

void display_handler_quantum_painter_debugging(char *text_buffer, size_t buffer_len) {
snprintf(text_buffer, buffer_len - 1, "%s", debug_quantum_painter ? "enabled" : "disabled");
}

menu_entry_t debug_entries[] = {
MENU_ENTRY_CHILD("Debugging", debugging_enable), // force formatting
MENU_ENTRY_CHILD("Keyboard Debugging", keyboard_debugging),
MENU_ENTRY_CHILD("Matrix Debugging", matrix_debugging),
MENU_ENTRY_CHILD("Mouse Debugging", mouse_debugging),
MENU_ENTRY_CHILD("Pointing Device Debugging", pointing_debugging),
MENU_ENTRY_CHILD("Action Debugging", action_debugging),
MENU_ENTRY_CHILD("Split Serial Debugging", split_serial_debugging),
MENU_ENTRY_CHILD("Quantum Painter Debugging", quantum_painter_debugging),
MENU_ENTRY_CHILD("I2C Scanner", i2c_scanner),
MENU_ENTRY_CHILD("Matrix Scan Rate Print", scan_rate),
};
Loading

0 comments on commit 8678912

Please sign in to comment.