aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2017-03-08 00:30:48 -0500
committercnlohr <lohr85@gmail.com>2017-03-08 00:30:48 -0500
commit394cbc465e776137834eea830038b43ea98f6268 (patch)
tree29e60f5257db7377236a1cd76b540685b76a7b8b /include
parent57e82519b4844620851784e7682a2c562cb06d47 (diff)
downloadlibsurvive-394cbc465e776137834eea830038b43ea98f6268.tar.gz
libsurvive-394cbc465e776137834eea830038b43ea98f6268.tar.bz2
Switch types over to avoiding extra struct keyword. Switch poses to "SurvivePose" type.
Diffstat (limited to 'include')
-rw-r--r--include/libsurvive/poser.h22
-rw-r--r--include/libsurvive/survive.h8
-rw-r--r--include/libsurvive/survive_types.h17
3 files changed, 26 insertions, 21 deletions
diff --git a/include/libsurvive/poser.h b/include/libsurvive/poser.h
index 4894acf..c514953 100644
--- a/include/libsurvive/poser.h
+++ b/include/libsurvive/poser.h
@@ -11,22 +11,22 @@ typedef enum PoserType_t
POSERDATA_FULL_SCENE, //Full, statified X, Y sweep data for both lighthouses.
} PoserType;
-struct PoserData
+typedef struct
{
PoserType pt;
uint8_t data[0];
-};
+} PoserData;
-struct PoserDataIMU
+typedef struct
{
PoserType pt;
uint8_t datamask; //0 = accel present, 1 = gyro present, 2 = mag present.
FLT accel[3];
FLT gyro[3];
FLT mag[3];
-};
+} PoserDataIMU;
-struct PoserDataLight
+typedef struct
{
PoserType pt;
int sensor_id;
@@ -34,21 +34,21 @@ struct PoserDataLight
uint32_t timecode; //In object-local ticks.
FLT length; //In seconds
FLT angle; //In radians from center of lighthouse.
-};
+} PoserDataLight;
-struct PoserDataFullScene
+typedef struct
{
PoserType pt;
//If "lengths[...]" < 0, means not a valid piece of sweep information.
FLT lengths[SENSORS_PER_OBJECT][NUM_LIGHTHOUSES][2];
- FLT angles [SENSORS_PER_OBJECT][NUM_LIGHTHOUSES][2]; //2 Axes
+ FLT angles [SENSORS_PER_OBJECT][NUM_LIGHTHOUSES][2]; //2 Axes (Angles in LH space)
- struct PoserDataIMU lastimu;
-};
+ PoserDataIMU lastimu;
+} PoserDataFullScene;
//When you register your posers using the internal system,
-typedef int (*PoserCB)( struct SurviveObject * so, struct PoserData * pd );
+typedef int (*PoserCB)( SurviveObject * so, PoserData * pd );
#endif
diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h
index 536c7fb..20e50ca 100644
--- a/include/libsurvive/survive.h
+++ b/include/libsurvive/survive.h
@@ -4,14 +4,14 @@
#include <stdint.h>
#include "poser.h"
-struct SurviveContext;
+typedef struct SurviveContext SurviveContext;
//DANGER: This structure may be redefined. Note that it is logically split into 64-bit chunks
//for optimization on 32- and 64-bit systems.
struct SurviveObject
{
- struct SurviveContext * ctx;
+ SurviveContext * ctx;
char codename[4]; //3 letters, null-terminated. Currently HMD, WM0, WM1.
char drivername[4]; //3 letters for driver. Currently "HTC"
@@ -27,8 +27,8 @@ struct SurviveObject
//Pose Information, also "resolver" field.
FLT PoseConfidence; //0..1
- FLT Position[3];
- FLT Rotation[4];
+ SurvivePose OutPose;
+ SurvivePose FromLHPose[NUM_LIGHTHOUSES]; //Optionally filled out by poser, contains computed position from each lighthouse.
void * PoserData; //Initialized to zero, configured by poser, can be anything the poser wants.
PoserCB * PoserFn;
diff --git a/include/libsurvive/survive_types.h b/include/libsurvive/survive_types.h
index 593819f..6137774 100644
--- a/include/libsurvive/survive_types.h
+++ b/include/libsurvive/survive_types.h
@@ -9,6 +9,11 @@
#endif
#endif
+typedef struct SurvivePose
+{
+ FLT Pos[3];
+ FLT Rot[4];
+} SurvivePose;
//Careful with this, you can't just add another one right now, would take minor changes in survive_data.c and the cal tools.
//It will also require a recompile. TODO: revisit this and correct the comment once fixed.
@@ -17,13 +22,13 @@
#define INTBUFFSIZE 64
#define SENSORS_PER_OBJECT 32
-struct SurviveObject;
-struct SurviveContext;
+typedef struct SurviveObject SurviveObject;
+typedef struct SurviveContext SurviveContext;
-typedef void (*text_feedback_func)( struct SurviveContext * ctx, const char * fault );
-typedef void (*light_process_func)( struct SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length );
-typedef void (*imu_process_func)( struct SurviveObject * so, int16_t * accelgyro, uint32_t timecode, int id );
-typedef void (*angle_process_func)( struct SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle );
+typedef void (*text_feedback_func)( SurviveContext * ctx, const char * fault );
+typedef void (*light_process_func)( SurviveObject * so, int sensor_id, int acode, int timeinsweep, uint32_t timecode, uint32_t length );
+typedef void (*imu_process_func)( SurviveObject * so, int16_t * accelgyro, uint32_t timecode, int id );
+typedef void (*angle_process_func)( SurviveObject * so, int sensor_id, int acode, uint32_t timecode, FLT length, FLT angle );
#endif