Changes to allow hardware camera trigger

Dependencies:   mbed

Fork of GPS_Incremental by james kain

Committer:
dannyman939
Date:
Thu Apr 18 00:59:49 2013 +0000
Revision:
10:078891935385
Parent:
0:c746ee34feae
Hardware trigger camera using the DigitalOut of Pin 2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dannyman939 0:c746ee34feae 1 /* mbed SDFileSystem Library, for providing file access to SD cards
dannyman939 0:c746ee34feae 2 * Copyright (c) 2008-2010, sford
dannyman939 0:c746ee34feae 3 *
dannyman939 0:c746ee34feae 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
dannyman939 0:c746ee34feae 5 * of this software and associated documentation files (the "Software"), to deal
dannyman939 0:c746ee34feae 6 * in the Software without restriction, including without limitation the rights
dannyman939 0:c746ee34feae 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
dannyman939 0:c746ee34feae 8 * copies of the Software, and to permit persons to whom the Software is
dannyman939 0:c746ee34feae 9 * furnished to do so, subject to the following conditions:
dannyman939 0:c746ee34feae 10 *
dannyman939 0:c746ee34feae 11 * The above copyright notice and this permission notice shall be included in
dannyman939 0:c746ee34feae 12 * all copies or substantial portions of the Software.
dannyman939 0:c746ee34feae 13 *
dannyman939 0:c746ee34feae 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dannyman939 0:c746ee34feae 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dannyman939 0:c746ee34feae 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
dannyman939 0:c746ee34feae 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dannyman939 0:c746ee34feae 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
dannyman939 0:c746ee34feae 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
dannyman939 0:c746ee34feae 20 * THE SOFTWARE.
dannyman939 0:c746ee34feae 21 */
dannyman939 0:c746ee34feae 22
dannyman939 0:c746ee34feae 23 #ifndef MBED_SDFILESYSTEM_H
dannyman939 0:c746ee34feae 24 #define MBED_SDFILESYSTEM_H
dannyman939 0:c746ee34feae 25
dannyman939 0:c746ee34feae 26 #include "mbed.h"
dannyman939 0:c746ee34feae 27 #include "FATFileSystem.h"
dannyman939 0:c746ee34feae 28
dannyman939 0:c746ee34feae 29 /** Access the filesystem on an SD Card using SPI
dannyman939 0:c746ee34feae 30 *
dannyman939 0:c746ee34feae 31 * @code
dannyman939 0:c746ee34feae 32 * #include "mbed.h"
dannyman939 0:c746ee34feae 33 * #include "SDFileSystem.h"
dannyman939 0:c746ee34feae 34 *
dannyman939 0:c746ee34feae 35 * SDFileSystem sd(p5, p6, p7, p12, "sd"); // mosi, miso, sclk, cs
dannyman939 0:c746ee34feae 36 *
dannyman939 0:c746ee34feae 37 * int main() {
dannyman939 0:c746ee34feae 38 * FILE *fp = fopen("/sd/myfile.txt", "w");
dannyman939 0:c746ee34feae 39 * fprintf(fp, "Hello World!\n");
dannyman939 0:c746ee34feae 40 * fclose(fp);
dannyman939 0:c746ee34feae 41 * }
dannyman939 0:c746ee34feae 42 */
dannyman939 0:c746ee34feae 43 class SDFileSystem : public FATFileSystem {
dannyman939 0:c746ee34feae 44 public:
dannyman939 0:c746ee34feae 45
dannyman939 0:c746ee34feae 46 /** Create the File System for accessing an SD Card using SPI
dannyman939 0:c746ee34feae 47 *
dannyman939 0:c746ee34feae 48 * @param mosi SPI mosi pin connected to SD Card
dannyman939 0:c746ee34feae 49 * @param miso SPI miso pin conencted to SD Card
dannyman939 0:c746ee34feae 50 * @param sclk SPI sclk pin connected to SD Card
dannyman939 0:c746ee34feae 51 * @param cs DigitalOut pin used as SD Card chip select
dannyman939 0:c746ee34feae 52 * @param name The name used to access the virtual filesystem
dannyman939 0:c746ee34feae 53 */
dannyman939 0:c746ee34feae 54 SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name);
dannyman939 0:c746ee34feae 55 virtual int disk_initialize();
dannyman939 0:c746ee34feae 56 virtual int disk_write(const char *buffer, int block_number);
dannyman939 0:c746ee34feae 57 virtual int disk_read(char *buffer, int block_number);
dannyman939 0:c746ee34feae 58 virtual int disk_status();
dannyman939 0:c746ee34feae 59 virtual int disk_sync();
dannyman939 0:c746ee34feae 60 virtual int disk_sectors();
dannyman939 0:c746ee34feae 61
dannyman939 0:c746ee34feae 62 protected:
dannyman939 0:c746ee34feae 63
dannyman939 0:c746ee34feae 64 int _cmd(int cmd, int arg);
dannyman939 0:c746ee34feae 65 int _cmdx(int cmd, int arg);
dannyman939 0:c746ee34feae 66 int _cmd8();
dannyman939 0:c746ee34feae 67 int _cmd58();
dannyman939 0:c746ee34feae 68 int initialise_card();
dannyman939 0:c746ee34feae 69 int initialise_card_v1();
dannyman939 0:c746ee34feae 70 int initialise_card_v2();
dannyman939 0:c746ee34feae 71
dannyman939 0:c746ee34feae 72 int _read(char *buffer, int length);
dannyman939 0:c746ee34feae 73 int _write(const char *buffer, int length);
dannyman939 0:c746ee34feae 74 int _sd_sectors();
dannyman939 0:c746ee34feae 75 int _sectors;
dannyman939 0:c746ee34feae 76
dannyman939 0:c746ee34feae 77 SPI _spi;
dannyman939 0:c746ee34feae 78 DigitalOut _cs;
dannyman939 0:c746ee34feae 79 };
dannyman939 0:c746ee34feae 80
dannyman939 0:c746ee34feae 81 #endif