Skip to content

Commit a684bcd

Browse files
icyqwqlbuque
authored andcommitted
libs/unit: Rename to Joystick2.
Signed-off-by: icyqwq <[email protected]>
1 parent 67edd0b commit a684bcd

File tree

6 files changed

+71
-71
lines changed

6 files changed

+71
-71
lines changed
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11

2-
.. |JoystickV2Unit| image::
2+
.. |Joystick2Unit| image::
33
:target:
44
:height: 200px
55
:width: 200px
66

7-
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/init.png
8-
.. |set_axis_x_invert.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/set_axis_x_invert.png
9-
.. |set_axis_y_invert.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/set_axis_y_invert.png
10-
.. |set_axis_swap.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/set_axis_swap.png
11-
.. |get_adc_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/get_adc_value.png
12-
.. |get_button_status.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/get_button_status.png
13-
.. |set_led_brightness.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/set_led_brightness.png
14-
.. |fill_color.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/fill_color.png
15-
.. |fill_color_rgb.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/fill_color_rgb.png
16-
.. |set_axis_x_mapping.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/set_axis_x_mapping.png
17-
.. |set_axis_y_mapping.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/set_axis_y_mapping.png
18-
.. |set_deadzone_adc.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/set_deadzone_adc.png
19-
.. |set_deadzone_position.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/set_deadzone_position.png
20-
.. |get_axis_position.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/get_axis_position.png
21-
.. |set_address.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/set_address.png
22-
.. |get_firmware_version.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/get_firmware_version.png
23-
.. |get_x_raw.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/get_x_raw.png
24-
.. |get_y_raw.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/get_y_raw.png
25-
.. |get_x_position.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/get_x_position.png
26-
.. |get_y_position.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/get_y_position.png
7+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/init.png
8+
.. |set_axis_x_invert.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/set_axis_x_invert.png
9+
.. |set_axis_y_invert.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/set_axis_y_invert.png
10+
.. |set_axis_swap.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/set_axis_swap.png
11+
.. |get_adc_value.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/get_adc_value.png
12+
.. |get_button_status.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/get_button_status.png
13+
.. |set_led_brightness.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/set_led_brightness.png
14+
.. |fill_color.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/fill_color.png
15+
.. |fill_color_rgb.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/fill_color_rgb.png
16+
.. |set_axis_x_mapping.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/set_axis_x_mapping.png
17+
.. |set_axis_y_mapping.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/set_axis_y_mapping.png
18+
.. |set_deadzone_adc.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/set_deadzone_adc.png
19+
.. |set_deadzone_position.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/set_deadzone_position.png
20+
.. |get_axis_position.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/get_axis_position.png
21+
.. |set_address.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/set_address.png
22+
.. |get_firmware_version.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/get_firmware_version.png
23+
.. |get_x_raw.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/get_x_raw.png
24+
.. |get_y_raw.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/get_y_raw.png
25+
.. |get_x_position.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/get_x_position.png
26+
.. |get_y_position.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/get_y_position.png
2727

28-
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystickv2/example.png
28+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/unit/joystick2/example.png
2929

docs/en/units/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ Unit
7171
watering.rst
7272
weight_i2c.rst
7373
zigbee.rst
74-
joystickv2.rst
74+
joystick2.rst

docs/en/units/joystickv2.rst renamed to docs/en/units/joystick2.rst

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11

2-
JoystickV2Unit
2+
JoystickUnit
33
==============
44

5-
.. include:: ../refs/unit.joystickv2.ref
5+
.. include:: ../refs/unit.joystick2.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

99
Support the following products:
1010

11-
|JoystickV2Unit|
11+
|JoystickUnit|
1212

1313
Micropython Example::
1414

1515
import os, sys, io
1616
import M5
1717
from M5 import *
18-
from unit import JoystickV2Unit
18+
from unit import JoystickUnit
1919
from hardware import *
2020
i2c = I2C(1, scl=22, sda=21)
21-
joystick = JoystickV2Unit(i2c)
21+
joystick = JoystickUnit(i2c)
2222
joystick.read_adc_value()
2323
joystick.read_button_status()
2424
joystick.set_rgb_led(255, 0, 0)
@@ -33,18 +33,18 @@ UIFLOW2 Example:
3333

3434
.. only:: builder_html
3535

36-
class JoystickV2Unit
36+
class JoystickUnit
3737
--------------------
3838

3939
Constructors
4040
------------
4141

42-
.. class:: JoystickV2Unit(i2c, address)
42+
.. class:: JoystickUnit(i2c, address)
4343

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

4646
:param I2C i2c: I2C port to use.
47-
:param int address: I2C address of the JoystickV2 Unit.
47+
:param int address: I2C address of the Joystick Unit.
4848

4949
UIFLOW2:
5050

@@ -54,7 +54,7 @@ Constructors
5454
Methods
5555
-------
5656

57-
.. method:: JoystickV2Unit.set_axis_x_invert(invert)
57+
.. method:: JoystickUnit.set_axis_x_invert(invert)
5858

5959
Invert the X-axis of the joystick.
6060

@@ -65,7 +65,7 @@ Methods
6565

6666
|set_axis_x_invert.png|
6767

68-
.. method:: JoystickV2Unit.set_axis_y_invert(invert)
68+
.. method:: JoystickUnit.set_axis_y_invert(invert)
6969

7070
Invert the Y-axis of the joystick.
7171

@@ -76,7 +76,7 @@ Methods
7676

7777
|set_axis_y_invert.png|
7878

79-
.. method:: JoystickV2Unit.set_axis_swap(swap)
79+
.. method:: JoystickUnit.set_axis_swap(swap)
8080

8181
Swap the X-axis and Y-axis of the joystick.
8282

