LAN(Wi-Fi) air controller through the Internet. Also you can use TANK. See:http://wizard.nestegg.jp/lanir.html
Dependencies: EthernetNetIf mbed HTTPServer
SDFileSystem.h@0:6f9648f5eaab, 2011-08-01 (annotated)
- Committer:
- halfpitch
- Date:
- Mon Aug 01 19:21:55 2011 +0000
- Revision:
- 0:6f9648f5eaab
Rev.A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
halfpitch | 0:6f9648f5eaab | 1 | /* mbed Microcontroller Library - SDFileSystem |
halfpitch | 0:6f9648f5eaab | 2 | * Copyright (c) 2008-2009, sford |
halfpitch | 0:6f9648f5eaab | 3 | */ |
halfpitch | 0:6f9648f5eaab | 4 | |
halfpitch | 0:6f9648f5eaab | 5 | // VERY DRAFT CODE!!! |
halfpitch | 0:6f9648f5eaab | 6 | |
halfpitch | 0:6f9648f5eaab | 7 | #ifndef SDFILESYSTEM_H |
halfpitch | 0:6f9648f5eaab | 8 | #define SDFILESYSTEM_H |
halfpitch | 0:6f9648f5eaab | 9 | |
halfpitch | 0:6f9648f5eaab | 10 | #include "mbed.h" |
halfpitch | 0:6f9648f5eaab | 11 | #include "FATFileSystem.h" |
halfpitch | 0:6f9648f5eaab | 12 | |
halfpitch | 0:6f9648f5eaab | 13 | /* Class: SDFileSystem |
halfpitch | 0:6f9648f5eaab | 14 | * Access the filesystem on an SD Card using SPI |
halfpitch | 0:6f9648f5eaab | 15 | * |
halfpitch | 0:6f9648f5eaab | 16 | * Example: |
halfpitch | 0:6f9648f5eaab | 17 | * > SDFileSystem sd(p5, p6, p7, p12, "sd"); |
halfpitch | 0:6f9648f5eaab | 18 | * > |
halfpitch | 0:6f9648f5eaab | 19 | * > int main() { |
halfpitch | 0:6f9648f5eaab | 20 | * > FILE *fp = fopen("/sd/myfile.txt", "w"); |
halfpitch | 0:6f9648f5eaab | 21 | * > fprintf(fp, "Hello World!\n"); |
halfpitch | 0:6f9648f5eaab | 22 | * > fclose(fp); |
halfpitch | 0:6f9648f5eaab | 23 | * > } |
halfpitch | 0:6f9648f5eaab | 24 | */ |
halfpitch | 0:6f9648f5eaab | 25 | class SDFileSystem : public FATFileSystem { |
halfpitch | 0:6f9648f5eaab | 26 | public: |
halfpitch | 0:6f9648f5eaab | 27 | |
halfpitch | 0:6f9648f5eaab | 28 | /* Constructor: SDFileSystem |
halfpitch | 0:6f9648f5eaab | 29 | * Create the File System for accessing an SD Card using SPI |
halfpitch | 0:6f9648f5eaab | 30 | * |
halfpitch | 0:6f9648f5eaab | 31 | * Variables: |
halfpitch | 0:6f9648f5eaab | 32 | * mosi - SPI mosi pin connected to SD Card |
halfpitch | 0:6f9648f5eaab | 33 | * miso - SPI miso pin conencted to SD Card |
halfpitch | 0:6f9648f5eaab | 34 | * sclk - SPI sclk pin connected to SD Card |
halfpitch | 0:6f9648f5eaab | 35 | * cs - DigitalOut pin used as SD Card chip select |
halfpitch | 0:6f9648f5eaab | 36 | * name - The name used to access the filesystem |
halfpitch | 0:6f9648f5eaab | 37 | */ |
halfpitch | 0:6f9648f5eaab | 38 | SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name); |
halfpitch | 0:6f9648f5eaab | 39 | virtual int disk_initialize(); |
halfpitch | 0:6f9648f5eaab | 40 | virtual int disk_write(const char *buffer, int block_number); |
halfpitch | 0:6f9648f5eaab | 41 | virtual int disk_read(char *buffer, int block_number); |
halfpitch | 0:6f9648f5eaab | 42 | virtual int disk_status(); |
halfpitch | 0:6f9648f5eaab | 43 | virtual int disk_sync(); |
halfpitch | 0:6f9648f5eaab | 44 | virtual int disk_sectors(); |
halfpitch | 0:6f9648f5eaab | 45 | |
halfpitch | 0:6f9648f5eaab | 46 | protected: |
halfpitch | 0:6f9648f5eaab | 47 | |
halfpitch | 0:6f9648f5eaab | 48 | int _cmd(int cmd, int arg); |
halfpitch | 0:6f9648f5eaab | 49 | int _cmdx(int cmd, int arg); |
halfpitch | 0:6f9648f5eaab | 50 | int _cmd8(); |
halfpitch | 0:6f9648f5eaab | 51 | int _cmd58(); |
halfpitch | 0:6f9648f5eaab | 52 | int initialise_card(); |
halfpitch | 0:6f9648f5eaab | 53 | int initialise_card_v1(); |
halfpitch | 0:6f9648f5eaab | 54 | int initialise_card_v2(); |
halfpitch | 0:6f9648f5eaab | 55 | |
halfpitch | 0:6f9648f5eaab | 56 | |
halfpitch | 0:6f9648f5eaab | 57 | int _read(char *buffer, int length); |
halfpitch | 0:6f9648f5eaab | 58 | int _write(const char *buffer, int length); |
halfpitch | 0:6f9648f5eaab | 59 | int _sd_sectors(); |
halfpitch | 0:6f9648f5eaab | 60 | int _sectors; |
halfpitch | 0:6f9648f5eaab | 61 | |
halfpitch | 0:6f9648f5eaab | 62 | SPI _spi; |
halfpitch | 0:6f9648f5eaab | 63 | DigitalOut _cs; |
halfpitch | 0:6f9648f5eaab | 64 | }; |
halfpitch | 0:6f9648f5eaab | 65 | |
halfpitch | 0:6f9648f5eaab | 66 | #endif |