aboutsummaryrefslogtreecommitdiffstats
path: root/cphidgetaccelerometer.h
blob: 039d07645cf41ee7a1851d5f607e4f17377a33d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef __CPHIDGETACCELEROMETER
#define __CPHIDGETACCELEROMETER
#include "cphidget.h"

/** \defgroup phidaccel Phidget Accelerometer 
 * \ingroup phidgets
 * These calls are specific to the Phidget Accelerometer object. See your device's User Guide for more specific API details, technical information, and revision details. The User Guide, along with other resources, can be found on the product page for your device.
 * @{
 */

DPHANDLE(Accelerometer)
CHDRSTANDARD(Accelerometer)

/**
 * Gets the number of acceleration axes supported by this accelerometer.
 * @param phid An attached phidget accelerometer handle.
 * @param count The axis count.
 */
CHDRGET(Accelerometer,AxisCount,int *count)

/**
 * Gets the current acceleration of an axis.
 * @param phid An attached phidget accelerometer handle.
 * @param index The acceleration index.
 * @param acceleration The acceleration.
 */
CHDRGETINDEX(Accelerometer,Acceleration,double *acceleration)
/**
 * Gets the maximum accleration supported by an axis.
 * @param phid An attached phidget accelerometer handle.
 * @param index The acceleration index
 * @param max The maximum acceleration
 */
CHDRGETINDEX(Accelerometer,AccelerationMax,double *max)
/**
 * Gets the minimum acceleraiton supported by an axis.
 * @param phid An attached phidget accelerometer handle.
 * @param index The acceleration index
 * @param min The minimum acceleraion
 */
CHDRGETINDEX(Accelerometer,AccelerationMin,double *min)
/**
 * Sets an acceleration change event handler. This is called when the acceleration changes by more then the change trigger.
 * @param phid A phidget accelerometer handle.
 * @param fptr Callback function pointer.
 * @param userPtr A pointer for use by the user - this value is passed back into the callback function.
 */
CHDREVENTINDEX(Accelerometer,AccelerationChange,double acceleration)
/**
 * Gets the change trigger for an axis.
 * @param phid An attached phidget accelerometer handle.
 * @param index The acceleration index
 * @param trigger The change trigger.
 */
CHDRGETINDEX(Accelerometer,AccelerationChangeTrigger,double *trigger)
/**
 * Sets the change trigger for an axis.
 * @param phid An attached phidget accelerometer handle.
 * @param index The acceleration index
 * @param trigger The change trigger.
 */
CHDRSETINDEX(Accelerometer,AccelerationChangeTrigger,double trigger)

#ifndef REMOVE_DEPRECATED
DEP_CHDRGET("Deprecated - use CPhidgetAccelerometer_getAxisCount",Accelerometer,NumAxis,int *)
#endif

#ifndef EXTERNALPROTO
#define ACCEL_MAXAXES 3
struct _CPhidgetAccelerometer {
	CPhidget phid;
	int (CCONV *fptrAccelerationChange)(CPhidgetAccelerometerHandle, void *, int, double);           
	void *fptrAccelerationChangeptr;

	double axis[ACCEL_MAXAXES];
	double axisChangeTrigger[ACCEL_MAXAXES];
	double axisLastTrigger[ACCEL_MAXAXES];

	double accelerationMax, accelerationMin;
} typedef CPhidgetAccelerometerInfo;
#endif

/** @} */

#endif