vitasdk
Documentation of the vitasdk

Detailed Description

Exports for User.


Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceMotion_stub



Functions

int sceMotionGetState (SceMotionState *motionState)
 Gets the current motion state. More...
 
int sceMotionGetSensorState (SceMotionSensorState *sensorState, int numRecords)
 Gets the current motion sensor state. More...
 
int sceMotionGetDeviceLocation (SceMotionDeviceLocation *deviceLocation)
 Gets the location of the device's sensors in relation to its center point (in mm). More...
 
int sceMotionGetBasicOrientation (SceFVector3 *basicOrientation)
 Gets the basic orientation of the device in relation to gravity. More...
 
int sceMotionRotateYaw (float radians)
 Rotate the yaw axis. More...
 
int sceMotionGetTiltCorrection (void)
 Get Status of tilt correction. More...
 
int sceMotionSetTiltCorrection (int setValue)
 Activate/deactivate tilt correction. More...
 
int sceMotionGetDeadband (void)
 Get status of deadbanding. More...
 
int sceMotionSetDeadband (int setValue)
 Activate/deactivate deadbanding. More...
 
int sceMotionGetGyroBiasCorrection (void)
 Get status of gyroscope bias correction. More...
 
int sceMotionSetGyroBiasCorrection (int setValue)
 Activate/deactivate gyroscope bias correction. More...
 
int sceMotionSetAngleThreshold (float angle)
 Define the angle threshold for basic orientation. More...
 
float sceMotionGetAngleThreshold (void)
 Get the angle threshold for basic orientation. More...
 
int sceMotionReset (void)
 Set current orientation as origin. More...
 
int sceMotionMagnetometerOn (void)
 Start magnetometer sampling. More...
 
int sceMotionMagnetometerOff (void)
 Stop magnetometer sampling. More...
 
int sceMotionGetMagnetometerState (void)
 Get status of magnetometer sampling. More...
 
int sceMotionStartSampling (void)
 Start sampling. More...
 
int sceMotionStopSampling (void)
 Stop sampling. More...
 

Data Structure Documentation

◆ SceMotionState

struct SceMotionState

Returned motion state.

Data Fields
unsigned int timestamp Local timestamp of the device.
SceFVector3 acceleration Accelerometer data.
SceFVector3 angularVelocity Angular velocity data.
uint8_t reserved1[12] Reserved data.
SceFQuaternion deviceQuat Orientation data as a Quaternion.
SceFMatrix4 rotationMatrix Orientation data as a rotation matrix.
SceFMatrix4 nedMatrix Magnetometer orientation matrix.
uint8_t reserved2[4] Reserved data.
SceFVector3 basicOrientation Orientation of the device in reference to gravity.
SceULong64 hostTimestamp Timestamp of the data in microseconds.
uint8_t reserved3[36] Reserved data.
uint8_t magFieldStability One of SceMotionMagFieldStability.
uint8_t unknown Unknown.
uint8_t reserved4[2] Reserved data.

◆ SceMotionSensorState

struct SceMotionSensorState

Returned motion sensor state.

Note
- SceMotionSensorState holds actual sensor data as opposed to SceMotionState which uses a calculated state
Data Fields
SceFVector3 accelerometer Accelerometer data.
SceFVector3 gyro Angular velocity data.
uint8_t reserved1[12] Reserved data.
unsigned int timestamp Timestamp of the data in microseconds.
unsigned int counter Number of requested state.
uint8_t reserved2[4] Reserved data.
SceULong64 hostTimestamp Timestamp of the data in microseconds.
uint8_t unknown Unknown.
uint8_t reserved3[7] Reserved data.

◆ SceMotionDeviceLocation

struct SceMotionDeviceLocation

Returned location of both the accelerometer and gyroscope in mm.

Note
- Axies are fixed with z axis being straight perpendicular through the screen and x axis being parallel to the screen's bottom and top edge
- Direction of the z axis is as if the device were laying on a flat surface, oled/lcd side facing upwards
- OLED models should return the following values:
- Accelerometer: x == -32; y == 12; z == -8
- Gyroscope: x == -33; y == 6; z == -8
- LCD models should return the following values:
- Accelerometer: x == 13; y == 19; z == -8
- Gyroscope: x == 13; y == 19; z == -8
Data Fields
SceFVector3 accelerometer Location of te accelerometer in relation to the center of the device (in mm)
SceFVector3 gyro Location of te gyroscope in relation to the center of the device (in mm)
uint8_t reserved[24] Reserved data.

Enumeration Type Documentation

◆ SceMotionMagFieldStability

Enumerator
SCE_MOTION_MAGFIELD_UNSTABLE 
SCE_MOTION_MAGFIELD_UNUSED 
SCE_MOTION_MAGFIELD_STABLE 

◆ SceMotionErrorCode

Enumerator
SCE_MOTION_ERROR_DATA_INVALID 
SCE_MOTION_ERROR_READING 
SCE_MOTION_ERROR_NON_INIT_ERR 
SCE_MOTION_ERROR_STATE_INVALID 
SCE_MOTION_ERROR_CALIB_READ_FAIL 
SCE_MOTION_ERROR_OUT_OF_BOUNDS 
SCE_MOTION_ERROR_NOT_SAMPLING 
SCE_MOTION_ERROR_ALREADY_SAMPLING 
SCE_MOTION_ERROR_MEM_IN_USE 

