#include "TOF_B_I2C.h"


tofsense_f_output_parameter tof_f0;//The structure storing the output data of TOFSense-F with ID 0

int main()
{
	TOF_B_init();
	
	while(1)
	{
		IIC_Unpack_Data(iic_read_buff,&tof_f0);//Read and decode all register information through IIC, and store the decoded variables into the structure member variables

		//print data via terminal
		printf("id: %d\r\n",tof_f0.id);

		printf("system_time:%d \r\n",tof_f0.system_time);

		printf("dis: %.2fm\r\n",tof_f0.dis);

		printf("dis_status: %d \r\n",tof_f0.dis_status);

		printf("signal_strength: %d \r\n",tof_f0.signal_strength);

		printf("range_precision: %d \r\n\n",tof_f0.range_precision);
		
		delay(100);//Query every 100ms

	} 
  
  return 0;
}