SELKIELogger  1.0.0
LPMSMessages.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "SELKIELoggerBase.h"
#include "LPMSTypes.h"
Include dependency graph for LPMSMessages.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LPMS_START   0x3A
 Message prefix byte.
 
#define LPMS_END1   0x0D
 First message suffix byte.
 
#define LPMS_END2   0x0A
 Second message suffix byte.
 
#define LPMS_MSG_REPLY_ACK   0x00
 Command successful (Doesn't appear everywhere it should)
 
#define LPMS_MSG_REPLY_NAK   0x01
 Command unsuccessful.
 
#define LPMS_MSG_SAVE_REG   0x04
 Write data to specific internal registers.
 
#define LPMS_MSG_FACTORY_RESET   0x05
 Reset to default configuration.
 
#define LPMS_MSG_MODE_CMD   0x06
 Switch to command mode.
 
#define LPMS_MSG_MODE_STREAM   0x07
 Switch to continuous readout mode.
 
#define LPMS_MSG_GET_SENSORSTATE   0x08
 Get sensor state.
 
#define LPMS_MSG_GET_IMUDATA   0x09
 IMU data, as configured by LPMS_MSG_SET_OUTPUTS.
 
#define LPMS_MSG_GET_SENSORMODEL   0x14
 Get hardware model as 24 character string.
 
#define LPMS_MSG_GET_FIRMWAREVER   0x15
 Get firmware version as 24 character string.
 
#define LPMS_MSG_GET_SERIALNUM   0x16
 Get serial number as 24 character string.
 
#define LPMS_MSG_GET_FILTERVER   0x17
 Get filter version as 24 character string.
 
#define LPMS_MSG_SET_OUTPUTS   0x1E
 Configure fields included in IMUDATA messages.
 
#define LPMS_MSG_GET_OUTPUTS   0x1F
 Get fields configured for IMUDATA messages.
 
#define LPMS_MSG_SET_ID   0x20
 Reassign sensor ID.
 
#define LPMS_MSG_GET_ID   0x21
 Get current sensor ID.
 
#define LPMS_MSG_SET_FREQ   0x22
 Set streaming output rate (Hz)
 
#define LPMS_MSG_GET_FREQ   0x23
 Get current streaming output rate.
 
#define LPMS_MSG_SET_RADIANS   0x24
 Use radians for angular quantities (1) instead of degrees (0)
 
#define LPMS_MSG_GET_RADIANS   0x25
 Get unit for angular quantities - radians (1) or degrees (0)
 
#define LPMS_MSG_SET_ACCRANGE   0x32
 Set accelerometer range (g)
 
#define LPMS_MSG_GET_ACCRANGE   0x33
 Get accelerometer range (g)
 
#define LPMS_MSG_SET_GYRRANGE   0x3C
 Set gyroscope range (dps)
 
#define LPMS_MSG_GET_GYRRANGE   0x3D
 Get gyroscope range (dps)
 
#define LPMS_MSG_SET_MAGRANGE   0x46
 Set magnetometer range (gauss)
 
#define LPMS_MSG_GET_MAGRANGE   0x47
 Get magnetometer range (gauss)
 
#define LPMS_MSG_SET_FILTER   0x5A
 Set motion filtering mode.
 
#define LPMS_MSG_GET_FILTER   0x5B
 Get motion filtering mode.
 
#define LPMS_MSG_SET_UARTBAUD   0x82
 Set baud rate.
 
#define LPMS_MSG_GET_UARTBAUD   0x83
 Get baud rate.
 
#define LPMS_MSG_SET_UARTFORMAT   0x84
 Set output data format - LPMS (0), ASCII (1)
 
#define LPMS_MSG_GET_UARTFORMAT   0x85
 Get output data format - LPMS (0), ASCII (1)
 
#define LPMS_MSG_SET_UARTPRECISION   0x88
 Set output data precision - Fixed point (0) or floats (1)
 
#define LPMS_MSG_GET_UARTPRECISION   0x89
 Get output data precision - Fixed point (0) or floats (1)
 

Functions

bool lpms_from_bytes (const uint8_t *in, const size_t len, lpms_message *msg, size_t *pos)
 Read bytes and populate message structure. More...
 
bool lpms_to_bytes (const lpms_message *msg, uint8_t **out, size_t *len)
 Convert message structure to flat array. More...
 
bool lpms_checksum (const lpms_message *msg, uint16_t *csum)
 Calculate checksum for LPMS message packet. More...
 
bool lpms_imu_set_timestamp (const lpms_message *msg, lpms_data *d)
 Extract timestamp from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_accel_raw (const lpms_message *msg, lpms_data *d)
 Extract accel_raw from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_accel_cal (const lpms_message *msg, lpms_data *d)
 Extract accel_cal from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_gyro_raw (const lpms_message *msg, lpms_data *d)
 Extract gyro_raw from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_gyro_cal (const lpms_message *msg, lpms_data *d)
 Extract gyro_cal from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_gyro_aligned (const lpms_message *msg, lpms_data *d)
 Extract gyro_aligned from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_mag_raw (const lpms_message *msg, lpms_data *d)
 Extract mag_raw from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_mag_cal (const lpms_message *msg, lpms_data *d)
 Extract mag_cal from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_omega (const lpms_message *msg, lpms_data *d)
 Extract omega from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_quaternion (const lpms_message *msg, lpms_data *d)
 Extract quaternion from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_euler_angles (const lpms_message *msg, lpms_data *d)
 Extract euler_angles from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_accel_linear (const lpms_message *msg, lpms_data *d)
 Extract accel_linear from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_pressure (const lpms_message *msg, lpms_data *d)
 Extract pressure from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_altitude (const lpms_message *msg, lpms_data *d)
 Extract altitude from lpms_message into lpms_data, if available. More...
 
bool lpms_imu_set_temperature (const lpms_message *msg, lpms_data *d)
 Extract temperature from lpms_message into lpms_data, if available. More...
 

Detailed Description

Data types and definitions for communication with LPMS devices

Definition in file LPMSMessages.h.

Function Documentation

◆ lpms_checksum()

bool lpms_checksum ( const lpms_message msg,
uint16_t *  csum 
)

Calculate checksum for LPMS message packet.

Parameters
[in]msgPointer to message structure
[out]csumCalculated checksum value
Returns
True if calculated successfully, false on error

Definition at line 135 of file LPMSMessages.c.

◆ lpms_from_bytes()

bool lpms_from_bytes ( const uint8_t *  in,
const size_t  len,
lpms_message msg,
size_t *  pos 
)

Read bytes and populate message structure.

Populate lpms_message from array of bytes, searching for valid start byte if required.

Parameters
[in]inArray of bytes
[in]lenNumber of bytes available in array
[out]msgPointer to lpms_message
[out]posNumber of bytes consumed
Returns
True on success, false on error

Definition at line 42 of file LPMSMessages.c.

◆ lpms_imu_set_accel_cal()

bool lpms_imu_set_accel_cal ( const lpms_message msg,
lpms_data d 
)

Extract accel_cal from lpms_message into lpms_data, if available.

Extract calibrated accelerometer data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 194 of file LPMSMessages.c.

◆ lpms_imu_set_accel_linear()

bool lpms_imu_set_accel_linear ( const lpms_message msg,
lpms_data d 
)

Extract accel_linear from lpms_message into lpms_data, if available.

Extract linear acceleration data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 411 of file LPMSMessages.c.

◆ lpms_imu_set_accel_raw()

bool lpms_imu_set_accel_raw ( const lpms_message msg,
lpms_data d 
)

Extract accel_raw from lpms_message into lpms_data, if available.

Extract raw accelerometer data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 178 of file LPMSMessages.c.

◆ lpms_imu_set_altitude()

bool lpms_imu_set_altitude ( const lpms_message msg,
lpms_data d 
)

Extract altitude from lpms_message into lpms_data, if available.

Extract altitude data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 470 of file LPMSMessages.c.

◆ lpms_imu_set_euler_angles()

bool lpms_imu_set_euler_angles ( const lpms_message msg,
lpms_data d 
)

Extract euler_angles from lpms_message into lpms_data, if available.

Extract Euler orientation angles from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 383 of file LPMSMessages.c.

◆ lpms_imu_set_gyro_aligned()

bool lpms_imu_set_gyro_aligned ( const lpms_message msg,
lpms_data d 
)

Extract gyro_aligned from lpms_message into lpms_data, if available.

Extract aligned gyroscope data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 258 of file LPMSMessages.c.

◆ lpms_imu_set_gyro_cal()

bool lpms_imu_set_gyro_cal ( const lpms_message msg,
lpms_data d 
)

Extract gyro_cal from lpms_message into lpms_data, if available.

Extract calibrated gyroscope data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 235 of file LPMSMessages.c.

◆ lpms_imu_set_gyro_raw()

bool lpms_imu_set_gyro_raw ( const lpms_message msg,
lpms_data d 
)

Extract gyro_raw from lpms_message into lpms_data, if available.

Extract raw gyroscope data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 214 of file LPMSMessages.c.

◆ lpms_imu_set_mag_cal()

bool lpms_imu_set_mag_cal ( const lpms_message msg,
lpms_data d 
)

Extract mag_cal from lpms_message into lpms_data, if available.

Extract calibrated magnetometer data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 305 of file LPMSMessages.c.

◆ lpms_imu_set_mag_raw()

bool lpms_imu_set_mag_raw ( const lpms_message msg,
lpms_data d 
)

Extract mag_raw from lpms_message into lpms_data, if available.

Extract raw magnetometer data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 281 of file LPMSMessages.c.

◆ lpms_imu_set_omega()

bool lpms_imu_set_omega ( const lpms_message msg,
lpms_data d 
)

Extract omega from lpms_message into lpms_data, if available.

Extract angular momentum from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 330 of file LPMSMessages.c.

◆ lpms_imu_set_pressure()

bool lpms_imu_set_pressure ( const lpms_message msg,
lpms_data d 
)

Extract pressure from lpms_message into lpms_data, if available.

Extract atmospheric pressure data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 440 of file LPMSMessages.c.

◆ lpms_imu_set_quaternion()

bool lpms_imu_set_quaternion ( const lpms_message msg,
lpms_data d 
)

Extract quaternion from lpms_message into lpms_data, if available.

Extract orientation quaternion from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 356 of file LPMSMessages.c.

◆ lpms_imu_set_temperature()

bool lpms_imu_set_temperature ( const lpms_message msg,
lpms_data d 
)

Extract temperature from lpms_message into lpms_data, if available.

Extract temperature data from input message into data struct. Checks if data is expected to be present before attempting to extract.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 501 of file LPMSMessages.c.

◆ lpms_imu_set_timestamp()

bool lpms_imu_set_timestamp ( const lpms_message msg,
lpms_data d 
)

Extract timestamp from lpms_message into lpms_data, if available.

Extract timestamp from input message into data struct.

Parameters
[in]msgPointer to message structure containing IMU data
[in,out]dPointer to lpms_data structure to populate
Returns
True if data extracted from message, false on error

Definition at line 161 of file LPMSMessages.c.

◆ lpms_to_bytes()

bool lpms_to_bytes ( const lpms_message msg,
uint8_t **  out,
size_t *  len 
)

Convert message structure to flat array.

Convert lpms_message structure to array of bytes. The array will be allocated here and must be freed by the caller.

Parameters
[in]msgPointer to lpms_message
[out]outPointer to array of bytes
[out]lenPointer to size_t - will be set to array length
Returns
True on success, false on error

Definition at line 104 of file LPMSMessages.c.