blob: 80a9cdad3d88746f0c9ab8d5d52bb05875dc1c03 (
plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
* SD.h
*
* Created on: 2011/08/19
* Author: atsu
*/
#ifndef SD_H_
#define SD_H_
#include <libmary.h>
#include <SPI.h>
#include "pff.h"
#ifdef __cplusplus
extern "C" {
#endif
class PETITFS{
private:
FATFS fatfs; // File system object
DIR dir; // Directory object
FILINFO fno; // File information object
WORD bw, br, i;
char buff[64];
FRESULT rc;
public:
int SDCS; //CS pin
PETITFS();
~PETITFS();
BOOL begin(SSP_PORT port);
BOOL begin(int cs_pin);
BOOL begin();
BOOL exists();
BOOL mkdir();
FRESULT open(const char* filename); //???
BOOL remove(const char* filename);
BOOL rmdir(const char* filename);
int available();
void close();
void flush();
int peek();
unsigned long position();
void print(const char *s);
void print(int val, RADIX_FORMAT format);
void println(const char *s);
void println(int val, RADIX_FORMAT format) ;
BOOL seek(unsigned long pos);
unsigned long size();
int read();
void write(const char *s);
void write(const char *s,int length);
};
extern PETITFS SDFile;
#ifdef __cplusplus
} //extern "C"
#endif
#endif /* SD_H_ */
|