/** * Initialize the peripherals and state for this task. */ uint8_t camera_task_setup() { /* Initialize I2C peripherals for this task. */ ov5642_init(); lps331_init(); hts221_init(); /* Intialize SPI peripherals for this task. */ spi_take(); arduCamInstalled = arducam_init(); /* Try to mount the SD card. */ if (fn_initvolume(mmc_spi_initfunc) != F_NO_ERROR) { trace_printf("sdcard: failed to mount volume\n"); spi_give(); return 0; } #ifdef CLEAN_SD_CARD /* Delete DATA.LOG and JPG files from the SD card. */ trace_printf("camera_task: cleaning SD card\n"); f_delete("DATA.LOG"); f_delete("file.txt"); F_FIND xFindStruct; if (f_findfirst("*.JPG", &xFindStruct) == F_NO_ERROR) { do { f_delete(xFindStruct.filename); } while (f_findnext(&xFindStruct) == F_NO_ERROR); } #endif spi_give(); return 1; // OK }
PRIVATE UINT8 AppS2wCmd_deleteFile(UINT8 *ptr) { INT32 retVal; UINT8 *p; UINT8 *fileName; UINT8 partnNum; UINT32 val = 0; /* get the file name file */ p = AppS2wParse_NextParamGet(&ptr); if(!p) { return S2W_EINVAL; } fileName = p; p = AppS2wParse_NextParamGet(&ptr); if(!p) { return S2W_EINVAL; } AppS2wParse_Int(p, (UINT32 *)&val); partnNum = val; retVal = f_delete((const INT8 *) fileName); if(retVal < 0) { return S2W_FAILURE; } else { return S2W_SUCCESS; } }
/** ****************************************************************** * @ingroup S2w-Application * @brief Process delete SSL certificate. * This function delete the certificate. * @param certName pointer to to certificate name to delete * @param 0 Operation success. * @return 1 Operation failed. ******************************************************************/ PUBLIC UINT8 AppS2w_CertDelete(UINT8 *certName) { UINT8 fileName[42]={0}; INT32 retVal =0; UINT32 len; if(!s2wappMainTaskCtxt->fsInit) { App_FsInit(); s2wappMainTaskCtxt->fsInit = TRUE; f_enterFS(); } S2wCert_MemFree(certName); len = sprintf((char*)fileName,"A:/certs/"); memcpy(fileName+len,certName,strlen((const char *)certName)); retVal = f_delete((char*)fileName); if(retVal == F_NO_ERROR) { return S2W_SUCCESS; } else return S2W_FAILURE; }
static portBASE_TYPE prvDELCommand( char *pcWriteBuffer, size_t xWriteBufferLen, const char *pcCommandString ) { const char *pcParameter; portBASE_TYPE xParameterStringLength; unsigned char ucReturned; /* This function assumes xWriteBufferLen is large enough! */ ( void ) xWriteBufferLen; /* Obtain the parameter string. */ pcParameter = FreeRTOS_CLIGetParameter ( pcCommandString, /* The command string itself. */ 1, /* Return the first parameter. */ &xParameterStringLength /* Store the parameter string length. */ ); /* Sanity check something was returned. */ configASSERT( pcParameter ); /* Attempt to delete the file. */ ucReturned = f_delete( pcParameter ); if( ucReturned == F_NO_ERROR ) { sprintf( pcWriteBuffer, "%s was deleted", pcParameter ); } else { sprintf( pcWriteBuffer, "Error" ); } strcat( pcWriteBuffer, cliNEW_LINE ); return pdFALSE; }