-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5455f87
Showing
55 changed files
with
6,987 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 23a1ffe8f800ed1227cdb68dedead008 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
API | ||
=== | ||
|
||
This is the front page for the API documentation of the **pydualsense** library. | ||
|
||
|
||
.. toctree:: | ||
ds_enum | ||
ds_main | ||
ds_eventsystem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pydualsense enums classes | ||
========================= | ||
|
||
The enum module provides the used `enums` by **pydualsense**. These `enums` are used to update the state of the controller as a parameter to call the used functions. | ||
|
||
|
||
.. automodule:: pydualsense.enums | ||
:noindex: | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
pydualsense event system classes | ||
================================ | ||
|
||
The `Event System` implements the event system used for the button callbacks | ||
|
||
.. automodule:: pydualsense.event_system | ||
:noindex: | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pydualsense main class | ||
====================== | ||
|
||
`pydualsense` is the main class of the library with the same name. It provides access to the states of the controller through manual reading of the :class:`DSState <pydualsense.pydualsense.DSState>` | ||
|
||
|
||
.. automodule:: pydualsense.pydualsense | ||
:noindex: | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Examples | ||
======== | ||
|
||
This pages displays some examples that on how the library can be used. All the examples can also be found inside the `examples` folder on the github repository. | ||
|
||
.. code-block:: python | ||
from pydualsense import * | ||
def cross_down(state): | ||
print(f'cross {state}') | ||
def circle_down(state): | ||
print(f'circle {state}') | ||
def dpad_down(state): | ||
print(f'dpad down {state}') | ||
def joystick(stateX, stateY): | ||
print(f'joystick {stateX} {stateY}') | ||
def gyro_changed(pitch, yaw, roll): | ||
print(f'{pitch}, {yaw}, {roll}') | ||
# create dualsense | ||
dualsense = pydualsense() | ||
# find device and initialize | ||
dualsense.init() | ||
# add events handler functions | ||
dualsense.cross_pressed += cross_down | ||
dualsense.circle_pressed += circle_down | ||
dualsense.dpad_down += dpad_down | ||
dualsense.left_joystick_changed += joystick | ||
dualsense.gyro_changed += gyro_changed | ||
# read controller state until R1 is pressed | ||
while not dualsense.state.R1: | ||
... | ||
# close device | ||
dualsense.close() | ||
The above example demonstrates the newly added c# like event system that makes it possible to trigger an event for the inputs of the controller. | ||
|
||
|
||
.. code-block:: python | ||
from pydualsense import * | ||
# get dualsense instance | ||
dualsense = pydualsense() | ||
# initialize controller and connect | ||
dualsense.init() | ||
print('Trigger Effect demo started') | ||
# set left and right rumble motors | ||
dualsense.setLeftMotor(255) | ||
dualsense.setRightMotor(100) | ||
# set left l2 trigger to Rigid and set index 1 to force 255 | ||
dualsense.triggerL.setMode(TriggerModes.Rigid) | ||
dualsense.triggerL.setForce(1, 255) | ||
# set left r2 trigger to Rigid | ||
dualsense.triggerR.setMode(TriggerModes.Pulse_A) | ||
dualsense.triggerR.setForce(0, 200) | ||
dualsense.triggerR.setForce(1, 255) | ||
dualsense.triggerR.setForce(2, 175) | ||
# loop until r1 is pressed to feel effect | ||
while not dualsense.state.R1: | ||
... | ||
# terminate the thread for message and close the device | ||
dualsense.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Welcome to pydualsense's documentation! | ||
======================================= | ||
|
||
|
||
**pydualsense** is a Python library that helps you interact with your PlayStation 5 DualSense controller. It reads the current state of the controller and also allows to update the triggers and other options on the controller. | ||
|
||
To get started check out the :doc:`usage` section for more information on how to install. | ||
|
||
|
||
.. note:: | ||
This project is under active development. | ||
|
||
Contents | ||
-------- | ||
|
||
.. toctree:: | ||
usage | ||
api | ||
examples | ||
modules | ||
|
||
|
||
TODOs | ||
----- | ||
|
||
.. todolist:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pydualsense | ||
=========== | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
pydualsense |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
pydualsense package | ||
=================== | ||
|
||
Submodules | ||
---------- | ||
|
||
pydualsense.enums module | ||
------------------------ | ||
|
||
.. automodule:: pydualsense.enums | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
pydualsense.event\_system module | ||
-------------------------------- | ||
|
||
.. automodule:: pydualsense.event_system | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
pydualsense.hidguardian module | ||
------------------------------ | ||
|
||
.. automodule:: pydualsense.hidguardian | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
pydualsense.pydualsense module | ||
------------------------------ | ||
|
||
.. automodule:: pydualsense.pydualsense | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Module contents | ||
--------------- | ||
|
||
.. automodule:: pydualsense | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Usage | ||
===== | ||
|
||
Installation | ||
------------ | ||
|
||
To use **pydualsense**, first install it using pip: | ||
|
||
.. code-block:: console | ||
(.venv) $ pip install --upgrade pydualsense | ||
This install the needed dependencies and the **pydualsense** library itself. | ||
|
||
|
||
Windows | ||
------- | ||
|
||
If you are on Windows the hidapi need to downloaded from `here <https://github.com/libusb/hidapi/releases>`_. | ||
The downloaded `.dll` file need to be placed in a path that is in your environments variable `path`. | ||
|
||
|
||
Linux based | ||
----------- | ||
|
||
If you are on a linux based system (e.g debian) you need to first need to install the hidapi through your package manager. | ||
|
||
On Ubuntu systems the package `libhidapi-dev` is required. | ||
|
||
.. code-block:: console | ||
sudo apt install libhidapi-dev | ||
Examples | ||
-------- | ||
|
||
For code examles on using the library see :doc:`examples` |
Oops, something went wrong.