#include <fastIO.h>
void setup() {
// put your setup code here, to run once:
fastPinMode(8, OUTPUT);
fastPinMode(2, OUTPUT);
fastPinMode(3, OUTPUT);
//fastDigitalWrite(A1, 1);
/*pinMode(8, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);*/
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(13, OUTPUT);
Serial.begin(115200);
delay(100);
Serial.println("Hello_Arduino_soft_Spi");
}
long data=0;
long tdata=0;
long data2=0;
long tdata2=0;
long data3=0;
long tdata3=0;
long time=0;
void loop() {
// put your main code here, to run repeatedly:
fastDigitalWrite(8, 1);
//digitalWrite(8, HIGH);
fastDigitalWrite(8, 1);
//digitalWrite(2, HIGH); //rst_spi
fastDigitalWrite(2, 1);
fastDigitalWrite(2, 1);
//delay(2);
// digitalWrite(8, LOW);
fastDigitalWrite(8, 0);
//digitalWrite(2, LOW); //rst_spi
fastDigitalWrite(2, 0);
//delay(2);
//
digitalWrite(13, HIGH);
time= micros();
for(int i=0;i<32;i++)
{
//clk_spi
fastDigitalWrite(3, 1);
//digitalWrite(3, HIGH);
//delayMicroseconds(1);
fastDigitalWrite(3, 0);
//delayMicroseconds(1);
//clk_data_read
// Serial.println(i);
bitWrite(data, i, fastDigitalRead(4));//digitalRead(4)); // write 1 to the least significant bit of x
bitWrite(data2, i, fastDigitalRead(5));//digitalRead(5)); // write 1 to the least significant bit of x
bitWrite(data3, i, fastDigitalRead(6));//digitalRead(6)); // write 1 to the least significant bit of x
}
time=micros()-time;
if(data!=tdata)
{
Serial.print(data);
Serial.print(":");
Serial.print(data2);
Serial.print(":");
Serial.print(data3);
Serial.print(":");
Serial.println(time);
tdata=data;
}
digitalWrite(13, LOW);
}