Esp8266/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  * Created on: Mar 2, 2016
10  * Author: harry-boe
11  *
12  */
13 
18 #pragma once
19 
20 #include "SPIBase.h"
21 #include "SPISettings.h"
22 
23 //#define SPI_DEBUG 1
24 
25 // for compatibility when porting from Arduino
26 #define SPI_HAS_TRANSACTION 0
27 
28 #define SPI_NO 1
29 
36 class SPIClass : public SPIBase
37 {
38 public:
39  bool begin() override;
40 
41  void end() override
42  {
43  }
44 
45  uint8_t read8() override;
46  uint32_t transfer32(uint32_t val, uint8_t bits = 32) override;
47 
48  using SPIBase::transfer;
49  void transfer(uint8_t* buffer, size_t numberBytes) override;
50 
51 protected:
52  void prepare(SPISettings& settings) override;
53 };
54 
56 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.
uint8_t read8() override
Read one byte from SPI without setting up registers.
uint32_t transfer32(uint32_t val, uint8_t bits=32) override
Send/receive a word of variable size.
Definition: Esp8266/Core/SPI.h:36
void end() override
Disable the SPI bus (leaving pin modes unchanged).
Definition: Esp8266/Core/SPI.h:41
void prepare(SPISettings &settings) override
Prepare/configure with settings.
Definition: SPIBase.h:28
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.