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
SakuraIO_SPI.cpp
00001 #include "mbed.h" 00002 #include "SakuraIO.h" 00003 #include "SakuraIO/debug.h" 00004 00005 00006 void SakuraIO_SPI::begin(){ 00007 dbgln("CS=0"); 00008 cs = 0; 00009 } 00010 00011 void SakuraIO_SPI::end(){ 00012 dbgln("CS=1"); 00013 cs = 1; 00014 wait_us(20); 00015 } 00016 00017 void SakuraIO_SPI::sendByte(uint8_t data){ 00018 wait_us(20); 00019 dbg("Send="); 00020 dbgln(data); 00021 wait_us(10); 00022 spi.write(data); 00023 } 00024 00025 00026 uint8_t SakuraIO_SPI::receiveByte(bool stop){ 00027 return receiveByte(); 00028 } 00029 00030 uint8_t SakuraIO_SPI::receiveByte(){ 00031 uint8_t ret; 00032 wait_us(10); 00033 ret = spi.write(0x00); 00034 dbg("Recv="); 00035 dbgln(ret); 00036 return ret; 00037 } 00038 00039 SakuraIO_SPI::SakuraIO_SPI(SPI &_spi, PinName _cs): spi(_spi), cs(_cs){ 00040 cs = 1; 00041 } 00042 00043 SakuraIO_SPI::SakuraIO_SPI(PinName _mosi, PinName _miso, PinName _sck, PinName _cs): spi(_mosi, _miso, _sck), cs(_cs){ 00044 cs = 1; 00045 }
Generated on Sun Jul 17 2022 01:16:21 by
1.7.2
