Microchip® Advanced Software Framework

common/applications/sensors/inertial_demo/main.c File Reference

Common Sensor Service Inertial Sensor Example.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdio.h>
#include <asf.h>
#include <led.h>


#define ACTIVITY_LED   (LED1) /* LED to blink to show activity */
#define PRINT_BANNER   (true) /* If true, print sensor config information */
#define SCALED_DATA   (true) /* If true, convert sensor data to std. units */


int main (void)
 Inertial sensor demo application entry. More...

#define ACTIVITY_LED   (LED1) /* LED to blink to show activity */

Referenced by main().

#define PRINT_BANNER   (true) /* If true, print sensor config information */

Referenced by main().

#define SCALED_DATA   (true) /* If true, convert sensor data to std. units */

Referenced by main().

int main ( void  )

Inertial sensor demo application entry.

After initializing the Xplained platform and sensor boards, this application attaches descriptors to the accelerometer, gyroscope, and compass devices on an Xplained inertial sensor board. The sensor data, which is formatted and printed via printf() after being read, can be viewed with a serial terminal application on a machine attached to the USB interface on the Xplained board.

References ACTIVITY_LED, sensor_data_t::axis, delay_ms, freq, sensor_data_t::heading, PRINT_BANNER, sensor_data_t::scaled, SCALED_DATA, sensor_attach(), sensor_device_id(), sensor_get_acceleration(), sensor_get_bandwidth(), sensor_get_field(), sensor_get_heading(), sensor_get_range(), sensor_get_rotation(), sensor_get_temperature(), sensor_platform_init(), SENSOR_TYPE_ACCELEROMETER, SENSOR_TYPE_COMPASS, SENSOR_TYPE_GYROSCOPE, sensor_data_t::temperature, and version.