Send IR data from SD card. I changed Chip Select signal timing.

Dependencies:   mbed

Committer:
halfpitch
Date:
Wed Jul 13 14:25:47 2011 +0000
Revision:
0:da2f4475a464
RevA

Who changed what in which revision?

UserRevisionLine numberNew contents of line
halfpitch 0:da2f4475a464 1 /* mbed Microcontroller Library - SDFileSystem
halfpitch 0:da2f4475a464 2 * Copyright (c) 2008-2009, sford
halfpitch 0:da2f4475a464 3 */
halfpitch 0:da2f4475a464 4
halfpitch 0:da2f4475a464 5 // VERY DRAFT CODE!!!
halfpitch 0:da2f4475a464 6
halfpitch 0:da2f4475a464 7 #ifndef SDFILESYSTEM_H
halfpitch 0:da2f4475a464 8 #define SDFILESYSTEM_H
halfpitch 0:da2f4475a464 9
halfpitch 0:da2f4475a464 10 #include "mbed.h"
halfpitch 0:da2f4475a464 11 #include "FATFileSystem.h"
halfpitch 0:da2f4475a464 12
halfpitch 0:da2f4475a464 13 //Nest Egg Inc.-----
halfpitch 0:da2f4475a464 14 //http://wizard.nestegg.jp/
halfpitch 0:da2f4475a464 15 #include "wwChipSelect.h"
halfpitch 0:da2f4475a464 16
halfpitch 0:da2f4475a464 17 //channel No must be A4 A3 A2 A1
halfpitch 0:da2f4475a464 18 //#define ch_num 0x05 //channel No 0101, depend on your SPI module setting. (1:High 0:Low)
halfpitch 0:da2f4475a464 19 #define reset_ch 0x00 //channel No 0000, for reset.
halfpitch 0:da2f4475a464 20 //------------------
halfpitch 0:da2f4475a464 21
halfpitch 0:da2f4475a464 22 /* Class: SDFileSystem
halfpitch 0:da2f4475a464 23 * Access the filesystem on an SD Card using SPI
halfpitch 0:da2f4475a464 24 *
halfpitch 0:da2f4475a464 25 * Example:
halfpitch 0:da2f4475a464 26 * > SDFileSystem sd(p5, p6, p7, p12, "sd");
halfpitch 0:da2f4475a464 27 * >
halfpitch 0:da2f4475a464 28 * > int main() {
halfpitch 0:da2f4475a464 29 * > FILE *fp = fopen("/sd/myfile.txt", "w");
halfpitch 0:da2f4475a464 30 * > fprintf(fp, "Hello World!\n");
halfpitch 0:da2f4475a464 31 * > fclose(fp);
halfpitch 0:da2f4475a464 32 * > }
halfpitch 0:da2f4475a464 33 */
halfpitch 0:da2f4475a464 34 class SDFileSystem : public FATFileSystem {
halfpitch 0:da2f4475a464 35 public:
halfpitch 0:da2f4475a464 36
halfpitch 0:da2f4475a464 37 /* Constructor: SDFileSystem
halfpitch 0:da2f4475a464 38 * Create the File System for accessing an SD Card using SPI
halfpitch 0:da2f4475a464 39 *
halfpitch 0:da2f4475a464 40 * Variables:
halfpitch 0:da2f4475a464 41 * mosi - SPI mosi pin connected to SD Card
halfpitch 0:da2f4475a464 42 * miso - SPI miso pin conencted to SD Card
halfpitch 0:da2f4475a464 43 * sclk - SPI sclk pin connected to SD Card
halfpitch 0:da2f4475a464 44 * cs - DigitalOut pin used as SD Card chip select
halfpitch 0:da2f4475a464 45 * name - The name used to access the filesystem
halfpitch 0:da2f4475a464 46 */
halfpitch 0:da2f4475a464 47 SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name);
halfpitch 0:da2f4475a464 48
halfpitch 0:da2f4475a464 49 //Nest Egg Inc.-----
halfpitch 0:da2f4475a464 50 //http://wizard.nestegg.jp/
halfpitch 0:da2f4475a464 51 void SetCh(int ch);
halfpitch 0:da2f4475a464 52 //------------------
halfpitch 0:da2f4475a464 53 virtual int disk_initialize();
halfpitch 0:da2f4475a464 54 virtual int disk_write(const char *buffer, int block_number);
halfpitch 0:da2f4475a464 55 virtual int disk_read(char *buffer, int block_number);
halfpitch 0:da2f4475a464 56 virtual int disk_status();
halfpitch 0:da2f4475a464 57 virtual int disk_sync();
halfpitch 0:da2f4475a464 58 virtual int disk_sectors();
halfpitch 0:da2f4475a464 59
halfpitch 0:da2f4475a464 60 protected:
halfpitch 0:da2f4475a464 61
halfpitch 0:da2f4475a464 62 int _cmd(int cmd, int arg);
halfpitch 0:da2f4475a464 63 int _cmdx(int cmd, int arg);
halfpitch 0:da2f4475a464 64 int _cmd8();
halfpitch 0:da2f4475a464 65 int _cmd58();
halfpitch 0:da2f4475a464 66 int initialise_card();
halfpitch 0:da2f4475a464 67 int initialise_card_v1();
halfpitch 0:da2f4475a464 68 int initialise_card_v2();
halfpitch 0:da2f4475a464 69
halfpitch 0:da2f4475a464 70
halfpitch 0:da2f4475a464 71 int _read(char *buffer, int length);
halfpitch 0:da2f4475a464 72 int _write(const char *buffer, int length);
halfpitch 0:da2f4475a464 73 int _sd_sectors();
halfpitch 0:da2f4475a464 74 int _sectors;
halfpitch 0:da2f4475a464 75
halfpitch 0:da2f4475a464 76 SPI _spi;
halfpitch 0:da2f4475a464 77 //Nest Egg Inc.-----
halfpitch 0:da2f4475a464 78 //DigitalOut _cs;
halfpitch 0:da2f4475a464 79 wwChipSelect _cs;
halfpitch 0:da2f4475a464 80
halfpitch 0:da2f4475a464 81 //------------------
halfpitch 0:da2f4475a464 82
halfpitch 0:da2f4475a464 83 };
halfpitch 0:da2f4475a464 84
halfpitch 0:da2f4475a464 85 #endif