Skip to content

Commit 84e28e7

Browse files
committed
fixed : complie error on other Arduino hardware emvironment
*add include arduino.h *fixed : formula at SPI_HAS_TRANSACTION (#if -> #ifdef)
1 parent 8a9fd91 commit 84e28e7

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/SakuraIO_SPI.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
#include <Arduino.h>
12
#include <SPI.h>
23
#include "SakuraIO.h"
34
#include "SakuraIO/debug.h"
45

5-
#if SPI_HAS_TRANSACTION
6+
#ifdef SPI_HAS_TRANSACTION
67
static SPISettings settings;
78
#endif
89

910
void SakuraIO_SPI::begin(){
10-
#if SPI_HAS_TRANSACTION
11+
#ifdef SPI_HAS_TRANSACTION
1112
SPI.beginTransaction(settings);
1213
#endif
1314
dbgln("CS=0");
@@ -17,7 +18,7 @@ void SakuraIO_SPI::begin(){
1718
void SakuraIO_SPI::end(){
1819
dbgln("CS=1");
1920
digitalWrite(cs, HIGH);
20-
#if SPI_HAS_TRANSACTION
21+
#ifdef SPI_HAS_TRANSACTION
2122
SPI.endTransaction();
2223
#endif
2324
delayMicroseconds(20);
@@ -47,7 +48,7 @@ uint8_t SakuraIO_SPI::receiveByte(){
4748
SakuraIO_SPI::SakuraIO_SPI(int _cs){
4849
cs = _cs;
4950
SPI.begin();
50-
#if SPI_HAS_TRANSACTION
51+
#ifdef SPI_HAS_TRANSACTION
5152
settings = SPISettings(350000, MSBFIRST, SPI_MODE0); // 350kHz, MSB First, SPI mode 0
5253
#endif
5354
pinMode(cs, OUTPUT);

0 commit comments

Comments
 (0)