Skip to content

Commit 40df468

Browse files
icyqwqlbuque
authored andcommitted
docs: Fix JoystickV2Unit Bug.
Signed-off-by: icyqwq <[email protected]>
1 parent 6db46a1 commit 40df468

File tree

1 file changed

+37
-14
lines changed

1 file changed

+37
-14
lines changed

docs/en/units/joystickv2.rst

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
JoystickV2Unit
33
==============
44

5-
.. include:: ../refs/unit.joystickv2unit.ref
5+
.. include:: ../refs/unit.joystickv2.ref
66

77
The joystick is an input unit for control, utilizing an I2C communication interface and supporting three-axis control signals (X/Y-axis analog input for displacement and Z-axis digital input for key presses). It is ideal for applications like gaming and robot control.
88

@@ -41,7 +41,7 @@ Constructors
4141

4242
.. class:: JoystickV2Unit(i2c, address)
4343

44-
Initialize the JoystickV2 Unit.
44+
Initialize the JoystickV2 Unit.
4545

4646
:param I2C i2c: I2C port to use.
4747
:param int address: I2C address of the JoystickV2 Unit.
@@ -58,6 +58,7 @@ Methods
5858

5959
Invert the X-axis of the joystick.
6060

61+
6162
:param bool invert: Whether to invert the X-axis.
6263

6364
UIFLOW2:
@@ -68,6 +69,7 @@ Methods
6869

6970
Invert the Y-axis of the joystick.
7071

72+
7173
:param bool invert: Whether to invert the Y-axis.
7274

7375
UIFLOW2:
@@ -78,6 +80,7 @@ Methods
7880

7981
Swap the X-axis and Y-axis of the joystick.
8082

83+
8184
:param bool swap: Whether to swap the X-axis and Y-axis.
8285

8386
UIFLOW2:
@@ -88,6 +91,8 @@ Methods
8891

8992
Read the ADC value of the joystick.
9093

94+
:return (tuple): Returns a tuple of the X-axis and Y-axis ADC values, from 0 to 65535
95+
9196

9297
UIFLOW2:
9398

@@ -97,6 +102,8 @@ Methods
97102

98103
Read the button status of the joystick.
99104

105+
:return (bool): Returns the button status. True if pressed, False if not pressed.
106+
100107

101108
UIFLOW2:
102109

@@ -106,6 +113,7 @@ Methods
106113

107114
Set the RGB LED color of the joystick.
108115

116+
109117
:param int r: The red value (0-255).
110118
:param int g: The green value (0-255).
111119
:param int b: The blue value (0-255).
@@ -118,20 +126,25 @@ Methods
118126

119127
Get the RGB LED color of the joystick.
120128

129+
:return (tuple): Returns a tuple of the RGB LED color values.
130+
121131

122132
UIFLOW2:
123133

124134
|get_rgb_led.svg|
125135

126136
.. method:: JoystickV2Unit.set_axis_x_mapping(adc_neg_min, adc_neg_max, adc_pos_min, adc_pos_max)
127137

128-
Set the mapping parameters of the X-axis.
138+
::
129139

130-
ADC Raw 0 65536
131-
|------------------------------------------------------|
132-
Mapped -4096 0 0 4096
133-
|---------------------|-dead zone-|--------------------|
134-
adc_neg_min adc_neg_max adc_pos_min adc_pos_max
140+
Set the mapping parameters of the X-axis.
141+
142+
ADC Raw 0 65536
143+
|------------------------------------------------------|
144+
Mapped -4096 0 0 4096
145+
|---------------------|-dead zone-|--------------------|
146+
adc_neg_min adc_neg_max adc_pos_min adc_pos_max
147+
135148

136149

137150
:param int adc_neg_min: The minimum ADC value of the negative range.
@@ -145,13 +158,16 @@ Mapped -4096 0 0 4096
145158

146159
.. method:: JoystickV2Unit.set_axis_y_mapping(adc_neg_min, adc_neg_max, adc_pos_min, adc_pos_max)
147160

148-
Set the mapping parameters of the Y-axis.
161+
::
149162

150-
ADC Raw 0 65536
151-
|------------------------------------------------------|
152-
Mapped -4096 0 0 4096
153-
|---------------------|-dead zone-|--------------------|
154-
adc_neg_min adc_neg_max adc_pos_min adc_pos_max
163+
Set the mapping parameters of the Y-axis.
164+
165+
ADC Raw 0 65536
166+
|------------------------------------------------------|
167+
Mapped -4096 0 0 4096
168+
|---------------------|-dead zone-|--------------------|
169+
adc_neg_min adc_neg_max adc_pos_min adc_pos_max
170+
155171

156172

157173
:param int adc_neg_min: The minimum ADC value of the negative range.
@@ -167,6 +183,7 @@ Mapped -4096 0 0 4096
167183

168184
Set the dead zone of the joystick.
169185

186+
170187
:param int x_adc_raw: The dead zone of the X-axis. Range is 0 to 32768.
171188
:param int y_adc_raw: The dead zone of the Y-axis. Range is 0 to 32768.
172189

@@ -178,6 +195,7 @@ Mapped -4096 0 0 4096
178195

179196
Set the dead zone of the joystick.
180197

198+
181199
:param int x_pos: The dead zone of the X-axis. Range is 0 to 4096.
182200
:param int y_pos: The dead zone of the Y-axis. Range is 0 to 4096.
183201

@@ -189,6 +207,8 @@ Mapped -4096 0 0 4096
189207

190208
Read the position of the joystick.
191209

210+
:return (tuple): Returns a tuple of the X-axis and Y-axis positions. The range is -4096 to 4096.
211+
192212

193213
UIFLOW2:
194214

@@ -198,6 +218,7 @@ Mapped -4096 0 0 4096
198218

199219
Set the I2C address of the JoystickV2 Unit.
200220

221+
201222
:param int address: The I2C address to set.
202223

203224
UIFLOW2:
@@ -208,6 +229,8 @@ Mapped -4096 0 0 4096
208229

209230
Read the firmware version of the JoystickV2 Unit.
210231

232+
:return (int): Returns the firmware version.
233+
211234

212235
UIFLOW2:
213236

0 commit comments

Comments
 (0)