beautypg.com

PNI RM3000-F Sensor Suite User Manual

Page 46

background image

PNI Sensor Corporation

Doc #1016102 r04

RM3000-f & RM2000-f Sensor Suite User Manual

Page 46

/*************************************************************************
* Function Name : DataReady()
* Description : Check DRDY pin, return true if high, otherwise false.
* Input : None
* Output : None
* Return : true or false
*************************************************************************/

bool DataReady()
{

if (DRDY_PIN == 1)

return true;

else

return false;

}


/*************************************************************************
* Function Name : main()
* Description : Init 3D MagIC, set config, and read one measurement
* Input : None
* Output : None
* Return : None
*************************************************************************/

main()
{

//Init 3D MagIC

ThreeD_magic_init();

//The following is to get one measurement on X, Y and Z

//To get multiple measurement, repeat the following in a loop.


//Set up 3D MagIC to read one measurement on X, Y and Z axes

ThreeD_magic_setup();

//If data is not ready, wait here

while (DataReady() != true);

//Clock out (read) the measurement.

mag_sample();

}