drjohnsmith
Well-known member
Have some code on teensy 3.2, duino 1.81
From what I am seeing with a scope
the first time I call this it works,
the second time, it seems to be totally ignoring the pin,
probably my code, but it struck a thought..
In my old C days, we had to define input pins as volatile,
but in arduino world we dont seem to ,
Is this taken care of when we declare a pin mode as digital input ?
For reference , SPI1_nRDY is a copy of the SPI MISO pin, wired onto teensy 3.2 pin D8 , its not the SPI pin itself.
uint8_t WaitRdyGoLow(void)
{
for ( uint8_t i = 0 ; i < 1000; i++ )
{
delay ( 1 );
if ( digitalRead( SPI1_nRDY ) == 0 )
{
Serial.println("!");
return( 0);
}
}
Serial.println (" Wait time out error" );
return( 1 ); // loop timed out , so return error
}//WaitRdyGoLow
From what I am seeing with a scope
the first time I call this it works,
the second time, it seems to be totally ignoring the pin,
probably my code, but it struck a thought..
In my old C days, we had to define input pins as volatile,
but in arduino world we dont seem to ,
Is this taken care of when we declare a pin mode as digital input ?
For reference , SPI1_nRDY is a copy of the SPI MISO pin, wired onto teensy 3.2 pin D8 , its not the SPI pin itself.
uint8_t WaitRdyGoLow(void)
{
for ( uint8_t i = 0 ; i < 1000; i++ )
{
delay ( 1 );
if ( digitalRead( SPI1_nRDY ) == 0 )
{
Serial.println("!");
return( 0);
}
}
Serial.println (" Wait time out error" );
return( 1 ); // loop timed out , so return error
}//WaitRdyGoLow