Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of gr-peach-opencv-project-sd-card by
SDBlockDevice_GR_PEACH.h
00001 #ifndef MBED_SDFILESYSTEM_GR_PEACH_H 00002 #define MBED_SDFILESYSTEM_GR_PEACH_H 00003 00004 #include "SDBlockDevice.h" 00005 00006 /** 00007 * A class to communicate a SD 00008 */ 00009 class SDBlockDevice_GR_PEACH : public SDBlockDevice { 00010 public: 00011 00012 /** 00013 * Constructor 00014 * 00015 * @param rootdir mount name 00016 */ 00017 SDBlockDevice_GR_PEACH() : SDBlockDevice(P8_5, P8_6, P8_3, P8_4), _sd_cd(P7_8), _connect(false) { 00018 // Set SPI clock rate to 20MHz for data transfer 00019 _transfer_sck = 20000000; 00020 } 00021 00022 /** 00023 * Check if a SD is connected 00024 * 00025 * @return true if a SD is connected 00026 */ 00027 bool connected() { 00028 if (_sd_cd.read() != 0) { 00029 _connect = false; 00030 } 00031 return _connect; 00032 } 00033 00034 /** 00035 * Try to connect to a SD 00036 * 00037 * @return true if connection was successful 00038 */ 00039 bool connect() { 00040 if (_sd_cd.read() == 0) { 00041 _connect = true; 00042 } else { 00043 _connect = false; 00044 } 00045 return _connect; 00046 } 00047 00048 00049 private: 00050 DigitalIn _sd_cd; 00051 bool _connect; 00052 }; 00053 00054 #endif
Generated on Tue Jul 12 2022 14:47:35 by
1.7.2
