Normal CS setting data for saving IR data.

Dependencies:   mbed

Committer:
halfpitch
Date:
Sat Sep 03 17:06:30 2011 +0000
Revision:
0:558646c716d0
Rev.A

Who changed what in which revision?

UserRevisionLine numberNew contents of line
halfpitch 0:558646c716d0 1 /* mbed Microcontroller Library - SDFileSystem
halfpitch 0:558646c716d0 2 * Copyright (c) 2008-2009, sford
halfpitch 0:558646c716d0 3 */
halfpitch 0:558646c716d0 4
halfpitch 0:558646c716d0 5 // VERY DRAFT CODE!!!
halfpitch 0:558646c716d0 6
halfpitch 0:558646c716d0 7 #ifndef SDFILESYSTEM_H
halfpitch 0:558646c716d0 8 #define SDFILESYSTEM_H
halfpitch 0:558646c716d0 9
halfpitch 0:558646c716d0 10 #include "mbed.h"
halfpitch 0:558646c716d0 11 #include "FATFileSystem.h"
halfpitch 0:558646c716d0 12
halfpitch 0:558646c716d0 13 /* Class: SDFileSystem
halfpitch 0:558646c716d0 14 * Access the filesystem on an SD Card using SPI
halfpitch 0:558646c716d0 15 *
halfpitch 0:558646c716d0 16 * Example:
halfpitch 0:558646c716d0 17 * > SDFileSystem sd(p5, p6, p7, p12, "sd");
halfpitch 0:558646c716d0 18 * >
halfpitch 0:558646c716d0 19 * > int main() {
halfpitch 0:558646c716d0 20 * > FILE *fp = fopen("/sd/myfile.txt", "w");
halfpitch 0:558646c716d0 21 * > fprintf(fp, "Hello World!\n");
halfpitch 0:558646c716d0 22 * > fclose(fp);
halfpitch 0:558646c716d0 23 * > }
halfpitch 0:558646c716d0 24 */
halfpitch 0:558646c716d0 25 class SDFileSystem : public FATFileSystem {
halfpitch 0:558646c716d0 26 public:
halfpitch 0:558646c716d0 27
halfpitch 0:558646c716d0 28 /* Constructor: SDFileSystem
halfpitch 0:558646c716d0 29 * Create the File System for accessing an SD Card using SPI
halfpitch 0:558646c716d0 30 *
halfpitch 0:558646c716d0 31 * Variables:
halfpitch 0:558646c716d0 32 * mosi - SPI mosi pin connected to SD Card
halfpitch 0:558646c716d0 33 * miso - SPI miso pin conencted to SD Card
halfpitch 0:558646c716d0 34 * sclk - SPI sclk pin connected to SD Card
halfpitch 0:558646c716d0 35 * cs - DigitalOut pin used as SD Card chip select
halfpitch 0:558646c716d0 36 * name - The name used to access the filesystem
halfpitch 0:558646c716d0 37 */
halfpitch 0:558646c716d0 38 SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name);
halfpitch 0:558646c716d0 39 virtual int disk_initialize();
halfpitch 0:558646c716d0 40 virtual int disk_write(const char *buffer, int block_number);
halfpitch 0:558646c716d0 41 virtual int disk_read(char *buffer, int block_number);
halfpitch 0:558646c716d0 42 virtual int disk_status();
halfpitch 0:558646c716d0 43 virtual int disk_sync();
halfpitch 0:558646c716d0 44 virtual int disk_sectors();
halfpitch 0:558646c716d0 45
halfpitch 0:558646c716d0 46 protected:
halfpitch 0:558646c716d0 47
halfpitch 0:558646c716d0 48 int _cmd(int cmd, int arg);
halfpitch 0:558646c716d0 49 int _cmdx(int cmd, int arg);
halfpitch 0:558646c716d0 50 int _cmd8();
halfpitch 0:558646c716d0 51 int _cmd58();
halfpitch 0:558646c716d0 52 int initialise_card();
halfpitch 0:558646c716d0 53 int initialise_card_v1();
halfpitch 0:558646c716d0 54 int initialise_card_v2();
halfpitch 0:558646c716d0 55
halfpitch 0:558646c716d0 56
halfpitch 0:558646c716d0 57 int _read(char *buffer, int length);
halfpitch 0:558646c716d0 58 int _write(const char *buffer, int length);
halfpitch 0:558646c716d0 59 int _sd_sectors();
halfpitch 0:558646c716d0 60 int _sectors;
halfpitch 0:558646c716d0 61
halfpitch 0:558646c716d0 62 SPI _spi;
halfpitch 0:558646c716d0 63 DigitalOut _cs;
halfpitch 0:558646c716d0 64 };
halfpitch 0:558646c716d0 65
halfpitch 0:558646c716d0 66 #endif