mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Revising SD library API.
Open now returns a file object (which has a close() method); exists() no longer accepts a parent directory.
This commit is contained in:
39
libraries/SD/File.cpp
Normal file
39
libraries/SD/File.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
|
||||
SD - a slightly more friendly wrapper for sdfatlib
|
||||
|
||||
This library aims to expose a subset of SD card functionality
|
||||
in the form of a higher level "wrapper" object.
|
||||
|
||||
License: GNU General Public License V3
|
||||
(Because sdfatlib is licensed with this.)
|
||||
|
||||
(C) Copyright 2010 SparkFun Electronics
|
||||
|
||||
*/
|
||||
|
||||
#include <SD.h>
|
||||
|
||||
void File::write(uint8_t val) {
|
||||
SD.file.write(val);
|
||||
}
|
||||
|
||||
void File::write(const char *str) {
|
||||
SD.file.write(str);
|
||||
}
|
||||
|
||||
void File::write(const uint8_t *buf, size_t size) {
|
||||
SD.file.write(buf, size);
|
||||
}
|
||||
|
||||
int File::read() {
|
||||
return SD.file.read();
|
||||
}
|
||||
|
||||
void File::close() {
|
||||
SD.file.close();
|
||||
}
|
||||
|
||||
File::operator bool() {
|
||||
return SD.file.isOpen();
|
||||
}
|
Reference in New Issue
Block a user