Skip to content

Commit

Permalink
Added getRawSensorData
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentva committed Dec 8, 2016
1 parent a44a775 commit ef6be8d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Pozyx.h
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,20 @@ class PozyxClass
*/
static int setSensorMode(uint8_t sensor_mode, uint16_t remote_id = NULL);

/**
* Obtain all raw sensor data at once as it's stored in the registers.
* This functions reads out the pressure, acceleration, magnetic field strength, angular velocity, orientation in Euler angles, the orientation as a quaternion,
* the linear acceleration, the gravity vector and temperature.
*
* @param sensor_raw: reference to the sensor_raw object
* @param remote_id: optional parameter that determines the remote device to be used
*
* @retval #POZYX_SUCCESS success.
* @retval #POZYX_FAILURE function failed.
* @retval #POZYX_TIMEOUT function timed out, no response received.
*/
static int getRawSensorData(sensor_raw_t *sensor_raw, uint16_t remote_id = NULL);

/**
* Obtain all sensor data at once.
* This functions reads out the pressure, acceleration, magnetic field strength, angular velocity, orientation in Euler angles, the orientation as a quaternion,
Expand Down
12 changes: 12 additions & 0 deletions Pozyx_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,18 @@ int PozyxClass::getPositionError(pos_error_t *pos_error, uint16_t remote_id)
* Function regarding the sensor data
*/

int PozyxClass::getRawSensorData(sensor_raw_t *sensor_raw, uint16_t remote_id)
{
assert(sensor_raw != NULL);

if(remote_id == NULL){
return regRead(POZYX_PRESSURE, (uint8_t *)sensor_raw, sizeof(sensor_raw_t));
}
else{
return remoteRegRead(remote_id, POZYX_PRESSURE, (uint8_t *)sensor_raw, sizeof(sensor_raw_t));
}
}

int PozyxClass::getAllSensorData(sensor_data_t *sensor_data, uint16_t remote_id)
{
assert(sensor_data != NULL);
Expand Down

0 comments on commit ef6be8d

Please sign in to comment.