这篇教程C++ BSP_SD_Init函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中BSP_SD_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ BSP_SD_Init函数的具体用法?C++ BSP_SD_Init怎么用?C++ BSP_SD_Init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了BSP_SD_Init函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SD_initialize//{{{DSTATUS SD_initialize (BYTE lun) { Stat = STA_NOINIT; if (BSP_SD_Init() == MSD_OK) Stat &= ~STA_NOINIT; return Stat; }
开发者ID:colinporth,项目名称:radioPlus,代码行数:8,
示例2: SD_StorageInit/** * @brief Initializes the SD Storage. * @param None * @retval Status */uint8_t SD_StorageInit(void){ /*Initializes the SD card device*/ BSP_SD_Init(); /* Check if the SD card is plugged in the slot */ if(BSP_SD_IsDetected() == SD_PRESENT ) { /* Link the SD Card disk I/O driver */ if(FATFS_LinkDriver(&SD_Driver, SD_Path) == 0) { if((f_mount(&SD_FatFs, (TCHAR const*)SD_Path, 0) != FR_OK)) { /* FatFs Initialization Error */ LCD_ErrLog("Cannot Initialize FatFs! /n"); return 1; } else { LCD_DbgLog ("INFO : FatFs Initialized! /n"); } } } else { LCD_ErrLog("SD card NOT plugged /n"); return 1; } return 0;}
开发者ID:eemei,项目名称:library-stm32f4,代码行数:35,
示例3: _cbFileControl/** * @brief Callback function of the File Control page * @param pMsg: pointer to data structure of type WM_MESSAGE * @retval None */static void _cbFileControl(WM_MESSAGE * pMsg){ WM_HWIN hItem; int NCode; int Id; int result; switch (pMsg->MsgId) { case WM_INIT_DIALOG: /* Initialization of 'Brightness' */ hItem = WM_GetDialogItem(pMsg->hWin, ID_FOLDER_CAPTION); TEXT_SetFont(hItem, GUI_FONT_13B_1); hItem = WM_GetDialogItem(pMsg->hWin, ID_FOLDER); EDIT_SetText(hItem, (char *)capture_folder); break; case WM_NOTIFY_PARENT: Id = WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(Id) { case ID_BROWSE: /* Notifications sent by 'Radio' */ switch(NCode) { case WM_NOTIFICATION_RELEASED: pFileInfo->pfGetData = k_GetData; pFileInfo->pMask = acMask_folder; BSP_SD_Init(); SD_Configured = 1; chooser_select_folder = CHOOSEFILE_Create(CAMERA_hWin, 20, 20, 200, 150, apDrives, GUI_COUNTOF(apDrives), 0, "Select a folder", 0, pFileInfo); result = GUI_ExecCreatedDialog(chooser_select_folder); if (result == 0) { if(((pFileInfo->pRoot[0] == '0' ) || (pFileInfo->pRoot[0] == '1' ))) { hItem = WM_GetDialogItem(hDialogFileControl, ID_FOLDER); EDIT_SetText(hItem, (char *)pFileInfo->pRoot); chooser_select_folder = 0; WM_InvalidateWindow(hDialogFileControl); WM_Paint(hDialogFileControl); strncpy((char *)(CAMERA_SAVE_PATH),pFileInfo->pRoot , FILEMGR_FULL_PATH_SIZE); strncpy((char *)capture_folder,pFileInfo->pRoot , FILEMGR_FULL_PATH_SIZE); } } break; } break; } break; default: WM_DefaultProc(pMsg); break; }}
开发者ID:eemei,项目名称:library-stm32f4,代码行数:65,
示例4: SDCard_Config/** * @brief SD Card Configuration. * @param None * @retval None */static void SDCard_Config(void){ uint32_t counter = 0; if(FATFS_LinkDriver(&SD_Driver, SD_Path) == 0) { /* Initialize the SD mounted on adafruit 1.8" TFT shield */ if(BSP_SD_Init() != MSD_OK) { TFT_DisplayErrorMessage(BSP_SD_INIT_FAILED); } /* Check the mounted device */ if(f_mount(&SD_FatFs, (TCHAR const*)"/", 0) != FR_OK) { TFT_DisplayErrorMessage(FATFS_NOT_MOUNTED); } else { /* Initialize the Directory Files pointers (heap) */ for (counter = 0; counter < MAX_BMP_FILES; counter++) { pDirectoryFiles[counter] = malloc(11); } } }}
开发者ID:Lembed,项目名称:STM32CubeF1-mirrors,代码行数:32,
示例5: k_StorageInit/** * @brief Storage drives initialization * @param None * @retval None */void k_StorageInit(void){ /* Link the USB Host disk I/O driver */ FATFS_LinkDriver(&USBH_Driver, USBDISK_Drive); /* Link the micro SD disk I/O driver */ FATFS_LinkDriver(&SD_Driver, mSDDISK_Drive); /* Create USB background task */ osThreadDef(STORAGE_Thread, StorageThread, osPriorityBelowNormal, 0, 2 * configMINIMAL_STACK_SIZE); osThreadCreate (osThread(STORAGE_Thread), NULL); /* Create Storage Message Queue */ osMessageQDef(osqueue, 10, uint16_t); StorageEvent = osMessageCreate (osMessageQ(osqueue), NULL); /* Init Host Library */ USBH_Init(&hUSB_Host, USBH_UserProcess, 0); /* Add Supported Class */ USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS); /* Start Host Process */ USBH_Start(&hUSB_Host); /* Enable SD Interrupt mode */ BSP_SD_Init(); BSP_SD_ITConfig(); if(BSP_SD_IsDetected()) { osMessagePut ( StorageEvent, MSDDISK_CONNECTION_EVENT, 0); }}
开发者ID:451506709,项目名称:automated_machine,代码行数:39,
示例6: Storage_Init/** * @brief SDCARD Initialization for FatFs * @param None * @retval err : Error status (0=> success, 1=> fail) */uint32_t Storage_Init(void){ BSP_SD_Init(); /****************** FatFs Volume Acess ******************************/ if (f_mount(0, &fs)) { return 1; } return 0;}
开发者ID:pierreroth64,项目名称:STM32Cube_FW_F4,代码行数:16,
示例7: CAMERA_SaveToFile/** * @brief Save the data to specified file. * @param path: pointer to the saving path * @retval File saved */uint8_t CAMERA_SaveToFile(uint8_t *path){ RTC_TimeTypeDef Time; RTC_DateTypeDef Date; FIL file; uint32_t NumWrittenData; uint8_t ret = 1; char filename[FILEMGR_FILE_NAME_SIZE]; char fullpath[FILEMGR_FILE_NAME_SIZE]; /* Create filename */ k_GetTime(&Time); k_GetDate(&Date); sprintf((char *)filename, "/Camera_%02d%02d%04d_%02d%02d%02d.bmp", Date.Date, Date.Month, Date.Year + 2015, Time.Hours, Time.Minutes, Time.Seconds); strcpy((char *)fullpath, (char *)path); strcat ((char *)fullpath, (char *)filename); BSP_CAMERA_Suspend(); BSP_SD_Init(); /* Can not create file */ if (f_open(&file, (char *)fullpath, FA_CREATE_NEW | FA_WRITE) == FR_OK) { /* Write the received data into the file */ if (f_write(&file, (char *)BMPHeader_QQVGA24Bit, RGB_HEADER_SIZE, (UINT *)&NumWrittenData) == FR_OK) { f_sync(&file); /* Convert RGB16 image to RGB24 */ RGB16toRGB24((uint8_t *)CAMERA_CVRT_BUFFER, (uint8_t *)&buffer_camera); if (f_write(&file, (char *)CAMERA_CVRT_BUFFER, MAX_IMAGE_SIZE, (UINT*)&NumWrittenData)== FR_OK) { /*File Written correctly */ ret = 0; } } f_close(&file); } BSP_CAMERA_Init(RESOLUTION_R160x120); CAMERA_Configured = 1; BSP_CAMERA_Resume(); return ret;}
开发者ID:Joe-Merten,项目名称:Stm32-Tools-Evaluation,代码行数:59,
示例8: TM_FATFS_SD_SDIO_disk_initializeDSTATUS TM_FATFS_SD_SDIO_disk_initialize(void) { Stat = STA_NOINIT; /* Configure the SDCARD device */ if (BSP_SD_Init() == MSD_OK) { Stat &= ~STA_NOINIT; } else { Stat |= STA_NOINIT; } return Stat;}
开发者ID:MaJerle,项目名称:stm32fxxx_hal_libraries,代码行数:12,
示例9: SD_initialize/** * @brief Initializes a Drive * @param None * @retval DSTATUS: Operation status */DSTATUS SD_initialize(void){ Stat = STA_NOINIT; /* Configure the uSD device */ if(BSP_SD_Init() == MSD_OK) { Stat &= ~STA_NOINIT; } return Stat;}
开发者ID:BeyondCloud,项目名称:uRock,代码行数:17,
示例10: mainint main(void){ uint8_t lcd_status = LCD_OK; CPU_CACHE_Enable(); HAL_Init(); /* Configura el reloj del sistema en 200 Mhz */ SystemClock_Config(); BSP_LED_Init(LED1); /*Configura el botón de usuario en modo GPIO*/ BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO); /*Inicializar LCD*/ lcd_status = BSP_LCD_Init(); if(lcd_status != LCD_OK) while(1); /*Inicializa LCD Layers*/ BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, SDRAM_DEVICE_ADDR); Display_Description(); uint8_t detectSD = 0; uint8_t SD_state = MSD_OK; while(1){ if(BSP_PB_GetState(BUTTON_KEY) != 0){ HAL_Delay(500); Display_Description(); detectSD = 1; } if(detectSD){ detectSD = 0; SD_state = BSP_SD_Init(); if(SD_state != MSD_OK){ BSP_LCD_ClearStringLine(11); BSP_LCD_ClearStringLine(12); BSP_LCD_DisplayStringAt(0, (BSP_LCD_GetYSize()/2.5)+25, (uint8_t *)"Tarjeta SD no encontrada", CENTER_MODE); } else{ BSP_LCD_ClearStringLine(11); BSP_LCD_ClearStringLine(12); BSP_LCD_DisplayStringAt(0, (BSP_LCD_GetYSize()/2.5)+25, (uint8_t *)"Tarjeta SD encontrada", CENTER_MODE); } } }}
开发者ID:aescacena,项目名称:stm32f7,代码行数:51,
示例11: BSP_SD_DetectCallback/** * @brief SD detect callback * @param None * @retval None */ void BSP_SD_DetectCallback(void){ if((BSP_SD_IsDetected())) { /* After sd disconnection, a SD Init is required */ BSP_SD_Init(); osMessagePut ( StorageEvent, MSDDISK_CONNECTION_EVENT, 0); } else { osMessagePut ( StorageEvent, MSDDISK_DISCONNECTION_EVENT, 0); }}
开发者ID:pierreroth64,项目名称:STM32Cube_FW_F4,代码行数:19,
示例12: CAMERA_Stop/** * @brief Stop the camera capture. * @param None * @retval None */void CAMERA_Stop(void){ if( CameraError != CAMERA_ERROR) { /* Disable Camera request and Disable DCMI capture */ BSP_CAMERA_Stop(); } /* After SD disconnection, a SD Init is required */ BSP_SD_Init(); /* Restore Audio configuration */ k_BspAudioInit();}
开发者ID:eemei,项目名称:library-stm32f4,代码行数:19,
示例13: HAL_GPIO_EXTI_Callback/** * @brief EXTI line detection callbacks. * @param GPIO_Pin: Specifies the pins connected EXTI line * @retval None */void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){ if(GPIO_Pin == MFX_IRQOUT_PIN) { if(BSP_SD_IsDetected()) { if(CAMERA_Configured == 0) { BSP_SD_Init(); } osMessagePut ( StorageEvent, MSDDISK_CONNECTION_EVENT, 0); } else { osMessagePut ( StorageEvent, MSDDISK_DISCONNECTION_EVENT, 0); } }}
开发者ID:451506709,项目名称:automated_machine,代码行数:23,
示例14: STORAGE_IsReady/** * @brief Checks whether the medium is ready. * @param lun: Logical unit number * @retval Status (0: Ok / -1: Error) */int8_t STORAGE_IsReady(uint8_t lun){ int8_t ret = -1; if(k_StorageGetStatus (MSD_DISK_UNIT) == 1) { if(prev_state == 0) { BSP_SD_Init(); } prev_state = 1; ret = 0; } else if(prev_state == 1) { prev_state = 0; } return ret;}
开发者ID:451506709,项目名称:automated_machine,代码行数:24,
示例15: SD_exti_demo/** * @brief SD Demo exti detection * @param None * @retval None */void SD_exti_demo (void){ uint32_t ITstatus = 0; SD_main_test(); if(BSP_SD_IsDetected() != SD_PRESENT) { BSP_SD_Init(); BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(20, BSP_LCD_GetYSize()-30, (uint8_t *)"SD Not Connected", LEFT_MODE); } else { BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAt(20, BSP_LCD_GetYSize()-30, (uint8_t *)"SD Connected ", LEFT_MODE); } BSP_SD_ITConfig(); while (1) { if (MfxExtiReceived == 1) { MfxExtiReceived = 0; ITstatus = BSP_IO_ITGetStatus(SD_DETECT_PIN); if (ITstatus) { SD_Detection(); } BSP_IO_ITClear(); } if(CheckForUserInput() > 0) { BSP_SD_DeInit(); return; } }}
开发者ID:451506709,项目名称:automated_machine,代码行数:45,
示例16: STORAGE_IsReady/** * @brief Checks whether the medium is ready. * @param lun: Logical unit number * @retval Status (0: OK / -1: Error) */int8_t STORAGE_IsReady(uint8_t lun){ static int8_t prev_status = 0; int8_t ret = -1; // if(BSP_SD_IsDetected() != SD_NOT_PRESENT) { if(prev_status < 0) { BSP_SD_Init(); prev_status = 0; } if(BSP_SD_GetStatus() == MSD_OK) { ret = 0; } }// else if(prev_status == 0)// {// prev_status = -1;// } return ret;}
开发者ID:PaxInstruments,项目名称:STM32CubeF3,代码行数:29,
示例17: CAMERA_Stop/** * @brief Stop the camera capture. * @param None * @retval None */void CAMERA_Stop(void){ GPIO_InitTypeDef GPIO_InitStruct; if( CameraError != CAMERA_ERROR) { /* Disable Camera request and Disable DCMI capture */ BSP_CAMERA_Stop(); /* QSPI CLK GPIO pin reconfiguration */ GPIO_InitStruct.Pin = QSPI_CS_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Speed = GPIO_SPEED_HIGH; GPIO_InitStruct.Pin = QSPI_CLK_PIN; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Alternate = GPIO_AF9_QSPI; HAL_GPIO_Init(QSPI_CLK_GPIO_PORT, &GPIO_InitStruct); /* Msp SD initialization */ BSP_SD_Init(); CAMERA_Configured = 0; }}
开发者ID:Joe-Merten,项目名称:Stm32-Tools-Evaluation,代码行数:29,
示例18: STORAGE_IsReady/** * @brief Checks whether the medium is ready. * @param lun: Logical unit number * @retval Status (0: Ok / -1: Error) */int8_t STORAGE_IsReady(uint8_t lun){ static int8_t prev_status = 0; int8_t ret = -1; if(BSP_SD_IsDetected() != SD_NOT_PRESENT) { if(prev_status < 0) { BSP_SD_Init(); prev_status = 0; } if(BSP_SD_GetStatus() == SD_TRANSFER_OK) { ret = 0; } } else if(prev_status == 0) { prev_status = -1; } return ret;}
开发者ID:EarnestHein89,项目名称:STM32Cube_FW_F4,代码行数:29,
示例19: main/** * @brief Main program * @param None * @retval None */int main(void){ uint32_t counter = 0; uint8_t str[30]; uwInternelBuffer = (uint8_t *)0xC0260000; /* Enable the CPU Cache */ CPU_CACHE_Enable(); /* STM32F7xx HAL library initialization: - Configure the Flash ART accelerator on ITCM interface - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 200 MHz */ SystemClock_Config(); /* Configure LED3 */ BSP_LED_Init(LED3); /*##-1- Configure LCD ######################################################*/ LCD_Config(); BSP_SD_Init(); while(BSP_SD_IsDetected() != SD_PRESENT) { BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAtLine(8, (uint8_t*)" Please insert SD Card "); } BSP_LCD_Clear(LCD_COLOR_BLACK); /*##-2- Link the SD Card disk I/O driver ###################################*/ if(FATFS_LinkDriver(&SD_Driver, SD_Path) != 0) { Error_Handler(); } else { /*##-3- Initialize the Directory Files pointers (heap) ###################*/ for (counter = 0; counter < MAX_BMP_FILES; counter++) { pDirectoryFiles[counter] = malloc(MAX_BMP_FILE_NAME); if(pDirectoryFiles[counter] == NULL) { /* Set the Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAtLine(8, (uint8_t*)" Cannot allocate memory "); while(1) { } } } /*##-4- Display Background picture #######################################*/ /* Select Background Layer */ BSP_LCD_SelectLayer(0); /* Register the file system object to the FatFs module */ if(f_mount(&SD_FatFs, (TCHAR const*)SD_Path, 0) != FR_OK) { /* FatFs Initialization Error */ /* Set the Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAtLine(8, (uint8_t*)" FatFs Initialization Error "); } else { /* Open directory */ if (f_opendir(&directory, (TCHAR const*)"/BACK") != FR_OK) { /* Set the Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAtLine(8, (uint8_t*)" Open directory.. fails "); while(1) { } } } if (Storage_CheckBitmapFile("BACK/image.bmp", &uwBmplen) == 0) { /* Format the string */ Storage_OpenReadFile(uwInternelBuffer, "BACK/image.bmp"); /* Write bmp file on LCD frame buffer */ BSP_LCD_DrawBitmap(0, 0, uwInternelBuffer); }//.........这里部分代码省略.........
开发者ID:acrepina,项目名称:STM32F7_serverWEB,代码行数:101,
示例20: _mmcsd_idlebool _mmcsd_idle(unsigned int unit_nr){ if(card_detect != NULL) { gpio_idle(card_detect); if(card_detect->event.state_up) { card_detect->event.state_up = false; card_detected = false; } } if(card_detect == NULL || card_detect->event.state_dn) { HAL_SD_ErrorTypedef res = SD_OK; res = BSP_SD_Init(); if(res != SD_OK) { if(card_detect != NULL) card_detect->event.state_dn = false; //if(DebugCom) //UARTprintf(DebugCom, "MMCSD%d ERROR initializing card./n/r" , 0); card_detected = false; return false; } if(card_detect != NULL) card_detect->event.state_dn = false; MmcSdFatFs.drv_rw_func.DriveStruct = (void *)&uSdCardInfo;//SdStruct; MmcSdFatFs.drv_rw_func.drv_r_func = _mmcsd_read; MmcSdFatFs.drv_rw_func.drv_w_func = _mmcsd_write;#if (_FFCONF == 82786) if(!f_mount(2, &MmcSdFatFs))#else if(!f_mount(&MmcSdFatFs,"SD1:", 1))#endif { if(f_opendir(&g_sDirObject, g_cCwdBuf0) == FR_OK) {#ifdef MMCSD_DEBUG_EN if(DebugCom) { uart.printf(DebugCom, "MMCSD%d drive %d mounted/n/r" , 0 , 0); uart.printf(DebugCom, "MMCSD%d Fat fs detected/n/r" , 0); uart.printf(DebugCom, "MMCSD%d Fs type: " , 0); if(MmcSdFatFs.fs_type == FS_FAT12) { uart.printf(DebugCom, "Fat12");} else if(MmcSdFatFs.fs_type == FS_FAT16){ uart.printf(DebugCom, "Fat16");} else if(MmcSdFatFs.fs_type == FS_FAT32){ uart.printf(DebugCom, "Fat32");} else if(MmcSdFatFs.fs_type == FS_EXFAT){ uart.printf(DebugCom, "exFat");} else { uart.printf(DebugCom, "None");} uart.printf(DebugCom, "/n/r"); //UARTprintf(DebugCom, "MMCSD0 BootSectorAddress: %u /n/r",(unsigned int)g_sFatFs.); uart.printf(DebugCom, "MMCSD%d BytesPerSector: %d /n/r",0, /*(int)g_sFatFs.s_size*/512); uart.printf(DebugCom, "MMCSD%d SectorsPerCluster: %d /n/r",0, (int)MmcSdFatFs.csize); //UARTprintf(DebugCom, "MMCSD0 AllocTable1Begin: %u /n/r",(unsigned int)g_sFatFs.fatbase); //UARTprintf(DebugCom, "MMCSD%d NumberOfFats: %d /n/r",0, (int)MmcSdFatFs.n_fats); //UARTprintf(DebugCom, "MMCSD0 MediaType: %d /n/r",Drives_Table[0]->DiskInfo_MediaType); //UARTprintf(DebugCom, "MMCSD0 AllocTableSize: %u /n/r",Drives_Table[0]->DiskInfo_AllocTableSize); //UARTprintf(DebugCom, "MMCSD%d DataSectionBegin: %d /n/r",0, (int)MmcSdFatFs.fatbase); uart.printf(DebugCom, "MMCSD%d uSD DiskCapacity: %uMB/n/r",0, (unsigned long)((unsigned long long)((unsigned long long)MmcSdFatFs.n_fatent * (unsigned long long)/*g_sFatFs.s_size*/512 *(unsigned long long)MmcSdFatFs.csize) / 1000000)); }#endif card_detected = true; } else { if(DebugCom) uart.printf(DebugCom, "MMCSD%d ERROR oppening path/n/r" , 0); card_detected = false; } } else { if(DebugCom) uart.printf(DebugCom, "MMCSD%d ERROR mounting disk/n/r" , 0); card_detected = false; } } return card_detected;}
开发者ID:MorgothCreator,项目名称:mSdk,代码行数:79,
示例21: STORAGE_Init/** * @brief Initailizes the storage unit (medium) * @param lun: Logical unit number * @retval Status (0 : Ok / -1 : Error) */int8_t STORAGE_Init(uint8_t lun){ BSP_SD_Init(); return 0;}
开发者ID:EarnestHein89,项目名称:STM32Cube_FW_F4,代码行数:10,
示例22: main/** * @brief Main program * @param None * @retval None */int main(void){ uint32_t counter = 0, transparency = 0; uint8_t str[30]; uwInternelBuffer = (uint8_t *)0xC0260000; /* Enable the CPU Cache */ CPU_CACHE_Enable(); /* STM32F7xx HAL library initialization: - Configure the Flash ART accelerator on ITCM interface - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); /* Configure the system clock to 200 MHz */ SystemClock_Config(); /* Configure LED3 */ BSP_LED_Init(LED3); /*##-1- Configure LCD ######################################################*/ LCD_Config(); /* Configure TAMPER Button */ BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO); BSP_SD_Init(); while(BSP_SD_IsDetected() != SD_PRESENT) { BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAtLine(8, (uint8_t*)" Please insert SD Card "); } BSP_LCD_Clear(LCD_COLOR_BLACK); /*##-2- Link the SD Card disk I/O driver ###################################*/ if(FATFS_LinkDriver(&SD_Driver, SD_Path) == 0) { /*##-3- Initialize the Directory Files pointers (heap) ###################*/ for (counter = 0; counter < MAX_BMP_FILES; counter++) { pDirectoryFiles[counter] = malloc(MAX_BMP_FILE_NAME); if(pDirectoryFiles[counter] == NULL) { /* Set the Text Color */ BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAtLine(8, (uint8_t*)" Cannot allocate memory "); while(1) { } } } /* Get the BMP file names on root directory */ ubNumberOfFiles = Storage_GetDirectoryBitmapFiles("/Media", pDirectoryFiles); if (ubNumberOfFiles == 0) { for (counter = 0; counter < MAX_BMP_FILES; counter++) { free(pDirectoryFiles[counter]); } BSP_LCD_DisplayStringAtLine(8, (uint8_t*)" No Bitmap files... "); while(1) { } } } else { /* FatFs Initialization Error */ Error_Handler(); } while(1) { counter = 0; while ((counter) < ubNumberOfFiles) { /* Step1 : Display on Foreground layer -------------------------------*/ /* Format the string */ sprintf ((char*)str, "Media/%-11.11s", pDirectoryFiles[counter]); if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0) { /* Format the string */ sprintf ((char*)str, "Media/%-11.11s", pDirectoryFiles[counter]); /* Set LCD foreground Layer *///.........这里部分代码省略.........
开发者ID:acrepina,项目名称:STM32F7_serverWEB,代码行数:101,
示例23: SD_main_test/** * @brief Main part of SD Demo Test * @param None * @retval None */void SD_main_test (void){ uint8_t SD_state = SD_OK; SD_SetHint(); SD_state = BSP_SD_Init(); if(SD_state != SD_OK) { if(SD_state == MSD_ERROR_SD_NOT_PRESENT) { BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SD shall be inserted before running test", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SD Initialization : FAIL.", LEFT_MODE); } BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SD Initialization : OK.", LEFT_MODE); SD_state = BSP_SD_Erase(BLOCK_START_ADDR, (BLOCKSIZE * NUM_OF_BLOCKS)); if(SD_state != SD_OK) { BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SD ERASE : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SD ERASE : OK.", LEFT_MODE); /* Fill the buffer to write */ Fill_Buffer(aTxBuffer, BUFFER_WORDS_SIZE, 0x22FF); SD_state = BSP_SD_WriteBlocks(aTxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS); if(SD_state != SD_OK) { BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SD WRITE : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SD WRITE : OK.", LEFT_MODE); SD_state = BSP_SD_ReadBlocks(aRxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS); if(SD_state != SD_OK) { BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SD READ : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SD READ : OK.", LEFT_MODE); if(Buffercmp(aTxBuffer, aRxBuffer, BUFFER_WORDS_SIZE) > 0) { BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SD COMPARE : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 175, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SD Test : OK.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 175, (uint8_t *)"SD can be removed.", LEFT_MODE); } } } } }}
开发者ID:451506709,项目名称:automated_machine,代码行数:75,
示例24: SD_demo/** * @brief SD Demo * @param None * @retval None */void SD_demo(void){ uint8_t SD_state = SD_OK; static uint8_t prev_status = 0; SD_SetHint(); SD_state = BSP_SD_Init(); if(SD_state != SD_OK) { BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SD Initialization : FAIL.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SD Initialization : OK.", LEFT_MODE); SD_state = BSP_SD_Erase(BLOCK_START_ADDR, (BLOCKSIZE * NUM_OF_BLOCKS)); if(SD_state != SD_OK) { BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SD ERASE : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SD ERASE : OK.", LEFT_MODE); /* Fill the buffer to write */ Fill_Buffer(aTxBuffer, BUFFER_WORDS_SIZE, 0x22FF); SD_state = BSP_SD_WriteBlocks(aTxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS); if(SD_state != SD_OK) { BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SD WRITE : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SD WRITE : OK.", LEFT_MODE); SD_state = BSP_SD_ReadBlocks(aRxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS); if(SD_state != SD_OK) { BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SD READ : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SD READ : OK.", LEFT_MODE); if(Buffercmp(aTxBuffer, aRxBuffer, BUFFER_WORDS_SIZE) > 0) { BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SD COMPARE : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 175, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SD Test : OK.", LEFT_MODE); } } } } } /* Check if the SD card is plugged in the slot */ if(BSP_SD_IsDetected() == SD_PRESENT) { BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAt(20, BSP_LCD_GetYSize()-30, (uint8_t *)"SD Connected ", LEFT_MODE); } else { BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(20, BSP_LCD_GetYSize()-30, (uint8_t *)"SD Not Connected", LEFT_MODE); } while (1) { /* Check if the SD card is plugged in the slot */ if(BSP_SD_IsDetected() != SD_PRESENT) { if(prev_status == 0) { BSP_SD_Init(); prev_status = 1; BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(20, BSP_LCD_GetYSize()-30, (uint8_t *)"SD Not Connected", LEFT_MODE); } } else if (prev_status == 1) { BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAt(20, BSP_LCD_GetYSize()-30, (uint8_t *)"SD Connected ", LEFT_MODE); prev_status = 0; } //.........这里部分代码省略.........
开发者ID:PaxInstruments,项目名称:STM32CubeF4,代码行数:101,
示例25: SD_demo/** * @brief SD Demo * @param None * @retval None */void SD_demo(void){ uint8_t SD_state = MSD_OK; SD_SetHint(); SD_state = BSP_SD_Init(); BSP_LCD_SetFont(&Font8); if(SD_state != MSD_OK) { BSP_LCD_DisplayStringAt(4, 88, (uint8_t *)"SD Initialization: FAIL", LEFT_MODE); BSP_LCD_DisplayStringAt(4, 100, (uint8_t *)"SD Test Aborted", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(4, 88, (uint8_t *)"SD Initialization: OK", LEFT_MODE); SD_state = BSP_SD_Erase(BLOCK_START_ADDR, (BLOCKSIZE * NUM_OF_BLOCKS)); if(SD_state != MSD_OK) { BSP_LCD_DisplayStringAt(4, 100, (uint8_t *)"SD ERASE: FAILED", LEFT_MODE); BSP_LCD_DisplayStringAt(4, 112, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(4, 100, (uint8_t *)"SD ERASE: OK", LEFT_MODE); /* Fill the buffer to write */ Fill_Buffer(aTxBuffer, BUFFER_WORDS_SIZE, 0x22FF); SD_state = BSP_SD_WriteBlocks(aTxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS); if(SD_state != MSD_OK) { BSP_LCD_DisplayStringAt(4, 112, (uint8_t *)"SD WRITE: FAILED", LEFT_MODE); BSP_LCD_DisplayStringAt(4, 124, (uint8_t *)"SD Test Aborted", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(4, 112, (uint8_t *)"SD WRITE: OK", LEFT_MODE); SD_state = BSP_SD_ReadBlocks(aRxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS); if(SD_state != MSD_OK) { BSP_LCD_DisplayStringAt(4, 124, (uint8_t *)"SD READ: FAILED", LEFT_MODE); BSP_LCD_DisplayStringAt(4, 136, (uint8_t *)"SD Test Aborted", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(4, 124, (uint8_t *)"SD READ: OK", LEFT_MODE); if(Buffercmp(aTxBuffer, aRxBuffer, BUFFER_WORDS_SIZE) > 0) { BSP_LCD_DisplayStringAt(4, 136, (uint8_t *)"SD COMPARE: FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(4, 148, (uint8_t *)"SD Test Aborted", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(4, 136, (uint8_t *)"SD Test: OK", LEFT_MODE); } } } } } while (1) { if(CheckForUserInput() > 0) { return; } }}
开发者ID:pengphei,项目名称:STM32Cube_L0,代码行数:76,
示例26: SD_demo/** * @brief SD Demo * @param None * @retval None */void SD_demo (void){ uint8_t SD_state = SD_RESPONSE_NO_ERROR; __IO uint8_t prev_status = 0; SD_SetHint(); SD_state = BSP_SD_Init(); /* Check if the SD card is plugged in the slot */ if(BSP_SD_IsDetected() == SD_PRESENT) { BSP_LCD_SetTextColor(LCD_COLOR_GREEN); BSP_LCD_DisplayStringAt(20, BSP_LCD_GetYSize()-30, (uint8_t *)"SD Connected ", LEFT_MODE); } else { BSP_LCD_SetTextColor(LCD_COLOR_RED); BSP_LCD_DisplayStringAt(20, BSP_LCD_GetYSize()-30, (uint8_t *)"SD Not Connected", LEFT_MODE); } BSP_LCD_SetTextColor(LCD_COLOR_BLACK); if(SD_state != SD_RESPONSE_NO_ERROR) { BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SD INITIALIZATION : FAIL.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SD INITIALIZATION : OK.", LEFT_MODE); SD_state = BSP_SD_GetCardInfo(&CardInfo); if(SD_state != SD_RESPONSE_NO_ERROR) { BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SD GET CARD INFO : FAIL.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SD GET CARD INFO : OK.", LEFT_MODE); SD_state = BSP_SD_Erase(BLOCK_START_ADDR, (BLOCKSIZE * NUM_OF_BLOCKS)); /* Verify that SD card is ready to use after the Erase */ SD_state |= BSP_SD_GetStatus(); if(SD_state != SD_RESPONSE_NO_ERROR) { BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SD ERASE : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SD ERASE : OK.", LEFT_MODE); /* Fill the buffer to write */ Fill_Buffer(aTxBuffer, BUFFER_WORDS_SIZE, 0x22FF); SD_state = BSP_SD_WriteBlocks((uint32_t *)aTxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS); if(SD_state != SD_RESPONSE_NO_ERROR) { BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SD WRITE : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SD WRITE : OK.", LEFT_MODE); SD_state = BSP_SD_ReadBlocks((uint32_t *)aRxBuffer, BLOCK_START_ADDR, BLOCKSIZE, NUM_OF_BLOCKS); if(SD_state != SD_RESPONSE_NO_ERROR) { BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SD READ : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 175, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SD READ : OK.", LEFT_MODE); if(Buffercmp(aTxBuffer, aRxBuffer, BUFFER_WORDS_SIZE) > 0) { BSP_LCD_DisplayStringAt(20, 175, (uint8_t *)"SD COMPARE : FAILED.", LEFT_MODE); BSP_LCD_DisplayStringAt(20, 190, (uint8_t *)"SD Test Aborted.", LEFT_MODE); } else { BSP_LCD_DisplayStringAt(20, 175, (uint8_t *)"SD TEST : OK.", LEFT_MODE); } } } } } } while (1) { /* Check if the SD card is plugged in the slot *///.........这里部分代码省略.........
开发者ID:eleciawhite,项目名称:STM32Cube,代码行数:101,
注:本文中的BSP_SD_Init函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ BSP_SD_IsDetected函数代码示例 C++ BSP_SDRAM_Init函数代码示例 |