![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
this will take a image from C328 serial camera and store those images in mbed flash as html and this html page is uploaded into the server at ip:192.168.1.2
SDFileSystem.h@0:e1a0471e5ffb, 2010-12-15 (annotated)
- Committer:
- mitesh2patel
- Date:
- Wed Dec 15 15:01:56 2010 +0000
- Revision:
- 0:e1a0471e5ffb
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mitesh2patel | 0:e1a0471e5ffb | 1 | /* mbed Microcontroller Library - SDFileSystem |
mitesh2patel | 0:e1a0471e5ffb | 2 | * Copyright (c) 2008-2009, sford |
mitesh2patel | 0:e1a0471e5ffb | 3 | */ |
mitesh2patel | 0:e1a0471e5ffb | 4 | |
mitesh2patel | 0:e1a0471e5ffb | 5 | #ifndef SDFILESYSTEM_H |
mitesh2patel | 0:e1a0471e5ffb | 6 | #define SDFILESYSTEM_H |
mitesh2patel | 0:e1a0471e5ffb | 7 | |
mitesh2patel | 0:e1a0471e5ffb | 8 | #include "mbed.h" |
mitesh2patel | 0:e1a0471e5ffb | 9 | #include "FATFileSystem.h" |
mitesh2patel | 0:e1a0471e5ffb | 10 | |
mitesh2patel | 0:e1a0471e5ffb | 11 | /* Class: SDFileSystem |
mitesh2patel | 0:e1a0471e5ffb | 12 | * Access the filesystem on an SD Card using SPI |
mitesh2patel | 0:e1a0471e5ffb | 13 | * |
mitesh2patel | 0:e1a0471e5ffb | 14 | * Example: |
mitesh2patel | 0:e1a0471e5ffb | 15 | * > SDFileSystem sd(p5, p6, p7, p12, "sd"); |
mitesh2patel | 0:e1a0471e5ffb | 16 | * > |
mitesh2patel | 0:e1a0471e5ffb | 17 | * > int main() { |
mitesh2patel | 0:e1a0471e5ffb | 18 | * > FILE *fp = fopen("/sd/myfile.txt", "w"); |
mitesh2patel | 0:e1a0471e5ffb | 19 | * > fprintf(fp, "Hello World!\n"); |
mitesh2patel | 0:e1a0471e5ffb | 20 | * > fclose(fp); |
mitesh2patel | 0:e1a0471e5ffb | 21 | * > } |
mitesh2patel | 0:e1a0471e5ffb | 22 | */ |
mitesh2patel | 0:e1a0471e5ffb | 23 | class SDFileSystem : public FATFileSystem { |
mitesh2patel | 0:e1a0471e5ffb | 24 | public: |
mitesh2patel | 0:e1a0471e5ffb | 25 | |
mitesh2patel | 0:e1a0471e5ffb | 26 | /* Constructor: SDFileSystem |
mitesh2patel | 0:e1a0471e5ffb | 27 | * Create the File System for accessing an SD Card using SPI |
mitesh2patel | 0:e1a0471e5ffb | 28 | * |
mitesh2patel | 0:e1a0471e5ffb | 29 | * Variables: |
mitesh2patel | 0:e1a0471e5ffb | 30 | * mosi - SPI mosi pin connected to SD Card |
mitesh2patel | 0:e1a0471e5ffb | 31 | * miso - SPI miso pin conencted to SD Card |
mitesh2patel | 0:e1a0471e5ffb | 32 | * sclk - SPI sclk pin connected to SD Card |
mitesh2patel | 0:e1a0471e5ffb | 33 | * cs - DigitalOut pin used as SD Card chip select |
mitesh2patel | 0:e1a0471e5ffb | 34 | * name - The name used to access the filesystem |
mitesh2patel | 0:e1a0471e5ffb | 35 | */ |
mitesh2patel | 0:e1a0471e5ffb | 36 | SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name); |
mitesh2patel | 0:e1a0471e5ffb | 37 | virtual int disk_initialize(); |
mitesh2patel | 0:e1a0471e5ffb | 38 | virtual int disk_write(const char *buffer, int block_number); |
mitesh2patel | 0:e1a0471e5ffb | 39 | virtual int disk_read(char *buffer, int block_number); |
mitesh2patel | 0:e1a0471e5ffb | 40 | virtual int disk_status(); |
mitesh2patel | 0:e1a0471e5ffb | 41 | virtual int disk_sync(); |
mitesh2patel | 0:e1a0471e5ffb | 42 | virtual int disk_sectors(); |
mitesh2patel | 0:e1a0471e5ffb | 43 | |
mitesh2patel | 0:e1a0471e5ffb | 44 | protected: |
mitesh2patel | 0:e1a0471e5ffb | 45 | |
mitesh2patel | 0:e1a0471e5ffb | 46 | int _cmd(int cmd, int arg); |
mitesh2patel | 0:e1a0471e5ffb | 47 | int _cmd8(); |
mitesh2patel | 0:e1a0471e5ffb | 48 | |
mitesh2patel | 0:e1a0471e5ffb | 49 | int _read(char *buffer, int length); |
mitesh2patel | 0:e1a0471e5ffb | 50 | int _write(const char *buffer, int length); |
mitesh2patel | 0:e1a0471e5ffb | 51 | int _sd_sectors(); |
mitesh2patel | 0:e1a0471e5ffb | 52 | int _sectors; |
mitesh2patel | 0:e1a0471e5ffb | 53 | |
mitesh2patel | 0:e1a0471e5ffb | 54 | SPI _spi; |
mitesh2patel | 0:e1a0471e5ffb | 55 | DigitalOut _cs; |
mitesh2patel | 0:e1a0471e5ffb | 56 | }; |
mitesh2patel | 0:e1a0471e5ffb | 57 | |
mitesh2patel | 0:e1a0471e5ffb | 58 | #endif |