- 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
177 lines
6.0 KiB
C
177 lines
6.0 KiB
C
/*
|
|
* 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, 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(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 //
|
|
//////////////////////////////
|
|
|
|
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 = 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(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: 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();
|
|
}
|
|
|
|
/*******************************************************************
|
|
Internal Functions
|
|
*******************************************************************/
|