Skip to content

Commit 4bd75df

Browse files
authored
Merge pull request #127 from arduino/hardware-spi-pure-virtual
HardwareSPI needs to be a abstract base class
2 parents 0bb01af + 4756cd3 commit 4bd75df

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

api/HardwareSPI.h

+13-11
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,24 @@ const SPISettings DEFAULT_SPI_SETTINGS = SPISettings();
104104
class HardwareSPI
105105
{
106106
public:
107-
virtual uint8_t transfer(uint8_t data);
108-
virtual uint16_t transfer16(uint16_t data);
109-
virtual void transfer(void *buf, size_t count);
107+
virtual ~HardwareSPI() { }
108+
109+
virtual uint8_t transfer(uint8_t data) = 0;
110+
virtual uint16_t transfer16(uint16_t data) = 0;
111+
virtual void transfer(void *buf, size_t count) = 0;
110112

111113
// Transaction Functions
112-
virtual void usingInterrupt(int interruptNumber);
113-
virtual void notUsingInterrupt(int interruptNumber);
114-
virtual void beginTransaction(SPISettings settings);
115-
virtual void endTransaction(void);
114+
virtual void usingInterrupt(int interruptNumber) = 0;
115+
virtual void notUsingInterrupt(int interruptNumber) = 0;
116+
virtual void beginTransaction(SPISettings settings) = 0;
117+
virtual void endTransaction(void) = 0;
116118

117119
// SPI Configuration methods
118-
virtual void attachInterrupt();
119-
virtual void detachInterrupt();
120+
virtual void attachInterrupt() = 0;
121+
virtual void detachInterrupt() = 0;
120122

121-
virtual void begin();
122-
virtual void end();
123+
virtual void begin() = 0;
124+
virtual void end() = 0;
123125
};
124126

125127
// Alias SPIClass to HardwareSPI since it's already the defacto standard for SPI classe name

0 commit comments

Comments
 (0)