39 *x = s.x = (buffer[0] << 13) | (buffer[1] << 5) | ((buffer[2] & 0xF8) >> 3);
40 *y = s.x = ((buffer[2] & 0x07) << 18) | (buffer[3] << 10) | (buffer[4] << 2) |
41 ((buffer[5] & 0xC0) >> 6);
42 *z = s.x = ((buffer[5] & 0x3F) << 15) | (buffer[6] << 7) | (buffer[7] >> 1);
48 buffer[0] =
UByte(x >> 13);
49 buffer[1] =
UByte(x >> 5);
50 buffer[2] =
UByte((x << 3) | ((y >> 18) & 0x07));
51 buffer[3] =
UByte(y >> 10);
52 buffer[4] =
UByte(y >> 2);
53 buffer[5] =
UByte((y << 6) | ((z >> 15) & 0x3F));
54 buffer[6] =
UByte(z >> 7);
55 buffer[7] =
UByte(z << 1);
59 float val,
float factor,
const char* label)
63 for (
unsigned i = 0; i<count; i++)
65 if (ramp[i] >= threshold)
68 OVR_DEBUG_LOG((
"SensorDevice::SetRange - %s clamped to %0.4f",
69 label,
float(ramp[count-1]) / factor));
127 : CommandId(0), Flags(0), PacketInterval(0), SampleRate(0)
163 : AccelOffset(), GyroOffset(), AccelMatrix(), GyroMatrix(), Temperature(0)
190 static const float sensorMax = (1 << 20) - 1;
203 for (
int i = 0; i < 3; i++)
212 for (
int i = 0; i < 3; i++)
225 : CommandId(commandId), KeepAliveIntervalMs(interval)
void SetSensorRange(const SensorRange &r, UInt16 commandId=0)
UInt16 KeepAliveIntervalMs
const UInt16 GyroRangeRamp[]
SensorRangeImpl(const SensorRange &r, UInt16 commandId=0)
void GetSensorRange(SensorRange *r)
SensorFactoryCalibrationImpl()
static SensorRange GetMaxSensorRange()
void PackSensor(UByte *buffer, SInt32 x, SInt32 y, SInt32 z)
const UInt16 AccelRangeRamp[]
void SetSensorCoordinates(bool sensorCoordinates)
__BEGIN_NAMESPACE_STD void void __END_NAMESPACE_STD void __BEGIN_NAMESPACE_STD void * memset(void *__s, int __c, size_t __n) __THROW __nonnull((1))
void UnpackSensor(const UByte *buffer, SInt32 *x, SInt32 *y, SInt32 *z)
SensorKeepAliveImpl(UInt16 interval=0, UInt16 commandId=0)
bool IsUsingSensorCoordinates() const
#define OVR_DEBUG_LOG(args)
UInt16 SelectSensorRampValue(const UInt16 *ramp, unsigned count, float val, float factor, const char *label)
SInt16 DecodeSInt16(const UByte *buffer)
#define OVR_UNUSED2(a1, a2)
const UInt16 MagRangeRamp[]