Function Documentation

◆ sceMotionGetState()

int sceMotionGetState ( SceMotionState motionState)

Gets the current motion state.

Parameters
[out]*motionState- See SceMotionState
Returns
0, <0 on error.

◆ sceMotionGetSensorState()

int sceMotionGetSensorState ( SceMotionSensorState sensorState,
int  numRecords 
)

Gets the current motion sensor state.

Parameters
[in]numRecords- Amount of records to get
[out]*motionSensorState- See SceMotionSensorState
Returns
0, <0 on error

◆ sceMotionGetDeviceLocation()

int sceMotionGetDeviceLocation ( SceMotionDeviceLocation deviceLocation)

Gets the location of the device's sensors in relation to its center point (in mm).

Parameters
[out]*deviceLocation- See SceMotionDeviceLocation
Returns
0, <0 on error

◆ sceMotionGetBasicOrientation()

int sceMotionGetBasicOrientation ( SceFVector3 basicOrientation)

Gets the basic orientation of the device in relation to gravity.

Note
- Possible values in the output vector are -1, 0 and 1
- Using the same coordinate system as SceMotionDeviceLocation these values are set in the vector depending on if the axies' positive or negative directions are facing away from gravitational pull
- For example if the vita is laying on a flat and level surface, with the OLED/LCD side facing upwards, the Z part of the vector will be 1
- Now flipping the device upwards, taking hold of the right joystick's side, until it forms a 90 degree angle to the surface will result in the X part of the vector being 1 instead
- Both examples would result in the returned value being -1 if flipped 180 degrees, swapping their top and bottom sides in correlation to gravity
- The angle of rotation in relation to being in a centered state on an axis (returned as 0) after which the device will change the value is determined by ::SceMotionSetAngleThreshold
- In order for this function to return up to date data, sceMotionGetState must be called prior to call this function.
Parameters
[out]*basicOrientation
Returns
0, <0 on error

◆ sceMotionRotateYaw()

int sceMotionRotateYaw ( float  radians)

Rotate the yaw axis.

Parameters
[in]radians- Rotation angle in radians
Returns
0

◆ sceMotionGetTiltCorrection()

int sceMotionGetTiltCorrection ( void  )

Get Status of tilt correction.

Note
- With tilt correction enabled the data for roll and pitch movements of the device get recalculated to not distort the yaw movements in relation to gravity
- Enabled by default
Returns
1 if enabled, 0 if disabled

◆ sceMotionSetTiltCorrection()

int sceMotionSetTiltCorrection ( int  setValue)

Activate/deactivate tilt correction.

Note
- For more information see sceMotionGetTiltCorrection
Parameters
[in]setValue- 1 to enable, 0 to disable
Returns
0

◆ sceMotionGetDeadband()

int sceMotionGetDeadband ( void  )

Get status of deadbanding.

Note
- With deadbanding enabled the device will filter out small movements to reduce jitter
- Potentially decreaces accuracy of fine movements
- Enabled by default
Returns
1 if enabled, 0 if disabled

◆ sceMotionSetDeadband()

int sceMotionSetDeadband ( int  setValue)

Activate/deactivate deadbanding.

Note
- For more information see ::sceMotionGetDeadbanding
Parameters
[in]setValue- 1 to enable, 0 to disable
Returns
0

◆ sceMotionGetGyroBiasCorrection()

int sceMotionGetGyroBiasCorrection ( void  )

Get status of gyroscope bias correction.

Note
- With gyroscope bias correction enabled the device will attempt to adjust for outside influences that could impact calibration
- Enabled by default
Returns
1 if enabled, 0 if disabled

◆ sceMotionSetGyroBiasCorrection()

int sceMotionSetGyroBiasCorrection ( int  setValue)

Activate/deactivate gyroscope bias correction.

Note
- For more information see sceMotionGetGyroBiasCorrection
Parameters
[in]setValue- 1 to enable, 0 to disable
Returns
0

◆ sceMotionSetAngleThreshold()

int sceMotionSetAngleThreshold ( float  angle)

Define the angle threshold for basic orientation.

Parameters
[in]angle- range of 0 to 45 degrees
Returns
0

◆ sceMotionGetAngleThreshold()

float sceMotionGetAngleThreshold ( void  )

Get the angle threshold for basic orientation.

Returns
angle in degrees

◆ sceMotionReset()

int sceMotionReset ( void  )

Set current orientation as origin.

Returns
0, <0 on error

◆ sceMotionMagnetometerOn()

int sceMotionMagnetometerOn ( void  )

Start magnetometer sampling.

Returns
0, <0 on error

◆ sceMotionMagnetometerOff()

int sceMotionMagnetometerOff ( void  )

Stop magnetometer sampling.

Returns
0, <0 on error

◆ sceMotionGetMagnetometerState()

int sceMotionGetMagnetometerState ( void  )

Get status of magnetometer sampling.

Returns
1 if enabled, 0 if disabled

◆ sceMotionStartSampling()

int sceMotionStartSampling ( void  )

Start sampling.

Returns
0, <0 on error

◆ sceMotionStopSampling()

int sceMotionStopSampling ( void  )

Stop sampling.

Returns
0, <0 on error