Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SakuraIO by
Revision 4:85955eb2e61a, committed 2016-11-21
- 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 |
--- 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
--- 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; +}