Soldered SD Card Arduino Library
1.0.0
Easily read and write files to and form the SD card breakout! A fork of the original SDFat library by Bill Greiman.
Toggle main menu visibility
Loading...
Searching...
No Matches
ArduinoFiles.h
Go to the documentation of this file.
1
25
#ifndef ArduinoFiles_h
26
#define ArduinoFiles_h
27
#include "
../SdFatConfig.h
"
28
//------------------------------------------------------------------------------
30
#ifndef FILE_READ
31
#define FILE_READ O_RDONLY
32
#endif
// FILE_READ
34
#ifndef FILE_WRITE
35
#define FILE_WRITE (O_RDWR | O_CREAT | O_AT_END)
36
#endif
// FILE_WRITE
37
//------------------------------------------------------------------------------
42
template
<
class
BaseFile>
class
PrintFile
:
public
print_t
,
public
BaseFile
43
{
44
public
:
45
using
BaseFile::clearWriteError;
46
using
BaseFile::getWriteError;
47
using
BaseFile::read;
48
using
BaseFile::write;
53
size_t
write
(uint8_t b)
54
{
55
return
BaseFile::write(&b, 1);
56
}
57
};
58
//------------------------------------------------------------------------------
63
template
<
class
BaseFile,
typename
PosType>
class
StreamFile
:
public
stream_t
,
public
BaseFile
64
{
65
public
:
66
using
BaseFile::clearWriteError;
67
using
BaseFile::getWriteError;
68
using
BaseFile::read;
69
using
BaseFile::write;
70
71
StreamFile
()
72
{
73
}
74
78
int
available
()
79
{
80
return
BaseFile::available();
81
}
82
83
void
flush
()
84
{
85
BaseFile::sync();
86
}
87
90
bool
isDirectory
()
91
{
92
return
BaseFile::isDir();
93
}
94
99
const
char
*
name
()
const
100
{
101
return
"use getName()"
;
102
}
103
107
int
peek
()
108
{
109
return
BaseFile::peek();
110
}
111
112
PosType
position
()
113
{
114
return
BaseFile::curPosition();
115
}
116
121
int
read
()
122
{
123
return
BaseFile::read();
124
}
125
126
void
rewindDirectory
()
127
{
128
if
(BaseFile::isDir())
129
{
130
BaseFile::rewind();
131
}
132
}
133
140
bool
seek
(PosType pos)
141
{
142
return
BaseFile::seekSet(pos);
143
}
144
145
PosType
size
()
146
{
147
return
BaseFile::fileSize();
148
}
149
154
size_t
write
(uint8_t b)
155
{
156
return
BaseFile::write(b);
157
}
158
170
size_t
write
(
const
uint8_t *buffer,
size_t
size
)
171
{
172
return
BaseFile::write(buffer,
size
);
173
}
174
};
175
#endif
// ArduinoFiles_h
SdFatConfig.h
configuration definitions
print_t
Print print_t
Definition
SysCall.h:66
stream_t
Stream stream_t
Definition
SysCall.h:68
PrintFile
PrintFile class.
Definition
ArduinoFiles.h:43
PrintFile::write
size_t write(uint8_t b)
Definition
ArduinoFiles.h:53
StreamFile::available
int available()
Definition
ArduinoFiles.h:78
StreamFile::write
size_t write(uint8_t b)
Definition
ArduinoFiles.h:154
StreamFile::write
size_t write(const uint8_t *buffer, size_t size)
Definition
ArduinoFiles.h:170
StreamFile::StreamFile
StreamFile()
Definition
ArduinoFiles.h:71
StreamFile::position
PosType position()
Definition
ArduinoFiles.h:112
StreamFile::read
int read()
Definition
ArduinoFiles.h:121
StreamFile::flush
void flush()
Definition
ArduinoFiles.h:83
StreamFile::name
const char * name() const
Definition
ArduinoFiles.h:99
StreamFile::size
PosType size()
Definition
ArduinoFiles.h:145
StreamFile::isDirectory
bool isDirectory()
Definition
ArduinoFiles.h:90
StreamFile::seek
bool seek(PosType pos)
Definition
ArduinoFiles.h:140
StreamFile::rewindDirectory
void rewindDirectory()
Definition
ArduinoFiles.h:126
StreamFile::peek
int peek()
Definition
ArduinoFiles.h:107
src
common
ArduinoFiles.h
Generated on
for Soldered SD Card Arduino Library by
1.17.0. Dark theme by
Tilen Majerle
. All rights reserved. Copyright:
Soldered