USBMSD SD card Hello World for Mbed platforms
Dependencies: mbed USBMSD_SD USBDevice
SDcard.h@2:27a7e7f8d399, 2011-11-11 (annotated)
- Committer:
- samux
- Date:
- Fri Nov 11 15:22:53 2011 +0000
- Revision:
- 2:27a7e7f8d399
we have 2MB with the sdcard!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux |
2:27a7e7f8d399 | 1 | /* mbed Microcontroller Library - SDFileSystem |
samux |
2:27a7e7f8d399 | 2 | * Copyright (c) 2008-2009, sford |
samux |
2:27a7e7f8d399 | 3 | */ |
samux |
2:27a7e7f8d399 | 4 | |
samux |
2:27a7e7f8d399 | 5 | #ifndef SDCARD_H |
samux |
2:27a7e7f8d399 | 6 | #define SDCARD_H |
samux |
2:27a7e7f8d399 | 7 | |
samux |
2:27a7e7f8d399 | 8 | #include "mbed.h" |
samux |
2:27a7e7f8d399 | 9 | |
samux |
2:27a7e7f8d399 | 10 | class SDcard |
samux |
2:27a7e7f8d399 | 11 | { |
samux |
2:27a7e7f8d399 | 12 | public: |
samux |
2:27a7e7f8d399 | 13 | SDcard(PinName mosi, PinName miso, PinName sclk, PinName cs); |
samux |
2:27a7e7f8d399 | 14 | virtual int disk_write(const char *buffer, int block_number); |
samux |
2:27a7e7f8d399 | 15 | virtual int disk_read(char *buffer, int block_number); |
samux |
2:27a7e7f8d399 | 16 | |
samux |
2:27a7e7f8d399 | 17 | protected: |
samux |
2:27a7e7f8d399 | 18 | |
samux |
2:27a7e7f8d399 | 19 | int _cmd(int cmd, int arg); |
samux |
2:27a7e7f8d399 | 20 | int _read(char *buffer, int length); |
samux |
2:27a7e7f8d399 | 21 | int _write(const char *buffer, int length); |
samux |
2:27a7e7f8d399 | 22 | |
samux |
2:27a7e7f8d399 | 23 | SPI _spi; |
samux |
2:27a7e7f8d399 | 24 | DigitalOut _cs; |
samux |
2:27a7e7f8d399 | 25 | }; |
samux |
2:27a7e7f8d399 | 26 | |
samux |
2:27a7e7f8d399 | 27 | #endif |