vitasdk
Documentation of the vitasdk
motion.h
Go to the documentation of this file.
1 
7 #ifndef _PSP2_MOTION_H_
8 #define _PSP2_MOTION_H_
9 
10 #include <vitasdk/build_utils.h>
11 #include <psp2/types.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /* enum */
18 
24 
25 typedef enum SceMotionErrorCode {
34  SCE_MOTION_ERROR_MEM_IN_USE = 0x80360208
36 
37 
38 /* struct */
39 
41 typedef struct SceMotionState {
42  unsigned int timestamp;
45  uint8_t reserved1[12];
49  uint8_t reserved2[4];
52  uint8_t reserved3[36];
54  uint8_t unknown;
55  uint8_t reserved4[2];
58 
62 typedef struct SceMotionSensorState {
65  uint8_t reserved1[12];
66  unsigned int timestamp;
67  unsigned int counter;
68  uint8_t reserved2[4];
70  uint8_t unknown;
71  uint8_t reserved3[7];
74 
85 typedef struct SceMotionDeviceLocation {
88  uint8_t reserved[24];
91 
92 /* prototypes */
93 
102 
111 int sceMotionGetSensorState(SceMotionSensorState *sensorState, int numRecords);
112 
121 
136 
144 int sceMotionRotateYaw(float radians);
145 
153 
161 int sceMotionSetTiltCorrection(int setValue);
162 
171 
179 int sceMotionSetDeadband(int setValue);
180 
188 
197 
205 int sceMotionSetAngleThreshold(float angle);
206 
213 
219 int sceMotionReset(void);
220 
227 
234 
241 
248 
255 
256 #ifdef __cplusplus
257 }
258 #endif
259 
260 #endif /* _PSP2_MOTION_H_ */
uint8_t reserved[24]
Reserved data.
Definition: motion.h:88
SceFVector3 gyro
Angular velocity data.
Definition: motion.h:64
unsigned int counter
Number of requested state.
Definition: motion.h:67
int sceMotionSetGyroBiasCorrection(int setValue)
Activate/deactivate gyroscope bias correction.
int sceMotionGetGyroBiasCorrection(void)
Get status of gyroscope bias correction.
int sceMotionMagnetometerOn(void)
Start magnetometer sampling.
SceFQuaternion deviceQuat
Orientation data as a Quaternion.
Definition: motion.h:46
int sceMotionGetTiltCorrection(void)
Get Status of tilt correction.
int sceMotionRotateYaw(float radians)
Rotate the yaw axis.
VITASDK_BUILD_ASSERT_EQ(0xF8, SceMotionState)
int sceMotionGetMagnetometerState(void)
Get status of magnetometer sampling.
SceFVector3 basicOrientation
Orientation of the device in reference to gravity.
Definition: motion.h:50
SceFVector3 acceleration
Accelerometer data.
Definition: motion.h:43
SceFMatrix4 nedMatrix
Magnetometer orientation matrix.
Definition: motion.h:48
uint8_t reserved4[2]
Reserved data.
Definition: motion.h:55
SceMotionErrorCode
Definition: motion.h:25
SceULong64 hostTimestamp
Timestamp of the data in microseconds.
Definition: motion.h:51
unsigned int timestamp
Timestamp of the data in microseconds.
Definition: motion.h:66
int sceMotionGetState(SceMotionState *motionState)
Gets the current motion state.
int sceMotionSetAngleThreshold(float angle)
Define the angle threshold for basic orientation.
uint8_t reserved3[7]
Reserved data.
Definition: motion.h:71
int sceMotionGetDeviceLocation(SceMotionDeviceLocation *deviceLocation)
Gets the location of the device's sensors in relation to its center point (in mm).
uint8_t reserved3[36]
Reserved data.
Definition: motion.h:52
uint8_t reserved1[12]
Reserved data.
Definition: motion.h:45
uint8_t reserved2[4]
Reserved data.
Definition: motion.h:68
SceFVector3 accelerometer
Accelerometer data.
Definition: motion.h:63
unsigned int timestamp
Local timestamp of the device.
Definition: motion.h:42
int sceMotionStopSampling(void)
Stop sampling.
SceFVector3 gyro
Location of te gyroscope in relation to the center of the device (in mm)
Definition: motion.h:87
int sceMotionStartSampling(void)
Start sampling.
uint8_t unknown
Unknown.
Definition: motion.h:70
int sceMotionGetBasicOrientation(SceFVector3 *basicOrientation)
Gets the basic orientation of the device in relation to gravity.
uint8_t reserved1[12]
Reserved data.
Definition: motion.h:65
int sceMotionMagnetometerOff(void)
Stop magnetometer sampling.
int sceMotionGetDeadband(void)
Get status of deadbanding.
SceFVector3 accelerometer
Location of te accelerometer in relation to the center of the device (in mm)
Definition: motion.h:86
int sceMotionSetTiltCorrection(int setValue)
Activate/deactivate tilt correction.
uint8_t magFieldStability
One of SceMotionMagFieldStability.
Definition: motion.h:53
SceFVector3 angularVelocity
Angular velocity data.
Definition: motion.h:44
int sceMotionSetDeadband(int setValue)
Activate/deactivate deadbanding.
uint8_t reserved2[4]
Reserved data.
Definition: motion.h:49
int sceMotionReset(void)
Set current orientation as origin.
SceULong64 hostTimestamp
Timestamp of the data in microseconds.
Definition: motion.h:69
int sceMotionGetSensorState(SceMotionSensorState *sensorState, int numRecords)
Gets the current motion sensor state.
SceFMatrix4 rotationMatrix
Orientation data as a rotation matrix.
Definition: motion.h:47
SceMotionMagFieldStability
Definition: motion.h:19
uint8_t unknown
Unknown.
Definition: motion.h:54
float sceMotionGetAngleThreshold(void)
Get the angle threshold for basic orientation.
@ SCE_MOTION_ERROR_ALREADY_SAMPLING
Definition: motion.h:33
@ SCE_MOTION_ERROR_OUT_OF_BOUNDS
Definition: motion.h:31
@ SCE_MOTION_ERROR_NON_INIT_ERR
Definition: motion.h:28
@ SCE_MOTION_ERROR_DATA_INVALID
Definition: motion.h:26
@ SCE_MOTION_ERROR_READING
Definition: motion.h:27
@ SCE_MOTION_ERROR_MEM_IN_USE
Definition: motion.h:34
@ SCE_MOTION_ERROR_CALIB_READ_FAIL
Definition: motion.h:30
@ SCE_MOTION_ERROR_NOT_SAMPLING
Definition: motion.h:32
@ SCE_MOTION_ERROR_STATE_INVALID
Definition: motion.h:29
@ SCE_MOTION_MAGFIELD_UNSTABLE
Definition: motion.h:20
@ SCE_MOTION_MAGFIELD_STABLE
Definition: motion.h:22
@ SCE_MOTION_MAGFIELD_UNUSED
Definition: motion.h:21
Returned location of both the accelerometer and gyroscope in mm.
Definition: motion.h:85
Returned motion sensor state.
Definition: motion.h:62
Returned motion state.
Definition: motion.h:41
uint64_t SceULong64
Definition: types.h:54
Definition: types.h:181
Definition: types.h:189
Definition: types.h:124