The sensor device service provides high-level interfaces and binary driver libraries for sensor devices on systems built around Atmel microcontrollers.
Common API for UC3, XMEGA, AVR MEGA, and SAM.
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the Sensor Device Stack. | |
Common Sensor API | |
Data Structures | |
struct | sensor_axis_vec_t |
Sensor Axis Descriptor. More... | |
struct | sensor_caps_t |
Sensor Capabilities. More... | |
struct | sensor_data_t |
Sensor Data Descriptor. More... | |
struct | sensor_desc |
Generic Sensor API Descriptor. More... | |
struct | sensor_device_t |
Sensor Device Driver Specific Descriptor. More... | |
interface | sensor_enum_callback |
Sensor Enumeration Handler Callback Type. More... | |
interface | sensor_event_callback |
Sensor Event Handler Callback Type. More... | |
struct | sensor_event_callback_t |
allocate one per event type (v. More... | |
struct | sensor_event_data_t |
Sensor Event Data Descriptor. More... | |
struct | sensor_funcs_t |
Sensor Driver Entry Point Table. More... | |
struct | sensor_hal |
Sensor Platform Hardware Abstraction Descriptor. More... | |
struct | sensor_map_t |
Sensor Operational Capabilities Descriptors. More... | |
struct | sensor_orient_t |
Sensor Orientation Descriptor. More... | |
struct | sensor_tap_params_t |
Sensor Tap Event Parameters. More... | |
struct | sensor_threshold_desc_t |
Sensor Threshold Descriptor. More... | |
Macros | |
#define | SENSOR_CHANNEL_ALL (-1) |
Sensor Channel Constants - used to select channel within device. More... | |
Typedefs | |
typedef struct sensor_hal | sensor_hal_t |
Sensor Hardware Abstraction Descriptor. More... | |
typedef struct sensor_desc | sensor_t |
Generic Sensor API Descriptor. More... | |
Sensor Physical Axis Definitions | |
enum | sensor_axis_t { SENSOR_AXIS_X = 0, SENSOR_AXIS_Y = 1, SENSOR_AXIS_Z = 2, SENSOR_AXIS_NONE = -1 } |
Sensor Axis Name Constants. More... | |
enum | sensor_sign_t { SENSOR_SIGN_POS = 1, SENSOR_SIGN_NEG = -1, SENSOR_SIGN_NONE = 0 } |
Sensor Axis Sign Constants. More... | |
#define | AXIS_X_POS {SENSOR_AXIS_X, SENSOR_SIGN_POS} |
#define | AXIS_X_NEG {SENSOR_AXIS_X, SENSOR_SIGN_NEG} |
#define | AXIS_Y_POS {SENSOR_AXIS_Y, SENSOR_SIGN_POS} |
#define | AXIS_Y_NEG {SENSOR_AXIS_Y, SENSOR_SIGN_NEG} |
#define | AXIS_Z_POS {SENSOR_AXIS_Z, SENSOR_SIGN_POS} |
#define | AXIS_Z_NEG {SENSOR_AXIS_Z, SENSOR_SIGN_NEG} |
#define | AXIS_NONE {SENSOR_AXIS_NONE, SENSOR_SIGN_NONE} |
Sensor Sample Commands and Data Formats | |
enum | sample_format_t { SAMPLE_FORMAT_COUNTS, SAMPLE_FORMAT_SCALED } |
Sensor Sample Data Format. More... | |
enum | sensor_units_t { SENSOR_UNITS_NONE, SENSOR_UNITS_g0, SENSOR_UNITS_gauss, SENSOR_UNITS_lux, SENSOR_UNITS_lumen, SENSOR_UNITS_pascal, SENSOR_UNITS_deg_per_sec, SENSOR_UNITS_deg_Celcius, SENSOR_UNITS_tesla, SENSOR_UNITS_volt_DC, SENSOR_UNITS_volt_AC } |
Sensor Sample Units. More... | |
enum | sensor_scale_t { SENSOR_SCALE_micro = -6, SENSOR_SCALE_milli = -3, SENSOR_SCALE_centi = -2, SENSOR_SCALE_deci = -1, SENSOR_SCALE_one = 0, SENSOR_SCALE_deca = 1, SENSOR_SCALE_hecto = 2, SENSOR_SCALE_kilo = 3 } |
Sensor Sample Unit Scale. More... | |
typedef sensor_map_t | sensor_range_t |
typedef sensor_map_t | sensor_band_t |
Sensor API Convenience Macros and Functions | |
static int32_t | raw_to_scaled (const sensor_hal_t *hal, int32_t counts) |
Convert raw sensor data to scaled engineering units. More... | |
static int32_t | scaled_to_raw (const sensor_hal_t *hal, int32_t value) |
Convert scaled sensor data to raw counts. More... | |
void | default_event_handler (volatile sensor_event_data_t *data, volatile void *arg) |
Default sensor event callback handler. More... | |
#define | ARRAYSIZE(a) (sizeof(a) / sizeof(a[0])) |
#define | sensor_get_x(sensor, data) (sensor_get_axis(sensor, data, 0)) |
#define | sensor_get_y(sensor, data) (sensor_get_axis(sensor, data, 1)) |
#define | sensor_get_z(sensor, data) (sensor_get_axis(sensor, data, 2)) |
#define | sensor_get_pitch(sensor, data) (sensor_get_angle(sensor, data, 0)) |
#define | sensor_get_roll(sensor, data) (sensor_get_angle(sensor, data, 1)) |
#define | sensor_get_yaw(sensor, data) (sensor_get_angle(sensor, data, 2)) |
Sensor Bus I/O Wrapper Routines | |
#define | sensor_bus_init bus_init |
#define | sensor_bus_read(hal,...) bus_read( & (hal)->bus, __VA_ARGS__) |
#define | sensor_bus_write(hal,...) bus_write( & (hal)->bus, __VA_ARGS__) |
#define | sensor_bus_probe(hal,...) bus_probe( & (hal)->bus, __VA_ARGS__) |
#define | sensor_bus_get(hal,...) bus_get( & (hal)->bus, __VA_ARGS__) |
#define | sensor_bus_put(hal,...) bus_put( & (hal)->bus, __VA_ARGS__) |
#define | sensor_reg_bitclear(hal,...) |
#define | sensor_reg_bitset(hal,...) bus_reg_bitset( & (hal)->bus, __VA_ARGS__) |
#define | sensor_reg_fieldget(hal,...) |
#define | sensor_reg_fieldset(hal,...) |
#define ARRAYSIZE | ( | a | ) | (sizeof(a) / sizeof(a[0])) |
Referenced by bma020_init(), bma150_init(), bma180_init(), bma220_init(), bma222_init(), bma250_init(), imu3000_init(), itg3200_init(), kxtf9_init(), kxtf9_set_sample_rate(), and sensor_list().
#define AXIS_NONE {SENSOR_AXIS_NONE, SENSOR_SIGN_NONE} |
#define AXIS_X_NEG {SENSOR_AXIS_X, SENSOR_SIGN_NEG} |
#define AXIS_X_POS {SENSOR_AXIS_X, SENSOR_SIGN_POS} |
#define AXIS_Y_NEG {SENSOR_AXIS_Y, SENSOR_SIGN_NEG} |
#define AXIS_Y_POS {SENSOR_AXIS_Y, SENSOR_SIGN_POS} |
#define AXIS_Z_NEG {SENSOR_AXIS_Z, SENSOR_SIGN_NEG} |
#define AXIS_Z_POS {SENSOR_AXIS_Z, SENSOR_SIGN_POS} |
Referenced by ak8975_device_id(), ak8975_init(), bma020_device_id(), bma020_init(), bma020_set_bandwidth(), bma020_set_range(), bma150_device_id(), bma150_event(), bma150_get_temperature(), bma150_get_threshold(), bma150_init(), bma150_selftest(), bma150_set_bandwidth(), bma150_set_range(), bma180_device_id(), bma180_get_temperature(), bma180_init(), bma180_set_bandwidth(), bma180_set_range(), bma220_device_id(), bma220_event(), bma220_get_threshold(), bma220_init(), bma220_set_state(), bma222_device_id(), bma222_event(), bma222_get_temperature(), bma222_get_threshold(), bma222_init(), bma250_device_id(), bma250_event(), bma250_get_temperature(), bma250_get_threshold(), bma250_init(), bmp085_init(), bmp180_init(), bmp_device_id(), hmc5883l_set_bandwidth(), imu3000_default_init(), imu3000_device_id(), imu3000_set_bandwidth(), imu3000_set_range(), itg3200_default_init(), itg3200_device_id(), kxtf9_device_id(), kxtf9_get_threshold(), kxtf9_init(), kxtf9_isr(), kxtf9_set_bandwidth(), kxtf9_set_state(), kxtf9_standby(), sfh5712_device_id(), sfh5712_init(), sfh7770_calibrate(), sfh7770_device_id(), sfh7770_event(), sfh7770_get_threshold(), sfh7770_init(), and sfh7770_set_current().
#define sensor_bus_init bus_init |
Referenced by sensor_platform_init().
Referenced by ak8975_get_data(), ak8975_selftest(), ak8975_set_state(), bma020_set_bandwidth(), bma020_set_range(), bma150_event(), bma150_init(), bma150_set_bandwidth(), bma150_set_range(), bma150_set_state(), bma150_set_threshold(), bma180_set_bandwidth(), bma180_set_range(), bma220_event(), bma222_event(), bma222_set_bandwidth(), bma222_set_range(), bma222_set_state(), bma222_set_threshold(), bma222_sleep_en(), bma250_event(), bma250_set_bandwidth(), bma250_set_range(), bma250_set_state(), bma250_set_threshold(), bma250_sleep_en(), bmp_get_up(), bmp_get_ut(), bmp_set_state(), hmc5883l_get_data(), hmc5883l_init(), hmc5883l_selftest(), hmc5883l_set_bandwidth(), hmc5883l_set_range(), imu3000_default_init(), imu3000_event(), imu3000_set_bandwidth(), imu3000_set_range(), imu3000_set_sample_rate(), itg3200_default_init(), itg3200_event(), itg3200_set_bandwidth(), itg3200_set_sample_rate(), kxtf9_event(), kxtf9_init(), kxtf9_resume(), kxtf9_set_bandwidth(), kxtf9_set_range(), kxtf9_set_tap(), kxtf9_set_threshold(), kxtf9_standby(), sfh5712_init(), sfh5712_set_state(), sfh7770_event(), sfh7770_init(), sfh7770_set_current(), sfh7770_set_rate(), sfh7770_set_state(), and sfh7770_set_threshold().
Referenced by ak8975_get_data(), bma020_get_accel(), bma150_get_accel(), bma150_isr(), bma180_get_accel(), bma220_get_accel(), bma220_isr(), bma222_get_accel(), bma222_isr(), bma250_get_accel(), bma250_isr(), bmp_get_cal_param(), bmp_get_up(), bmp_get_ut(), hmc5883l_device_id(), hmc5883l_get_data(), hmc5883l_selftest(), imu3000_get_rotation(), imu3000_get_temperature(), imu3000_isr(), itg3200_get_rotation(), itg3200_get_temperature(), itg3200_isr(), kxtf9_get_accel(), kxtf9_isr(), sfh5712_get_light(), sfh7770_get_light(), sfh7770_get_proximity(), and sfh7770_isr().
Referenced by hmc5883l_selftest(), imu3000_default_init(), kxtf9_set_tap(), sfh7770_calibrate(), sfh7770_init(), and sfh7770_set_threshold().
#define SENSOR_CHANNEL_ALL (-1) |
Sensor Channel Constants - used to select channel within device.
Select all channels in device
Referenced by main(), sfh7770_get_threshold(), sfh7770_set_current(), and sfh7770_set_threshold().
#define sensor_get_pitch | ( | sensor, | |
data | |||
) | (sensor_get_angle(sensor, data, 0)) |
#define sensor_get_roll | ( | sensor, | |
data | |||
) | (sensor_get_angle(sensor, data, 1)) |
#define sensor_get_yaw | ( | sensor, | |
data | |||
) | (sensor_get_angle(sensor, data, 2)) |
#define sensor_reg_bitclear | ( | hal, | |
... | |||
) |
Referenced by bma150_selftest(), bma150_set_state(), bma220_sleep_en(), imu3000_event(), imu3000_set_state(), itg3200_event(), and itg3200_set_state().
#define sensor_reg_bitset | ( | hal, | |
... | |||
) | bus_reg_bitset( & (hal)->bus, __VA_ARGS__) |
Referenced by bma150_selftest(), bma150_set_state(), bma220_sleep_en(), imu3000_set_state(), itg3200_set_state(), and kxtf9_set_state().
#define sensor_reg_fieldget | ( | hal, | |
... | |||
) |
Referenced by bma222_get_threshold(), and bma250_get_threshold().
#define sensor_reg_fieldset | ( | hal, | |
... | |||
) |
Referenced by bma220_set_bandwidth(), bma220_set_range(), bma220_set_threshold(), bma222_set_threshold(), and bma250_set_threshold().
typedef sensor_map_t sensor_band_t |
typedef bool(* sensor_enum_callback)(const sensor_hal_t *, void *) |
typedef void(* sensor_event_callback)(volatile sensor_event_data_t *, volatile void *) |
typedef struct sensor_hal sensor_hal_t |
Sensor Hardware Abstraction Descriptor.
typedef sensor_map_t sensor_range_t |
typedef struct sensor_desc sensor_t |
Generic Sensor API Descriptor.
enum sample_format_t |
enum sensor_axis_t |
enum sensor_calibration_t |
enum sensor_command_t |
Sensor Command Constants - used for sensor ioctl operations.
enum sensor_error_t |
Sensor Driver and API Error Constants.
enum sensor_event_t |
Sensor Event Types.
enum sensor_feature_t |
Sensor Feature Constants.
enum sensor_proximity_t |
enum sensor_read_t |
Sensor Data Read Operations.
enum sensor_scale_t |
enum sensor_sign_t |
enum sensor_state_t |
Sensor Operational State Type Constants.
enum sensor_tap_axis_t |
enum sensor_test_t |
enum sensor_testerr_t |
enum sensor_threshold_t |
Sensor Threshold Type Constants.
enum sensor_type_t |
Sensor Type Constants.
enum sensor_units_t |
Sensor Sample Units.
enum sensor_vendor_t |
Sensor Vendor Constants.
void default_event_handler | ( | volatile sensor_event_data_t * | data, |
volatile void * | arg | ||
) |
Default sensor event callback handler.
The default event callback handler returns immediately.
data | Sensor event data descriptor |
arg | Optional user-specified callback argument |
The default event callback handler returns immediately.
data | Sensor event data descriptor |
arg | Optional user-specified callback argument |
Referenced by sensor_add_event().
|
inlinestatic |
Convert raw sensor data to scaled engineering units.
This routine converts a sensor sample, counts
, to a linearly scaled integer value in engineering units using device-specific range in standard engineering units and full scale resolution parameters in hal
.
hal | An initialized hardware interface descriptor. |
counts | An unscaled raw sensor sample value. |
References sensor_hal::range, and sensor_hal::resolution.
Referenced by bma222_get_threshold(), bma250_get_threshold(), and kxtf9_get_accel().
|
inlinestatic |
Convert scaled sensor data to raw counts.
This routine converts a linearly scaled integer value in engineering units to the corresponding "raw" reading value for the device, using the device-specific range in standard engineering units and full scale resolution parameters in "opts".
hal | An initialized hardware interface descriptor. |
value | A scaled sensor sample value. |
References sensor_hal::range, and sensor_hal::resolution.
Referenced by bma222_set_threshold(), bma250_set_threshold(), and kxtf9_set_tap().