Microchip® Advanced Software Framework

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

Common Sensor Service Pressure Sensor Example.

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

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

Macros

#define ACTIVITY_LED   (LED1)
 
#define PRINT_BANNER   (true)
 

Functions

int main (void)
 Pressure sensor demonstration application entry. More...
 

#define ACTIVITY_LED   (LED1)

Referenced by main().

#define PRINT_BANNER   (true)

Referenced by main().

int main ( void  )

Pressure sensor demonstration application entry.

After initializing the development platform and sensors, this application attaches a descriptor to the sensor on an Xplained pressure sensor board. The sensor pressure and temperature data, which is formatted and printed via printf() after being read, can be viewed with a terminal application on a machine attached to the serial interface on the development board.

References ACTIVITY_LED, sensor_device_t::caps, delay_ms, sensor_desc::drv, sensor_desc::err, sensor_desc::hal, sensor_caps_t::name, sensor_data_t::pressure, PRINT_BANNER, sensor_hal::resolution, sensor_data_t::scaled, sensor_attach(), sensor_device_id(), sensor_get_pressure(), sensor_get_temperature(), sensor_platform_init(), sensor_set_state(), SENSOR_STATE_HIGHEST_POWER, SENSOR_TYPE_BAROMETER, and sensor_data_t::temperature.