Save IR data

Dependencies:   mbed

Committer:
halfpitch
Date:
Wed Aug 31 15:50:30 2011 +0000
Revision:
0:decd8d14cc06
Rev.A

Who changed what in which revision?

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