This repository has been archived by the owner on Nov 19, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 693
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
applications/main/xtreme_app/scenes/xtreme_app_scene_misc_screen_color.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include "../xtreme_app.h" | ||
|
||
enum ByteInputResult { | ||
ByteInputResultOk, | ||
}; | ||
|
||
void xtreme_app_scene_misc_screen_color_byte_input_callback(void* context) { | ||
XtremeApp* app = context; | ||
|
||
view_dispatcher_send_custom_event(app->view_dispatcher, ByteInputResultOk); | ||
} | ||
|
||
void xtreme_app_scene_misc_screen_color_on_enter(void* context) { | ||
XtremeApp* app = context; | ||
ByteInput* byte_input = app->byte_input; | ||
|
||
byte_input_set_header_text(byte_input, "Set LCD Color (#RRGGBB)"); | ||
|
||
app->lcd_color = rgb_backlight_get_color(); | ||
|
||
byte_input_set_result_callback( | ||
byte_input, | ||
xtreme_app_scene_misc_screen_color_byte_input_callback, | ||
NULL, | ||
app, | ||
(void*)&app->lcd_color, | ||
sizeof(app->lcd_color)); | ||
|
||
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewByteInput); | ||
} | ||
|
||
bool xtreme_app_scene_misc_screen_color_on_event(void* context, SceneManagerEvent event) { | ||
XtremeApp* app = context; | ||
bool consumed = false; | ||
|
||
if(event.type == SceneManagerEventTypeCustom) { | ||
consumed = true; | ||
switch(event.event) { | ||
case ByteInputResultOk: | ||
rgb_backlight_set_color(app->lcd_color); | ||
app->save_backlight = true; | ||
scene_manager_previous_scene(app->scene_manager); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
return consumed; | ||
} | ||
|
||
void xtreme_app_scene_misc_screen_color_on_exit(void* context) { | ||
XtremeApp* app = context; | ||
byte_input_set_result_callback(app->byte_input, NULL, NULL, NULL, NULL, 0); | ||
byte_input_set_header_text(app->byte_input, ""); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters