I'm using a sensor that communicates over SPI with an arduino. I found a library to interface with it that uses a Data Ready pin. When the pin goes high it triggers an interrupt that reads the data.
I'm wondering what a Data Ready pin is and how to use it.
I'm also wondering what's up with this phrasing of code
// Data Ready Flag
boolean validData = false;
// Call ADIS16448 Class
ADIS16448 IMU(7,2,4); //ChipSelect,DataReady,Reset Pin Assignments
void setup()
{
Serial.begin(115200); // Initialize serial output via USB
IMU.configSPI(); // Configure SPI communication
delay(100); // Give the part time to start up
IMU.regWrite(SMPL_PRD,0x1), // Set Decimation on IMU
delay(20);
// Read the control registers once to print to screen
MSC = IMU.regRead(MSC_CTRL);
SENS = IMU.regRead(SENS_AVG);
SMPL = IMU.regRead(SMPL_PRD);
attachInterrupt(0, setDRFlag, RISING); // Attach interrupt to pin 2. Trigger on the rising edge
}
I think it might have something to do with this but I don't know.
////////////////////////////////////////////////////////////////////////////
// Constructor with configurable CS, DR, and RST
////////////////////////////////////////////////////////////////////////////
// CS - Chip select pin
// DR - DR output pin for data ready
// RST - Hardware reset pin
////////////////////////////////////////////////////////////////////////////
ADIS16448::ADIS16448(int CS, int DR, int RST) {
_CS = CS;
_DR = DR;
_RST = RST;
SPI.begin(); // Initialize SPI bus
configSPI(); // Configure SPI
//Set default pin states
pinMode(_CS, OUTPUT); // Set CS pin to be an output
pinMode(_DR, INPUT); // Set DR pin to be an input
pinMode(_RST, OUTPUT); // Set RST pin to be an output
digitalWrite(_CS, HIGH); // Initialize CS pin to be high
digitalWrite(_RST, HIGH); // Initialize RST pin to be high
}