/** * @brief Pause recording * @param None * @retval None */ static void RECORDER_Pause (void) { GL_PageControls_TypeDef* item; /* Pause/Resume recording */ AudioRecorder_PauseResume(REC_GL_State); /* Update GUI */ if (REC_GL_State == REC_GL_RECORDING) { REC_GL_State = REC_GL_IDLE; DestroyPageControl (RecordPage, REC_PAUSE_ID); RefreshPageControl(RecordPage, REC_PAUSE_ID); item = NewIcon (REC_STRT_ID, rec_start_icon, 40, 40, RECORDER_Pause); AddPageControlObj(110,135,item, RecordPage); RefreshPageControl(RecordPage, REC_STRT_ID); } else { REC_GL_State = REC_GL_RECORDING; DestroyPageControl (RecordPage, REC_STRT_ID); RefreshPageControl(RecordPage, REC_STRT_ID); item = NewIcon (REC_PAUSE_ID, rec_pause_icon, 40, 40, RECORDER_Pause); AddPageControlObj(110,135,item, RecordPage); RefreshPageControl(RecordPage, REC_PAUSE_ID); } }
/** * Create the screen */ void ScreenEditText_Create(void) { Create_PageObj(s_pThisScreen); /* * Create the UI widgets */ s_lblStatus = Widget_NewLabel("Tap Item then Edit.", LCD_COLOR_WHITE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_8x12Bold, 0); GL_PageControls_TypeDef* btnStore = NewButton(0, " Store ", store_Click); GL_PageControls_TypeDef* btnEdit = NewButton(0, " Edit ", edit_Click); GL_PageControls_TypeDef* btnDone = NewButton(0, " Done ", done_Click); // Populate the options buttons: for (int i = 0; i < Text_Items; i++) { GL_PageControls_TypeDef* btnText = NewButton(ID_TEXT_START + i, Text_GetName(i), textButton_Click); int x = (i / BUTTONS_PER_COLUMN) * COLUMN_WIDTH; int y = (i % BUTTONS_PER_COLUMN) * SPACE_PER_BUTTON_Y + FIRST_BUTTON_Y; AddPageControlObj(x, y, btnText, s_pThisScreen); } // Button Row AddPageControlObj(90, LCD_HEIGHT - 50, s_lblStatus, s_pThisScreen); AddPageControlObj(120 , LCD_HEIGHT - 30, btnStore, s_pThisScreen); AddPageControlObj(0, LCD_HEIGHT - 30, btnEdit, s_pThisScreen); AddPageControlObj(LCD_WIDTH - 75, LCD_HEIGHT - 30, btnDone, s_pThisScreen); }
/** * Create the screen */ void ScreenMode_Create(void) { Create_PageObj(s_pThisScreen); /* * Create the title and directions texts */ GL_PageControls_TypeDef* lblTitle = Widget_NewLabel("Mode Selection", LCD_COLOR_WHITE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_16x24, 0); GL_PageControls_TypeDef* lblDirections = Widget_NewLabel("Tap button for desired mode.", LCD_COLOR_BLUE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_8x12Bold, 0); AddPageControlObj(0, 10, lblTitle, s_pThisScreen); AddPageControlObj(0, 35, lblDirections, s_pThisScreen); // Populate the Mode buttons and descriptions: for (int i = 0; i < USERMODE_NUM_MODES; i++) { GL_PageControls_TypeDef* btnMode = NewButton(ID_MODEBTN_START + i, Mode_GetUserModeName(i), modeButton_Click); int btnX = BUTTON_LEFT; int btnY = i * SPACE_PER_BUTTON_Y + FIRST_BUTTON_Y; AddPageControlObj(btnX, btnY, btnMode, s_pThisScreen); GL_PageControls_TypeDef* lblDescription = Widget_NewLabel(Mode_GetUserModeDescription(i), LCD_COLOR_YELLOW, LCD_COLOR_BLACK, 1, GL_FONTOPTION_8x12Bold, 0); int lblX = LABEL_LEFT; int lblY = i * SPACE_PER_BUTTON_Y + FIRST_BUTTON_Y + LABEL_OFFSET_Y; AddPageControlObj(lblX, lblY, lblDescription, s_pThisScreen); } }
/** * Create the screen */ void ScreenCalibrationTest_Create(void) { Create_PageObj(s_pThisScreen); GL_PageControls_TypeDef* displayWidget = NewCustomWidget(1, showTouches_GetWidth, showTouches_GetHeight, showTouches_Click, showTouches_Draw, 0); AddPageControlObj(0, 0, displayWidget, s_pThisScreen); }
/** * Create the screen */ void ScreenCalibrate_Create(void) { Create_PageObj(s_pThisScreen); GL_PageControls_TypeDef* calibrationWidget = NewCustomWidget(1, calibration_GetWidth, calibration_GetHeight, calibration_Click, calibration_Draw, 0); AddPageControlObj(0, 0, calibrationWidget, s_pThisScreen); }
/* * Create a new widget and add it to the passed in page * Note: May create multiple controls (labels, buttons, ...) and add them to the page. */ void Widget_AddToPage_NewFFTDisplay(uint16_t x, uint16_t y, GL_Page_TypeDef *pPage) { GL_PageControls_TypeDef* newFFT = NewCustomWidget( 0, WidgetFFT_GetWidth, WidgetFFT_GetHeight, WidgetFFT_EventHandler, WidgetFFT_DrawHandler, 0); AddPageControlObj(x, y, newFFT, pPage); }
/** * Create the screen */ void ScreenMainCW_Create(void) { Create_PageObj(s_pThisScreen); // Title GL_PageControls_TypeDef* ctrlPskText = Widget_NewLabel("CW Screen", LCD_COLOR_YELLOW, LCD_COLOR_BLACK, 1, GL_FONTOPTION_16x24, 0); AddPageControlObj(0, 80, ctrlPskText, s_pThisScreen); // FFT Widget_AddToPage_NewFFTDisplay(80, 0, s_pThisScreen); // "Standard" complement of main screen buttons: // .. Mode GL_PageControls_TypeDef* btnMode = Widget_NewBigButtonMode(); AddPageControlObj(0, 0, btnMode, s_pThisScreen); // .. Options GL_PageControls_TypeDef* btnOptions = Widget_NewBigButtonOptions(); AddPageControlObj(0, LCD_HEIGHT - 42, btnOptions, s_pThisScreen); // .. Frequency GL_PageControls_TypeDef* btnFreq = Widget_NewBigButtonFrequency(); AddPageControlObj( LCD_WIDTH - ((GL_Custom_TypeDef*)(btnFreq->objPTR))->GetWidth(btnFreq), LCD_HEIGHT - ((GL_Custom_TypeDef*)(btnFreq->objPTR))->GetHeight(btnFreq), btnFreq, s_pThisScreen); // .. Rx & Tx buttons (Remove when code can automatically switch) GL_PageControls_TypeDef* btnRx = NewButton(10, " Rx ", rx_Click); GL_PageControls_TypeDef* btnTx = NewButton(9, " Tx ", tx_Click); AddPageControlObj(120, LCD_HEIGHT - 42, btnRx, s_pThisScreen); AddPageControlObj(165, LCD_HEIGHT - 42, btnTx, s_pThisScreen); }
/** * @brief Update module icon. * @param new_icon: New icon * @retval None */ void ETHERNET_UpdateIcon(const uint8_t *new_icon) { GL_PageControls_TypeDef* item; if((EthernetCurrentPage->Page_ID == ETHERNET_WEBSERVER_PAGE)|| (EthernetCurrentPage->Page_ID == ETHERNET_DISTANTCONTROL_PAGE)) { DestroyPageControl(EthernetCurrentPage, 1); item = NewIcon (1,new_icon,50,50,MOD_NullFunc); AddPageControlObj(185,40,item,EthernetCurrentPage); RefreshPageControl(EthernetCurrentPage, 1); } }
/** * @brief Stop recording and save the recorded file * @param None * @retval None */ static void RECORDER_Stop (void) { GL_PageControls_TypeDef* item; Recorder_UsedStorage = 0xFF; if (REC_GL_State == REC_GL_RECORDING) { AudioRecorder_Stop(); AudioRecorder_Close(); DestroyPageControl (RecordPage, REC_STOP_ID); RefreshPageControl(RecordPage, REC_STOP_ID); DestroyPageControl (RecordPage, REC_PAUSE_ID); RefreshPageControl(RecordPage, REC_PAUSE_ID); DestroyPageControl (RecordPage, REC_STRT_ID); RefreshPageControl(RecordPage, REC_STRT_ID); DestroyPageControl (RecordPage, REC_CANCEL_ID); RefreshPageControl(RecordPage, REC_CANCEL_ID); /* Restore old icons */ item = NewIcon (REC_STRT_ID, rec_start_icon, 40, 40, RECORDER_Start); AddPageControlObj(170,135,item, RecordPage); RefreshPageControl(RecordPage, REC_STRT_ID); item = NewIcon (REC_PAUSE_ID, rec_pause_icon, 40, 40, MOD_NullFunc); AddPageControlObj(110,135,item, RecordPage); RefreshPageControl(RecordPage, REC_PAUSE_ID); item = NewIcon (REC_PLAY_ID, rec_play_icon, 40, 40, RECORDER_Play); AddPageControlObj(50,135,item, RecordPage); RefreshPageControl(RecordPage, REC_PLAY_ID); } }
void ScreenAdvanced_Create(void) { Create_PageObj(s_pThisScreen); /* * Create the UI widgets */ GL_PageControls_TypeDef* lblTitle = Widget_NewLabel("Advanced", LCD_COLOR_WHITE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_16x24, 0); GL_PageControls_TypeDef* lblDirections1 = Widget_NewLabel("Tap to select", LCD_COLOR_WHITE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_8x12Bold, 0); GL_PageControls_TypeDef* lblDirections2 = Widget_NewLabel("setting changes value", LCD_COLOR_WHITE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_8x12Bold, 0); s_lblStatus = Widget_NewLabel("Tap setting to exit", LCD_COLOR_WHITE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_8x12Bold, 0); GL_PageControls_TypeDef* btnOptionsBigButton = Widget_NewBigButtonOptions(); GL_PageControls_TypeDef* btnDefaults = NewButton(0, "Defaults", defaults_Click); GL_PageControls_TypeDef* btnCalibrate = NewButton(13, "Cal. Screen", calibrate_Click); /* * Place the widgets onto the screen */ // Title AddPageControlObj( 0, 0, lblTitle, s_pThisScreen); AddPageControlObj(115, 0, lblDirections1, s_pThisScreen); AddPageControlObj(115, 10, lblDirections2, s_pThisScreen); // Populate the options buttons: for (int i = START_ADVANCED_OPTIONS; i < END_ADVANCED_OPTIONS; i++) { GL_PageControls_TypeDef* btnOption = NewButton(ID_OPTION_START + i, Options_GetName(i), optionButton_Click); int x = ((i - START_ADVANCED_OPTIONS) / BUTTONS_PER_ADV_COLUMN) * COLUMN_WIDTH; int y = ((i - START_ADVANCED_OPTIONS) % BUTTONS_PER_ADV_COLUMN) * SPACE_PER_BUTTON_Y + FIRST_BUTTON_Y; AddPageControlObj(x, y, btnOption, s_pThisScreen); } // Button Row AddPageControlObj(0, LCD_HEIGHT - 42, btnOptionsBigButton, s_pThisScreen); AddPageControlObj(0, LCD_HEIGHT - 60, s_lblStatus, s_pThisScreen); AddPageControlObj(204, FIRST_BUTTON_Y, btnCalibrate, s_pThisScreen); AddPageControlObj(85, LCD_HEIGHT - 30, btnDefaults, s_pThisScreen); }
/** * @brief Display the main menu * @param None * @retval None */ void GL_ShowMainMenu(void) { uint8_t TempStr[25]; RTC_TimeTypeDef RTC_TimeStructure; RTC_DateTypeDef RTC_DateStructure; GL_PageControls_TypeDef *Icon , *LabelTime , *LabelDate, *LabelBkgnd; uint8_t sec, min, hour, day, month; uint16_t year; GL_Clear(White); GL_HomePage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( GL_HomePage, HOME_PAGE_ID ); /* Add group icons */ Icon = NewIcon(2 , Group_Connectivity_icon, BF_XSIZE, BF_YSIZE ,GL_ShowConnectivityGroup ); AddPageControlObj(305, 40, Icon, GL_HomePage ); Icon = NewIcon(3 , Group_Multimedia_icon, BF_XSIZE, BF_YSIZE ,GL_ShowMultimediaGroup ); AddPageControlObj(305, 103, Icon, GL_HomePage ); Icon = NewIcon(4 , Group_System_icon, BF_XSIZE, BF_YSIZE ,GL_ShowUtilitiesGroup ); AddPageControlObj(305, 166, Icon, GL_HomePage ); Icon = NewIcon(32 , STLogo, 40, 22 ,MOD_NullFunc ); AddPageControlObj(240, 216, Icon, GL_HomePage ); LabelBkgnd = NewLabel(33, (uint8_t *)"",GL_HORIZONTAL,GL_FONT_SMALL,GL_Red, GL_FALSE); AddPageControlObj(195, 227, LabelBkgnd, GL_HomePage); /* add modules */ switch(GL_Group) { case CONNECTIVITY_GROUP : GL_ShowConnectivityGroup(); break; case MULTIMEDIA_GROUP : GL_ShowMultimediaGroup(); break; case UTILITIES_GROUP : GL_ShowUtilitiesGroup(); break; } GL_HomePage->CustomPreDraw = DrawBackgroundZone; /* time section */ /* Get info from RTC here */ RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure); sec = RTC_TimeStructure.RTC_Seconds; min = RTC_TimeStructure.RTC_Minutes; hour = RTC_TimeStructure.RTC_Hours; sprintf((char *)TempStr, "%02d:%02d:%02d", hour , min, sec); LabelTime = NewLabel(30,TempStr,GL_HORIZONTAL,GL_FONT_SMALL,0x1253, GL_FALSE); AddPageControlObj(60, 215, LabelTime, GL_HomePage); RTC_GetDate(RTC_Format_BIN, &RTC_DateStructure); year = RTC_DateStructure.RTC_Year + 2000; month = RTC_DateStructure.RTC_Month; day = RTC_DateStructure.RTC_Date; sprintf((char *)TempStr, "%02d %s %04d", day , strMonth[month-1], year); LabelDate = NewLabel(31,TempStr,GL_HORIZONTAL,GL_FONT_SMALL,0x1253, GL_FALSE); AddPageControlObj(88, 227, LabelDate, GL_HomePage); RefreshPage(GL_HomePage); vTaskResume(Core_Time_Task_Handle); Global_Config.b.Force_Background_Refresh = 1; }
/** * @brief Create a child sub-page * @param Page : Page handler * @retval None */ static void CONSOLE_CreatePage(uint8_t Page) { GL_PageControls_TypeDef *ExitButton; switch (Page) { case CONSOLE_MAIN_PAGE: { ConsoleMainPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( ConsoleMainPage, CONSOLE_MAIN_PAGE ); ExitButton = NewButton(1, (uint8_t *)" Return ", return_to_menu); AddPageControlObj(195, 212, ExitButton, ConsoleMainPage); GL_SetPageHeader(ConsoleMainPage , (uint8_t *)"Events Log"); Label0 = NewLabel(2, (uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 40, Label0, ConsoleMainPage); Label1 = NewLabel(3,(uint8_t *) "", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 52, Label1, ConsoleMainPage); Label2 = NewLabel(4, (uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 64, Label2, ConsoleMainPage); Label3 = NewLabel(5,(uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 76, Label3, ConsoleMainPage); Label4 = NewLabel(6, (uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 88, Label4, ConsoleMainPage); Label5 = NewLabel(7, (uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 100, Label5, ConsoleMainPage); Label6 = NewLabel(8, (uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 112, Label6, ConsoleMainPage); Label7 = NewLabel(9, (uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 124, Label7, ConsoleMainPage); Label8 = NewLabel(10, (uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 136, Label8, ConsoleMainPage); Label9 = NewLabel(11, (uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 148, Label9, ConsoleMainPage); Label10 = NewLabel(12, (uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 160, Label10, ConsoleMainPage); Label11 = NewLabel(13, (uint8_t *)"", GL_HORIZONTAL, GL_FONT_SMALL, GL_Green, GL_TRUE); AddPageControlObj(307, 172, Label11, ConsoleMainPage); ConsoleMainPage->CustomPreDraw = DrawConsoleBackground; ConsoleMainPage->CustomPostDraw = CONSOLE_Refresh; ptr_back = Console_Msg.ptr ; } break; default: break; } }
/** * @brief Create a child sub-page * @param Page: Page handler * @retval None */ static void ETHERNET_CreatePage(uint8_t Page) { GL_PageControls_TypeDef* item; GL_PageControls_TypeDef* BackButton; GL_PageControls_TypeDef* ConfirmButton; GL_PageControls_TypeDef* Message; GL_ComboBoxGrp_TypeDef* pTmp; uint8_t str_address[64]; GL_SetBackColor( GL_White ); GL_SetTextColor( GL_Blue ); switch (Page) { case ETHERNET_MAIN_PAGE: { EthernetMainPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( EthernetMainPage, ETHERNET_MAIN_PAGE ); item = NewIcon (5, ethernet_icon,50,50,MOD_NullFunc); AddPageControlObj(185,40,item,EthernetMainPage); if((Global_Config.b.DistantControlEnabled != 0) && (Global_Config.b.BackgroundModeEnabled != 0)) { GL_SetMenuItem(EthernetMainPage, (uint8_t *)"Web Server",0,goto_webserver ); GL_SetMenuItem(EthernetMainPage, (uint8_t *)"Distant Control",1,goto_distantcontrol); GL_SetMenuItem(EthernetMainPage, (uint8_t *)"Settings",2,goto_EthernetSettingss ); GL_SetMenuItem(EthernetMainPage, (uint8_t *)"Return",3,return_to_menu ); } else { GL_SetMenuItem(EthernetMainPage, (uint8_t *)"Web Server",0,goto_webserver ); GL_SetMenuItem(EthernetMainPage, (uint8_t *)"Settings",1,goto_EthernetSettingss ); GL_SetMenuItem(EthernetMainPage, (uint8_t *)"Return",2,return_to_menu ); } GL_SetPageHeader(EthernetMainPage , (uint8_t *)"Ethernet Menu"); } break; case ETHERNET_WEBSERVER_PAGE: { EthernetWebServerPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( EthernetWebServerPage, ETHERNET_WEBSERVER_PAGE ); GL_SetPageHeader(EthernetWebServerPage , (uint8_t *)"Web Server"); item = NewIcon (1,ethernet_disconn_icon,50,50,MOD_NullFunc); AddPageControlObj(185,40,item,EthernetWebServerPage); BackButton= NewButton(2, (uint8_t *)" Return ",return_from_webserver); AddPageControlObj(195, 212, BackButton, EthernetWebServerPage); Message = NewLabel(3, (uint8_t *)" ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(290,113,Message,EthernetWebServerPage); Message = NewLabel(4, (uint8_t *)" ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(290,126,Message,EthernetWebServerPage); Message = NewLabel(5, (uint8_t *)" ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(290,139,Message,EthernetWebServerPage); Message = NewLabel(6, (uint8_t *)" ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(290,160,Message,EthernetWebServerPage); Message = NewLabel(7, (uint8_t *)" ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(290,173,Message,EthernetWebServerPage); Message = NewLabel(8, (uint8_t *)" ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(290,186,Message,EthernetWebServerPage); EthernetWebServerPage->CustomPostDraw = InitEthernet; } break; case ETHERNET_DISTANTCONTROL_PAGE: { EthernetDistantControlPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( EthernetDistantControlPage, ETHERNET_DISTANTCONTROL_PAGE ); GL_SetPageHeader(EthernetDistantControlPage , (uint8_t *)"Distant Control"); item = NewIcon (1,ethernet_conn_icon,50,50,MOD_NullFunc); AddPageControlObj(185,40,item,EthernetDistantControlPage); BackButton= NewButton(2, (uint8_t *)" Return ",return_from_distantcontrol); AddPageControlObj(195, 212, BackButton, EthernetDistantControlPage); Message = NewLabel(3, (uint8_t *)" ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(290,113,Message,EthernetDistantControlPage); Message = NewLabel(4, (uint8_t *)" ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(290,126,Message,EthernetDistantControlPage); Message = NewLabel(5, (uint8_t *)" ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(290,139,Message,EthernetDistantControlPage); Message = NewLabel(6, (uint8_t *)" ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(290,160,Message,EthernetDistantControlPage); EthernetDistantControlPage->CustomPostDraw = InitEthernet; } break; case ETHERNET_SETTINGS: { EthernetSettingssPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( EthernetSettingssPage, ETHERNET_SETTINGS ); item = NewIcon (1,ethernet_settings_icon,50,50,MOD_NullFunc); AddPageControlObj(185,40,item,EthernetSettingssPage); BackButton= NewButton(2, (uint8_t *)" Return ",return_from_settings); AddPageControlObj(195, 212, BackButton, EthernetSettingssPage); item= NewCheckbox(3 , (uint8_t *)"Enable DHCP Client", GL_TRUE, MOD_NullFunc); AddPageControlObj(260, 105, item, EthernetSettingssPage); item = NewLabel(4, (uint8_t *)"Image Format:",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black,GL_FALSE); AddPageControlObj(260,145,item,EthernetSettingssPage); item = NewComboBoxGrp(5); AddComboOption (item->objPTR, (uint8_t *)"BMP QQVGA", MOD_NullFunc); AddComboOption (item->objPTR, (uint8_t *)"BMP QVGA", MOD_NullFunc); AddPageControlObj( 260, 160, item, EthernetSettingssPage); GL_SetPageHeader(EthernetSettingssPage , (uint8_t *)"Ethernet Settings Menu"); MOD_GetParam(3, &EthCfg.d32); if(EthCfg.b.DHCPEnable == 1) { GL_SetChecked(EthernetSettingssPage, 3, EthCfg.b.DHCPEnable); } pTmp = (GL_ComboBoxGrp_TypeDef*)(item->objPTR); if((EthCfg.b.SelectedImageFormat > 0) && (EthCfg.b.SelectedImageFormat < 3)) { pTmp->ComboOptions[0]->IsActive = GL_FALSE; pTmp->ComboOptions[EthCfg.b.SelectedImageFormat -1]->IsActive = GL_TRUE; } } break; case ETHERNET_WARNING_PAGE: { EthernetWarningPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( EthernetWarningPage, ETHERNET_WARNING_PAGE ); BackButton= NewButton(2, (uint8_t *)" Cancel ",return_from_warning); AddPageControlObj(230, 212,BackButton,EthernetWarningPage); ConfirmButton= NewButton(3, (uint8_t *)"Disable",disable_distant_control); AddPageControlObj(150, 212,ConfirmButton,EthernetWarningPage); item = NewIcon (4,error_icon,50,50,MOD_NullFunc); AddPageControlObj(185, 40, item, EthernetWarningPage); GL_SetPageHeader(EthernetWarningPage , (uint8_t *)"Ethernet : warning"); item = NewLabel(5, (uint8_t *)"The Distant control feature is currently",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_TRUE); AddPageControlObj(310,100,item,EthernetWarningPage); item = NewLabel(6, (uint8_t *)"enabled. You need to disable the used",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_TRUE); AddPageControlObj(310,113,item,EthernetWarningPage); item = NewLabel(7, (uint8_t *)"processes and try later. do you want to",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_TRUE); AddPageControlObj(310,126,item,EthernetWarningPage); item = NewLabel(8, (uint8_t *)"disable the Distant control feature?",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_TRUE); AddPageControlObj(310,139,item,EthernetWarningPage); if(ETHERNET_CableConnectionStatus == 0) { sprintf((char *)str_address, "[IP Address : %s]",IPAddressAssigned); item = NewLabel(9,str_address,GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_FALSE); } else { item = NewLabel(9, (uint8_t *)"Network Cable is unplugged !!!",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_FALSE); } AddPageControlObj(310,160,item,EthernetWarningPage); EthernetWarningPage->CustomPostDraw = wUpdateConnectionStatus; } break; case ETHERNET_BCKMSG_PAGE: { EthernetWarningPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( EthernetWarningPage, ETHERNET_BCKMSG_PAGE ); item= NewButton(2, (uint8_t *)" OK ",return_bkgnd_from_errorpage); AddPageControlObj(185,212,item,EthernetWarningPage); item = NewIcon (3,error_icon,50,50,MOD_NullFunc); AddPageControlObj(185, 40, item, EthernetWarningPage); GL_SetPageHeader(EthernetWarningPage , (uint8_t *)"System : Warning"); item = NewLabel(4, (uint8_t *)"A Background process is already running, (uint8_t *)",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_TRUE); AddPageControlObj(310,100,item,EthernetWarningPage); item = NewLabel(5, (uint8_t *)"Background mode can not be disabled.",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_TRUE); AddPageControlObj(310,113,item,EthernetWarningPage); } default: break; } }
/** * @brief Start recording * @param None * @retval None */ static void RECORDER_Start (void) { GL_PageControls_TypeDef* item; uint8_t time[6]; RTC_TimeTypeDef RTC_TimeStructure; RTC_DateTypeDef RTC_DateStructure; /*Create file name */ if ( RTC_Error == 0) { RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure); RTC_GetDate(RTC_Format_BIN, &RTC_DateStructure); sprintf((char *)RecFileName, "Rec_%02d%02d%d%02d%02d%02d.wav", RTC_DateStructure.RTC_Date, RTC_DateStructure.RTC_Month, RTC_DateStructure.RTC_Year + 2000, RTC_TimeStructure.RTC_Hours, RTC_TimeStructure.RTC_Minutes, RTC_TimeStructure.RTC_Seconds); } else { /* Wait until one RNG number is ready */ while(RNG_GetFlagStatus(RNG_FLAG_DRDY)== RESET) { } RecoveryRecorderCounter = RNG_GetRandomNumber() & 0x7FFFFFFF; sprintf((char *)RecFileName, "Rec_%014d.wav", (int)RecoveryRecorderCounter); } RECORDER_GetDefaultDirectory(); strcat ((char *)REC_DefaultPath,"/"); strcat((char *)REC_DefaultPath, (char *)RecFileName); RefreshLabel(RecordPage , REC_FILNAME_ID, (uint8_t *)" "); if (AudioRecorder_Open(REC_DefaultPath)) { memset (RecFileName, 0, sizeof(RecFileName)); RefreshLabel(RecordPage , REC_FILNAME_ID, (uint8_t *)"Error Open File !"); return; } else { RefreshLabel(RecordPage , REC_FILNAME_ID, RecFileName); } /* Graphical update */ DestroyPageControl (RecordPage, REC_STRT_ID); RefreshPageControl(RecordPage, REC_STRT_ID); DestroyPageControl (RecordPage, REC_PLAY_ID); RefreshPageControl(RecordPage, REC_PLAY_ID); DestroyPageControl (RecordPage, REC_PAUSE_ID); RefreshPageControl(RecordPage, REC_PAUSE_ID); item = NewIcon (REC_STOP_ID, rec_stop_icon, 40, 40, RECORDER_Stop); AddPageControlObj(170,135,item, RecordPage); RefreshPageControl(RecordPage, REC_STOP_ID); item = NewIcon (REC_PAUSE_ID, rec_pause_icon, 40, 40, RECORDER_Pause); AddPageControlObj(110,135,item, RecordPage); RefreshPageControl(RecordPage, REC_PAUSE_ID); item = NewIcon (REC_CANCEL_ID, rec_cancel_icon, 40, 40, RECORDER_Cancel); AddPageControlObj(50,135,item, RecordPage); RefreshPageControl(RecordPage, REC_CANCEL_ID); sprintf((char *)time, "%02d:%02d", 0, 0); RefreshLabel(RecordPage, REC_TIME_ID, time); REC_GL_State = REC_GL_RECORDING; Recorder_UsedStorage = REC_DefaultPath[0]; AudioRecorder_Start(); }
static void RECORDER_CreatePage(uint8_t Page) { GL_PageControls_TypeDef* item; GL_PageControls_TypeDef* TimeInfo; GL_PageControls_TypeDef* ExitEventButton; GL_ComboBoxGrp_TypeDef* pTmp; uint8_t path[129]; GL_SetBackColor( GL_White ); GL_SetTextColor( GL_Blue ); switch (Page) { case RECORDER_MAIN_PAGE: { RecorderMainPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( RecorderMainPage, RECORDER_MAIN_PAGE ); item = NewIcon (REC_MAINICON_ID, recorder_icon,50,50,MOD_NullFunc); AddPageControlObj(185,40,item,RecorderMainPage); GL_SetMenuItem(RecorderMainPage, (uint8_t *)"Start Recorder",0, go_to_record_page ); GL_SetMenuItem(RecorderMainPage,(uint8_t *)"Settings",1, go_to_settings_page ); GL_SetMenuItem(RecorderMainPage,(uint8_t *)"Return",2, return_to_menu ); GL_SetPageHeader(RecorderMainPage , (uint8_t *)"Recorder Menu"); } break; case RECORDER_RECORD_PAGE: { RECORDER_GetDefaultDirectory(); /* Store selected settings */ MOD_GetParam(RECORDER_SETTINGS_MEM , &RecCfg.d32); switch (RecCfg.b.SampleRate) { case 0: case 1: RecorderSampleRate = 8000; break; case 2: RecorderSampleRate = 16000; break; } /* Deinit */ AudioRecorder_DeInit(); /* Initialize the recorder */ AudioRecorder_Init(RecorderSampleRate); RecordPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( RecordPage, RECORDER_RECORD_PAGE ); GL_SetPageHeader(RecorderMainPage , (uint8_t *)"Recorder"); /* Static display */ item = NewIcon (REC_MICLOGO_ID , rec_mic_logo, 110, 180, MOD_NullFunc); AddPageControlObj(300, 30, item, RecordPage); /*------------- Control icons */ ExitEventButton = NewButton(REC_RECEXIT_ID, (uint8_t *)" Return ", Exit_recorder); AddPageControlObj(195, 212, ExitEventButton, RecordPage); TimeInfo = NewLabel(REC_TIME_ID, (uint8_t *)"00:00", GL_HORIZONTAL, GL_FONT_BIG, GL_Red, GL_FALSE); AddPageControlObj(130,80, TimeInfo, RecordPage); item= NewLabel(REC_FILNAME_ID,(uint8_t *)"Press Record to start",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_FALSE); AddPageControlObj(170,40, item, RecordPage); item = NewIcon (REC_STRT_ID, rec_start_icon, 40, 40, RECORDER_Start); AddPageControlObj(170,135,item, RecordPage); item = NewIcon (REC_PAUSE_ID, rec_pause_icon, 40, 40, MOD_NullFunc); AddPageControlObj(110,135,item, RecordPage); item = NewIcon (REC_PLAY_ID, rec_play_icon, 40, 40, RECORDER_Play); AddPageControlObj(50,135,item, RecordPage); } break; case RECORDER_SETTINGS_PAGE: { MOD_GetParam(RECORDER_SETTINGS_MEM , &RecCfg.d32); SettingsPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( SettingsPage, RECORDER_RECORD_PAGE ); GL_SetPageHeader( SettingsPage , (uint8_t *)"Recorder Settings"); /* Exit button */ ExitEventButton = NewButton(1, (uint8_t *)" OK ", return_from_settings); AddPageControlObj(195, 212, ExitEventButton, SettingsPage); item = NewLabel(2, (uint8_t *)"Storage :", GL_HORIZONTAL, GL_FONT_SMALL, GL_Black, GL_FALSE); AddPageControlObj(260, 140, item, SettingsPage); item = NewButton(3, (uint8_t *)"...", Sel_folder); AddPageControlObj(120 , 150, item, SettingsPage); Check_DefaultPath((char *)path); if(strlen((char *)path) > REC_DST_PATH_LENGTH) { path[REC_DST_PATH_LENGTH - 2] = '.'; path[REC_DST_PATH_LENGTH - 1] = '.'; path[REC_DST_PATH_LENGTH] = 0; } item = NewLabel(4, path, GL_HORIZONTAL, GL_FONT_SMALL, GL_Blue, GL_FALSE); AddPageControlObj(260, 155, item, SettingsPage); /* Format selection settings */ item = NewLabel(4, (uint8_t *)"Audio Format: ", GL_HORIZONTAL, GL_FONT_SMALL, GL_Black, GL_FALSE); AddPageControlObj(260, 50, item, SettingsPage); item = NewComboBoxGrp(5); AddComboOption (item->objPTR, (uint8_t *)" PCM Wav ", set_encoder_wav); AddPageControlObj( 260, 65, item, SettingsPage); /* Sample Rate selection settings */ item = NewLabel(6, (uint8_t *)"Sample Rate:", GL_HORIZONTAL, GL_FONT_SMALL, GL_Black, GL_FALSE); AddPageControlObj(260, 95, item, SettingsPage); item = NewComboBoxGrp(7); AddComboOption (item->objPTR, (uint8_t *)" 8000 Hz ", MOD_NullFunc); AddComboOption (item->objPTR, (uint8_t *)" 16000 Hz ", MOD_NullFunc); AddPageControlObj( 260, 110, item, SettingsPage); pTmp = (GL_ComboBoxGrp_TypeDef*)(item->objPTR); if ((RecCfg.b.SampleRate > 0) && (RecCfg.b.SampleRate < 3)) { pTmp->ComboOptions[0]->IsActive = GL_FALSE; pTmp->ComboOptions[RecCfg.b.SampleRate -1]->IsActive = GL_TRUE; } } break; case RECORDER_ERROR_PAGE: { RecorderErrorPage = malloc(sizeof(GL_Page_TypeDef)); Create_PageObj( RecorderErrorPage, RECORDER_ERROR_PAGE ); ExitEventButton= NewButton(2, (uint8_t *)" OK ",return_from_errorpage); AddPageControlObj(185,212,ExitEventButton,RecorderErrorPage); item = NewIcon (3,error_icon,50,50,MOD_NullFunc); AddPageControlObj(185, 40, item, RecorderErrorPage); GL_SetPageHeader(RecorderErrorPage , (uint8_t *)"Audio Recorder : Error"); item = NewLabel(4,(uint8_t *)"An Audio process is already running in ",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_TRUE); AddPageControlObj(310,100,item,RecorderErrorPage); item = NewLabel(5,(uint8_t *)"background, Please stop it and try again.",GL_HORIZONTAL,GL_FONT_SMALL,GL_Black, GL_TRUE); AddPageControlObj(310,113,item,RecorderErrorPage); } break; default: break; } }
/** * Create the screen */ void ScreenOptions_Create(void) { Create_PageObj(s_pThisScreen); /* * Create the UI widgets */ GL_PageControls_TypeDef* lblTitle = Widget_NewLabel("Settings", LCD_COLOR_WHITE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_16x24, 0); GL_PageControls_TypeDef* lblDirections1 = Widget_NewLabel("Tap to select", LCD_COLOR_WHITE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_8x12Bold, 0); GL_PageControls_TypeDef* lblDirections2 = Widget_NewLabel("setting changes value", LCD_COLOR_WHITE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_8x12Bold, 0); s_lblStatus = Widget_NewLabel("Tap setting to exit", LCD_COLOR_WHITE, LCD_COLOR_BLACK, 0, GL_FONTOPTION_8x12Bold, 0); GL_PageControls_TypeDef* btnOptionsBigButton = Widget_NewBigButtonOptions(); GL_PageControls_TypeDef* btnAdvanced = NewButton(15, " Advanced ", advanced_Click); GL_PageControls_TypeDef* btnFunctions = NewButton(17, "Keyboard Fn", functionEditButton_Click); GL_PageControls_TypeDef* btnPrograms = NewButton(18, " Screen Fn ", programEditButton_Click); GL_PageControls_TypeDef* btnTags = NewButton(19, " <Tags> ", tagEditButton_Click); GL_PageControls_TypeDef* btnFilter = NewButton(20, " Filter ", Screen_filter_Click); /* * Place the widgets onto the screen */ // Title AddPageControlObj( 0, 0, lblTitle, s_pThisScreen); AddPageControlObj(115, 0, lblDirections1, s_pThisScreen); AddPageControlObj(115, 10, lblDirections2, s_pThisScreen); // Populate the options buttons: for (int i = START_BASIC_OPTIONS; i < END_BASIC_OPTIONS; i++) { GL_PageControls_TypeDef* btnOption = NewButton(ID_OPTION_START + i, Options_GetName(i), optionButton_Click); int x = (i / BUTTONS_PER_COLUMN) * COLUMN_WIDTH; int y = (i % BUTTONS_PER_COLUMN) * SPACE_PER_BUTTON_Y + FIRST_BUTTON_Y; AddPageControlObj(x, y, btnOption, s_pThisScreen); } // Button Row AddPageControlObj(0, LCD_HEIGHT - 42, btnOptionsBigButton, s_pThisScreen); AddPageControlObj(0, LCD_HEIGHT - 60, s_lblStatus, s_pThisScreen); AddPageControlObj(220, FIRST_BUTTON_Y, btnAdvanced, s_pThisScreen); AddPageControlObj(220, FIRST_BUTTON_Y + SPACE_PER_BUTTON_Y, btnFunctions, s_pThisScreen); AddPageControlObj(220, FIRST_BUTTON_Y + 2 * SPACE_PER_BUTTON_Y, btnPrograms, s_pThisScreen); AddPageControlObj(220, FIRST_BUTTON_Y + 3 * SPACE_PER_BUTTON_Y, btnTags, s_pThisScreen); AddPageControlObj(220, FIRST_BUTTON_Y + 4 * SPACE_PER_BUTTON_Y, btnFilter, s_pThisScreen); }