Skip to content

Commit c232127

Browse files
committed
Updated documentation
1 parent e9d5fa0 commit c232127

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ My goal with JoyShockLibrary is to enable game developers to support DS4, JoyCon
99
* **[Structs](#structs)**
1010
* **[Functions](#functions)**
1111
* **[Known and Perceived Issues](#known-and-perceived-issues)**
12+
* **[Backwards Compatibility](#backwards-compatibility)**
1213
* **[Credits](#credits)**
1314
* **[Helpful Resources](#helpful-resources)**
1415
* **[License](#license)**
@@ -51,6 +52,11 @@ The latest version of JoyShockLibrary can always be found [here](https://github.
5152
* **float accelX, accelY, accelZ** - accelerometer X axis, Y axis, and Z axis, respectively, in g (g-force).
5253
* **float gyroX, gyroY, gyroZ** - gyroscope angular velocity X, Y, and Z, respectively, in dps (degrees per second), when correctly calibrated.
5354

55+
**struct MOTION_STATE** - The MOTION_STATE reports the orientation of the device as calculated using a sensor fusion solution to combine gyro and accelerometer data.
56+
* **float quatW, quatX, quatY, quatZ** - a quaternion representing the orientation of the device.
57+
* **float accelX, accelY, accelZ** - local acceleration after accounting for and removing the effect of gravity.
58+
* **float gravX, gravY, gravZ** - local gravity direction.
59+
5460
### Functions
5561

5662
All these functions *should* be thread-safe, and none of them should cause any harm if given the wrong handle. If they do, please report this to me as an isuse.
@@ -65,7 +71,9 @@ All these functions *should* be thread-safe, and none of them should cause any h
6571

6672
**IMU\_STATE JslGetIMUState(int deviceId)** - Get the latest accelerometer + gyroscope state for the controller with the given id.
6773

68-
**TOUCH_STATE JslGetTouchState(int deviceId)** - Get the latest touchpad state for the controller with the given id. Only DualShock 4s support this.
74+
**MOTION\_STATE JslGetMotionState(int deviceId)** - Get the latest motion state for the controller with the given id.
75+
76+
**TOUCH\_STATE JslGetTouchState(int deviceId)** - Get the latest touchpad state for the controller with the given id. Only DualShock 4s support this.
6977

7078
**int JslGetButtons(int deviceId)** - Get the latest button state for the controller with the given id. If you want more than just the buttons, it's more efficient to use JslGetSimpleState.
7179

@@ -137,9 +145,16 @@ The Nintendo devices report every 15ms, but their IMUs actually report every 5ms
137145

138146
In a future version I hope to either combine the 3 rotations in a way that works better in 3D, or to add a way for a single controller event to report several IMU events at the same time.
139147

148+
## Backwards Compatibility
149+
JoyShockLibrary v2 changes the gyro and accelerometer axes from previous versions. Previous versions were inconsistent between gyro and accelerometer. When upgrading to JoyShockLibrary v2, in order to maintain previous behaviour:
150+
* Invert Gyro X
151+
* Swap Accel Z and Y
152+
* Then invert Accel Z
153+
140154
## Credits
141155
I'm Jibb Smart, and I made JoyShockLibrary. JoyShockLibrary has also benefited from the contributions of:
142156
* Romeo Calota (Linux support + general portability improvements)
157+
* RollinBarrel (touchpad support)
143158

144159
JoyShockLibrary uses substantial portions of mfosse's [JoyCon-Driver](https://github.com/mfosse/JoyCon-Driver), a [vJoy](http://vjoystick.sourceforge.net/site/) feeder for most communication with Nintendo devices, building on it with info from dekuNukem's [Nintendo Switch Reverse Engineering](https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/) page in order to (for example) unpack all gyro and accelerometer samples from each report.
145160

@@ -152,7 +167,7 @@ This software depends on signal11's [HIDAPI](https://github.com/signal11/hidapi)
152167
* Why gyro controls make gaming better;
153168
* How developers can do a better job implementing gyro controls;
154169
* How to use JoyShockLibrary;
155-
* How gamers can play any PC game with gyro controls using [JoyShockMapper](https://github.com/JibbSmart/JoyShockMapper).
170+
* How gamers can play any PC game with gyro controls using [JoyShockMapper](https://github.com/JibbSmart/JoyShockMapper), which uses JoyShockLibrary to read from supported controllers.
156171

157172
## License
158173
JoyShockLibrary is licensed under the MIT License - see [LICENSE.md](LICENSE.md).

0 commit comments

Comments
 (0)