@@ -87,7 +87,7 @@ Methods
8787

8888
|set_axis_swap.png|
8989

90-
.. method:: JoystickV2Unit.get_adc_value()
90+
.. method:: JoystickUnit.get_adc_value()
9191

9292
Read the ADC value of the joystick.
9393

@@ -98,7 +98,7 @@ Methods
9898

9999
|get_adc_value.png|
100100

101-
.. method:: JoystickV2Unit.get_button_status()
101+
.. method:: JoystickUnit.get_button_status()
102102

103103
Read the button status of the joystick.
104104

@@ -109,7 +109,7 @@ Methods
109109

110110
|get_button_status.png|
111111

112-
.. method:: JoystickV2Unit.set_led_brightness(brightness)
112+
.. method:: JoystickUnit.set_led_brightness(brightness)
113113

114114
Set the brightness of the RGB LED.
115115

@@ -120,7 +120,7 @@ Methods
120120

121121
|set_led_brightness.png|
122122

123-
.. method:: JoystickV2Unit.fill_color(v)
123+
.. method:: JoystickUnit.fill_color(v)
124124

125125
Set the RGB LED color of the joystick.
126126

@@ -131,7 +131,7 @@ Methods
131131

132132
|fill_color.png|
133133

134-
.. method:: JoystickV2Unit.fill_color_rgb(r, g, b)
134+
.. method:: JoystickUnit.fill_color_rgb(r, g, b)
135135

136136
Set the RGB LED color of the joystick.
137137

@@ -144,7 +144,7 @@ Methods
144144

145145
|fill_color_rgb.png|
146146

147-
.. method:: JoystickV2Unit.set_axis_x_mapping(adc_neg_min, adc_neg_max, adc_pos_min, adc_pos_max)
147+
.. method:: JoystickUnit.set_axis_x_mapping(adc_neg_min, adc_neg_max, adc_pos_min, adc_pos_max)
148148

149149
::
150150

@@ -167,7 +167,7 @@ Methods
167167

168168
|set_axis_x_mapping.png|
169169

170-
.. method:: JoystickV2Unit.set_axis_y_mapping(adc_neg_min, adc_neg_max, adc_pos_min, adc_pos_max)
170+
.. method:: JoystickUnit.set_axis_y_mapping(adc_neg_min, adc_neg_max, adc_pos_min, adc_pos_max)
171171

172172
::
173173

@@ -190,7 +190,7 @@ Methods
190190

191191
|set_axis_y_mapping.png|
192192

193-
.. method:: JoystickV2Unit.set_deadzone_adc(x_adc_raw, y_adc_raw)
193+
.. method:: JoystickUnit.set_deadzone_adc(x_adc_raw, y_adc_raw)
194194

195195
Set the dead zone of the joystick.
196196

@@ -202,7 +202,7 @@ Methods
202202

203203
|set_deadzone_adc.png|
204204

205-
.. method:: JoystickV2Unit.set_deadzone_position(x_pos, y_pos)
205+
.. method:: JoystickUnit.set_deadzone_position(x_pos, y_pos)
206206

207207
Set the dead zone of the joystick.
208208

@@ -214,7 +214,7 @@ Methods
214214

215215
|set_deadzone_position.png|
216216

217-
.. method:: JoystickV2Unit.get_axis_position()
217+
.. method:: JoystickUnit.get_axis_position()
218218

219219
Read the position of the joystick.
220220

@@ -225,9 +225,9 @@ Methods
225225

226226
|get_axis_position.png|
227227

228-
.. method:: JoystickV2Unit.set_address(address)
228+
.. method:: JoystickUnit.set_address(address)
229229

230-
Set the I2C address of the JoystickV2 Unit.
230+
Set the I2C address of the Joystick Unit.
231231

232232

233233
:param int address: The I2C address to set.
@@ -236,9 +236,9 @@ Methods
236236

237237
|set_address.png|
238238

239-
.. method:: JoystickV2Unit.get_firmware_version()
239+
.. method:: JoystickUnit.get_firmware_version()
240240

241-
Read the firmware version of the JoystickV2 Unit.
241+
Read the firmware version of the Joystick Unit.
242242

243243
:return (int): Returns the firmware version.
244244

@@ -247,7 +247,7 @@ Methods
247247

248248
|get_firmware_version.png|
249249

250-
.. method:: JoystickV2Unit.get_x_raw()
250+
.. method:: JoystickUnit.get_x_raw()
251251

252252
Read the raw X-axis value of the joystick.
253253

@@ -258,7 +258,7 @@ Methods
258258

259259
|get_x_raw.png|
260260

261-
.. method:: JoystickV2Unit.get_y_raw()
261+
.. method:: JoystickUnit.get_y_raw()
262262

263263
Read the raw Y-axis value of the joystick.
264264

@@ -269,7 +269,7 @@ Methods
269269

270270
|get_y_raw.png|
271271

272-
.. method:: JoystickV2Unit.get_x_position()
272+
.. method:: JoystickUnit.get_x_position()
273273

274274
Read the X-axis position of the joystick.
275275

@@ -280,7 +280,7 @@ Methods
280280

281281
|get_x_position.png|
282282

283-
.. method:: JoystickV2Unit.get_y_position()
283+
.. method:: JoystickUnit.get_y_position()
284284

285285
Read the Y-axis position of the joystick.
286286

m5stack/libs/unit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"IMUUnit": "imu",
5858
"IRUnit": "ir",
5959
"JoystickUnit": "joystick",
60-
"JoystickV2Unit": "joystickv2",
60+
"Joystick2Unit": "joystick2",
6161
"KeyUnit": "key",
6262
"KMeterISOUnit": "kmeter_iso",
6363
"KMeterUnit": "kmeter",

0 commit comments

Comments
 (0)