static void displayAGCVariables(int RSL) { // Display AGC Variables for Testing / Troubleshooting //GL_SetTextColor(LCD_COLOR_RED); //GL_SetBackColor(LCD_COLOR_BLACK); //char test2[7]; //intToCommaString((int)AGC_Mag, test2, 7); //GL_PrintString(75, 80, test2, 0); GL_SetFont(GL_FONTOPTION_8x16); GL_SetTextColor(LCD_COLOR_RED); GL_SetBackColor(LCD_COLOR_BLACK); char test3[3]; intToCommaString(PGAGain, test3, 3); GL_PrintString(110, 80, test3, 0); GL_SetTextColor(LCD_COLOR_RED); GL_SetBackColor(LCD_COLOR_BLACK); char test4[5]; intToCommaString(AGC_Signal, test4, 5); GL_PrintString(180, 80, test4, 0); GL_SetTextColor(LCD_COLOR_RED); GL_SetBackColor(LCD_COLOR_BLACK); char test5[5]; intToCommaString(RSL, test5, 5); GL_PrintString(277, 80, test5, 0); }
static void insideDrawHandler(GL_PageControls_TypeDef* pThis, _Bool force, int relX, int relY) { // Setup impossible values (at least for the idx) static UserModeType previousUserMode = -1; static int16_t previousRxTx = -1; UserModeType curUserMode = Mode_GetCurrentUserMode(); int16_t curRxTx = RxTx_InTxMode(); // Redraw only when needed: _Bool redrawUserMode = force || curUserMode != previousUserMode; _Bool redrawRxTx = force || curRxTx != previousRxTx; // Draw the user mode if (redrawUserMode) { GL_SetFont(GL_FONTOPTION_8x12Bold); GL_SetTextColor(BIGBUTTON_COLOR_NORMAL_TEXT); GL_SetBackColor(BIGBUTTON_COLOR_NORMAL_BACK); int writeX = relX + OFFSETX_TEXT; int writeY = relY + OFFSETY_MODE; GL_PrintString(writeX, writeY, Mode_GetCurrentUserModeName(), 0); previousUserMode = curUserMode; } // Draw Rx/Tx if (redrawRxTx) { GL_SetFont(GL_FONTOPTION_8x12Bold); int writeX = relX + OFFSETX_TEXT; int writeY = relY + OFFSETY_RXTX; if (RxTx_InRxMode()) { GL_SetBackColor(LCD_COLOR_GREEN); GL_SetTextColor(LCD_COLOR_BLACK); GL_PrintString(writeX, writeY, " RX ", 0); } else { GL_SetBackColor(LCD_COLOR_RED); GL_SetTextColor(LCD_COLOR_WHITE); GL_PrintString(writeX, writeY, " TX ", 0); } previousRxTx = curRxTx; } }
static void drawHandler(GL_PageControls_TypeDef* pThis, _Bool force) { LabelData *pInstData = getInstDataFromPageCtrl(pThis); // Check if a call to Widget_ChangeLabelText() has happened: _Bool change = 0; // Allow code to update itself (via an update handler, if any). if (pInstData->pUpdateHandler != 0) { change |= pInstData->pUpdateHandler(pThis, force); } change |= pInstData->isRedrawRequired; int x = pThis->objCoordinates.MinX; int y = pThis->objCoordinates.MinY; // Redraw? if (force || change) { GL_SetTextColor(pInstData->textColor); GL_SetBackColor(pInstData->backColor); GL_SetFont(pInstData->font); GL_PrintString(x, y, pInstData->strText, pInstData->isTransparent); } pInstData->isRedrawRequired = 0; }
void ClearTextDisplay(void) { int x; int y; GL_SetBackColor(LCD_COLOR_BLACK); for (row = FIRSTROW; row < LASTROW+1; row++) { y = OFFSETY_ONAIR + (row-1)*dy; for (col = FIRSTCOL; col <= LASTCOL; col++) { x = OFFSETX_ONAIR + (col-1)*dx; GL_PrintChar(x,y,BLANK,0); } } GL_SetBackColor(LCD_COLOR_WHITE); InitTextDisplay (); }
static void displayFrequencyOffsetText(_Bool force) { // Update the frequency offset displayed (text): static double oldSelectedFreq = -1; static double old_m_SQOpen = -1; if (force || oldSelectedFreq != NCO_Frequency || old_m_SQOpen != m_SQOpen) { oldSelectedFreq = NCO_Frequency; old_m_SQOpen = m_SQOpen; int textY = FFT_HEIGHT - 18; int numberX = 4 * CHARACTER_WIDTH; int labelX = 1; GL_SetFont(GL_FONTOPTION_8x16); GL_SetBackColor(LCD_COLOR_BLACK); GL_SetTextColor(LCD_COLOR_WHITE); GL_PrintString(labelX, textY, "AF", 0); // Display location on label. if (m_SQOpen == 0) GL_SetTextColor(LCD_COLOR_RED); else GL_SetTextColor(LCD_COLOR_GREEN); char number[MAX_FREQ_DIGITS + 1]; intToCommaString((int) NCO_Frequency, number, MAX_FREQ_DIGITS + 1); GL_PrintString(numberX, textY, number, 0); } }
// Change to a new screen. void Screen_ShowScreen(GL_Page_TypeDef *pNewScreen) { debug(GUI, "Screen_ShowScreen:1\n"); assert(pNewScreen != 0); // Break out if already on this screen. debug(GUI, "Screen_ShowScreen:2\n"); if (pNewScreen == s_pCurrentScreen) { debug(GUI, "Screen_ShowScreen:3\n"); return; } debug(GUI, "Screen_ShowScreen:4\n"); if (s_pCurrentScreen != 0) { debug(GUI, "Screen_ShowScreen:5\n"); s_pCurrentScreen->ShowPage(s_pCurrentScreen, GL_FALSE); debug(GUI, "Screen_ShowScreen:6\n"); } GL_Clear(LCD_COLOR_BLACK); GL_SetBackColor(LCD_COLOR_BLACK); GL_SetTextColor(LCD_COLOR_WHITE); // Second parameter as true forces the screen to redraw itself // as opposed to allowing it choose what to redraw based on need. pNewScreen->ShowPage(pNewScreen, GL_TRUE); debug(GUI, "Screen_ShowScreen:7\n"); s_pCurrentScreen = pNewScreen; debug(GUI, "Screen_ShowScreen:8\n"); // set default waterfall/spectrum display }
static void insideDrawHandler(GL_PageControls_TypeDef* pThis, _Bool force, int relX, int relY) { // Setup impossible values (as much as possible static BandPreset previousBand = -1; static uint32_t previousFreq = -1; static uint32_t previousStep = -1; BandPreset curBand = FrequencyManager_GetSelectedBand(); uint32_t curFreq = FrequencyManager_GetCurrentFrequency(); uint32_t curStep = FrequencyManager_GetFrequencyStepSize(); // Redraw only when needed: _Bool redrawBand = force || curBand != previousBand; _Bool redrawFreq = force || curFreq != previousFreq || curStep != previousStep; // Draw the band if (redrawBand) { GL_SetFont(GL_FONTOPTION_8x12Bold); GL_SetTextColor(BIGBUTTON_COLOR_NORMAL_TEXT); GL_SetBackColor(BIGBUTTON_COLOR_NORMAL_BACK); int writeX = relX + OFFSETX_TEXT; int writeY = relY + OFFSETY_BAND; GL_PrintString(writeX, writeY, FrequencyManager_GetBandName(FrequencyManager_GetSelectedBand()), 0); previousBand = curBand; } // Draw the Frequency if (redrawFreq) { GL_SetFont(GL_FONTOPTION_8x12Bold); GL_SetTextColor(BIGBUTTON_COLOR_EDIT_TEXT); GL_SetBackColor(BIGBUTTON_COLOR_EDIT_BACK); int writeX = relX + OFFSETX_TEXT; int writeY = relY + OFFSETY_FREQ; displayFrequency(FrequencyManager_GetCurrentFrequency(), writeX, writeY, FrequencyManager_GetFrequencyStepSize()); previousFreq = curFreq; previousStep = curStep; } }
static void insideDrawHandler(GL_PageControls_TypeDef* pThis, _Bool force, int relX, int relY) { // Setup impossible values (at least for the idx) static int lastOptIdx = -1; static int16_t lastOptValue = -30215; // Random-ish number int selOptIdx = Options_GetSelectedOption(); int16_t value = Options_GetValue(selOptIdx); // Redraw only when needed: _Bool redrawName = force || selOptIdx != lastOptIdx; _Bool redrawValue = force || redrawName || lastOptValue != value; // Change name display if (redrawName) { GL_SetFont(GL_FONTOPTION_8x12Bold); GL_SetTextColor(BIGBUTTON_COLOR_NORMAL_TEXT); GL_SetBackColor(BIGBUTTON_COLOR_NORMAL_BACK); GL_PrintString(relX + OFFSETX_OPTION, relY + OFFSETY_OPTION, Options_GetName(selOptIdx), 0); lastOptIdx = selOptIdx; } // Change value display if (redrawValue) { #define MAX_LEN 10 char numberStr[MAX_LEN]; intToCommaString(value, numberStr, MAX_LEN); GL_SetFont(GL_FONTOPTION_8x12Bold); GL_SetTextColor(BIGBUTTON_COLOR_EDIT_TEXT); GL_SetBackColor(BIGBUTTON_COLOR_EDIT_BACK); GL_PrintString(relX + OFFSETX_VALUE, relY + OFFSETY_VALUE, numberStr, 0); lastOptValue = value; } }
void GL_TestDisplayScreen(void) { #if 0 LCD_Clear(LCD_COLOR_BLUE); /* * Test fonts */ _Bool isTransparent = 1; GL_SetBackColor(LCD_COLOR_DGREEN); GL_SetTextColor(LCD_COLOR_YELLOW); GL_SetFont(GL_FONTOPTION_16x24); GL_PrintString(10, 10, "|/-\\ Hello World! abc&ABC", isTransparent); GL_SetFont(GL_FONTOPTION_12x12); GL_PrintString(10, 60, "|/-\\ Hello World! abc&ABC", isTransparent); GL_SetFont(GL_FONTOPTION_8x12); GL_PrintString(10, 100, "|/-\\ Hello World! abc&ABC", isTransparent); GL_SetFont(GL_FONTOPTION_8x12Bold); GL_PrintString(10, 140, "|/-\\ Hello World! abc&ABC", isTransparent); GL_SetFont(GL_FONTOPTION_8x16); GL_PrintString(10, 160, "|/-\\ Hello World! abc&ABC", isTransparent); GL_SetFont(GL_FONTOPTION_8x8); GL_PrintString(10, 200, "|/-\\ Hello World! abc&ABC", isTransparent); volatile int a = 0; while (1) a ++; #endif }
static void displaySMeter(int RSL) { int x = 80; int y = 68; LCD_SetDisplayWindow(x, y, SMETER_HEIGHT, FFT_WIDTH); LCD_WriteRAM_PrepareDir(LCD_WriteRAMDir_Down); int Signal_Level = ((RSL + 120) * 26) / 10; for (int x = 0; x < FFT_WIDTH; x++) { for (int y = 0; y < SMETER_HEIGHT; y++) { if (x <= Signal_Level) { LCD_WriteRAM(LCD_COLOR_GREEN); } else { LCD_WriteRAM(LCD_COLOR_DGRAY); } } } char SMeter$[7]; if (Signal_Level < 120) { if (Signal_Level < 0) Signal_Level = 0; int SLevel = Signal_Level / 12; sprintf(SMeter$, "S%i ", SLevel); } else { int SLevel = 9; int R = (Signal_Level - 100) / 3; sprintf(SMeter$, "S%i+%2i", SLevel, R); } GL_SetBackColor(LCD_COLOR_BLACK); GL_SetTextColor(LCD_COLOR_WHITE); GL_PrintString(1, 64, SMeter$, 0); }
static void WidgetFFT_DrawHandler(GL_PageControls_TypeDef* pThis, _Bool force) { // Bail if nothing to draw. if (!force && !DSP_Flag) { return; } int x = pThis->objCoordinates.MinX; int y = pThis->objCoordinates.MinY; /* * Calculate the data to draw: * - Use FFT_Magnitude[0..127] which is 0 to +4kHz of frequency * (don't use last half which is -4kHz to 0kHz) * - Scale the values up to fill a wider portion of the display. * (by averaging with neighboring data). This helps allow the * user to tap on frequencies to select them with better resolution. * - Average with "old" data from the previous pass to give it an * effective time-based smoothing (as in, display does not change * as abruptly as it would when using new data samples each time). */ //uint8_t FFT_Display[256]; static uint8_t FFT_Output[128]; // static because use last rounds data now. // TODO: Where are all these FFT constants from? for (int16_t j = 0; j < 128; j++) { // Changed for getting right display with SR6.3 // Convert from Q15 (fractional numeric representation) into integer FFT_Output[j] = (uint8_t) (6 * log((float32_t) (FFT_Magnitude[j] + 1))); if (FFT_Output[j] > 64) FFT_Output[j] = 64; FFT_Display[2 * j] = FFT_Output[j]; // Note that calculation uses values from last pass through. FFT_Display[2 * j + 1] = 0; //FFT_Display[2 * j + 1] = (FFT_Output[j] + FFT_Output[j + 1]) / 2; } /* * Display the FFT * - Drop the bottom 8, and top 8 frequency-display bins to discard * noisy sections near band edges due to filtering. */ float selectedFreqX = (float) (NCO_Frequency - 125) / 15.625; if (selectedFreqX < 0) { selectedFreqX = 0; } // Draw the FFT using direct memory writes (fast). LCD_SetDisplayWindow(x, y, FFT_HEIGHT, FFT_WIDTH); LCD_WriteRAM_PrepareDir(LCD_WriteRAMDir_Down); for (int x = 0; x < FFT_WIDTH; x++) { // Plot this column of the FFT. for (int y = 0; y < FFT_HEIGHT; y++) { // Draw red line for selected frequency if (x == (int) selectedFreqX) { // Leave some white at the top if (y <= SELFREQ_ADJ) { LCD_WriteRAM(LCD_COLOR_WHITE); } else { LCD_WriteRAM(LCD_COLOR_RED); } } // Draw data else if (FFT_HEIGHT - y < FFT_Display[x + 8]) { LCD_WriteRAM(LCD_COLOR_BLUE); } // Draw background else { LCD_WriteRAM(LCD_COLOR_WHITE); } } } // Update the frequency offset displayed (text): static double oldSelectedFreq = -1; if (force || oldSelectedFreq != NCO_Frequency) { oldSelectedFreq = NCO_Frequency; int textY = y + FFT_HEIGHT + TEXT_OFFSET_BELOW_FFT; int numberX = x + FFT_WIDTH - MAX_FREQ_DIGITS * CHARACTER_WIDTH; int labelX = numberX - CHARACTER_WIDTH * 8; // 7=# letters in label w/ a space GL_SetFont(GL_FONTOPTION_8x16); GL_SetBackColor(LCD_COLOR_BLACK); GL_SetTextColor(LCD_COLOR_WHITE); GL_PrintString(labelX, textY, "Offset:", 0); // Display location on label. GL_SetTextColor(LCD_COLOR_RED); char number[MAX_FREQ_DIGITS + 1]; intToCommaString((int)NCO_Frequency, number, MAX_FREQ_DIGITS + 1); GL_PrintString(numberX, textY, number, 0); } DSP_Flag = 0; // added per Charley }
static void drawHandler(GL_PageControls_TypeDef* pThis, _Bool force) { // Setup unlikely values to start static uint32_t lastOnAirHash = 0; static uint32_t lastTxHash = 0; static uint32_t lastKeyboardHash = 0; static uint32_t lastCallHash = 0; static uint32_t lastNameHash = 0; extern unsigned char NewChar; // uint32_t curOnAirHash = calculateStringHash((char*) LCD_buffer); uint32_t curTxHash = calculateStringHash(XmitBuffer); uint32_t curKeyboardHash = calculateStringHash((char*) kybd_string); uint32_t curCallHash = calculateStringHash(Get_Contact(0)); uint32_t curNameHash = calculateStringHash(Get_Contact(1)); // Redraw only when needed: //_Bool redrawTitle = force; _Bool redrawOnAirBuffer = force || NewChar != 0; // _Bool redrawOnAirBuffer = force || lastOnAirHash != curOnAirHash; _Bool redrawTxBuffer = force || lastTxHash != curTxHash; _Bool redrawKeyboardBuffer = force || lastKeyboardHash != curKeyboardHash; _Bool redrawCallBuffer = force || lastCallHash != curCallHash; _Bool redrawNameBuffer = force || lastNameHash != curNameHash; int x = pThis->objCoordinates.MinX; int y = pThis->objCoordinates.MinY; // Display title: //if (redrawTitle) { // // Title // GL_SetFont(FONT_TITLE); // GL_SetTextColor(TITLE_COLOUR); // GL_SetBackColor(TITLE_BACKGROUND); // GL_PrintString(x + OFFSETX_TITLE, y + OFFSETY_TITLE, "Rx/Tx/Keyboard PSK Data:", 0); // //} // Display Call if (redrawCallBuffer){ GL_SetFont(GL_FONTOPTION_8x16); GL_SetBackColor(LCD_COLOR_BLACK); GL_SetTextColor(LCD_COLOR_WHITE); GL_PrintString(25, 170,Get_Contact(0), 0); lastCallHash = curCallHash; } //Display Name if (redrawNameBuffer) { GL_SetFont(GL_FONTOPTION_8x16); GL_SetBackColor(LCD_COLOR_BLACK); GL_SetTextColor(LCD_COLOR_WHITE); //GL_PrintString(175, 170,Get_Contact(1), 0); GL_PrintString(151, 170,Get_Contact(1), 0); lastNameHash = curNameHash; } // Display the on-air buffer // (Was previously displayed in main()) GL_SetFont(FONT_DATA); GL_SetTextColor(DATA_COLOUR); GL_SetBackColor(DATA_BACKGROUND); if (redrawOnAirBuffer) { DisplayText (NewChar); NewChar = 0; // GL_PrintString(x + OFFSETX_ONAIR, y + OFFSETY_ONAIR, (char*) LCD_buffer, 0); // lastOnAirHash = curOnAirHash; } // Display the Queue if (redrawTxBuffer) { //GL_PrintString(x + OFFSETX_TX, y + OFFSETY_TX, XmitBuffer, 0); //lastTxHash = curTxHash; } // Display the keyboard buffer if (redrawKeyboardBuffer) { //GL_PrintString(x + OFFSETX_KEYBOARD, y + OFFSETY_KEYBOARD, (char*) kybd_string, 0); //lastKeyboardHash = curKeyboardHash; } }
/** * @brief Refresh the console window * @param None * @retval None */ void CONSOLE_Refresh (void) { uint16_t ptr , idx; if (ConsoleMainPage != NULL) { if (ConsoleMainPage->Page_ID == CONSOLE_MAIN_PAGE) { ClearTextZone(); /* copy msg table to labels */ if (Console_Msg.full == 0) { idx = 0; ptr = 0; if ( Console_Msg.ptr > CONSOLE_MAX_LINES) { ptr = Console_Msg.ptr - CONSOLE_MAX_LINES ; if (set_scroll == RESET) { GL_AddScroll (ConsoleMainPage, 293, 30, 140, ScrollUp, ScrollDown, 100); set_scroll = SET; } } while ( idx < CONSOLE_MAX_LINES ) { RefreshLabel (ConsoleMainPage, Label0->ID + idx, Console_Msg.msg[ptr + idx]); idx ++; } } else /* Message buffer full, new data are in the top */ { if (set_scroll == RESET) { GL_AddScroll (ConsoleMainPage, 293, 30, 140, ScrollUp, ScrollDown, 100); set_scroll = SET; } idx = 0; ptr = Console_Msg.ptr; while ( (idx < CONSOLE_MAX_LINES) && (ptr > 0)) { RefreshLabel (ConsoleMainPage, Label11->ID - idx, Console_Msg.msg[ptr - 1]); idx ++; ptr --; } ptr = CONSOLE_DEPDTH - 1; while (idx < CONSOLE_MAX_LINES) { RefreshLabel (ConsoleMainPage, Label11->ID - idx, Console_Msg.msg[ptr]); idx ++; ptr --; } } GL_SetBackColor (GL_White); } } }
/** * @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 Calibrate TouchScreen coordinates by LCD touch in 5 points * @param None * @retval None */ void TS_Calibration(void) { uint32_t coordinate_X1a = 0, coordinate_X2a = 0, coordinate_X3a = 0, coordinate_X4a = 0, coordinate_X5a = 0; uint32_t coordinate_Y1a = 0, coordinate_Y2a = 0, coordinate_Y3a = 0, coordinate_Y4a = 0, coordinate_Y5a = 0; uint32_t coordinate_X1b = 0, coordinate_X2b = 0, coordinate_X3b = 0, coordinate_X4b = 0, coordinate_X5b = 0; uint32_t coordinate_Y1b = 0, coordinate_Y2b = 0, coordinate_Y3b = 0, coordinate_Y4b = 0, coordinate_Y5b = 0; uint32_t coordinate_X1 = 0, coordinate_X2 = 0, coordinate_X3 = 0, coordinate_X4 = 0, coordinate_X5 = 0; uint32_t coordinate_Y1 = 0, coordinate_Y2 = 0, coordinate_Y3 = 0, coordinate_Y4 = 0, coordinate_Y5 = 0; uint16_t Xd1 = (LCD_Width / 2), Xd2 = 1 * (LCD_Width / 5), Xd3 = 4 * (LCD_Width / 5), Xd4 = 4 * (LCD_Width / 5), Xd5 = 1 * (LCD_Width / 5); uint16_t Yd1 = (LCD_Height / 2), Yd2 = 1 * (LCD_Height / 5), Yd3 = 1 * (LCD_Height / 5), Yd4 = 4 * (LCD_Height / 5), Yd5 = 4 * (LCD_Height / 5); double A = 0.0, B = 0.0, C = 0.0, D = 0.0, E = 0.0, F = 0.0; double d = 0.0, dx1 = 0.0, dx2 = 0.0, dx3 = 0.0, dy1 = 0.0, dy2 = 0.0, dy3 = 0.0; uint32_t X2_1 = 0, X2_2 = 0, X2_3 = 0, X2_4 = 0, X2_5 = 0; uint32_t Y2_1 = 0, Y2_2 = 0, Y2_3 = 0, Y2_4 = 0, Y2_5 = 0; uint32_t XxY_1 = 0, XxY_2 = 0, XxY_3 = 0, XxY_4 = 0, XxY_5 = 0; uint32_t XxXd_1 = 0, XxXd_2 = 0, XxXd_3 = 0, XxXd_4 = 0, XxXd_5 = 0; uint32_t YxXd_1 = 0, YxXd_2 = 0, YxXd_3 = 0, YxXd_4 = 0, YxXd_5 = 0; uint32_t XxYd_1 = 0, XxYd_2 = 0, XxYd_3 = 0, XxYd_4 = 0, XxYd_5 = 0; uint32_t YxYd_1 = 0, YxYd_2 = 0, YxYd_3 = 0, YxYd_4 = 0, YxYd_5 = 0; uint32_t alfa = 0, beta = 0, chi = 0, Kx = 0, Ky = 0, Lx = 0, Ly = 0; uint16_t epsilon = 0, fi = 0, Mx = 0, My = 0; GL_SetBackColor(GL_White); GL_SetTextColor(GL_Black); GL_Clear(White); GL_DisplayAdjStringLine(3 * (LCD_Height / 7), LCD_Width - 25, "Run Calibration.", GL_FALSE); GL_Delay(40); GL_DisplayAdjStringLine(3 * (LCD_Height / 7), LCD_Width - 25, "Run Calibration..", GL_FALSE); GL_Delay(40); GL_DisplayAdjStringLine(3 * (LCD_Height / 7), LCD_Width - 25, "Run Calibration...", GL_FALSE); GL_Delay(30); touch_done = 0; GL_Clear(White); GL_Cross( (LCD_Height / 2), (LCD_Width / 2) ); /* Absolute Central Point */ while ( touch_done == 0) { TSC_Read(); } coordinate_X1a = TSC_Value_X; coordinate_Y1a = TSC_Value_Y; GL_Delay(90); /* This is to catch only one touch event */ TSC_Init(); touch_done = 0; GL_Clear(White); GL_Cross(1*(LCD_Height / 5), 1*(LCD_Width / 5)); /* Nord-East Corner point */ while ( touch_done == 0) { TSC_Read(); } coordinate_X2a = TSC_Value_X; coordinate_Y2a = TSC_Value_Y; GL_Delay(90); /* This is to catch only one touch event */ TSC_Init(); touch_done = 0; GL_Clear(White); GL_Cross(1*(LCD_Height / 5), 4*(LCD_Width / 5)); /* Nord-West Corner */ while ( touch_done == 0) { TSC_Read(); } coordinate_X3a = TSC_Value_X; coordinate_Y3a = TSC_Value_Y; GL_Delay(90); /* This is to catch only one touch event */ TSC_Init(); touch_done = 0; GL_Clear(White); GL_Cross(4*(LCD_Height / 5), 4*(LCD_Width / 5)); /* Sud-West Corner */ while ( touch_done == 0) { TSC_Read(); } coordinate_X4a = TSC_Value_X; coordinate_Y4a = TSC_Value_Y; GL_Delay(90); /* This is to catch only one touch event */ TSC_Init(); touch_done = 0; GL_Clear(White); GL_Cross(4*(LCD_Height / 5), 1*(LCD_Width / 5)); /* Sud-East Corner point */ while ( touch_done == 0) { TSC_Read(); } coordinate_X5a = TSC_Value_X; coordinate_Y5a = TSC_Value_Y; GL_Delay(90); /* This is to catch only one touch event */ TSC_Init(); touch_done = 0; GL_Clear(White); GL_Cross( (LCD_Height / 2), (LCD_Width / 2) ); /* Absolute Central Point */ while ( touch_done == 0) { TSC_Read(); } coordinate_X1b = TSC_Value_X; coordinate_Y1b = TSC_Value_Y; GL_Delay(90); /* This is to catch only one touch event */ TSC_Init(); touch_done = 0; GL_Clear(White); GL_Cross(1*(LCD_Height / 5), 1*(LCD_Width / 5)); /* Nord-East Corner point */ while ( touch_done == 0) { TSC_Read(); } coordinate_X2b = TSC_Value_X; coordinate_Y2b = TSC_Value_Y; GL_Delay(90); /* This is to catch only one touch event */ TSC_Init(); touch_done = 0; GL_Clear(White); GL_Cross(1*(LCD_Height / 5), 4*(LCD_Width / 5)); /* Nord-West Corner */ while ( touch_done == 0) { TSC_Read(); } coordinate_X3b = TSC_Value_X; coordinate_Y3b = TSC_Value_Y; GL_Delay(90); /* This is to catch only one touch event */ TSC_Init(); touch_done = 0; GL_Clear(White); GL_Cross(4*(LCD_Height / 5), 4*(LCD_Width / 5)); /* Sud-West Corner */ while ( touch_done == 0) { TSC_Read(); } coordinate_X4b = TSC_Value_X; coordinate_Y4b = TSC_Value_Y; GL_Delay(90); /* This is to catch only one touch event */ TSC_Init(); touch_done = 0; GL_Clear(White); GL_Cross(4*(LCD_Height / 5), 1*(LCD_Width / 5)); /* Sud-East Corner point */ while ( touch_done == 0) { TSC_Read(); } coordinate_X5b = TSC_Value_X; coordinate_Y5b = TSC_Value_Y; GL_Delay(90); /* This is to catch only one touch event */ TSC_Init(); touch_done = 0; /* Average between X and Y coupled Touchscreen values */ coordinate_X1 = (coordinate_X1a + coordinate_X1b) / 2; coordinate_X2 = (coordinate_X2a + coordinate_X2b) / 2; coordinate_X3 = (coordinate_X3a + coordinate_X3b) / 2; coordinate_X4 = (coordinate_X4a + coordinate_X4b) / 2; coordinate_X5 = (coordinate_X5a + coordinate_X5b) / 2; coordinate_Y1 = (coordinate_Y1a + coordinate_Y1b) / 2; coordinate_Y2 = (coordinate_Y2a + coordinate_Y2b) / 2; coordinate_Y3 = (coordinate_Y3a + coordinate_Y3b) / 2; coordinate_Y4 = (coordinate_Y4a + coordinate_Y4b) / 2; coordinate_Y5 = (coordinate_Y5a + coordinate_Y5b) / 2; X2_1 = (coordinate_X1 * coordinate_X1); X2_2 = (coordinate_X2 * coordinate_X2); X2_3 = (coordinate_X3 * coordinate_X3); X2_4 = (coordinate_X4 * coordinate_X4); X2_5 = (coordinate_X5 * coordinate_X5); Y2_1 = (coordinate_Y1 * coordinate_Y1); Y2_2 = (coordinate_Y2 * coordinate_Y2); Y2_3 = (coordinate_Y3 * coordinate_Y3); Y2_4 = (coordinate_Y4 * coordinate_Y4); Y2_5 = (coordinate_Y5 * coordinate_Y5); XxY_1 = (coordinate_X1 * coordinate_Y1); XxY_2 = (coordinate_X2 * coordinate_Y2); XxY_3 = (coordinate_X3 * coordinate_Y3); XxY_4 = (coordinate_X4 * coordinate_Y4); XxY_5 = (coordinate_X5 * coordinate_Y5); XxXd_1 = ( coordinate_X1 * Xd1 ); XxXd_2 = ( coordinate_X2 * Xd2 ); XxXd_3 = ( coordinate_X3 * Xd3 ); XxXd_4 = ( coordinate_X4 * Xd4 ); XxXd_5 = ( coordinate_X5 * Xd5 ); YxXd_1 = ( coordinate_Y1 * Xd1 ); YxXd_2 = ( coordinate_Y2 * Xd2 ); YxXd_3 = ( coordinate_Y3 * Xd3 ); YxXd_4 = ( coordinate_Y4 * Xd4 ); YxXd_5 = ( coordinate_Y5 * Xd5 ); XxYd_1 = ( coordinate_X1 * Yd1 ); XxYd_2 = ( coordinate_X2 * Yd2 ); XxYd_3 = ( coordinate_X3 * Yd3 ); XxYd_4 = ( coordinate_X4 * Yd4 ); XxYd_5 = ( coordinate_X5 * Yd5 ); YxYd_1 = ( coordinate_Y1 * Yd1 ); YxYd_2 = ( coordinate_Y2 * Yd2 ); YxYd_3 = ( coordinate_Y3 * Yd3 ); YxYd_4 = ( coordinate_Y4 * Yd4 ); YxYd_5 = ( coordinate_Y5 * Yd5 ); alfa = X2_1 + X2_2 + X2_3 + X2_4 + X2_5; beta = Y2_1 + Y2_2 + Y2_3 + Y2_4 + Y2_5; chi = XxY_1 + XxY_2 + XxY_3 + XxY_4 + XxY_5; epsilon = coordinate_X1 + coordinate_X2 + coordinate_X3 + coordinate_X4 + coordinate_X5; fi = coordinate_Y1 + coordinate_Y2 + coordinate_Y3 + coordinate_Y4 + coordinate_Y5; Kx = XxXd_1 + XxXd_2 + XxXd_3 + XxXd_4 + XxXd_5; Ky = XxYd_1 + XxYd_2 + XxYd_3 + XxYd_4 + XxYd_5; Lx = YxXd_1 + YxXd_2 + YxXd_3 + YxXd_4 + YxXd_5; Ly = YxYd_1 + YxYd_2 + YxYd_3 + YxYd_4 + YxYd_5; Mx = Xd1 + Xd2 + Xd3 + Xd4 + Xd5; My = Yd1 + Yd2 + Yd3 + Yd4 + Yd5; d = 5 * ( ((double)alfa * beta) - ((double)chi * chi) ) + 2 * ((double)chi * epsilon * fi) - ((double)alfa * fi * fi ) - ( (double)beta * epsilon * epsilon ); dx1 = 5 * ( ((double)Kx * beta) - ((double)Lx * chi) ) + ((double)fi * ( ((double)Lx * epsilon) - ((double)Kx * fi) )) + ((double)Mx * ( ((double)chi * fi) - ((double)beta * epsilon) )); dx2 = 5 * ( ((double)Lx * alfa) - ((double)Kx * chi) ) + ((double)epsilon * ( ((double)Kx * fi) - ((double)Lx * epsilon) )) + ((double)Mx * ( ((double)chi * epsilon) - ((double)alfa * fi) )); dx3 = ((double)Kx * ( ((double)chi * fi) - ((double)beta * epsilon) )) + ((double)Lx * ( ((double)chi * epsilon) - ((double)alfa * fi) )) + ((double)Mx * ( ((double)alfa * beta) - ((double)chi * chi) )); dy1 = 5 * ( ((double)Ky * beta) - ((double)Ly * chi) ) + ((double)fi * ( ((double)Ly * epsilon) - ((double)Ky * fi) )) + ((double)My * ( ((double)chi * fi) - ((double)beta * epsilon) )); dy2 = 5 * ( ((double)Ly * alfa) - ((double)Ky * chi) ) + ((double)epsilon * ( ((double)Ky * fi) - ((double)Ly * epsilon) )) + ((double)My * ( ((double)chi * epsilon) - ((double)alfa * fi) )); dy3 = ((double)Ky * ( ((double)chi * fi) - ((double)beta * epsilon) )) + ((double)Ly * ( ((double)chi * epsilon) - ((double)alfa * fi) )) + ((double)My * ( ((double)alfa * beta) - ((double)chi * chi) )); A = dx1 / d; B = dx2 / d; C = dx3 / d; D = dy1 / d; E = dy2 / d; F = dy3 / d; /* To avoid computation with "double" variables A, B, C, D, E, F, we use the s32 variables A2, B2, C2, D2, E2, F2, multiplied for a Scale Factor equal to 100000 to retain the precision*/ A2 = (s32)(A * RESCALE_FACTOR); B2 = (s32)(B * RESCALE_FACTOR); C2 = (s32)(C * RESCALE_FACTOR); D2 = (s32)(D * RESCALE_FACTOR); E2 = (s32)(E * RESCALE_FACTOR); F2 = (s32)(F * RESCALE_FACTOR); GL_Clear(White); GL_DisplayAdjStringLine(3 * (LCD_Height / 7), 10 * (LCD_Width / 11), "Calibration done!", GL_FALSE); GL_Delay(25); /* Now show HOME Menu */ GL_Clear(White); calibration_done = 1; /********************* FLASH PROGRAMMING FOR SAVING "calibration_done" variable **********************/ TSC_FlashStatus = TSC_FLASH_COMPLETE; TSC_MemoryProgramStatus = PASSED; FlashFree_Address = CalibrationAddr; /* Unlock the Flash Program Erase controller */ TSC_FLASH_Unlock(); /* Erase Flash sectors ******************************************************/ #if defined(USE_STM3210C_EVAL) || defined(USE_STM32100E_EVAL) || defined(USE_STM3220F_EVAL) /* Clear All pending flags */ TSC_FLASH_ClearFlag( TSC_FLASH_FLAG_BSY | TSC_FLASH_FLAG_EOP | TSC_FLASH_FLAG_PGERR | TSC_FLASH_FLAG_WRPRTERR); /* Erase Last Flash Page */ TSC_FlashStatus = TSC_FLASH_ErasePage( FlashFree_Address ); #endif /* Writing calibration parameters to the Flash Memory */ TSC_FlashStatus = TSC_FLASH_ProgramWord( FlashFree_Address, calibration_done); /* Increasing Flash Memory Page Address */ FlashFree_Address = FlashFree_Address + 4; /* Writing Calibration Parameter */ TSC_FlashStatus = TSC_FLASH_ProgramWord( FlashFree_Address, A2); /* Increasing Flash Memory Page Address */ FlashFree_Address = FlashFree_Address + 4; /* Writing Calibration Parameter */ TSC_FlashStatus = TSC_FLASH_ProgramWord( FlashFree_Address, B2); /* Increasing Flash Memory Page Address */ FlashFree_Address = FlashFree_Address + 4; /* Writing Calibration Parameter */ TSC_FlashStatus = TSC_FLASH_ProgramWord( FlashFree_Address, C2); /* Increasing Flash Memory Page Address */ FlashFree_Address = FlashFree_Address + 4; /* Writing Calibration Parameter */ TSC_FlashStatus = TSC_FLASH_ProgramWord( FlashFree_Address, D2); /* Increasing Flash Memory Page Address */ FlashFree_Address = FlashFree_Address + 4; /* Writing Calibration Parameter */ TSC_FlashStatus = TSC_FLASH_ProgramWord( FlashFree_Address, E2); /* Increasing Flash Memory Page Address */ FlashFree_Address = FlashFree_Address + 4; /* Writing Calibration Parameter */ TSC_FlashStatus = TSC_FLASH_ProgramWord( FlashFree_Address, F2); /* Increasing Flash Memory Page Address */ FlashFree_Address = FlashFree_Address + 4; /* Reading Calibration Flag from the Flash Memory */ calibration_done = (*(__IO uint32_t*) CalibrationAddr) & 0x000000FF; }
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; } }