sample/sensor.h¶
Defines
-
DP_SENS__OUTPUTS_MAX
¶
-
DP_SENS__RESOLUTION_MAX
¶
-
DP_SENS__ACCEL_MAGNO
¶
-
DP_SENS__STATUS_NOT_SET
¶
Functions
-
uint8_t
sensor_read
(uint16_t *, uint8_t)¶ Manages the selection of sensor driver and reading of sensor data.
Checks that a sensor has been configured (if not, the sensor configuration routine is called), then calls the correct sensor driver function based on the sensor type recorded in SystemState.
- Return
- 0 on success, 1 on failure
- Parameters
buf
: buffer for storing sensor reading, passed to driver functionbuf_size
: length of buffer in bytes (not number of elements)
-
uint8_t
sensor_drive_accel_magno
(uint8_t, uint16_t *)¶ Read sensor data from the LSM303D accelerometer/magnetometer sensor.
Initiates communication with the LSM303D sensor, disables its low power mode and enables its outputs. Then acquires sensor data, storing this in the provided buffer. The sensor is returned to low power mode once sensor data is read.
- Return
- 0 on success, 1 on failure
- Parameters
sensor_addr
: module address at which sensor is located on the duinoPRO (1-6)buf
: buffer for storing sensor reading, passed to driver function