serial_debugger/serial_debugger_GSLC.h

173 lines
6.0 KiB
C

//<File !Start!>
// FILE: [serial_debugger_GSLC.h]
// Created by GUIslice Builder version: [0.15.b004]
//
// GUIslice Builder Generated GUI Framework File
//
// For the latest guides, updates and support view:
// https://github.com/ImpulseAdventure/GUIslice
//
//<File !End!>
#ifndef _GUISLICE_GEN_H
#define _GUISLICE_GEN_H
// ------------------------------------------------
// Headers to include
// ------------------------------------------------
#include "src/guislice/GUIslice.h"
#include "src/guislice/GUIslice_drv.h"
// Include any extended elements
//<Includes !Start!>
// Include extended elements
#include "src/guislice/XProgress.h"
#include "src/guislice/XTextbox.h"
//<Includes !End!>
// ------------------------------------------------
// Headers and Defines for fonts
// Note that font files are located within the Adafruit-GFX library folder:
// ------------------------------------------------
//<Fonts !Start!>
#if defined(DRV_DISP_TFT_ESPI)
#error Project tab->Target Platform should be tft_espi
#endif
#include <Adafruit_GFX.h>
#include "src/guislice/NotoMono8pt7b.h"
//<Fonts !End!>
// ------------------------------------------------
// Defines for resources
// ------------------------------------------------
//<Resources !Start!>
//<Resources !End!>
// ------------------------------------------------
// Enumerations for pages, elements, fonts, images
// ------------------------------------------------
//<Enum !Start!>
enum {E_PG_MAIN};
enum {E_ELEM_BATT_LEVEL,E_ELEM_STATUS,E_ELEM_TEXT};
// Must use separate enum for fonts with MAX_FONT at end to use gslc_FontSet.
enum {E_AO_NOTOMONO8PT7B,MAX_FONT};
//<Enum !End!>
// ------------------------------------------------
// Instantiate the GUI
// ------------------------------------------------
// ------------------------------------------------
// Define the maximum number of elements and pages
// ------------------------------------------------
//<ElementDefines !Start!>
#define MAX_PAGE 1
#define MAX_ELEM_PG_MAIN 3 // # Elems total on page
#define MAX_ELEM_PG_MAIN_RAM MAX_ELEM_PG_MAIN // # Elems in RAM
//<ElementDefines !End!>
// ------------------------------------------------
// Create element storage
// ------------------------------------------------
gslc_tsGui m_gui;
gslc_tsDriver m_drv;
gslc_tsFont m_asFont[MAX_FONT];
gslc_tsPage m_asPage[MAX_PAGE];
//<GUI_Extra_Elements !Start!>
gslc_tsElem m_asPage1Elem[MAX_ELEM_PG_MAIN_RAM];
gslc_tsElemRef m_asPage1ElemRef[MAX_ELEM_PG_MAIN];
gslc_tsXProgress m_sXBarGauge1;
gslc_tsXTextbox m_sTextbox1;
char m_acTextboxBuf1[952]; // NRows=17 NCols=56
#define MAX_STR 100
//<GUI_Extra_Elements !End!>
// ------------------------------------------------
// Program Globals
// ------------------------------------------------
// Element References for direct access
//<Extern_References !Start!>
extern gslc_tsElemRef* m_pElemBatteryLevel;
extern gslc_tsElemRef* m_pElemStatusText;
extern gslc_tsElemRef* m_pElemText;
extern gslc_tsElemRef* m_pTextSlider;
//<Extern_References !End!>
// Define debug message function
static int16_t DebugOut(char ch);
// ------------------------------------------------
// Callback Methods
// ------------------------------------------------
bool CbBtnCommon(void* pvGui,void *pvElemRef,gslc_teTouch eTouch,int16_t nX,int16_t nY);
bool CbCheckbox(void* pvGui, void* pvElemRef, int16_t nSelId, bool bState);
bool CbDrawScanner(void* pvGui,void* pvElemRef,gslc_teRedrawType eRedraw);
bool CbKeypad(void* pvGui, void *pvElemRef, int16_t nState, void* pvData);
bool CbListbox(void* pvGui, void* pvElemRef, int16_t nSelId);
bool CbSlidePos(void* pvGui,void* pvElemRef,int16_t nPos);
bool CbSpinner(void* pvGui, void *pvElemRef, int16_t nState, void* pvData);
bool CbTickScanner(void* pvGui,void* pvScope);
// ------------------------------------------------
// Create page elements
// ------------------------------------------------
void InitGUIslice_gen()
{
gslc_tsElemRef* pElemRef = NULL;
if (!gslc_Init(&m_gui,&m_drv,m_asPage,MAX_PAGE,m_asFont,MAX_FONT)) { return; }
// ------------------------------------------------
// Load Fonts
// ------------------------------------------------
//<Load_Fonts !Start!>
if (!gslc_FontSet(&m_gui,E_AO_NOTOMONO8PT7B,GSLC_FONTREF_PTR,&NotoMono8pt7b,1)) { return; }
//<Load_Fonts !End!>
//<InitGUI !Start!>
gslc_PageAdd(&m_gui,E_PG_MAIN,m_asPage1Elem,MAX_ELEM_PG_MAIN_RAM,m_asPage1ElemRef,MAX_ELEM_PG_MAIN);
// NOTE: The current page defaults to the first page added. Here we explicitly
// ensure that the main page is the correct page no matter the add order.
gslc_SetPageCur(&m_gui,E_PG_MAIN);
// Set Background to a flat color
gslc_SetBkgndColor(&m_gui,GSLC_COL_BLACK);
// -----------------------------------
// PAGE: E_PG_MAIN
// Create progress bar E_ELEM_BATT_LEVEL
pElemRef = gslc_ElemXProgressCreate(&m_gui,E_ELEM_BATT_LEVEL,E_PG_MAIN,&m_sXBarGauge1,
(gslc_tsRect){263,5,50,15},0,100,0,GSLC_COL_GREEN,false);
m_pElemBatteryLevel = pElemRef;
// Create E_ELEM_STATUS text label
pElemRef = gslc_ElemCreateTxt(&m_gui,E_ELEM_STATUS,E_PG_MAIN,(gslc_tsRect){2,2,250,21},
(char*)"UART0 / 1151200",0,E_AO_NOTOMONO8PT7B);
gslc_ElemSetTxtCol(&m_gui,pElemRef,GSLC_COL_GREEN);
m_pElemStatusText = pElemRef;
// Create textbox
pElemRef = gslc_ElemXTextboxCreate(&m_gui,E_ELEM_TEXT,E_PG_MAIN,&m_sTextbox1,
(gslc_tsRect){3,30,313,202},E_AO_NOTOMONO8PT7B,
(char*)&m_acTextboxBuf1,17,56);
gslc_ElemXTextboxWrapSet(&m_gui,pElemRef,true);
gslc_ElemSetTxtCol(&m_gui,pElemRef,GSLC_COL_GRAY_LT3);
gslc_ElemSetCol(&m_gui,pElemRef,GSLC_COL_GRAY,GSLC_COL_BLACK,GSLC_COL_BLACK);
m_pElemText = pElemRef;
//<InitGUI !End!>
//<Startup !Start!>
//<Startup !End!>
}
#endif // end _GUISLICE_GEN_H