- Initial commit of base firmware - which is still very raw
This commit is contained in:
362
Firmware/Screens_Display/Screen_Loading.c
Normal file
362
Firmware/Screens_Display/Screen_Loading.c
Normal file
@@ -0,0 +1,362 @@
|
||||
/*
|
||||
* Screen_Loading.c
|
||||
*
|
||||
* Created: Fri Apr 02 2021 14:34:01
|
||||
* Author Chris
|
||||
*/
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include "../Version.h"
|
||||
#include "../Display.h"
|
||||
#include "../Display_Color.h"
|
||||
#include "../Display_Objects.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
#define LOADING_MAX 100
|
||||
|
||||
#define DOT_ANIMATION_SPEED 8
|
||||
#define TEXT_CHANGE_INTERVAL 25
|
||||
#define PROGRESS_UPDATE_DELAY 2
|
||||
|
||||
// Logo fade-in animation settings
|
||||
#define LOGO_FADE_START_FRAME 40 // Frame when logo starts appearing
|
||||
#define LOGO_FADE_DURATION 25 // Frames to complete fade-in
|
||||
#define LOGO_HOLD_DURATION 35 // Frames to hold at full opacity before transition
|
||||
|
||||
// Clean Monochromatic Colors (RGB565)
|
||||
#define COLOR_BACKGROUND 0x0000 // Pure black #000000
|
||||
#define COLOR_TEXT_PRIMARY 0xBEF7 // Off-white #F5F5F5
|
||||
#define COLOR_TEXT_SECONDARY 0x1084 // Medium gray #808080
|
||||
#define COLOR_PROGRESS_TRACK 0x4529 // Dark track #252832
|
||||
#define COLOR_PROGRESS_FILL 0xFBDE // Light gray #DEDEDE
|
||||
#define COLOR_DOT_ACTIVE 0xFFFF // Pure white #FFFFFF
|
||||
#define COLOR_DOT_INACTIVE 0x0842 // Dark gray #404450
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_Victor_Mono_Bold_8x19[];
|
||||
extern const unsigned char _Font_Victor_Mono_Regular_6x11[];
|
||||
extern const unsigned char _Font_Victor_Mono_Regular_7x13[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_10x17[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_6x12[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_Oblique_10x19[];
|
||||
|
||||
extern const uint16_t _Image_Fad_Logo_Background_160x160[];
|
||||
|
||||
static Object_ID _Object_Progress_Track;
|
||||
static Object_ID _Object_Progress_Fill;
|
||||
static Object_ID _Object_Loading_Text;
|
||||
static Object_ID _Object_Status_Text;
|
||||
static Object_ID _Object_Version_Text;
|
||||
static Object_ID _Object_Dots[3];
|
||||
static Object_ID _Object_Logo_Image;
|
||||
|
||||
static int32_t _Counter;
|
||||
static int32_t _Loading_Value;
|
||||
static int32_t _Post_Load_Wait;
|
||||
static int32_t _Animation_Counter;
|
||||
static int32_t _Dot_Animation_Phase;
|
||||
static int32_t _Text_Phase;
|
||||
static int32_t _Logo_Blend_Phase;
|
||||
static int32_t _Logo_Fade_Counter;
|
||||
|
||||
// Loading status messages
|
||||
static char* _Loading_Messages[] = {
|
||||
"Initializing system...",
|
||||
"Loading configuration...",
|
||||
"Preparing interface...",
|
||||
"Setting up hardware...",
|
||||
"Configuring display...",
|
||||
"Loading resources...",
|
||||
"Finalizing setup...",
|
||||
"Ready to start!"
|
||||
};
|
||||
static const int _Message_Count = 8;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Loading();
|
||||
|
||||
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);
|
||||
|
||||
// Helper functions
|
||||
static void Update_Dot_Animation(void);
|
||||
static void Update_Status_Text(void);
|
||||
static void Update_Logo_Fade_Animation(void);
|
||||
static float Smooth_Fade_Curve(float t);
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Functions
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Loading()
|
||||
{
|
||||
_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();
|
||||
|
||||
// Initialize variables
|
||||
_Loading_Value = 0;
|
||||
_Animation_Counter = 0;
|
||||
_Dot_Animation_Phase = 0;
|
||||
_Text_Phase = 0;
|
||||
_Post_Load_Wait = 0;
|
||||
_Logo_Blend_Phase = 0;
|
||||
_Logo_Fade_Counter = 0;
|
||||
|
||||
// Create fonts
|
||||
Font_ID Font_Primary = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_10x17, 1);
|
||||
Font_ID Font_Secondary = Display_Objects_Add_Font(_Font_Victor_Mono_Regular_6x11, 0);
|
||||
Font_ID Font_Micro = Display_Objects_Add_Font(_Font_Victor_Mono_Regular_6x11, 0);
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
|
||||
// Progress bar background track
|
||||
_Object_Progress_Track = Display_Objects_Add_Rectangle_Filled(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 45, NOT_SELECTABLE, COLOR_PROGRESS_TRACK, DISPLAY_WIDTH - 60, 8, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
// Progress bar fill
|
||||
_Object_Progress_Fill = Display_Objects_Add_Value_Bar_Rect(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 45, NOT_SELECTABLE, &_Loading_Value, LOADING_MAX, 0, LEFT_TO_RIGHT, COLOR_PROGRESS_FILL, DISPLAY_WIDTH - 60, 8, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
// Three dots positioned below progress bar
|
||||
for(int i = 0; i < 3; i++) {
|
||||
_Object_Dots[i] = Display_Objects_Add_Circle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 46 + (i * 4), 55, NOT_SELECTABLE, COLOR_DOT_INACTIVE, 3, 1, NO_STYLE, NO_ANIMATION);
|
||||
}
|
||||
|
||||
// Main loading text, // Above progress bar
|
||||
_Object_Loading_Text = Display_Objects_Add_Text(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 35, NOT_SELECTABLE, "Loading", Font_Primary, COLOR_TEXT_PRIMARY, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
// Dynamic status text // Below dots
|
||||
_Object_Status_Text = Display_Objects_Add_Text(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 65, NOT_SELECTABLE, _Loading_Messages[0], Font_Secondary, COLOR_TEXT_SECONDARY, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
// Version text (minimal, bottom corner)
|
||||
char version_string[16];
|
||||
sprintf(version_string, "v%s", VERSION_BUILD_STRING);
|
||||
_Object_Version_Text = Display_Objects_Add_Text(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 96, NOT_SELECTABLE, version_string, Font_Micro, COLOR_TEXT_SECONDARY, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
|
||||
|
||||
|
||||
// Logo image (initially disabled, will be shown during blend)
|
||||
_Object_Logo_Image = Display_Objects_Add_Image(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, _Image_Fad_Logo_Background_160x160, 0, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Update_Enabled(_Object_Logo_Image, false);
|
||||
Display_Objects_Update_Alpha(_Object_Logo_Image, 0);
|
||||
|
||||
Display_Select_First_Object();
|
||||
Display_Select_Object();
|
||||
|
||||
_Counter = 0;
|
||||
}
|
||||
|
||||
void Screen_Tick(void)
|
||||
{
|
||||
_Animation_Counter++;
|
||||
|
||||
// Update loading progress
|
||||
if(_Loading_Value < LOADING_MAX) {
|
||||
if(_Animation_Counter % PROGRESS_UPDATE_DELAY == 0) {
|
||||
_Loading_Value++;
|
||||
}
|
||||
}
|
||||
|
||||
// Update animated dots
|
||||
Update_Dot_Animation();
|
||||
|
||||
// Update status text periodically
|
||||
if(_Animation_Counter % TEXT_CHANGE_INTERVAL == 0) {
|
||||
Update_Status_Text();
|
||||
}
|
||||
|
||||
// Handle completion
|
||||
if(_Loading_Value >= LOADING_MAX)
|
||||
{
|
||||
_Post_Load_Wait++;
|
||||
|
||||
if(_Post_Load_Wait == 20)
|
||||
{
|
||||
// Set all dots to active state
|
||||
for(int i = 0; i < 3; i++) {
|
||||
Display_Objects_Update_Color(_Object_Dots[i], COLOR_DOT_ACTIVE);
|
||||
}
|
||||
Display_Objects_Update_Text(_Object_Status_Text, "Complete!");
|
||||
// Recenter the completion text
|
||||
Display_Objects_Update_Coordinates(_Object_Status_Text, CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 65);
|
||||
}
|
||||
else if(_Post_Load_Wait >= 25 && _Post_Load_Wait < LOGO_FADE_START_FRAME)
|
||||
{
|
||||
// Start fading out loading elements early (15 frames before logo appears)
|
||||
float Fade_Factor = (float)(_Post_Load_Wait - 25) / (LOGO_FADE_START_FRAME - 25);
|
||||
|
||||
// Apply smooth easing curve for more natural fade
|
||||
Fade_Factor = Smooth_Fade_Curve(Fade_Factor);
|
||||
|
||||
// Calculate faded colors for loading elements
|
||||
Display_Color Faded_Primary = Display_Color_Interpolate_Float(COLOR_TEXT_PRIMARY , COLOR_BACKGROUND, Fade_Factor);
|
||||
Display_Color Faded_Secondary = Display_Color_Interpolate_Float(COLOR_TEXT_SECONDARY , COLOR_BACKGROUND, Fade_Factor);
|
||||
Display_Color Faded_Progress = Display_Color_Interpolate_Float(COLOR_PROGRESS_FILL , COLOR_BACKGROUND, Fade_Factor);
|
||||
Display_Color Faded_Dots = Display_Color_Interpolate_Float(COLOR_DOT_ACTIVE , COLOR_BACKGROUND, Fade_Factor);
|
||||
Display_Color Faded_Track = Display_Color_Interpolate_Float(COLOR_PROGRESS_TRACK , COLOR_BACKGROUND, Fade_Factor);
|
||||
|
||||
// Apply faded colors
|
||||
Display_Objects_Update_Color(_Object_Loading_Text, Faded_Primary);
|
||||
Display_Objects_Update_Color(_Object_Status_Text, Faded_Secondary);
|
||||
Display_Objects_Update_Color(_Object_Version_Text, Faded_Secondary);
|
||||
Display_Objects_Update_Color(_Object_Progress_Fill, Faded_Progress);
|
||||
Display_Objects_Update_Color(_Object_Progress_Track, Faded_Track);
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
Display_Objects_Update_Color(_Object_Dots[i], Faded_Dots);
|
||||
}
|
||||
}
|
||||
else if(_Post_Load_Wait >= LOGO_FADE_START_FRAME)
|
||||
{
|
||||
Update_Logo_Fade_Animation();
|
||||
|
||||
if(_Post_Load_Wait >= LOGO_FADE_START_FRAME + LOGO_FADE_DURATION + LOGO_HOLD_DURATION)
|
||||
{
|
||||
Screen_Setup_Menu_Main(TRANSITION_LEFT, TRANSITION_NONE, INOUT_SINE, 25, true, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Action_CCW(Object_ID 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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
static void Update_Dot_Animation(void)
|
||||
{
|
||||
// Only animate dots while loading
|
||||
if(_Loading_Value >= LOADING_MAX) return;
|
||||
|
||||
_Dot_Animation_Phase++;
|
||||
if(_Dot_Animation_Phase >= (DOT_ANIMATION_SPEED * 3)) {
|
||||
_Dot_Animation_Phase = 0;
|
||||
}
|
||||
|
||||
// Determine which dot should be active
|
||||
int active_dot = _Dot_Animation_Phase / DOT_ANIMATION_SPEED;
|
||||
|
||||
// Update dot colors
|
||||
for(int i = 0; i < 3; i++) {
|
||||
Display_Color dot_color = (i == active_dot) ? COLOR_DOT_ACTIVE : COLOR_DOT_INACTIVE;
|
||||
Display_Objects_Update_Color(_Object_Dots[i], dot_color);
|
||||
}
|
||||
}
|
||||
|
||||
static void Update_Status_Text(void)
|
||||
{
|
||||
// Only update text while loading
|
||||
if(_Loading_Value >= LOADING_MAX) return;
|
||||
|
||||
// Calculate which message to show based on progress
|
||||
int message_index = (_Loading_Value * _Message_Count) / LOADING_MAX;
|
||||
if(message_index >= _Message_Count) {
|
||||
message_index = _Message_Count - 1;
|
||||
}
|
||||
|
||||
// Update the status text
|
||||
Display_Objects_Update_Text(_Object_Status_Text, _Loading_Messages[message_index]);
|
||||
}
|
||||
|
||||
static void Update_Logo_Fade_Animation(void)
|
||||
{
|
||||
// Enable logo on first frame if not already enabled
|
||||
if(_Logo_Fade_Counter == 0) {
|
||||
Display_Objects_Update_Enabled(_Object_Logo_Image, true);
|
||||
}
|
||||
|
||||
_Logo_Fade_Counter++;
|
||||
|
||||
// Calculate fade progress (0.0 to 1.0)
|
||||
float Fade_Progress = (float)_Logo_Fade_Counter / (float)LOGO_FADE_DURATION;
|
||||
|
||||
// Clamp to valid range
|
||||
if(Fade_Progress > 1.0f) {
|
||||
Fade_Progress = 1.0f;
|
||||
}
|
||||
|
||||
// Apply easing for smoother fade-in (ease-out cubic)
|
||||
float Eased_Progress = Ease_Out_Cubic(Fade_Progress);
|
||||
|
||||
// Convert to alpha value (0-255)
|
||||
uint8_t Alpha_Value = (uint8_t)(Eased_Progress * 127.0f);
|
||||
|
||||
// Update the logo's alpha
|
||||
Display_Objects_Update_Alpha(_Object_Logo_Image, Alpha_Value);
|
||||
}
|
||||
|
||||
static float Smooth_Fade_Curve(float t)
|
||||
{
|
||||
// Smoothstep function for natural easing: 3t² - 2t³
|
||||
// Provides smooth acceleration and deceleration
|
||||
if(t <= 0.0f) return 0.0f;
|
||||
if(t >= 1.0f) return 1.0f;
|
||||
|
||||
return t * t * (3.0f - 2.0f * t);
|
||||
}
|
||||
196
Firmware/Screens_Display/Screen_Menu_Main.c
Normal file
196
Firmware/Screens_Display/Screen_Menu_Main.c
Normal file
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Screen_Menu_Main.c
|
||||
*
|
||||
* Created: Fri Apr 02 2021 14:34:01
|
||||
* Author Chris
|
||||
*/
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
#define ENTRY_COUNT 4
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_10x17[];
|
||||
|
||||
extern const uint16_t _Image_Computer_64x64[];
|
||||
extern const uint16_t _Image_Energy_64x64[];
|
||||
extern const uint16_t _Image_Music_64x64[];
|
||||
extern const uint16_t _Image_Setting_64x64[];
|
||||
|
||||
|
||||
static Object_ID _Object_Ring_Menu;
|
||||
static int32_t _Ring_Menu_Selected = 0; // 0 = Mode, 1 = MIDI, 2 = Power, 3 = Settings
|
||||
|
||||
// Define your 4 menu items
|
||||
static Menu_Ring_Item_Config _Ring_Menu_Items[ENTRY_COUNT] = {
|
||||
{
|
||||
.Label = "MIDI",
|
||||
.Icon = _Image_Music_64x64
|
||||
},
|
||||
{
|
||||
.Label = "SETUP",
|
||||
.Icon = _Image_Setting_64x64
|
||||
},
|
||||
{
|
||||
.Label = "POWER",
|
||||
.Icon = _Image_Energy_64x64
|
||||
},
|
||||
{
|
||||
.Label = "MODE",
|
||||
.Icon = _Image_Computer_64x64
|
||||
}
|
||||
};
|
||||
|
||||
// Ring menu configuration
|
||||
static Configuration_Menu_Ring _Ring_Menu_Config = {
|
||||
.Center_Text_Color = DISPLAY_COLOR_FROM_RGB888(100, 181, 246),
|
||||
.Center_BG_Color = DISPLAY_COLOR_FROM_RGB888(26, 26, 46),
|
||||
.Center_Border_Color = DISPLAY_COLOR_FROM_RGB888(51, 51, 51),
|
||||
.Selection_Ring_Color = DISPLAY_COLOR_FROM_RGB888(255, 215, 0),
|
||||
|
||||
.Center_Text_Font = _Font_DejaVu_Sans_Mono_10x17,
|
||||
|
||||
.Item_Radius = 85,
|
||||
.Center_Size = 90,
|
||||
.Image_Size = 64,
|
||||
|
||||
.Selection_Ring_Diameter = 0,
|
||||
.Selection_Ring_Thickness = 3,
|
||||
.Selection_Ring_Padding = 0,
|
||||
|
||||
.Selection_Scale = 1.15f,
|
||||
.Animation_Duration = 15,
|
||||
.Idle_Rotation_Speed = 2.0f,
|
||||
.Start_Angle_Degrees = 0.0f,
|
||||
.Distribute_Evenly = true,
|
||||
.Fixed_Angle_Step = 90.0f,
|
||||
|
||||
.Enable_Appear_Animation = false
|
||||
};
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Menu_Main(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, bool do_menu_animation, uint32_t selected_entry);
|
||||
|
||||
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_Menu_Main(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, bool do_menu_animation, uint32_t selected_entry)
|
||||
{
|
||||
_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 //
|
||||
//////////////////////////////
|
||||
|
||||
_Object_Ring_Menu = Display_Objects_Add_Menu_Ring(_Ring_Menu_Items, ENTRY_COUNT, &_Ring_Menu_Selected, &_Ring_Menu_Config);
|
||||
|
||||
if(do_menu_animation) {
|
||||
Display_Objects_Menu_Ring_Start_Appear_Animation(_Object_Ring_Menu);
|
||||
}
|
||||
|
||||
Display_Select_First_Object();
|
||||
Display_Select_Object();
|
||||
|
||||
// Initialize values
|
||||
_Ring_Menu_Selected = 0;
|
||||
if(selected_entry < ENTRY_COUNT) {
|
||||
_Ring_Menu_Selected = selected_entry;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
UI_Control_Selector_Inc(&_Ring_Menu_Selected, 0, ENTRY_COUNT-1, true);
|
||||
}
|
||||
|
||||
void Screen_Action_CCW(Object_ID object_id)
|
||||
{
|
||||
UI_Control_Selector_Dec(&_Ring_Menu_Selected, 0, ENTRY_COUNT-1, true);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
switch (_Ring_Menu_Selected)
|
||||
{
|
||||
case 0: break;
|
||||
case 1: Screen_Setup_Settings(TRANSITION_UP, TRANSITION_UP, INOUT_SINE, 15); break;
|
||||
case 2: break;
|
||||
case 3: break;
|
||||
}
|
||||
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
146
Firmware/Screens_Display/Screen_Select_RGB.c
Normal file
146
Firmware/Screens_Display/Screen_Select_RGB.c
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* File: Screen_Select_RGB.c
|
||||
*
|
||||
* Created: Created: Friday August 2025 13:35:25
|
||||
* Author: Chris
|
||||
*/
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
static Object_ID _RGB_Selector_Object;
|
||||
static RGB_Color* _RGB_Color;
|
||||
|
||||
static uint8_t _Current_Component;
|
||||
static uint8_t* _Color;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, RGB_Color* rgb_color);
|
||||
|
||||
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_RGB(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, RGB_Color* rgb_color)
|
||||
{
|
||||
_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 //
|
||||
//////////////////////////////
|
||||
|
||||
_Current_Component = 0;
|
||||
_RGB_Color = rgb_color;
|
||||
_Color = &(rgb_color->Array[_Current_Component]);
|
||||
|
||||
// Create the RGB selector object
|
||||
_RGB_Selector_Object = Display_Objects_Add_Select_RGB(
|
||||
_RGB_Color, // Pointer to color to modify
|
||||
&_Current_Component, // Indicater for active RGB Base Color
|
||||
&_Configuration_Default_Select_RGB // Use configuration
|
||||
);
|
||||
|
||||
Display_Select_Object();
|
||||
|
||||
UI_Control_Acceleration_Reset();
|
||||
UI_Control_Acceleration_Set_Enabled(true);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int32_t Color = *_Color;
|
||||
UI_Control_Selector_Inc(&Color, 0, UINT8_MAX, false);
|
||||
*_Color = (uint8_t)Color;
|
||||
}
|
||||
|
||||
void Screen_Action_CCW(Object_ID object_id)
|
||||
{
|
||||
int32_t Color = *_Color;
|
||||
UI_Control_Selector_Dec(&Color, 0, UINT8_MAX, false);
|
||||
*_Color = (uint8_t)Color;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if(_Current_Component < 2) {
|
||||
_Current_Component++;
|
||||
|
||||
_Color = &(_RGB_Color->Array[_Current_Component]);
|
||||
|
||||
Display_Select_Object();
|
||||
return;
|
||||
}
|
||||
|
||||
// Screen_Setup_Menu_Main(TRANSITION_DOWN, TRANSITION_DOWN, INOUT_SINE, 15, false, 1);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
|
||||
176
Firmware/Screens_Display/Screen_Settings.c
Normal file
176
Firmware/Screens_Display/Screen_Settings.c
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Screen_Settings.c
|
||||
*
|
||||
* Created: Fri Apr 02 2021 14:34:01
|
||||
* Author Chris
|
||||
*/
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
#define MENU_ENTRY_COUNT 7
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_10x17[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_15x26[];
|
||||
|
||||
extern const uint16_t _Image_Bronze_Copper_Microchip2_64x64[];
|
||||
extern const uint16_t _Image_Forest_Pine_Midi_64x64[];
|
||||
extern const uint16_t _Image_Midnight_Blue_Back_64x64[];
|
||||
extern const uint16_t _Image_Olive_Sage_Diskette_64x64[];
|
||||
extern const uint16_t _Image_Rust_Orange_About1_64x64[];
|
||||
extern const uint16_t _Image_Steel_Blue_Jam_Happy_64x64[];
|
||||
extern const uint16_t _Image_Stone_Blue_Light_On_64x64[];
|
||||
|
||||
static Object_ID _Object_Menu;
|
||||
|
||||
static Icon_Row_Item _Icon_Row_Items[MENU_ENTRY_COUNT] = {
|
||||
{ _Image_Forest_Pine_Midi_64x64 , TEXT_AND_LENGTH("MIDI to Light") },
|
||||
{ _Image_Steel_Blue_Jam_Happy_64x64 , TEXT_AND_LENGTH("Jam Mode") },
|
||||
{ _Image_Stone_Blue_Light_On_64x64 , TEXT_AND_LENGTH("Constant Light") },
|
||||
{ _Image_Bronze_Copper_Microchip2_64x64 , TEXT_AND_LENGTH("Device") },
|
||||
{ _Image_Olive_Sage_Diskette_64x64 , TEXT_AND_LENGTH("Save to EEPROM") },
|
||||
{ _Image_Rust_Orange_About1_64x64 , TEXT_AND_LENGTH("About") },
|
||||
{ _Image_Midnight_Blue_Back_64x64 , TEXT_AND_LENGTH("Back") }
|
||||
};
|
||||
|
||||
static Configuration_Menu_Icon_Row _Configuration_Menu_Icon_Row = {
|
||||
.Icon_Space_Width = 80,
|
||||
.Shrink_Factor = 0.25,
|
||||
.Y_Images = DISPLAY_Y_CENTER,
|
||||
.Y_Images_Warp = 0,
|
||||
.Y_Text = DISPLAY_Y_CENTER + 55,
|
||||
|
||||
.Font = _Font_DejaVu_Sans_Mono_10x17,
|
||||
.Color = DISPLAY_COLOR_LIGHTGREY
|
||||
};
|
||||
|
||||
static int32_t _Selected_Item;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Settings(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
|
||||
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_Settings(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_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 //
|
||||
//////////////////////////////
|
||||
|
||||
Style_ID Style_Font = Display_Objects_Add_Style(DISPLAY_COLOR_LIGHTGREY, DISPLAY_COLOR_BLACK, 0, 5, 3, 5, 3, 5, 0);
|
||||
Font_ID Font_Title = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_Bold_15x26, 0);
|
||||
|
||||
|
||||
Display_Objects_Add_Text(CENTER_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 50, 45, NOT_SELECTABLE, "Settings", Font_Title, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Rectangle_Filled(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_FROM_RGB888(32, 32, 32), DISPLAY_WIDTH, 85, NO_STYLE, NO_ANIMATION);
|
||||
_Object_Menu = Display_Objects_Add_Menu_Icon_Row(_Icon_Row_Items, MENU_ENTRY_COUNT, &_Selected_Item, &_Configuration_Menu_Icon_Row);
|
||||
// Display_Objects_Add_Rounded_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_FROM_RGB888(255, 223, 0), 70, 70, 21, 4, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
_Selected_Item = 0;
|
||||
|
||||
Display_Select_First_Object();
|
||||
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)
|
||||
{
|
||||
UI_Control_Selector_Inc(&_Selected_Item, 0, MENU_ENTRY_COUNT-1, false);
|
||||
}
|
||||
|
||||
void Screen_Action_CCW(Object_ID object_id)
|
||||
{
|
||||
UI_Control_Selector_Dec(&_Selected_Item, 0, MENU_ENTRY_COUNT-1, false);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
switch (_Selected_Item)
|
||||
{
|
||||
case 0: break;
|
||||
case 1: break;
|
||||
case 2: break;
|
||||
case 3: break;
|
||||
case 4: break;
|
||||
case 5: break;
|
||||
case 6: Screen_Setup_Menu_Main(TRANSITION_DOWN, TRANSITION_DOWN, INOUT_SINE, 15, false, 1); break;
|
||||
}
|
||||
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
Reference in New Issue
Block a user