SPIBase.h
Go to the documentation of this file.
1 /*
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * SPIBase.h
8  *
9  * Created on: Mar 2, 2016
10  * Author: harry-boe
11  *
12  */
13 
14 #pragma once
15 
16 #include "SPISettings.h"
17 
23 /* @brief Base class/interface for SPI implementations
24  */
25 class SPIBase
26 {
27 public:
29  {
30  }
31 
32  virtual ~SPIBase()
33  {
34  }
35 
38  virtual void begin() = 0;
39 
42  virtual void end() = 0;
43 
46  virtual void beginTransaction(SPISettings mySettings) = 0;
47 
50  virtual void endTransaction() = 0;
51 
60  virtual unsigned char transfer(unsigned char val) = 0;
61  virtual unsigned short transfer16(unsigned short val) = 0;
62  virtual void transfer(uint8_t* buffer, size_t size) = 0;
63 
70 };
71 
Definition: SPISettings.h:33
virtual void beginTransaction(SPISettings mySettings)=0
beginTransaction(): Initializes the SPI bus using the defined SPISettings.
SPIBase()
Definition: SPIBase.h:28
virtual void endTransaction()=0
endTransaction(): Stop using the SPI bus. Normally this is called after de-asserting the chip select...
virtual unsigned short transfer16(unsigned short val)=0
virtual ~SPIBase()
Definition: SPIBase.h:32
virtual unsigned char transfer(unsigned char val)=0
transfer(), transfer16()
virtual void end()=0
end(): Disables the SPI bus (leaving pin modes unchanged).
Definition: SPIBase.h:25
SPISettings SPIDefaultSettings
Default settings used by the SPI bus until reset by beginTransaction(SPISettings) ...
Definition: SPIBase.h:69
virtual void begin()=0
begin(): Initializes the SPI bus by setting SCK, MOSI, and SS to outputs, pulling SCK and MOSI low...