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.
Dependencies: MX12 ServoRingBuffer mbed-src
Fork of SpindleBot by
SSPI.cpp
00001 #include "SSPI.h" 00002 00003 00004 SSPI::SSPI(PinName mosi, PinName miso, PinName sclk) 00005 : MOSI(mosi), 00006 MISO(miso), 00007 SCLK(sclk) { 00008 00009 } 00010 00011 00012 unsigned char SSPI::write(unsigned char data) 00013 { 00014 unsigned char i; 00015 unsigned char out_data=0; 00016 wait_us(SCLK_DELAY_US); 00017 SCLK=0; 00018 for(i=0; i<8; i++) 00019 { 00020 wait_us(SCLK_DELAY_US); 00021 SCLK=1; 00022 wait_us(SCLK_DELAY_US); 00023 if(CHECK_BIT(data,7-i)) 00024 { 00025 MOSI=1; 00026 } 00027 else 00028 { 00029 MOSI=0; 00030 } 00031 out_data= ( out_data << 1 ) | MISO.read(); 00032 SCLK=0; 00033 } 00034 return out_data; 00035 }
Generated on Thu Jul 14 2022 07:15:41 by
1.7.2
