roo_io
API Documentation for roo_io
Loading...
Searching...
No Matches
sdspi.h
Go to the documentation of this file.
1
#pragma once
2
3
#if (defined ESP32 && defined ARDUINO)
4
5
#include <functional>
6
#include <string>
7
8
#include "SPI.h"
9
#include "
roo_io/base/string_view.h
"
10
#include "
roo_io/fs/esp32/base_vfs_filesystem.h
"
11
#include "
roo_io/fs/posix/posix_mount.h
"
12
#include "sd_diskio.h"
13
14
namespace
roo_io
{
15
16
// Exposes the roo_io::Filesystem interface over the native ESP32 Arduino SD
17
// implementation, using the VFS API and Posix interface to the file system.
18
// This is very similar to "roo_io/fs/arduino/sdfs.h", but uses the lower-level
19
// sd_diskio interface directly, instead of going through the Arduino SD object.
20
class
ArduinoSdSpiFs
:
public
BaseEsp32VfsFilesystem
{
21
public
:
22
void
setCsPin
(
uint8_t
cs_pin
) {
cs_pin_
= (
gpio_num_t
)
cs_pin
; }
23
void
setSPI
(
decltype
(
::SPI
)&
spi
) {
spi_
= &
spi
; }
24
25
MediaPresence checkMediaPresence()
override
;
26
27
protected
:
28
friend
ArduinoSdSpiFs
CreateArduinoSdSpiFs
();
29
30
ArduinoSdSpiFs
(
uint8_t
cs_pin
=
SS
,
decltype
(
::SPI
)&
spi
=
::SPI
,
31
uint32_t
freq
= 20000000);
32
33
MountImpl::MountResult mountImpl(std::function<
void
()>
unmount_fn
)
override
;
34
35
void
unmountImpl()
override
;
36
37
gpio_num_t
cs_pin_
;
38
39
decltype
(
::SPI
)*
spi_
;
40
41
uint8_t
pdrv_
;
42
};
43
44
extern
ArduinoSdSpiFs
SD_SPI
;
45
46
}
// namespace roo_io
47
48
#endif
base_vfs_filesystem.h
roo_io
Definition
byte.h:6
roo_io::basic_string_view
roo::basic_string_view< CharT, Traits > basic_string_view
Definition
string_view.h:8
posix_mount.h
string_view.h
temp_repos
roo_io
src
roo_io
fs
esp32
arduino
sdspi.h
Generated by
1.9.8