1
1
2
- JoystickUnit
2
+ Joystick2 Unit
3
3
==============
4
4
5
5
.. include :: ../refs/unit.joystick2.ref
@@ -8,17 +8,17 @@ The joystick is an input unit for control, utilizing an I2C communication interf
8
8
9
9
Support the following products:
10
10
11
- |JoystickUnit |
11
+ |Joystick2Unit |
12
12
13
13
Micropython Example::
14
14
15
15
import os, sys, io
16
16
import M5
17
17
from M5 import *
18
- from unit import JoystickUnit
18
+ from unit import Joystick2Unit
19
19
from hardware import *
20
20
i2c = I2C(1, scl=22, sda=21)
21
- joystick = JoystickUnit (i2c)
21
+ joystick = Joystick2Unit (i2c)
22
22
joystick.read_adc_value()
23
23
joystick.read_button_status()
24
24
joystick.set_rgb_led(255, 0, 0)
@@ -33,13 +33,15 @@ UIFLOW2 Example:
33
33
34
34
.. only :: builder_html
35
35
36
- class JoystickUnit
36
+ |cores3_joystick_example.m5f2 |
37
+
38
+ class Joystick2Unit
37
39
--------------------
38
40
39
41
Constructors
40
42
------------
41
43
42
- .. class :: JoystickUnit (i2c, address)
44
+ .. class :: Joystick2Unit (i2c, address)
43
45
44
46
Initialize the Joystick Unit.
45
47
@@ -54,7 +56,7 @@ Constructors
54
56
Methods
55
57
-------
56
58
57
- .. method :: JoystickUnit .set_axis_x_invert(invert)
59
+ .. method :: Joystick2Unit .set_axis_x_invert(invert)
58
60
59
61
Invert the X-axis of the joystick.
60
62
@@ -65,7 +67,7 @@ Methods
65
67
66
68
|set_axis_x_invert.png |
67
69
68
- .. method :: JoystickUnit .set_axis_y_invert(invert)
70
+ .. method :: Joystick2Unit .set_axis_y_invert(invert)
69
71
70
72
Invert the Y-axis of the joystick.
71
73
@@ -76,7 +78,7 @@ Methods
76
78
77
79
|set_axis_y_invert.png |
78
80
79
- .. method :: JoystickUnit .set_axis_swap(swap)
81
+ .. method :: Joystick2Unit .set_axis_swap(swap)
80
82
81
83
Swap the X-axis and Y-axis of the joystick.
82
84
@@ -87,7 +89,7 @@ Methods
87
89
88
90
|set_axis_swap.png |
89
91
90
- .. method :: JoystickUnit .get_adc_value()
92
+ .. method :: Joystick2Unit .get_adc_value()
91
93
92
94
Read the ADC value of the joystick.
93
95
@@ -98,7 +100,7 @@ Methods
98
100
99
101
|get_adc_value.png |
100
102
101
- .. method :: JoystickUnit .get_button_status()
103
+ .. method :: Joystick2Unit .get_button_status()
102
104
103
105
Read the button status of the joystick.
104
106
@@ -109,7 +111,7 @@ Methods
109
111
110
112
|get_button_status.png |
111
113
112
- .. method :: JoystickUnit .set_led_brightness(brightness)
114
+ .. method :: Joystick2Unit .set_led_brightness(brightness)
113
115
114
116
Set the brightness of the RGB LED.
115
117
@@ -120,7 +122,7 @@ Methods
120
122
121
123
|set_led_brightness.png |
122
124
123
- .. method :: JoystickUnit .fill_color(v)
125
+ .. method :: Joystick2Unit .fill_color(v)
124
126
125
127
Set the RGB LED color of the joystick.
126
128
@@ -131,7 +133,7 @@ Methods
131
133
132
134
|fill_color.png |
133
135
134
- .. method :: JoystickUnit .fill_color_rgb(r, g, b)
136
+ .. method :: Joystick2Unit .fill_color_rgb(r, g, b)
135
137
136
138
Set the RGB LED color of the joystick.
137
139
@@ -140,11 +142,8 @@ Methods
140
142
:param int g: The green value (0-255).
141
143
:param int b: The blue value (0-255).
142
144
143
- UIFLOW2:
144
-
145
- |fill_color_rgb.png |
146
145
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)
148
147
149
148
::
150
149
@@ -167,7 +166,7 @@ Methods
167
166
168
167
|set_axis_x_mapping.png |
169
168
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)
171
170
172
171
::
173
172
@@ -190,7 +189,7 @@ Methods
190
189
191
190
|set_axis_y_mapping.png |
192
191
193
- .. method :: JoystickUnit .set_deadzone_adc(x_adc_raw, y_adc_raw)
192
+ .. method :: Joystick2Unit .set_deadzone_adc(x_adc_raw, y_adc_raw)
194
193
195
194
Set the dead zone of the joystick.
196
195
@@ -202,7 +201,7 @@ Methods
202
201
203
202
|set_deadzone_adc.png |
204
203
205
- .. method :: JoystickUnit .set_deadzone_position(x_pos, y_pos)
204
+ .. method :: Joystick2Unit .set_deadzone_position(x_pos, y_pos)
206
205
207
206
Set the dead zone of the joystick.
208
207
@@ -214,7 +213,7 @@ Methods
214
213
215
214
|set_deadzone_position.png |
216
215
217
- .. method :: JoystickUnit .get_axis_position()
216
+ .. method :: Joystick2Unit .get_axis_position()
218
217
219
218
Read the position of the joystick.
220
219
@@ -225,18 +224,14 @@ Methods
225
224
226
225
|get_axis_position.png |
227
226
228
- .. method :: JoystickUnit .set_address(address)
227
+ .. method :: Joystick2Unit .set_address(address)
229
228
230
229
Set the I2C address of the Joystick Unit.
231
230
232
231
233
232
:param int address: The I2C address to set.
234
233
235
- UIFLOW2:
236
-
237
- |set_address.png |
238
-
239
- .. method :: JoystickUnit.get_firmware_version()
234
+ .. method :: Joystick2Unit.get_firmware_version()
240
235
241
236
Read the firmware version of the Joystick Unit.
242
237
@@ -247,7 +242,7 @@ Methods
247
242
248
243
|get_firmware_version.png |
249
244
250
- .. method :: JoystickUnit .get_x_raw()
245
+ .. method :: Joystick2Unit .get_x_raw()
251
246
252
247
Read the raw X-axis value of the joystick.
253
248
@@ -258,7 +253,7 @@ Methods
258
253
259
254
|get_x_raw.png |
260
255
261
- .. method :: JoystickUnit .get_y_raw()
256
+ .. method :: Joystick2Unit .get_y_raw()
262
257
263
258
Read the raw Y-axis value of the joystick.
264
259
@@ -269,7 +264,7 @@ Methods
269
264
270
265
|get_y_raw.png |
271
266
272
- .. method :: JoystickUnit .get_x_position()
267
+ .. method :: Joystick2Unit .get_x_position()
273
268
274
269
Read the X-axis position of the joystick.
275
270
@@ -280,7 +275,7 @@ Methods
280
275
281
276
|get_x_position.png |
282
277
283
- .. method :: JoystickUnit .get_y_position()
278
+ .. method :: Joystick2Unit .get_y_position()
284
279
285
280
Read the Y-axis position of the joystick.
286
281
0 commit comments