sensor.h

Functions to read various input sensors.

This file defines the sensor service, which provides functions for reading the various input sensors that are available on the device, including the accelerometer, magnetometer, temperature, illuminance, and so on.

The supported sensors are listed by the enumeration sensor_type_t. To start receiving sensor events, call sensor_request_events() and pass in the sensor type. To set the refresh rate of the sensor, call sensor_set_rate() . To specify whether duplicate sensor events should be skipped, call sensor_set_skip_duplicates() .

Once a BPS event is received, you can call sensor_get_domain() to determine whether it was a sensor event and bps_event_get_code() to determine the type of sensor event.

The sensors return a variety of different data, so depending on which sensor you want to use, you need to call a different sensor_event_get_* function to retrieve the readings. See the individual functions to determine which sensors they work with.

To stop receiving sensor events, call sensor_stop_events() .