aboutsummaryrefslogtreecommitdiff
path: root/include/libsurvive/survive.h
diff options
context:
space:
mode:
authormwturvey <michael.w.turvey@intel.com>2017-03-17 14:41:59 -0700
committermwturvey <michael.w.turvey@intel.com>2017-03-17 14:41:59 -0700
commitb6981854dff11022e3de56e56cbf4633f1c49598 (patch)
treef5b8f4ff1425f704d791d5b9af9c8af65455868d /include/libsurvive/survive.h
parent94be8ccdbfb2f44c9bc569428537444030ba8eeb (diff)
parenta53c520c2d1a3bb9faa4cb5e4ee9ccc48bb1835f (diff)
downloadlibsurvive-b6981854dff11022e3de56e56cbf4633f1c49598.tar.gz
libsurvive-b6981854dff11022e3de56e56cbf4633f1c49598.tar.bz2
Merge branch 'master' into UsbTrackerOnWin
# Conflicts: # src/survive_vive.c
Diffstat (limited to 'include/libsurvive/survive.h')
-rw-r--r--include/libsurvive/survive.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/include/libsurvive/survive.h b/include/libsurvive/survive.h
index e3e167a..e04586c 100644
--- a/include/libsurvive/survive.h
+++ b/include/libsurvive/survive.h
@@ -136,10 +136,12 @@ void survive_default_angle_process( SurviveObject * so, int sensor_id, int acode
////////////////////// Survive Drivers ////////////////////////////
-void RegisterDriver( const char * name, void * data );
+void RegisterDriver(const char * name, void * data);
-#ifdef _WIN32
-#define REGISTER_LINKTIME( func )
+#ifdef _MSC_VER
+#define REGISTER_LINKTIME( func ) \
+ __pragma(comment(linker,"/export:REGISTER"#func));\
+ void REGISTER##func() { RegisterDriver(#func, &func); }
#else
#define REGISTER_LINKTIME( func ) \
void __attribute__((constructor)) REGISTER##func() { RegisterDriver(#func, &func); }
@@ -155,22 +157,14 @@ void survive_add_driver( SurviveContext * ctx, void * payload, DeviceDriverCb po
//For lightcap, etc. Don't change this structure at all. Regular vive is dependent on it being exactly as-is.
//When you write drivers, you can use this to send survive lightcap data.
-#ifdef _WIN32
-#pragma pack(push,1)
-#endif
typedef struct
{
uint8_t sensor_id;
uint16_t length;
uint32_t timestamp;
}
-#ifdef __linux__
-__attribute__((packed))
-#endif
LightcapElement;
-#ifdef _WIN32
-#pragma pack(pop)
-#endif
+
//This is the disambiguator function, for taking light timing and figuring out place-in-sweep for a given photodiode.
void handle_lightcap( SurviveObject * so, LightcapElement * le );