Host/Core/SPI.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  * SPI.h
8  */
9 
14 #pragma once
15 
16 #include "SPIBase.h"
17 #include "SPISettings.h"
18 
19 //#define SPI_DEBUG 1
20 
21 // for compatibility when porting from Arduino
22 #define SPI_HAS_TRANSACTION 0
23 
30 class SPIClass : public SPIBase
31 {
32 public:
33  bool begin() override;
34 
35  void end() override
36  {
37  }
38 
40  using SPIBase::transfer;
41  void transfer(uint8_t* buffer, size_t numberBytes) override;
42 
43 protected:
44  void prepare(SPISettings& settings) override;
45 };
46 
48 extern SPIClass SPI;
Definition: SPISettings.h:66
bool begin() override
Initialize the SPI bus by setting SCK, MOSI, and SS to outputs, pulling SCK and MOSI low...
SPIClass SPI
Global instance of SPI class.
void beginTransaction(SPISettings &settings)
Initialize the SPI bus using the defined SPISettings.
Definition: SPIBase.h:48
Definition: Esp8266/Core/SPI.h:36
void prepare(SPISettings &settings) override
Prepare/configure with settings.
Definition: SPIBase.h:28
void end() override
Disable the SPI bus (leaving pin modes unchanged).
Definition: Host/Core/SPI.h:35
uint8_t transfer(uint8_t val)
Send/receive one bytes of data.
Definition: SPIBase.h:101
void transfer(uint8_t *buffer, size_t numberBytes) override
Send/receive a variable-length block of data.