Skip to content

Commit 1cf6228

Browse files
committed
docs: Updated documentation for the Joystick2 Unit.
Signed-off-by: lbuque <[email protected]>
1 parent a684bcd commit 1cf6228

File tree

5 files changed

+161
-35
lines changed

5 files changed

+161
-35
lines changed

docs/en/refs/unit.joystick2.ref

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
.. |Joystick2Unit| image::
3-
:target:
2+
.. |Joystick2Unit| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/products/unit/Unit-JoyStick2/4.webp
3+
:target: https://docs.m5stack.com/en/unit/Unit-JoyStick2
44
:height: 200px
55
:width: 200px
66

@@ -27,3 +27,11 @@
2727

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

30+
.. |cores3_joystick_example.m5f2| raw:: html
31+
32+
<a
33+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/joystick2/cores3_joystick_example.m5f2"
34+
target="_blank"
35+
>
36+
cores3_joystick_example.m5f2
37+
</a>

docs/en/units/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Unit
3737
imupro.rst
3838
ir.rst
3939
joystick.rst
40+
joystick2.rst
4041
key.rst
4142
kmeter.rst
4243
lcd.rst
@@ -71,4 +72,3 @@ Unit
7172
watering.rst
7273
weight_i2c.rst
7374
zigbee.rst
74-
joystick2.rst

docs/en/units/joystick2.rst

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
JoystickUnit
2+
Joystick2 Unit
33
==============
44

55
.. include:: ../refs/unit.joystick2.ref
@@ -8,17 +8,17 @@ The joystick is an input unit for control, utilizing an I2C communication interf
88

99
Support the following products:
1010

11-
|JoystickUnit|
11+
|Joystick2Unit|
1212

1313
Micropython Example::
1414

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

3434
.. only:: builder_html
3535

36-
class JoystickUnit
36+
|cores3_joystick_example.m5f2|
37+
38+
class Joystick2Unit
3739
--------------------
3840

3941
Constructors
4042
------------
4143

42-
.. class:: JoystickUnit(i2c, address)
44+
.. class:: Joystick2Unit(i2c, address)
4345

4446
Initialize the Joystick Unit.
4547

@@ -54,7 +56,7 @@ Constructors
5456
Methods
5557
-------
5658

57-
.. method:: JoystickUnit.set_axis_x_invert(invert)
59+
.. method:: Joystick2Unit.set_axis_x_invert(invert)
5860

5961
Invert the X-axis of the joystick.
6062

@@ -65,7 +67,7 @@ Methods
6567

6668
|set_axis_x_invert.png|
6769

68-
.. method:: JoystickUnit.set_axis_y_invert(invert)
70+
.. method:: Joystick2Unit.set_axis_y_invert(invert)
6971

7072
Invert the Y-axis of the joystick.
7173

@@ -76,7 +78,7 @@ Methods
7678

7779
|set_axis_y_invert.png|
7880

79-
.. method:: JoystickUnit.set_axis_swap(swap)
81+
.. method:: Joystick2Unit.set_axis_swap(swap)
8082

8183
Swap the X-axis and Y-axis of the joystick.
8284

@@ -87,7 +89,7 @@ Methods
8789

8890
|set_axis_swap.png|
8991

90-
.. method:: JoystickUnit.get_adc_value()
92+
.. method:: Joystick2Unit.get_adc_value()
9193

9294
Read the ADC value of the joystick.
9395

@@ -98,7 +100,7 @@ Methods
98100

99101
|get_adc_value.png|
100102

101-
.. method:: JoystickUnit.get_button_status()
103+
.. method:: Joystick2Unit.get_button_status()
102104

103105
Read the button status of the joystick.
104106

@@ -109,7 +111,7 @@ Methods
109111

110112
|get_button_status.png|
111113

112-
.. method:: JoystickUnit.set_led_brightness(brightness)
114+
.. method:: Joystick2Unit.set_led_brightness(brightness)
113115

114116
Set the brightness of the RGB LED.
115117

@@ -120,7 +122,7 @@ Methods
120122

121123
|set_led_brightness.png|
122124

123-
.. method:: JoystickUnit.fill_color(v)
125+
.. method:: Joystick2Unit.fill_color(v)
124126

