- added more light functions
- added docstrings for functions
This commit is contained in:
Florian Kaiser
2020-11-29 22:41:09 +01:00
parent 0bf55f756b
commit a54fb55b91
2 changed files with 48 additions and 8 deletions

View File

@@ -53,12 +53,6 @@ class pydualsense:
return dual_sense return dual_sense
# color stuff
def setColor(self, r: int, g:int, b:int):
if r > 255 or g > 255 or b > 255:
raise Exception('colors have values from 0 to 255 only')
self.color = (r,g,b)
# right trigger # right trigger
def setRightTriggerMode(self, mode: TriggerModes): def setRightTriggerMode(self, mode: TriggerModes):
@@ -111,7 +105,53 @@ class pydualsense:
def setMicrophoneLED(self, value): def setMicrophoneLED(self, value):
self.audio.microphone_led = value self.audio.microphone_led = value
def setPlayer(self, player : PlayerID): # color stuff
def setColor(self, r: int, g:int, b:int):
"""sets the led colour around the touchpad
:param r: red channel, 0..255
:type r: int
:param g: green channel, 0..255
:type g: int
:param b: blue channel, 0..255
:type b: int
:raises Exception: wron color values
"""
if (r > 255 or g > 255 or b > 255) or (r < 0 or g < 0 or b < 0):
raise Exception('colors have values from 0 to 255 only')
self.color = (r,g,b)
def setLEDOption(self, option: LedOptions):
"""set led option
:param option: led option
:type option: LedOptions
"""
self.light.ledOption = option
def setPulseOption(self, option: PulseOptions):
"""set the pulse option for the leds
:param option: [description]
:type option: PulseOptions
"""
self.light.pulseOptions = option
def setBrightness(self, brightness: Brightness):
"""set the brightness of the player leds
:param brightness: brightness for the leds
:type brightness: Brightness
"""
self.light.brightness = brightness
def setPlayerID(self, player : PlayerID):
"""set the player ID. The controller has 5 white LED which signals
which player the controller is
:param player: the player id from 1 to 5
:type player: PlayerID
"""
self.light.playerNumber = player self.light.playerNumber = player
def sendReport(self): def sendReport(self):

View File

@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
setup( setup(
name='pydualsense', name='pydualsense',
version='0.1.0', version='0.2.0',
description='use your DualSense (PS5) controller with python', description='use your DualSense (PS5) controller with python',
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",