-
Notifications
You must be signed in to change notification settings - Fork 1
/
SDFileSystem.h
39 lines (35 loc) · 1.03 KB
/
SDFileSystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef MBED_SDFILESYSTEM_H
#define MBED_SDFILESYSTEM_H
#include "mbed.h"
#include "FATFileSystem.h"
#include <stdint.h>
class SDFileSystem : public FATFileSystem
{
public:
SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char *name);
virtual int disk_initialize();
virtual int disk_status();
virtual int disk_read(uint8_t *buffer, uint32_t block_number, uint32_t count);
virtual int disk_write(const uint8_t *buffer, uint32_t block_number, uint32_t count);
virtual int disk_sync();
virtual uint32_t disk_sectors();
protected:
int _cmd(int cmd, int arg);
int _cmdx(int cmd, int arg);
int _cmd8();
int _cmd58();
int initialise_card();
int initialise_card_v1();
int initialise_card_v2();
int _read(uint8_t *buffer, uint32_t length);
int _write(const uint8_t *buffer, uint32_t length);
uint32_t _sd_sectors();
uint32_t _sectors;
uint32_t _init_sck;
uint32_t _transfer_sck;
SPI _spi;
DigitalOut _cs;
int cdv;
int _is_initialized;
};
#endif