125127
Set the RGB LED color of the joystick.
126128

@@ -131,7 +133,7 @@ Methods
131133

132134
|fill_color.png|
133135

134-
.. method:: JoystickUnit.fill_color_rgb(r, g, b)
136+
.. method:: Joystick2Unit.fill_color_rgb(r, g, b)
135137

136138
Set the RGB LED color of the joystick.
137139

@@ -140,11 +142,8 @@ Methods
140142
:param int g: The green value (0-255).
141143
:param int b: The blue value (0-255).
142144

143-
UIFLOW2:
144-
145-
|fill_color_rgb.png|
146145

147-
.. method:: JoystickUnit.set_axis_x_mapping(adc_neg_min, adc_neg_max, adc_pos_min, adc_pos_max)
146+
.. method:: Joystick2Unit.set_axis_x_mapping(adc_neg_min, adc_neg_max, adc_pos_min, adc_pos_max)
148147

149148
::
150149

@@ -167,7 +166,7 @@ Methods
167166

168167
|set_axis_x_mapping.png|
169168

170-
.. method:: JoystickUnit.set_axis_y_mapping(adc_neg_min, adc_neg_max, adc_pos_min, adc_pos_max)
169+
.. method:: Joystick2Unit.set_axis_y_mapping(adc_neg_min, adc_neg_max, adc_pos_min, adc_pos_max)
171170

172171
::
173172

@@ -190,7 +189,7 @@ Methods
190189

191190
|set_axis_y_mapping.png|
192191

193-
.. method:: JoystickUnit.set_deadzone_adc(x_adc_raw, y_adc_raw)
192+
.. method:: Joystick2Unit.set_deadzone_adc(x_adc_raw, y_adc_raw)
194193

195194
Set the dead zone of the joystick.
196195

@@ -202,7 +201,7 @@ Methods
202201

203202
|set_deadzone_adc.png|
204203

205-
.. method:: JoystickUnit.set_deadzone_position(x_pos, y_pos)
204+
.. method:: Joystick2Unit.set_deadzone_position(x_pos, y_pos)
206205

207206
Set the dead zone of the joystick.
208207

@@ -214,7 +213,7 @@ Methods
214213

215214
|set_deadzone_position.png|
216215

217-
.. method:: JoystickUnit.get_axis_position()
216+
.. method:: Joystick2Unit.get_axis_position()
218217

219218
Read the position of the joystick.
220219

@@ -225,18 +224,14 @@ Methods
225224

226225
|get_axis_position.png|
227226

228-
.. method:: JoystickUnit.set_address(address)
227+
.. method:: Joystick2Unit.set_address(address)
229228

230229
Set the I2C address of the Joystick Unit.
231230

232231

233232
:param int address: The I2C address to set.
234233

235-
UIFLOW2:
236-
237-
|set_address.png|
238-
239-
.. method:: JoystickUnit.get_firmware_version()
234+
.. method:: Joystick2Unit.get_firmware_version()
240235

241236
Read the firmware version of the Joystick Unit.
242237

@@ -247,7 +242,7 @@ Methods
247242

248243
|get_firmware_version.png|
249244

250-
.. method:: JoystickUnit.get_x_raw()
245+
.. method:: Joystick2Unit.get_x_raw()
251246

252247
Read the raw X-axis value of the joystick.
253248

@@ -258,7 +253,7 @@ Methods
258253

259254
|get_x_raw.png|
260255

261-
.. method:: JoystickUnit.get_y_raw()
256+
.. method:: Joystick2Unit.get_y_raw()
262257

263258
Read the raw Y-axis value of the joystick.
264259

@@ -269,7 +264,7 @@ Methods
269264

270265
|get_y_raw.png|
271266

272-
.. method:: JoystickUnit.get_x_position()
267+
.. method:: Joystick2Unit.get_x_position()
273268

274269
Read the X-axis position of the joystick.
275270

@@ -280,7 +275,7 @@ Methods
280275

281276
|get_x_position.png|
282277

283-
.. method:: JoystickUnit.get_y_position()
278+
.. method:: Joystick2Unit.get_y_position()
284279

285280
Read the Y-axis position of the joystick.
286281

0 commit comments

Comments
 (0)