interface library

This commit is contained in:
Richard Koeppe 2024-06-06 11:36:09 +02:00
parent c5f5e6fb98
commit c4d610a3a0
2 changed files with 19 additions and 11 deletions

View File

@ -1,5 +1,7 @@
#ifndef VN_VECTOR_H_INCLUDED
#define VN_VECTOR_H_INCLUDED
#include <cstring>
#include <stdio.h>
/** \brief Various vector types and operations. */
@ -9,7 +11,7 @@ extern "C" {
/** \brief Represents a 3 component vector with an underlying data type of
* <c>float</c>. */
typedef union {
typedef union vec3f {
float c[3]; /**< Indexable. */
struct {
@ -23,12 +25,12 @@ typedef union {
float c1; /**< Component 1. */
float c2; /**< Component 2. */
};
} vec3f;
vec3f() { std::memset(this, 0, sizeof(vec3f)); }
};
/** \brief Represents a 3 component vector with an underlying data type of
* <c>double</c>. */
typedef union {
typedef union vec3d {
double c[3]; /**< Indexable. */
struct {
@ -42,12 +44,12 @@ typedef union {
double c1; /**< Component 1. */
double c2; /**< Component 2. */
};
} vec3d;
vec3d() { std::memset(this, 0, sizeof(vec3d)); }
};
/** \brief Represents a 4 component vector with an underlying data type of
* <c>float</c>. */
typedef union {
typedef union vec4f {
float c[4]; /**< Indexable. */
struct {
@ -63,8 +65,8 @@ typedef union {
float c2; /**< Component 2. */
float c3; /**< Component 2. */
};
} vec4f;
vec4f() { std::memset(this, 0, sizeof(vec4f)); }
};
/** \brief Initializes a 3-dimensional float vector from an float array.
*

View File

@ -402,7 +402,7 @@ typedef struct {
} VelocityCompensationStatusRegister;
/** \brief Structure representing the IMU Measurements register. */
typedef struct {
typedef struct ImuMeasurementsRegister {
/** \brief The Mag field. */
vec3f mag;
@ -418,7 +418,11 @@ typedef struct {
/** \brief The Pressure field. */
float pressure;
} ImuMeasurementsRegister;
ImuMeasurementsRegister() {
temp = 0.0;
pressure = 0.0;
};
};
/** \brief Structure representing the GPS Configuration register. */
typedef struct {
@ -821,6 +825,8 @@ typedef struct {
} YawPitchRollTrueBodyAccelerationAndAngularRatesRegister;
const uint16_t YawPitchRollTrueBodyAccelerationAndAngularRatesRegisterID = 239;
/** \brief Structure representing the Yaw, Pitch, Roll, True Inertial Acceleration and Angular Rates register. */
typedef struct {
/** \brief The YawPitchRoll field. */