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.
Loading...
Searching...
No Matches
SdSpiSoftDriver.h
Go to the documentation of this file.
1
29#ifndef SdSpiSoftDriver_h
30#define SdSpiSoftDriver_h
31#include "../DigitalIO/SoftSPI.h"
37{
38 public:
40 void activate()
41 {
42 }
44 virtual void begin() = 0;
49 void begin(SdSpiConfig spiConfig)
50 {
51 (void)spiConfig;
52 begin();
53 }
56 {
57 }
62 virtual uint8_t receive() = 0;
70 uint8_t receive(uint8_t *buf, size_t count)
71 {
72 for (size_t i = 0; i < count; i++)
73 {
74 buf[i] = receive();
75 }
76 return 0;
77 }
82 virtual void send(uint8_t data) = 0;
88 void send(const uint8_t *buf, size_t count)
89 {
90 for (size_t i = 0; i < count; i++)
91 {
92 send(buf[i]);
93 }
94 }
99 void setSckSpeed(uint32_t maxSck)
100 {
101 (void)maxSck;
102 }
103};
104//------------------------------------------------------------------------------
109template <uint8_t MisoPin, uint8_t MosiPin, uint8_t SckPin> class SoftSpiDriver : public SdSpiSoftDriver
110{
111 public:
113 void begin()
114 {
115 m_spi.begin();
116 }
121 uint8_t receive()
122 {
123 return m_spi.receive();
124 }
129 void send(uint8_t data)
130 {
131 m_spi.send(data);
132 }
133
134 private:
136};
137
140#endif // SdSpiSoftDriver_h
SdSpiSoftDriver SdSpiDriver
Definition SdSpiSoftDriver.h:139
SPI card configuration.
Definition SdSpiDriver.h:112
Base class for external soft SPI.
Definition SdSpiSoftDriver.h:37
void deactivate()
Definition SdSpiSoftDriver.h:55
virtual uint8_t receive()=0
void send(const uint8_t *buf, size_t count)
Definition SdSpiSoftDriver.h:88
void setSckSpeed(uint32_t maxSck)
Definition SdSpiSoftDriver.h:99
virtual void send(uint8_t data)=0
uint8_t receive(uint8_t *buf, size_t count)
Definition SdSpiSoftDriver.h:70
void activate()
Definition SdSpiSoftDriver.h:40
virtual void begin()=0
void begin(SdSpiConfig spiConfig)
Definition SdSpiSoftDriver.h:49
Fast software SPI.
Definition SoftSPI.h:49
void begin()
Definition SoftSPI.h:53
Class for external soft SPI.
Definition SdSpiSoftDriver.h:110
uint8_t receive()
Definition SdSpiSoftDriver.h:121
void begin()
Definition SdSpiSoftDriver.h:113
SoftSPI< MisoPin, MosiPin, SckPin, 0 > m_spi
Definition SdSpiSoftDriver.h:135
void send(uint8_t data)
Definition SdSpiSoftDriver.h:129