/* * File: Screen_Select_Bool.c * * Created: Created: Thursday August 2025 16:03:21 * Author: Chris */ // ============================================================================================ // Includes #include "../Screens.h" #include "../UI_Control.h" #include "../Display_Default_Configurations.h" #include "../Display.h" #include "../Display_Objects.h" // ============================================================================================ // Defines // ============================================================================================ // Variables static void (*_Return_Function)(Screen_Transition_Direction, Screen_Transition_Direction, Easing, uint32_t, int32_t); static int32_t _Return_Value; static uint8_t* _Value; static bool _Bool_Value; // ============================================================================================ // Function Declarations void Screen_Setup_Select_Bool(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, char* title, uint32_t title_length, uint8_t *value, void (*return_function)(Screen_Transition_Direction, Screen_Transition_Direction, Easing, uint32_t, int32_t), int32_t return_value); static void Screen_Tick (void); static void Screen_Click (uint button_return_value); static void Screen_Touch_Event (int16_t x, int16_t y); static void Screen_Action_CW (Object_ID object_id); static void Screen_Action_CCW (Object_ID object_id); static void Screen_On_Object_Focused (Object_ID object_id); static void Screen_On_Object_Defocused (Object_ID object_id); static void Screen_On_Object_Select (Object_ID object_id); static void Screen_On_Object_Deselect (Object_ID object_id); /******************************************************************* Functions *******************************************************************/ void Screen_Setup_Select_Bool(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, char* title, uint32_t title_length, uint8_t *value, void (*return_function)(Screen_Transition_Direction, Screen_Transition_Direction, Easing, uint32_t, int32_t), int32_t return_value) { _Screen_Tick = Screen_Tick; _Screen_Click = Screen_Click; _Screen_Touch_Event = Screen_Touch_Event; _Screen_Action_CW = Screen_Action_CW; _Screen_Action_CCW = Screen_Action_CCW; _Screen_On_Objects_Focused = Screen_On_Object_Focused; _Screen_On_Objects_Defocused = Screen_On_Object_Defocused; _Screen_On_Object_Select = Screen_On_Object_Select; _Screen_On_Object_Deselect = Screen_On_Object_Deselect; Display_Objects_Clear(); Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration); ////////////////////////////// // Add Display Objects here // ////////////////////////////// _Return_Function = return_function; _Return_Value = return_value; _Value = value; _Bool_Value = (*_Value) > 0; Display_Objects_Add_Select_YesNo(title, title_length, &_Bool_Value, &_Configuration_Default_Select_YesNo); Display_Select_Object(); } void Screen_Tick(void) { } void Screen_Click(uint button_return_value) { } void Screen_Touch_Event(int16_t x, int16_t y) { } void Screen_Action_CW(Object_ID object_id) { (*_Value) ^= 0x01; _Bool_Value = (*_Value) > 0; } void Screen_Action_CCW(Object_ID object_id) { Screen_Action_CW(object_id); } void Screen_On_Object_Focused(Object_ID object_id) { } void Screen_On_Object_Defocused(Object_ID object_id) { } void Screen_On_Object_Select(Object_ID object_id) { } void Screen_On_Object_Deselect(Object_ID object_id) { _Return_Function(TRANSITION_DOWN, TRANSITION_DOWN, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, _Return_Value); } /******************************************************************* Internal Functions *******************************************************************/