Renesas GR-PEACH OpenCV Development / gr-peach-opencv-project-sd-card_update

Fork of gr-peach-opencv-project-sd-card by the do

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mStorage.cpp Source File

mStorage.cpp

00001 #include "mStorage.hpp"
00002 
00003 cStorage::cStorage(char *name)
00004 {
00005     fs = new FATFileSystem(name);
00006     mounted = false;
00007 }
00008 
00009 cStorage::~cStorage(void)
00010 {
00011     if( mounted == true)
00012     {
00013         fs->unmount();
00014         delete fs;
00015     }
00016 }
00017 
00018 mStorageError cStorage::isConnectSdCard()
00019 {
00020     if (sd.connect()) 
00021     {
00022         return STORG_PASS;
00023     }
00024     return STORG_FAIL;
00025 }
00026 
00027 mStorageError cStorage::mountSdCard()
00028 {
00029     if(fs == NULL)
00030     {
00031         return STORG_FAIL;
00032     }
00033     else if( fs->mount(&sd) == 0 )
00034     {
00035         mounted = true;
00036         return STORG_PASS;
00037     }
00038     return STORG_FAIL;
00039 }
00040 
00041 mStorageError cStorage::unmountSdCard()
00042 {
00043     if( mounted == true )
00044     {
00045         fs->mount(&sd);
00046         return STORG_PASS;
00047     }
00048     return STORG_FAIL;
00049 }