Sakura IoT Platform b

Fork of SakuraIO by SAKURA Internet

Files at this revision

API Documentation at this revision

Comitter:
sakurafan
Date:
Mon Nov 21 14:10:51 2016 +0000
Parent:
2:6f8e51a42a7d
Commit message:
fix spi

Changed in this revision

SakuraIO.h Show annotated file Show diff for this revision Revisions of this file
SakuraIO_SPI.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 6f8e51a42a7d -r 85955eb2e61a SakuraIO.h
--- a/SakuraIO.h	Sat Nov 19 12:34:23 2016 +0000
+++ b/SakuraIO.h	Mon Nov 21 14:10:51 2016 +0000
@@ -62,15 +62,16 @@
 class SakuraIO_SPI : public SakuraIO
 {
 protected:
-    SPI &spi;
-    DigitalOut &cs;
+    SPI spi;
+    DigitalOut cs;
     virtual void begin();
     virtual void end();
     virtual void sendByte(uint8_t data);
     virtual uint8_t receiveByte(bool stop);
     virtual uint8_t receiveByte();
 public:
-    SakuraIO_SPI(SPI &_spi, DigitalOut &_cs);
+    SakuraIO_SPI(SPI &_spi, PinName _cs);
+    SakuraIO_SPI(PinName _mosi, PinName _miso, PinName _sck, PinName _cs);
 };
 
 class SakuraIO_I2C : public SakuraIO
diff -r 6f8e51a42a7d -r 85955eb2e61a SakuraIO_SPI.cpp
--- a/SakuraIO_SPI.cpp	Sat Nov 19 12:34:23 2016 +0000
+++ b/SakuraIO_SPI.cpp	Mon Nov 21 14:10:51 2016 +0000
@@ -36,6 +36,10 @@
   return ret;
 }
 
-SakuraIO_SPI::SakuraIO_SPI(SPI &_spi, DigitalOut &_cs): spi(_spi), cs(_cs){
+SakuraIO_SPI::SakuraIO_SPI(SPI &_spi, PinName _cs): spi(_spi), cs(_cs){
     cs = 1;
 }
+
+SakuraIO_SPI::SakuraIO_SPI(PinName _mosi, PinName _miso, PinName _sck, PinName _cs): spi(_mosi, _miso, _sck), cs(_cs){
+    cs = 1;
+}