/** * @brief Display Camera demo hint * @param None * @retval None */ static void Camera_SetHint(void) { /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set Camera Demo description */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 90); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetFont(&Font24); BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"CAMERA EXAMPLE", CENTER_MODE); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, 30, (uint8_t *)" Press 3 fingers for next resolution ", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 45, (uint8_t *)"Press Top/Bottom screen to change brightness ", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 60, (uint8_t *)"Press Left/Right screen to change contrast ", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 75, (uint8_t *)"Press 2 fingers to change visual effect ", CENTER_MODE); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_DrawRect(10, 100, BSP_LCD_GetXSize() - 20, BSP_LCD_GetYSize() - 110); BSP_LCD_DrawRect(11, 101, BSP_LCD_GetXSize() - 22, BSP_LCD_GetYSize() - 112); }
/** * @brief Display LCD demo hint * @param None * @retval None */ static void LCD_SetHint(void) { /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set LCD Demo description */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 80); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetFont(&Font20); BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"LCD", CENTER_MODE); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, 20, (uint8_t *)"This example shows", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 35, (uint8_t *)"LCD Features, use", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 50, (uint8_t *)"BUTTON to display", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 65, (uint8_t *)"next page", CENTER_MODE); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_DrawRect(1, 82, BSP_LCD_GetXSize() - 3, BSP_LCD_GetYSize()- 84); BSP_LCD_DrawRect(2, 83, BSP_LCD_GetXSize() - 5, BSP_LCD_GetYSize()- 86); }
/** * @brief Display Audio demo hint * @param None * @retval None */ static void Audio_SetHint(void) { /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set Audio Demo description */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 90); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetFont(&Font24); BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"AUDIO EXAMPLE", CENTER_MODE); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, 30, (uint8_t *)"Press User button for next menu", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 45, (uint8_t *)"Press Top/Bottom screen to change Volume ", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 60, (uint8_t *)"Press Left/Right screen to change Frequency", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 75, (uint8_t *)"Press 2 fingers for Pause/Resume ", CENTER_MODE); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_DrawRect(10, 100, BSP_LCD_GetXSize() - 20, BSP_LCD_GetYSize() - 110); BSP_LCD_DrawRect(11, 101, BSP_LCD_GetXSize() - 22, BSP_LCD_GetYSize() - 112); }
/** * @brief Display LCD demo hint * @param None * @retval None */ static void LCD_SetHint(void) { /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set Joystick Demo description */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 55); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetFont(&Font24); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, 10, (uint8_t *)"LCD Demo", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 25, (uint8_t *)"Use User BUTTON to", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 40, (uint8_t *)"display next page", CENTER_MODE); BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); }
/** * @brief Display Audio Record demo hint * @param None * @retval None */ static void AudioRec_SetHint(void) { /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set Audio Demo description */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 90); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetFont(&Font24); BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"AUDIO RECORD EXAMPLE", CENTER_MODE); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, 30, (uint8_t *)"Press User button for next menu ", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 45, (uint8_t *)"Click on Joystick to start recording ", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 60, (uint8_t *)"Make sure jumpers are in the right state ", CENTER_MODE); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_DrawRect(10, 100, BSP_LCD_GetXSize() - 20, BSP_LCD_GetYSize() - 110); BSP_LCD_DrawRect(11, 101, BSP_LCD_GetXSize() - 22, BSP_LCD_GetYSize() - 112); }
/** * @brief Manages the DMA FIFO error event. * @param None * @retval None */ void BSP_AUDIO_OUT_Error_CallBack(void) { /* Display message on the LCD screen */ BSP_LCD_SetBackColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(0, LINE(14), (uint8_t *)" DMA ERROR ", CENTER_MODE); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); /* Stop the program with an infinite loop */ while (BSP_PB_GetState(BUTTON_KEY) != RESET) { return;} /* could also generate a system reset to recover from the error */ /* .... */ }
/** * @brief Display TS Demo Hint * @param None * @retval None */ static void Touchscreen_SetHint(void) { /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set Touchscreen Demo description */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 80); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetFont(&Font24); BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"Touchscreen", CENTER_MODE); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, 30, (uint8_t *)"Please use the Touchscreen to", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 45, (uint8_t *)"activate the colored circle", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 60, (uint8_t *)"inside the rectangle", CENTER_MODE); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_DrawRect(10, 90, BSP_LCD_GetXSize() - 20, BSP_LCD_GetYSize()- 100); BSP_LCD_DrawRect(11, 91, BSP_LCD_GetXSize() - 22, BSP_LCD_GetYSize()- 102); }
/** * @brief Display TS Demo Hint * @param None * @retval None */ static void Touchscreen_SetHint(void) { /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set Touchscreen Demo description */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 80); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetFont(&Font24); BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"Touchscreen", CENTER_MODE); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, 30, (uint8_t *)"Please use the Touchscreen to", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 45, (uint8_t *)"fill the colored circles according to pressure applied", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 60, (uint8_t *)"Up to 5 finger touch coordinates are displayed", CENTER_MODE); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_DrawRect(10, 90, BSP_LCD_GetXSize() - 20, BSP_LCD_GetYSize() - 100); BSP_LCD_DrawRect(11, 91, BSP_LCD_GetXSize() - 22, BSP_LCD_GetYSize() - 102); }
/** * @brief Test ACCELERATOR MEMS Hardware. * The main objective of this test is to check acceleration on 2 axis X and Y * @param None * @retval None */ void ACCELERO_MEMS_Test(void) { MEMS_SetHint(); /* Init Accelerometer Mems */ if(BSP_ACCELERO_Init() != HAL_OK) { BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(0, 115, (uint8_t*)"Initialization problem", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 130, (uint8_t*)"MEMS cannot be initialized", CENTER_MODE); return; } while (1) { ACCELERO_ReadAcc(); if(CheckForUserInput() > 0) { return; } } }
/** * @brief Draw the menu. * @param None * @retval None */ static void Draw_Menu(void) { /* Set background Layer */ BSP_LCD_SelectLayer(0); /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Draw color image */ BSP_LCD_DrawBitmap(0, 0, (uint8_t *)color2); /* Draw save image */ BSP_LCD_DrawBitmap(150, (BSP_LCD_GetYSize() - 50), (uint8_t *)save); /* Set Black as text color */ BSP_LCD_SetTextColor(LCD_COLOR_BLACK); /* Draw working window */ BSP_LCD_DrawRect(61, 0, (BSP_LCD_GetXSize()-61), (BSP_LCD_GetYSize()-60)); BSP_LCD_DrawRect(63, 3, (BSP_LCD_GetXSize()-66), (BSP_LCD_GetYSize()-66)); BSP_LCD_DrawRect(65, 5, (BSP_LCD_GetXSize()-70), (BSP_LCD_GetYSize()-70)); BSP_LCD_DrawRect(67, 7, (BSP_LCD_GetXSize()-74), (BSP_LCD_GetYSize()-74)); /* Draw size icons */ BSP_LCD_FillRect(60, (BSP_LCD_GetYSize()-48), 90, 48); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_FillCircle(75, (BSP_LCD_GetYSize()-24), 10); BSP_LCD_FillCircle(105, (BSP_LCD_GetYSize()-24), 5); BSP_LCD_FillCircle(135, (BSP_LCD_GetYSize()-24), 2); BSP_LCD_SetTextColor(LCD_COLOR_DARKRED); BSP_LCD_SetFont(&Font8); BSP_LCD_DisplayStringAt(210, (BSP_LCD_GetYSize()-55), (uint8_t *)"Color", LEFT_MODE); BSP_LCD_DisplayStringAt(210, (BSP_LCD_GetYSize()-45), (uint8_t *)"Size", LEFT_MODE); BSP_LCD_SetTextColor(LCD_COLOR_LIGHTMAGENTA); BSP_LCD_FillCircle(220, (BSP_LCD_GetYSize()-24), 2); }
/** * @brief Display audio play demo hint * @param format : structure containing informations of the file * @retval None */ static void AudioPlay_DisplayInfos(WAVE_FormatTypeDef * format) { uint8_t string[50] = {0}; sprintf((char *) string, "Sampling frequency : %ld Hz", format->SampleRate); BSP_LCD_DisplayStringAt(20, 100, string, CENTER_MODE); if (format->NbrChannels == 2) { sprintf((char *) string, "Format : %d bits stereo", format->BitPerSample); BSP_LCD_DisplayStringAt(20, 115, string, CENTER_MODE); } else if (format->NbrChannels == 1) { sprintf((char *) string, "Format : %d bits mono", format->BitPerSample); BSP_LCD_DisplayStringAt(20, 115, string, CENTER_MODE); } /* How to use Joystick for change speaker */ sprintf((char *) string, "Joystick Right for speaker only"); BSP_LCD_DisplayStringAt(20, 145, string, CENTER_MODE); sprintf((char *) string, "Joystick Left for headset only"); BSP_LCD_DisplayStringAt(20, 160, string, CENTER_MODE); }
/** * @brief Display SDRAM Demo Hint * @param None * @retval None */ static void SDRAM_SetHint(void) { /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set LCD Demo description */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 80); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_SetFont(&Font24); BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"SDRAM", CENTER_MODE); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, 30, (uint8_t *)"This example shows how to write", CENTER_MODE); BSP_LCD_DisplayStringAt(0, 45, (uint8_t *)"and read data on SDRAM", CENTER_MODE); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_DrawRect(10, 90, BSP_LCD_GetXSize() - 20, BSP_LCD_GetYSize() - 100); BSP_LCD_DrawRect(11, 91, BSP_LCD_GetXSize() - 22, BSP_LCD_GetYSize() - 102); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); }
/** * @brief Manages the DMA FIFO error event. * @param None * @retval None */ void BSP_AUDIO_OUT_Error_CallBack(void) { /* Display message on the LCD screen */ BSP_LCD_SetBackColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(0, LINE(12), (uint8_t *)" DMA ERROR ", CENTER_MODE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_ClearStringLine(10); /* Stop the program with an infinite loop */ while (1) {} /* could also generate a system reset to recover from the error */ /* .... */ }
static void Display_Description(void){ /* Set LCD Foreground Layer */ BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); BSP_LCD_SetFont(&LCD_DEFAULT_FONT); /* Clear the LCD */ BSP_LCD_SetBackColor(LCD_COLOR_WHITE);//Fondo de letras BSP_LCD_Clear(LCD_COLOR_WHITE);//Fondo de pantalla /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_DARKBLUE); /* Display LCD messages */ BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2.5, (uint8_t *)"Detector de SD", CENTER_MODE); BSP_LCD_DisplayStringAt(0, (BSP_LCD_GetYSize()/2.5)+25, (uint8_t *)"Buscando...", CENTER_MODE); /* Draw Bitmap */ //BSP_LCD_DrawBitmap((BSP_LCD_GetXSize() - 80) / 2, 65, (uint8_t *)stlogo); BSP_LCD_SetFont(&Font12); //Tamaño de letra BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - 20, (uint8_t *)"Diseno Microcontroladores. Universidad De Sevilla", CENTER_MODE); }
/** * @brief Display main demo messages * @param None * @retval None */ static void Display_DemoDescription(void) { uint8_t desc[50]; /* Set LCD Foreground Layer */ BSP_LCD_SelectLayer(1); BSP_LCD_SetFont(&LCD_DEFAULT_FONT); /* Clear the LCD */ BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_Clear(LCD_COLOR_WHITE); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_DARKBLUE); /* Display LCD messages */ BSP_LCD_DisplayStringAt(0, 10, (uint8_t*)"STM32F429I BSP", CENTER_MODE); BSP_LCD_SetFont(&Font16); BSP_LCD_DisplayStringAt(0, 35, (uint8_t*)"Drivers examples", CENTER_MODE); /* Draw Bitmap */ BSP_LCD_DrawBitmap((BSP_LCD_GetXSize() - 80)/2, 65, (uint8_t *)stlogo); BSP_LCD_SetFont(&Font8); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()- 20, (uint8_t*)"Copyright (c) STMicroelectronics 2014", CENTER_MODE); BSP_LCD_SetFont(&Font12); BSP_LCD_SetTextColor(LCD_COLOR_BLUE); BSP_LCD_FillRect(0, BSP_LCD_GetYSize()/2 + 15, BSP_LCD_GetXSize(), 60); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_SetBackColor(LCD_COLOR_BLUE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 + 30, (uint8_t*)"Press User Button to start:", CENTER_MODE); sprintf((char *)desc,"%s example", BSP_examples[DemoIndex].DemoName); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize()/2 + 45, (uint8_t *)desc, CENTER_MODE); }
/** * @brief Audio IN Error callback function. * @param None * @retval None */ void BSP_AUDIO_IN_Error_Callback(void) { /* This function is called when an Interrupt due to transfer error on or peripheral error occurs. */ /* Display message on the LCD screen */ BSP_LCD_SetBackColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(0, LINE(14), (uint8_t *)"TRANSFER ERROR", CENTER_MODE); /* Stop the program with an infinite loop */ while (BSP_PB_GetState(BUTTON_USER) != PB_RESET) { return; } /* could also generate a system reset to recover from the error */ /* .... */ }
void setTitle(char *title) { xSemaphoreTake(mutex_drawer, portMAX_DELAY); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_FillRect(0, 10, BSP_LCD_GetXSize(), 20); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); BSP_LCD_DisplayStringAt(0, 5, (uint8_t*) title, CENTER_MODE); xSemaphoreGive(mutex_drawer); }
/** * @brief Draws the menu. * @param None * @retval None */ static void Draw_Menu(void) { /* Set background Layer */ BSP_LCD_SelectLayer(0); /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); if (BSP_LCD_GetXSize() == 640) { /* Draw color image */ BSP_LCD_DrawBitmap(0, 0, (uint8_t *)color); } else { /* Draw color image */ BSP_LCD_DrawBitmap(0, 0, (uint8_t *)color2); } /* Draw save image */ BSP_LCD_DrawBitmap(310, (BSP_LCD_GetYSize() - 50), (uint8_t *)save); /* Set Black as text color */ BSP_LCD_SetTextColor(LCD_COLOR_BLACK); /* Draw working window */ BSP_LCD_DrawRect(61, 0, (BSP_LCD_GetXSize() - 61), (BSP_LCD_GetYSize() - 60)); BSP_LCD_DrawRect(63, 3, (BSP_LCD_GetXSize() - 66), (BSP_LCD_GetYSize() - 66)); BSP_LCD_DrawRect(65, 5, (BSP_LCD_GetXSize() - 70), (BSP_LCD_GetYSize() - 70)); BSP_LCD_DrawRect(67, 7, (BSP_LCD_GetXSize() - 74), (BSP_LCD_GetYSize() - 74)); /* Draw size icons */ BSP_LCD_FillRect(60, (BSP_LCD_GetYSize() - 48), 250, 48); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_FillCircle(95, (BSP_LCD_GetYSize() - 24), 20); BSP_LCD_FillCircle(145, (BSP_LCD_GetYSize() - 24), 15); BSP_LCD_FillCircle(195, (BSP_LCD_GetYSize() - 24), 10); BSP_LCD_FillCircle(245, (BSP_LCD_GetYSize() - 24), 5); BSP_LCD_FillCircle(295, (BSP_LCD_GetYSize() - 24), 2); BSP_LCD_SetTextColor(LCD_COLOR_DARKRED); BSP_LCD_SetFont(&Font8); BSP_LCD_DisplayStringAt(360, (BSP_LCD_GetYSize() - 55), (uint8_t *)"Selected Color Size", LEFT_MODE); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); BSP_LCD_FillRect(380, (BSP_LCD_GetYSize() - 40), 30, 30); BSP_LCD_FillCircle(450, (BSP_LCD_GetYSize()- 24), Radius); }
void setReceivedData() { xSemaphoreTake(mutex_drawer, portMAX_DELAY); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_FillRect(245, 95, BSP_LCD_GetXSize() - 245, 20); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); BSP_LCD_DisplayStringAt(240, 95, (uint8_t*) "Received packet: ", LEFT_MODE); xSemaphoreGive(mutex_drawer); }
/** * @brief Display the application footer on the LCD screen * @param footer: pointer to the string to be displayed * @retval None */ void LCD_LOG_SetFooter(uint8_t *footer) { /* Set the LCD Font */ BSP_LCD_SetFont (&LCD_LOG_FOOTER_FONT); BSP_LCD_SetTextColor(LCD_LOG_SOLID_BACKGROUND_COLOR); BSP_LCD_FillRect(0, BSP_LCD_GetYSize() - LCD_LOG_FOOTER_FONT.Height - 4, BSP_LCD_GetXSize(), LCD_LOG_FOOTER_FONT.Height + 4); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_LOG_SOLID_TEXT_COLOR); BSP_LCD_SetBackColor(LCD_LOG_SOLID_BACKGROUND_COLOR); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() - LCD_LOG_FOOTER_FONT.Height, footer, CENTER_MODE); BSP_LCD_SetBackColor(LCD_LOG_BACKGROUND_COLOR); BSP_LCD_SetTextColor(LCD_LOG_TEXT_COLOR); BSP_LCD_SetFont (&LCD_LOG_TEXT_FONT); }
/** * @brief Display the application header on the LCD screen * @param header: pointer to the string to be displayed * @retval None */ void LCD_LOG_SetHeader (uint8_t *header) { /* Set the LCD Font */ BSP_LCD_SetFont (&LCD_LOG_HEADER_FONT); BSP_LCD_SetTextColor(LCD_LOG_SOLID_BACKGROUND_COLOR); BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), LCD_LOG_HEADER_FONT.Height * 3); /* Set the LCD Text Color */ BSP_LCD_SetTextColor(LCD_LOG_SOLID_TEXT_COLOR); BSP_LCD_SetBackColor(LCD_LOG_SOLID_BACKGROUND_COLOR); BSP_LCD_DisplayStringAt(0, LCD_LOG_HEADER_FONT.Height, header, CENTER_MODE); BSP_LCD_SetBackColor(LCD_LOG_BACKGROUND_COLOR); BSP_LCD_SetTextColor(LCD_LOG_TEXT_COLOR); BSP_LCD_SetFont (&LCD_LOG_TEXT_FONT); }
/** * @brief LCD demo Text * @param None * @retval None */ static void LCD_Show_FeatureText(void) { BSP_LCD_SetTextColor(LCD_COLOR_BLACK); BSP_LCD_DisplayStringAt(14, 100, (uint8_t *)"Left aligned Text", LEFT_MODE); BSP_LCD_DisplayStringAt(0, 115, (uint8_t *)"Center aligned Text", CENTER_MODE); BSP_LCD_DisplayStringAt(14, 130, (uint8_t *)"Right aligned Text", RIGHT_MODE); BSP_LCD_SetFont(&Font24); BSP_LCD_DisplayStringAt(14, 180, (uint8_t *)"Font24", LEFT_MODE); BSP_LCD_SetFont(&Font20); BSP_LCD_DisplayStringAt(BSP_LCD_GetXSize() / 2 - 20, 180, (uint8_t *)"Font20", LEFT_MODE); BSP_LCD_SetFont(&Font16); BSP_LCD_DisplayStringAt(BSP_LCD_GetXSize() - 80, 184, (uint8_t *)"Font16", LEFT_MODE); }
/** * @brief Display temperature * @param temperature : temperature value * @retval None */ static void TSENSOR_Display_Temperature(uint16_t temperature) { uint8_t TempCelsiusDisplay[20] = {0}; BSP_LCD_SetTextColor(LCD_COLOR_BLACK); BSP_LCD_SetFont(&Font12); BSP_LCD_DisplayStringAt(0, 115, (uint8_t*)"Measured Temperature : ", CENTER_MODE); /* Change Font size to display Temperature Value */ BSP_LCD_SetFont(&Font16); if (temperature & 0x8000) { /* Display negative temperature */ BSP_LCD_SetTextColor(LCD_COLOR_RED); if (temperature & 0x0001) { sprintf ((char*)TempCelsiusDisplay, " -%d.5 C ", ((temperature & 0x7FFF)>>1)); }
/** * @brief Gets the file info. * @param file_idx: File index * @param info: Pointer to WAV file info * @retval Audio error */ static AUDIO_ErrorTypeDef GetFileInfo(uint16_t file_idx, WAVE_FormatTypeDef *info) { uint32_t bytesread; uint32_t duration; uint8_t str[FILEMGR_FILE_NAME_SIZE + 20]; if(f_open(&WavFile, (char *)FileList.file[file_idx].name, FA_OPEN_EXISTING | FA_READ) == FR_OK) { /* Fill the buffer to Send */ if(f_read(&WavFile, info, sizeof(WaveFormat), (void *)&bytesread) == FR_OK) { BSP_LCD_SetTextColor(LCD_COLOR_WHITE); sprintf((char *)str, "Playing file (%d/%d): %s", file_idx + 1, FileList.ptr, (char *)FileList.file[file_idx].name); BSP_LCD_ClearStringLine(4); BSP_LCD_DisplayStringAtLine(4, str); BSP_LCD_SetTextColor(LCD_COLOR_CYAN); sprintf((char *)str, "Sample rate : %d Hz", (int)(info->SampleRate)); BSP_LCD_ClearStringLine(6); BSP_LCD_DisplayStringAtLine(6, str); sprintf((char *)str, "Channels number : %d", info->NbrChannels); BSP_LCD_ClearStringLine(7); BSP_LCD_DisplayStringAtLine(7, str); duration = info->FileSize / info->ByteRate; sprintf((char *)str, "File Size : %d KB [%02d:%02d]", (int)(info->FileSize/1024), (int)(duration/60), (int)(duration%60)); BSP_LCD_ClearStringLine(8); BSP_LCD_DisplayStringAtLine(8, str); BSP_LCD_DisplayStringAt(263, LINE(8), (uint8_t *)"[00:00]", LEFT_MODE); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); sprintf((char *)str, "Volume : %lu", uwVolume); BSP_LCD_ClearStringLine(9); BSP_LCD_DisplayStringAtLine(9, str); return AUDIO_ERROR_NONE; } f_close(&WavFile); } return AUDIO_ERROR_IO; }
/** * @brief Gets the file info. * @param file_idx: File index * @param info: Pointer to WAV file info * @retval Audio error */ static AUDIO_ErrorTypeDef AUDIO_GetFileInfo(uint16_t file_idx, WAV_InfoTypedef *info) { uint8_t str [FILE_NAME_SIZE + 20]; uint8_t fname [FILE_NAME_SIZE]; uint32_t bytesread; uint32_t duration; if(MTP_GetWavObjectName(file_idx, fname) == 0) { if(MTP_GetData(file_idx, 0, sizeof(WAV_InfoTypedef), (uint8_t*)&wav_info, &bytesread) == 0) { BSP_LCD_SetTextColor(LCD_COLOR_WHITE); sprintf((char *)str, "Playing file (%d/%d): %s", file_idx + 1, MTP_GetWavObjectNumber(), (char *)fname); BSP_LCD_ClearStringLine(4); BSP_LCD_DisplayStringAtLine(4 ,str); BSP_LCD_SetTextColor(LCD_COLOR_CYAN); sprintf((char *)str , "Sample rate : %lu Hz", info->SampleRate); BSP_LCD_ClearStringLine(6); BSP_LCD_DisplayStringAtLine(6 ,str); sprintf((char *)str , "Channels number : %d", info->NbrChannels); BSP_LCD_ClearStringLine(7); BSP_LCD_DisplayStringAtLine(7 ,str); duration = info->FileSize / info->ByteRate; sprintf((char *)str , "File Size : %lu MB [%02lu:%02lu]", info->FileSize/1024/1024, duration/60, duration%60 ); BSP_LCD_ClearStringLine(8); BSP_LCD_DisplayStringAtLine(8 ,str); BSP_LCD_DisplayStringAt(263, LINE(8), (uint8_t *)"[00:00]", LEFT_MODE); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); return AUDIO_ERROR_NONE; } } return AUDIO_ERROR_IO; }
/** * @brief Run the About information * @param None. * @note display About information. * @retval None. */ static void AppMain_About(void) { exit_func = 0; BSP_LCD_SetFont(&Font20); BSP_LCD_Clear(LCD_COLOR_BLUE); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_DisplayStringAt(0,2*Font20.Height, (uint8_t *)EVAL_BOARD, CENTER_MODE); BSP_LCD_DisplayStringAt(0,3*Font20.Height, (uint8_t *)"Demonstration", CENTER_MODE); BSP_LCD_DisplayStringAt(0,5*Font20.Height, (uint8_t *)DEMO_VERSION, CENTER_MODE); BSP_LCD_DisplayStringAt(0,6*Font20.Height, (uint8_t *)DEMO_DATE, CENTER_MODE); BSP_LCD_DisplayStringAt(0,8*Font20.Height, (uint8_t *)DEMO_INFO1, CENTER_MODE); BSP_LCD_DisplayStringAt(0,9*Font20.Height, (uint8_t *)DEMO_INFO2, CENTER_MODE); BSP_LCD_DisplayStringAt(0,10*Font20.Height, (uint8_t *)DEMO_INFO3, CENTER_MODE); while(exit_func==0); }
void printNewDigitalInput() { xSemaphoreTake(mutex_drawer, portMAX_DELAY); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_FillRect(320,180, 80, 20); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); char buffer[5]; memset(buffer, 0, 5); sprintf(buffer, "%d", digitalIn); BSP_LCD_DisplayStringAt(320, 180, (uint8_t*) buffer, LEFT_MODE); xSemaphoreGive(mutex_drawer); }
/** * @brief Check for user input. * @param None * @retval Input state (1 : active / 0 : Inactive) */ static uint8_t CheckForUserInput(void) { if(BSP_PB_GetState(BUTTON_WAKEUP) == GPIO_PIN_RESET) { HAL_Delay(10); do { /* Clear previous line */ BSP_LCD_ClearStringLine(460); /* New text to display */ sprintf(str_display, ">> Frame Nb : %lu", frameCnt); /* Print updated frame number */ BSP_LCD_DisplayStringAt(0, 460, (uint8_t *)str_display, CENTER_MODE); } while (BSP_PB_GetState(BUTTON_WAKEUP) == GPIO_PIN_RESET); return 1 ; } return 0; }
/** * @brief Starts Audio streaming. * @param idx: File index * @retval Audio error */ AUDIO_ErrorTypeDef AUDIO_PLAYER_Start(uint8_t idx) { uint32_t bytesread; f_close(&WavFile); if(AUDIO_GetWavObjectNumber() > idx) { GetFileInfo(idx, &WaveFormat); /*Adjust the Audio frequency */ PlayerInit(WaveFormat.SampleRate); BufferCtl.state = BUFFER_OFFSET_NONE; /* Get Data from USB Flash Disk */ f_lseek(&WavFile, 0); /* Fill whole buffer at first time */ if(f_read(&WavFile, &BufferCtl.buff[0], AUDIO_OUT_BUFFER_SIZE, (void *)&bytesread) == FR_OK) { AudioState = AUDIO_STATE_PLAY; AUDIO_PlaybackDisplayButtons(); BSP_LCD_DisplayStringAt(250, LINE(9), (uint8_t *)" [PLAY ]", LEFT_MODE); { if(bytesread != 0) { BSP_AUDIO_OUT_Play((uint16_t*)&BufferCtl.buff[0], AUDIO_OUT_BUFFER_SIZE); BufferCtl.fptr = bytesread; return AUDIO_ERROR_NONE; } } } } return AUDIO_ERROR_IO; }
/** * @brief EEPROM Demo * @param None * @retval None */ void EEPROM_demo (void) { EEPROM_SetHint(); EepromFeature = 0; EepromTestNb = 0; /* Select EEPROM Component */ BSP_EEPROM_SelectDevice(EepromSelected[EepromTestNb++]); EEPROM_Show_Feature(EepromFeature++); while (1) { if(CheckForUserInput() > 0) { if(EepromFeature < EEPROM_FEATURES_NUM) { EEPROM_Show_Feature(EepromFeature++); } else { return; } if(EepromTestNb < EEPROM_TEST_NB) { /* Select another EEPROM */ BSP_LCD_SetTextColor(LCD_COLOR_BLACK); BSP_LCD_DisplayStringAt(0, 205, (uint8_t *)"Press KEY button to select other EEPROM", CENTER_MODE); BSP_EEPROM_SelectDevice(EepromSelected[EepromTestNb++]); /* Restart example feature */ EepromFeature = 0; } } HAL_Delay(100); } }