- Fixed drawing of round objects (Circles, Rounded Rects) using a lookup table
- Added function to read out the display_buffer via USB-Serial - Added basic structure and files for later complete firmware (still in progress) - Added Doc folder with schematic in it - Added Python script and batch file to read out the display buffer and open the image in gimp
This commit is contained in:
143
Firmware/Screens_Display/Screen_Graph.c
Normal file
143
Firmware/Screens_Display/Screen_Graph.c
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* File: Screen_Graph.c
|
||||
*
|
||||
* Created: Created: Thursday August 2025 12:59:42
|
||||
* Author: Chris
|
||||
*/
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Command_Definition.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
|
||||
#include "../INA260.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
#define GRAPH_DATA_WDITH 200
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_10x17[];
|
||||
|
||||
static uint16_t _Data_BusVoltage[GRAPH_DATA_WDITH];
|
||||
static uint16_t _Data_BusVoltage_Threshold_Overvoltage[GRAPH_DATA_WDITH];
|
||||
static uint16_t _Data_BusVoltage_Threshold_Undervoltage[GRAPH_DATA_WDITH];
|
||||
static float _Current_BusVoltage_V;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Graph(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_Graph(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 //
|
||||
//////////////////////////////
|
||||
for(int i=0;i<GRAPH_DATA_WDITH;i++) {
|
||||
_Data_BusVoltage[i] = 0;
|
||||
_Data_BusVoltage_Threshold_Overvoltage[i] = THRESHOLD_OVERVOLTAGE_mV;
|
||||
_Data_BusVoltage_Threshold_Undervoltage[i] = THRESHOLD_UNDERVOLTAGE_mV;
|
||||
}
|
||||
|
||||
Font_ID Font_10_1 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_10x17, 1);
|
||||
|
||||
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_BusVoltage, GRAPH_DATA_WDITH, 32000, 0, DISPLAY_COLOR_WHITE, 200, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_BusVoltage_Threshold_Overvoltage, GRAPH_DATA_WDITH, 32000, 0, DISPLAY_COLOR_RED, 200, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_BusVoltage_Threshold_Undervoltage, GRAPH_DATA_WDITH, 32000, 0, DISPLAY_COLOR_RED, 200, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
Display_Objects_Add_Float(CENTER_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 50, 232, NOT_SELECTABLE, &_Current_BusVoltage_V, "%2.3fV", Font_10_1, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
}
|
||||
|
||||
void Screen_Tick(void)
|
||||
{
|
||||
for(int i=0;i<GRAPH_DATA_WDITH-1;i++) {
|
||||
_Data_BusVoltage[i] = _Data_BusVoltage[i+1];
|
||||
}
|
||||
|
||||
_Data_BusVoltage[GRAPH_DATA_WDITH-1] = INA260_Get_BusVoltage_mV();
|
||||
_Current_BusVoltage_V = ((float)_Data_BusVoltage[GRAPH_DATA_WDITH-1]) / 1000.0f;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Screen_Setup_Menu_Main(TRANSITION_LEFT, TRANSITION_LEFT, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, false, 2);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
|
||||
@@ -130,8 +130,8 @@ void Screen_Setup_Loading()
|
||||
|
||||
// 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);
|
||||
Font_ID Font_Secondary = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_6x12, 0);
|
||||
Font_ID Font_Micro = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_6x12, 0);
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
|
||||
409
Firmware/Screens_Display/Screen_MIDI_Log.c
Normal file
409
Firmware/Screens_Display/Screen_MIDI_Log.c
Normal file
@@ -0,0 +1,409 @@
|
||||
/*
|
||||
* Screen_Data_List.c
|
||||
*
|
||||
* Created: Fri Feb 04 2022 22:03:02
|
||||
* Author Chris
|
||||
*/
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
|
||||
#include "../MIDI_Note_List.h"
|
||||
#include "../Command_Definition.h"
|
||||
|
||||
#include "pico/types.h"
|
||||
#include "pico/time.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_6x12[];
|
||||
|
||||
extern History_Buffer_t _MIDI_History_Buffer[RECEIVED_MIDI_HISTORY_BUFFER_SIZE];
|
||||
|
||||
static Object_ID _Object_Text_Top;
|
||||
static Object_ID _Object_Text_Bottom;
|
||||
static Object_ID _Object_Text_Return;
|
||||
|
||||
typedef struct {
|
||||
int Number;
|
||||
int Data;
|
||||
int Timestamp;
|
||||
|
||||
Object_ID Object_Number;
|
||||
Object_ID Object_Data_Hex;
|
||||
Object_ID Object_Data_Dec;
|
||||
Object_ID Object_Type_Info;
|
||||
Object_ID Object_Timestamp;
|
||||
Object_ID Object_Timestamp_Text;
|
||||
} Object_History_Entry_s;
|
||||
|
||||
static Object_History_Entry_s Objects_History[RECEIVED_MIDI_HISTORY_BUFFER_SIZE];
|
||||
|
||||
static int16_t _X_Number = 10+2;
|
||||
static int16_t _X_Data_Hex = 10+25;
|
||||
static int16_t _X_Data_Dec = 10+53;
|
||||
static int16_t _X_Data_Info = 10+25;
|
||||
static int16_t _X_Data_Timestamp = 10+89;
|
||||
static int16_t _X_Data_Timestamp_Text = 10+25;
|
||||
|
||||
static int16_t _Y_Offest_Scroll;
|
||||
static int16_t _Y_Offset_1st_Entry = 20;
|
||||
static int16_t _Y_Offset_Rows = 10;
|
||||
static int16_t _Y_Between_Entries = 38;
|
||||
|
||||
static int16_t _Y_Scroll_Speed = 10;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_MIDI_Log(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_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);
|
||||
|
||||
void Update_Object_Coordinates(void);
|
||||
void Update_Object_Values(void);
|
||||
bool Create_Info_Text(char* target_text, uint entry_id, uint8_t midi_data);
|
||||
bool Create_Info_Data_Text(char* target_text, uint entry_id, uint command_offset, uint8_t midi_data);
|
||||
bool Check_Entry_Is_Command(uint entry_id);
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Functions
|
||||
*******************************************************************/
|
||||
void Screen_Setup_MIDI_Log(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_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);
|
||||
|
||||
Font_ID Font_10_0 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_6x12, 0);
|
||||
Font_ID Font_10_1 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_6x12, 1);
|
||||
|
||||
Font_ID Font_Number = Font_10_0;
|
||||
Font_ID Font_Data = Font_10_0;
|
||||
Font_ID Font_Info = Font_10_0;
|
||||
|
||||
Style_ID Style_Header = Display_Objects_Add_Style(DISPLAY_COLOR_LIGHTGREY, DISPLAY_COLOR_BLACK, 0, 2, PADDING_1(2), STYLE_WIDTH_HEIGHT_RATIO_AUTO);
|
||||
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
|
||||
_Y_Offest_Scroll = 0;
|
||||
|
||||
_Object_Text_Top = Display_Objects_Add_Text(CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, 0, NOT_SELECTABLE, "Received MIDI Data", Font_10_0, DISPLAY_COLOR_BLACK, Style_Header, NO_ANIMATION);
|
||||
|
||||
for(int16_t i=0;i<RECEIVED_MIDI_HISTORY_BUFFER_SIZE;i++)
|
||||
{
|
||||
Object_History_Entry_s *E = &Objects_History[i];
|
||||
|
||||
E->Number = i+1;
|
||||
E->Object_Number = Display_Objects_Add_Integer(LEFT_TOP, BOTH_IN_PIXEL, 0, 0, NOT_SELECTABLE, &E->Number, "%u:", Font_Number, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
E->Data = 0;
|
||||
E->Object_Data_Hex = Display_Objects_Add_Integer(LEFT_TOP, BOTH_IN_PIXEL, 0, 0, NOT_SELECTABLE, &E->Data, "0x%02X", Font_Data, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
|
||||
E->Object_Data_Dec = Display_Objects_Add_Integer(LEFT_TOP, BOTH_IN_PIXEL, 0, 0, NOT_SELECTABLE, &E->Data, "(%u)", Font_Data, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
E->Object_Type_Info = Display_Objects_Add_Text(LEFT_TOP, BOTH_IN_PIXEL, 0, 0, NOT_SELECTABLE, "Info here", Font_Info, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
E->Timestamp = 0;
|
||||
E->Object_Timestamp = Display_Objects_Add_Integer(LEFT_TOP, BOTH_IN_PIXEL, 0, 0, NOT_SELECTABLE, &E->Timestamp, "%-8u", Font_Data, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
|
||||
E->Object_Timestamp_Text = Display_Objects_Add_Text(LEFT_TOP, BOTH_IN_PIXEL, 0,0, NOT_SELECTABLE, "Timestamp:", Font_Data, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
|
||||
}
|
||||
|
||||
_Object_Text_Bottom = Display_Objects_Add_Text(CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, 0, NOT_SELECTABLE, "List End", Font_10_0, DISPLAY_COLOR_BLACK, Style_Header, NO_ANIMATION);
|
||||
_Object_Text_Return = Display_Objects_Add_Text(CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, 0, NOT_SELECTABLE, "Click to return", Font_10_0, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
Update_Object_Coordinates();
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
void Screen_Tick(void)
|
||||
{
|
||||
Update_Object_Values();
|
||||
}
|
||||
|
||||
void Screen_Click(uint button_return_value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Action_CW(Object_ID object_id)
|
||||
{
|
||||
_Y_Offest_Scroll -= _Y_Scroll_Speed;
|
||||
Update_Object_Coordinates();
|
||||
}
|
||||
|
||||
void Screen_Action_CCW(Object_ID object_id)
|
||||
{
|
||||
_Y_Offest_Scroll += _Y_Scroll_Speed;
|
||||
Update_Object_Coordinates();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Screen_Setup_Menu_Main(TRANSITION_RIGHT, TRANSITION_RIGHT, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, false, 0);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
void Update_Object_Coordinates(void)
|
||||
{
|
||||
Display_Objects_Update_Coordinates(_Object_Text_Top, CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, _Y_Offest_Scroll);
|
||||
|
||||
for(uint i=0;i<RECEIVED_MIDI_HISTORY_BUFFER_SIZE;i++)
|
||||
{
|
||||
Object_History_Entry_s *E = &Objects_History[i];
|
||||
|
||||
Display_Objects_Update_Coordinates(E->Object_Number , LEFT_TOP, BOTH_IN_PIXEL, _X_Number , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(E->Object_Data_Hex , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Hex , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(E->Object_Data_Dec , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Dec , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(E->Object_Type_Info , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Info , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries + 1 * _Y_Offset_Rows);
|
||||
Display_Objects_Update_Coordinates(E->Object_Timestamp , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Timestamp , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries + 2 * _Y_Offset_Rows);
|
||||
Display_Objects_Update_Coordinates(E->Object_Timestamp_Text , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Timestamp_Text , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries + 2 * _Y_Offset_Rows);
|
||||
}
|
||||
|
||||
Display_Objects_Update_Coordinates(_Object_Text_Bottom, CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, _Y_Offset_1st_Entry + _Y_Offest_Scroll + RECEIVED_MIDI_HISTORY_BUFFER_SIZE*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(_Object_Text_Return, CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, _Y_Offset_1st_Entry + _Y_Offest_Scroll + RECEIVED_MIDI_HISTORY_BUFFER_SIZE*_Y_Between_Entries + _Y_Offset_1st_Entry);
|
||||
}
|
||||
|
||||
void Update_Object_Values(void)
|
||||
{
|
||||
for(uint i=0;i<RECEIVED_MIDI_HISTORY_BUFFER_SIZE;i++)
|
||||
{
|
||||
Object_History_Entry_s *E = &Objects_History[i];
|
||||
History_Buffer_t *H = &_MIDI_History_Buffer[i];
|
||||
char Info_Text[64];
|
||||
|
||||
if(H->Data != HISTORY_ENTRY_UNDEFINED)
|
||||
{
|
||||
E->Data = H->Data;
|
||||
E->Timestamp = H->Timestamp_ms;
|
||||
bool Success = Create_Info_Text((char *)Info_Text, i, (uint8_t)H->Data);
|
||||
Display_Objects_Update_Text(E->Object_Type_Info, Info_Text);
|
||||
|
||||
if(IS_MIDI_COMMAND((uint8_t)H->Data))
|
||||
{
|
||||
Display_Objects_Update_Color(E->Object_Type_Info, DISPLAY_COLOR_GREENYELLOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Success)
|
||||
{
|
||||
Display_Objects_Update_Color(E->Object_Type_Info, DISPLAY_COLOR_CYAN);
|
||||
}
|
||||
else
|
||||
{
|
||||
Display_Objects_Update_Color(E->Object_Type_Info, DISPLAY_COLOR_RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Display_Objects_Update_Text(E->Object_Type_Info, "No Data");
|
||||
Display_Objects_Update_Color(E->Object_Type_Info, DISPLAY_COLOR_DARKGREY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Create_Info_Text(char* target_text, uint entry_id, uint8_t midi_data)
|
||||
{
|
||||
if(IS_MIDI_DATA(midi_data))
|
||||
{
|
||||
uint Data_Offset = 0;
|
||||
for(uint i=0;i<3;i++)
|
||||
{
|
||||
Data_Offset++;
|
||||
if(Check_Entry_Is_Command(entry_id + Data_Offset))
|
||||
{
|
||||
return Create_Info_Data_Text(target_text, entry_id, Data_Offset, midi_data);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(target_text, "Data");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Otherwise, it is a MIDI Command
|
||||
uint8_t MIDI_Event = MIDI_EVENT_FROM_COMMAND(midi_data);
|
||||
|
||||
if(IS_MIDI_COMMAND_WITH_CHANNEL(midi_data))
|
||||
{
|
||||
uint8_t MIDI_Channel = MIDI_CHANNEL_FROM_COMMAND(midi_data) + 1;
|
||||
|
||||
switch (MIDI_Event)
|
||||
{
|
||||
case MIDI_EVENT_NOTE_OFF: sprintf(target_text, "Note Off Ch%u" , MIDI_Channel); break;
|
||||
case MIDI_EVENT_NOTE_ON: sprintf(target_text, "Note On Ch%u" , MIDI_Channel); break;
|
||||
case MIDI_EVENT_POLYPHONIC_KEY_PRESSURE: sprintf(target_text, "Poly. Key Ch%u" , MIDI_Channel); break;
|
||||
case MIDI_EVENT_CONTROL_CHANGE: sprintf(target_text, "Control Change Ch%u" , MIDI_Channel); break;
|
||||
case MIDI_EVENT_PROGRAM_CHANGE: sprintf(target_text, "Program Change Ch%u" , MIDI_Channel); break;
|
||||
case MIDI_EVENT_CHANNEL_PRESSURE: sprintf(target_text, "Channel Pressure Ch%u", MIDI_Channel); break;
|
||||
case MIDI_EVENT_PITCH_BEND: sprintf(target_text, "Pitch Bend Ch%u" , MIDI_Channel); break;
|
||||
|
||||
default: sprintf(target_text, "<unknown> Ch%u" , MIDI_Channel); return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t MIDI_System_Message = MIDI_CHANNEL_FROM_COMMAND(midi_data);
|
||||
|
||||
switch (MIDI_System_Message)
|
||||
{
|
||||
case MIDI_SYSTEM_EXCLUSIVE: sprintf(target_text, "System_Exclusive"); break;
|
||||
case MIDI_SYSTEM_TIME_CODE_QUARTER_FRAME: sprintf(target_text, "Time Code Quarter Frame"); break;
|
||||
case MIDI_SYSTEM_SONG_POSITION_POINTER: sprintf(target_text, "Song Position Pointer"); break;
|
||||
case MIDI_SYSTEM_SONG_SELECT: sprintf(target_text, "Song Select"); break;
|
||||
case MIDI_SYSTEM_TUNE_REQUEST: sprintf(target_text, "System Tune Request"); break;
|
||||
case MIDI_SYSTEM_EXCLUSIVE_END: sprintf(target_text, "End of Exclusive"); break;
|
||||
case MIDI_SYSTEM_TIMING_CLOCK: sprintf(target_text, "Timing Clock"); break;
|
||||
case MIDI_SYSTEM_START: sprintf(target_text, "Start Sequence"); break;
|
||||
case MIDI_SYSTEM_CONTINUE: sprintf(target_text, "Continue Sequence"); break;
|
||||
case MIDI_SYSTEM_STOP: sprintf(target_text, "Stop Sequence"); break;
|
||||
case MIDI_SYSTEM_ACTIVE_SENSING: sprintf(target_text, "Active Sensing"); break;
|
||||
case MIDI_SYSTEM_RESET: sprintf(target_text, "Sytem Reset"); break;
|
||||
|
||||
case MIDI_SYSTEM_UNDEFINED_1:
|
||||
case MIDI_SYSTEM_UNDEFINED_2:
|
||||
case MIDI_SYSTEM_UNDEFINED_3:
|
||||
case MIDI_SYSTEM_UNDEFINED_4: sprintf(target_text, "Undefined (Reserved)"); break;
|
||||
|
||||
default: sprintf(target_text, "<unknown>"); return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Create_Info_Data_Text(char* target_text, uint entry_id, uint command_offset, uint8_t midi_data)
|
||||
{
|
||||
if(entry_id + command_offset >= RECEIVED_MIDI_HISTORY_BUFFER_SIZE)
|
||||
{
|
||||
sprintf(target_text, "Error 0 -> Contact Chris");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t MIDI_Data_Command = (uint8_t)_MIDI_History_Buffer[entry_id + command_offset].Data;
|
||||
uint8_t MIDI_Event = MIDI_EVENT_FROM_COMMAND(MIDI_Data_Command);
|
||||
|
||||
if(IS_MIDI_COMMAND_WITH_CHANNEL(MIDI_Data_Command))
|
||||
{
|
||||
switch (MIDI_Event)
|
||||
{
|
||||
case MIDI_EVENT_NOTE_OFF:
|
||||
case MIDI_EVENT_NOTE_ON:
|
||||
case MIDI_EVENT_POLYPHONIC_KEY_PRESSURE:
|
||||
if(command_offset == 1) { sprintf(target_text, "Note %s%i", _MIDI_Note_List[midi_data].Tone_Name, _MIDI_Note_List[midi_data].Octave); return true; } else
|
||||
if(command_offset == 2) { sprintf(target_text, "Velocity of %u", midi_data); return true; }
|
||||
break;
|
||||
|
||||
case MIDI_EVENT_CONTROL_CHANGE:
|
||||
if(command_offset == 1) { sprintf(target_text, "Controller %u", midi_data); return true; } else
|
||||
if(command_offset == 2) { sprintf(target_text, "Velocity of %u", midi_data); return true; }
|
||||
break;
|
||||
|
||||
case MIDI_EVENT_PROGRAM_CHANGE:
|
||||
if(command_offset == 1) { sprintf(target_text, "Program %u", midi_data+1); return true; }
|
||||
break;
|
||||
|
||||
case MIDI_EVENT_CHANNEL_PRESSURE:
|
||||
if(command_offset == 1) { sprintf(target_text, "Pressure value %u", midi_data); return true; }
|
||||
break;
|
||||
|
||||
case MIDI_EVENT_PITCH_BEND:
|
||||
if(command_offset == 1) { sprintf(target_text, "Pitch upper value"); return true; } else
|
||||
if(command_offset == 2) { sprintf(target_text, "Pitch lower value"); return true; }
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t MIDI_System_Message = MIDI_CHANNEL_FROM_COMMAND(midi_data);
|
||||
|
||||
switch (MIDI_System_Message)
|
||||
{
|
||||
case MIDI_SYSTEM_EXCLUSIVE:
|
||||
sprintf(target_text, "System Message Data"); return true;
|
||||
break;
|
||||
|
||||
case MIDI_SYSTEM_TIME_CODE_QUARTER_FRAME:
|
||||
if(command_offset == 1) { sprintf(target_text, "Type %u Value %u", (midi_data & 0x70) >> 4, (midi_data & 0x0F)); return true; }
|
||||
break;
|
||||
|
||||
case MIDI_SYSTEM_SONG_POSITION_POINTER:
|
||||
if(command_offset == 1) { sprintf(target_text, "Beat upper value %u", midi_data); return true; } else
|
||||
if(command_offset == 2) { sprintf(target_text, "Beat lower value %u", midi_data); return true; }
|
||||
break;
|
||||
|
||||
case MIDI_SYSTEM_SONG_SELECT:
|
||||
if(command_offset == 1) { sprintf(target_text, "Selected song %u", midi_data); return true; }
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(target_text, "Unexpected MIDI Data");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Check_Entry_Is_Command(uint entry_id)
|
||||
{
|
||||
if(entry_id >= RECEIVED_MIDI_HISTORY_BUFFER_SIZE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(_MIDI_History_Buffer[entry_id].Data == HISTORY_ENTRY_UNDEFINED)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return IS_MIDI_COMMAND((uint8_t)_MIDI_History_Buffer[entry_id].Data);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ static Configuration_Menu_Ring _Ring_Menu_Config = {
|
||||
|
||||
.Selection_Ring_Diameter = 0,
|
||||
.Selection_Ring_Thickness = 3,
|
||||
.Selection_Ring_Padding = 0,
|
||||
.Selection_Ring_Padding = 2,
|
||||
|
||||
.Selection_Scale = 1.15f,
|
||||
.Animation_Duration = 15,
|
||||
@@ -182,10 +182,10 @@ 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;
|
||||
case 0: Screen_Setup_MIDI_Log (TRANSITION_LEFT, TRANSITION_LEFT , SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES); break;
|
||||
case 1: Screen_Setup_Settings (TRANSITION_UP, TRANSITION_UP , SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 0); break;
|
||||
case 2: Screen_Setup_Graph (TRANSITION_RIGHT, TRANSITION_RIGHT , SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES); break;
|
||||
case 3: Screen_Setup_Mode (TRANSITION_DOWN, TRANSITION_DOWN , SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES); break;
|
||||
}
|
||||
|
||||
Display_Select_Object();
|
||||
|
||||
127
Firmware/Screens_Display/Screen_Mode.c
Normal file
127
Firmware/Screens_Display/Screen_Mode.c
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* File: Screen_Mode.c
|
||||
*
|
||||
* Created: Created: Tuesday September 2025 19:44:30
|
||||
* Author: Chris
|
||||
*/
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Mode(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_Mode(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 //
|
||||
//////////////////////////////
|
||||
|
||||
Display_Objects_Add_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_RED, 80, 80, 1, NO_STYLE, NO_ANIMATION);
|
||||
// Display_Objects_Add_Rounded_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_GREEN, 80, 80, 10, 4, NO_STYLE, NO_ANIMATION);
|
||||
// Display_Objects_Add_Rounded_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_GREEN, 100, 100, 15, 1, NO_STYLE, NO_ANIMATION);
|
||||
// Display_Objects_Add_Rounded_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_GREEN, 80, 80, 5, 1, NO_STYLE, NO_ANIMATION);
|
||||
// Display_Objects_Add_Rounded_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_GREEN , 80, 80, 10, 1, NO_STYLE, NO_ANIMATION);
|
||||
// Display_Objects_Add_Rounded_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_BLUE , 60, 60, 5, 1, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
// Display_Objects_Add_Circle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_BLUE, 40, 5, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Circle_Filled(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_BLUE, 40, NO_STYLE, NO_ANIMATION);
|
||||
// Display_Objects_Add_Circle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_ORANGE, 40, 1, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Screen_Setup_Menu_Main(TRANSITION_UP, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, false, 3);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
|
||||
129
Firmware/Screens_Display/Screen_Select_Bool.c
Normal file
129
Firmware/Screens_Display/Screen_Select_Bool.c
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* 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
|
||||
*******************************************************************/
|
||||
|
||||
@@ -61,7 +61,7 @@ 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);
|
||||
void Screen_Setup_Settings(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item);
|
||||
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
@@ -78,7 +78,7 @@ 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)
|
||||
void Screen_Setup_Settings(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
@@ -109,7 +109,7 @@ void Screen_Setup_Settings(Screen_Transition_Direction direction_out, Screen_Tra
|
||||
_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;
|
||||
_Selected_Item = selected_item;
|
||||
|
||||
Display_Select_First_Object();
|
||||
Display_Select_Object();
|
||||
@@ -159,13 +159,13 @@ void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
{
|
||||
switch (_Selected_Item)
|
||||
{
|
||||
case 0: break;
|
||||
case 0: Screen_Setup_Settings_MIDI(TRANSITION_UP, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 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;
|
||||
case 5: Screen_Setup_Settings_About(TRANSITION_UP, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES); break;
|
||||
case 6: Screen_Setup_Menu_Main(TRANSITION_DOWN, TRANSITION_DOWN, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, false, 1); break;
|
||||
}
|
||||
|
||||
Display_Select_Object();
|
||||
|
||||
153
Firmware/Screens_Display/Screen_Settings_About.c
Normal file
153
Firmware/Screens_Display/Screen_Settings_About.c
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Screen_01.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"
|
||||
|
||||
#include "../Version.h"
|
||||
|
||||
#include "pico/types.h"
|
||||
#include "pico/time.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_6x12[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_7x15[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_7x15[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_15x26[];
|
||||
|
||||
static uint _Up_Time_s;
|
||||
static Object_ID _Object_Up_Time_s;
|
||||
static Object_ID _Object_Frame_Counter;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Settings_About(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_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_About(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_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);
|
||||
|
||||
Font_ID Font_12_0 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_6x12, 0);
|
||||
Font_ID Font_15_1 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_7x15, 1);
|
||||
Font_ID Font_Bold_15_1 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_Bold_7x15, 1);
|
||||
Font_ID Font_Bold_26_1 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_Bold_15x26, 0);
|
||||
|
||||
Font_ID Font_Title = Font_15_1;
|
||||
Font_ID Font_Value = Font_Bold_15_1;
|
||||
Font_ID Font_Heading = Font_Bold_26_1;
|
||||
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
uint16_t Y = 35;
|
||||
|
||||
Display_Objects_Add_Text(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 20, NOT_SELECTABLE, "MIDI Lighter", Font_Heading, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
// === Up Time ===
|
||||
Display_Objects_Add_Text(CENTER_BOTTOM, BOTH_IN_PERCENT, 50, Y-1, NOT_SELECTABLE, "Up Time", Font_Title, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
_Object_Up_Time_s = Display_Objects_Add_Integer(CENTER_TOP, BOTH_IN_PERCENT, 50, Y, NOT_SELECTABLE, &_Up_Time_s, "%us", Font_Value, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
|
||||
Y += 20;
|
||||
|
||||
// === Frame Counter ===
|
||||
Display_Objects_Add_Text(CENTER_BOTTOM, BOTH_IN_PERCENT, 50, Y-1, NOT_SELECTABLE, "#Frames", Font_Title, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
_Object_Frame_Counter = Display_Objects_Add_Integer(CENTER_TOP, BOTH_IN_PERCENT, 50, Y, NOT_SELECTABLE, (int*)Display_Get_Frame_Counter_Reference(), "%u", Font_Value, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
|
||||
Y += 20;
|
||||
|
||||
// === Version ===
|
||||
Display_Objects_Add_Text(CENTER_BOTTOM, BOTH_IN_PERCENT, 50, Y-1, NOT_SELECTABLE, "Version", Font_Title, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Text(CENTER_TOP, BOTH_IN_PERCENT, 50, Y, NOT_SELECTABLE, VERSION_BUILD_STRING, Font_Value, DISPLAY_COLOR_WHITE, NO_STYLE, NO_ANIMATION);
|
||||
Y += 20;
|
||||
|
||||
// === Text ===
|
||||
Display_Objects_Add_Text(CENTER_BOTTOM, BOTH_IN_PERCENT, 50, 95, NOT_SELECTABLE, "Click to return", Font_12_0, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
|
||||
_Up_Time_s = to_ms_since_boot(get_absolute_time()) / 1000u;
|
||||
}
|
||||
|
||||
void Screen_Tick(void)
|
||||
{
|
||||
_Up_Time_s = to_ms_since_boot(get_absolute_time()) / 1000u;
|
||||
|
||||
Display_Objects_Update_Coordinates(_Object_Up_Time_s, CENTER_TOP, BOTH_IN_PERCENT, 50, 35);
|
||||
Display_Objects_Update_Coordinates(_Object_Frame_Counter, CENTER_TOP, BOTH_IN_PERCENT, 50, 35 + 20);
|
||||
}
|
||||
|
||||
void Screen_Click(uint button_return_value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Screen_Setup_Settings(TRANSITION_DOWN, TRANSITION_DOWN, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 5);
|
||||
}
|
||||
|
||||
void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
144
Firmware/Screens_Display/Screen_Settings_MIDI.c
Normal file
144
Firmware/Screens_Display/Screen_Settings_MIDI.c
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* File: Screen_Settings_MIDI.c
|
||||
*
|
||||
* Created: Created: Thursday August 2025 14:24:40
|
||||
* 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 4
|
||||
#define MENU_CHAR_LENGTH 11
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_15x26[];
|
||||
|
||||
static int32_t _Selected_Item;
|
||||
|
||||
static char _Menu_Titles[MENU_ENTRY_COUNT][MENU_CHAR_LENGTH] = {
|
||||
{ "MIDI Config" },
|
||||
{ "Color Notes" },
|
||||
{ "Pause Light" },
|
||||
{ "Back " }
|
||||
};
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Settings_MIDI(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item);
|
||||
|
||||
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_MIDI(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item)
|
||||
{
|
||||
_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 //
|
||||
//////////////////////////////
|
||||
|
||||
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, "MIDI", Font_Title, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Select_List((char*)_Menu_Titles, MENU_ENTRY_COUNT, MENU_CHAR_LENGTH, &_Selected_Item, &_Configuration_Default_Select_List);
|
||||
|
||||
_Selected_Item = selected_item;
|
||||
|
||||
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: Screen_Setup_Settings_MIDI_Config(TRANSITION_UP, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 0); break;
|
||||
case 1: break;
|
||||
case 2: break;
|
||||
case 3: Screen_Setup_Settings(TRANSITION_DOWN, TRANSITION_DOWN, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 0); break;
|
||||
}
|
||||
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
|
||||
147
Firmware/Screens_Display/Screen_Settings_MIDI_Config.c
Normal file
147
Firmware/Screens_Display/Screen_Settings_MIDI_Config.c
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* File: Screen_Settings_MIDI_Config.c
|
||||
*
|
||||
* Created: Created: Thursday August 2025 15:53:58
|
||||
* Author: Chris
|
||||
*/
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
|
||||
#include "../EEPROM_M24C64.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
#define MENU_ENTRY_COUNT 4
|
||||
#define MENU_CHAR_LENGTH 13
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_11x17[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_15x26[];
|
||||
|
||||
static int32_t _Selected_Item;
|
||||
|
||||
static char _Menu_Titles[MENU_ENTRY_COUNT][MENU_CHAR_LENGTH] = {
|
||||
{ "MIDI Channel " },
|
||||
{ "Select Octave" },
|
||||
{ "Skip Note Off" },
|
||||
{ "Back " }
|
||||
};
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Settings_MIDI_Config(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item);
|
||||
|
||||
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_MIDI_Config(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item)
|
||||
{
|
||||
_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 //
|
||||
//////////////////////////////
|
||||
Font_ID Font_Title = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_Bold_11x17, 0);
|
||||
|
||||
|
||||
Display_Objects_Add_Text(CENTER_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 50, 45, NOT_SELECTABLE, "MIDI Config", Font_Title, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Select_List((char*)_Menu_Titles, MENU_ENTRY_COUNT, MENU_CHAR_LENGTH, &_Selected_Item, &_Configuration_Default_Select_List);
|
||||
|
||||
_Selected_Item = selected_item;
|
||||
|
||||
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: Screen_Setup_Select_Bool(TRANSITION_UP, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, "Skip Note Off?", 14, (uint8_t*)&_EEPROM_Content.Channel_MIDI_Configuration->Skip_Note_Off_Event, Screen_Setup_Settings_MIDI_Config, 2); break;
|
||||
case 3: Screen_Setup_Settings_MIDI(TRANSITION_DOWN, TRANSITION_DOWN, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 0); break;
|
||||
}
|
||||
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user