s8 temp;
double d_temp;
+ u8 stat_clk;
+ u8 clk_src;
if(argc < 2) usage_help(argv[0]);
}
else fprintf(stderr,"Error while initializing bno055.\n");
+ if(bno055_get_stat_main_clk(&stat_clk) != BNO055_SUCCESS)
+ fprintf(stderr,"Error while reading clock status.\n");
+ else
+ {
+ if(stat_clk==0)
+ {
+ clk_src=1;
+ if(bno055_set_clk_src(clk_src) != BNO055_SUCCESS) fprintf(stderr,"Error while setting clock source.\n");
+ else printf("Clock source changed to external\n");
+ }
+ else printf("Clock source can't be changed.\n");
+ }
+
printf("Raw data:\n");
if(bno055_set_operation_mode(BNO055_OPERATION_MODE_AMG) != BNO055_SUCCESS)
fprintf(stderr,"Error while setting operation mode.\n");
else fprintf(stderr,"Error while reading gravity in m/s^2.\n");
if(bno055_convert_double_temp_celsius(&d_temp) == BNO055_SUCCESS)
- printf("Temperature=%G degree Celsius\n",d_temp);
+ printf("Temperature=%G degrees Celsius\n",d_temp);
else fprintf(stderr,"Error while reading temperature in degrees Celsius.\n");
close(fd);