Normal CS setting, send IR data from SD card module.

Dependencies:   mbed

Committer:
halfpitch
Date:
Sat Sep 03 17:10:24 2011 +0000
Revision:
0:011aabf9f436
Rev.A

Who changed what in which revision?

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