本文整理汇总了C++中BSP_SD_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ BSP_SD_Init函数的具体用法?C++ BSP_SD_Init怎么用?C++ BSP_SD_Init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BSP_SD_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SD_initialize
//{{{
DSTATUS SD_initialize (BYTE lun) {
Stat = STA_NOINIT;
if (BSP_SD_Init() == MSD_OK)
Stat &= ~STA_NOINIT;
return Stat;
}
示例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;
}
示例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;
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例8: TM_FATFS_SD_SDIO_disk_initialize
DSTATUS 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;
}
示例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;
}
示例10: main
int 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);
}
}
}
}
示例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);
}
}
示例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();
}
示例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);
}
}
}
示例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;
}
示例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;
}
}
}