Skip to content

Commit 31a7ac0

Browse files
update for hid/ble
1 parent d359a9c commit 31a7ac0

File tree

2 files changed

+55
-56
lines changed

2 files changed

+55
-56
lines changed

docs/source/ria.rst

Lines changed: 37 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,12 @@ mouse input.
374374
375375
The amount of movement is computed by keeping track of the previous values
376376
and subtracting from the current value. Vsync timing (60Hz) isn't always
377-
fast enough. For perfect mouse input with fast mice, use an ISR at 8ms or
378-
faster (125Hz).
377+
fast enough. For perfect mouse input, use an ISR at 8ms or faster (125Hz).
378+
379+
It is recommended that applications consider the canvas resolution when
380+
interpreting the movement. For 640x480 and 640x360 resolutions, each unit
381+
of movement equates to one pixel. For 320x240 and 320x180 resolutions, two
382+
units of movement for each pixel.
379383

380384
.. code-block:: C
381385
@@ -392,28 +396,24 @@ faster (125Hz).
392396
6. Gamepads
393397
===========
394398

395-
The RIA supports up to four gamepads connected via USB. There is no way to
396-
support all controllers without writing three different classes of drivers:
397-
XInput, Sony, and HID. So that's what's in the RIA. Even so, there is no
398-
standard button layout for HID so ``des.c`` will need to be adjusted to
399-
support new gamepads.
400-
401-
Therefore, the recommended gamepads for the Picocomputer are: Xbox 360, Xbox
402-
One/Series, DualShock 4, and DualSense 5. There are plenty of third-party
403-
Xbox and PlayStation controllers which should work fine as well.
404-
405-
If your HID or third-party gamepad doesn't work, it probably needs to be
406-
added to ``des.c``. Any issues submitted in this regard cannot be resolved
407-
by Rumbledethumps—who doesn't have your gamepad. The community needs to
408-
step up here if excellent third-party and HID controller support is
409-
desired.
410-
411-
Be aware that this project pushes TinyUSB to its limit. Okay, let's be
412-
frank here: the TinyUSB stack is janky as hell and doesn't have any
413-
documentation. If you do a lot of plugging and unplugging it will
414-
eventually crash. Some devices will also break the boot sequence. Any
415-
issues submitted in this regard cannot be resolved by Rumbledethumps. The
416-
community needs to step up here if an excellent USB stack is desired.
399+
The RIA supports up to four gamepads. Generic HID, XInput, and Playstation
400+
controllers all work. Unfortunately, the TinyUSB stack that the RIA uses
401+
is unstable on the Pi Pico and not likely to get fixed. A new stack called
402+
CherryUSB is in the pipeline. In the meantime, Bluetooth is stable so get
403+
a BLE gamepad if you end up buying a new one. Some gamepads let you select
404+
between HID/DInput/Android and XInput. The XInput driver is more unstable
405+
that the HID driver, but try both.
406+
407+
Modern gamepads all have evolved to the same four buttons and two sticks
408+
design with some minor variations in the face buttons which are either
409+
XY/AB, YX/BA, or Square/Triangle/Cross/Circle. This is generally of no
410+
consequence to the application unless those buttons are intended to
411+
represent a direction. In that case, the Square/Triangle/Cross/Circle and
412+
XY/AB layouts are "the official" layout of the RP6502. You can, of course,
413+
do your own thing and request players use a specific gamepad.
414+
415+
Be aware that some gamepads will attempt to charge over USB. You can use
416+
a powered USB hub if needed.
417417

418418
Enable and disable access to the RIA gamepad XRAM registers by setting the
419419
extended register. The register value is the XRAM start address of the
@@ -438,24 +438,12 @@ Note that there are both digital and analog values for the left and right
438438
analog sticks and analog triggers L2/R2. This lets an application
439439
completely ignore the analog values if it desires.
440440

441-
Applications that want to use a simple "one stick and buttons" approach
442-
are encouraged to support both the dpad and left stick (merged). This is
443-
because gamepads without analog sticks usually present their direction
444-
pad as an emulated left analog stick. It also gives players using modern
445-
gamepads the option of using the dpad or analog stick.
446-
447441
Applications supporting L2 and R2 should be aware that some gamepads
448442
will only present digital information so the analog values will only
449-
ever be 0 or 255. This is seen on 8BitDo controllers in Dinput mode—
450-
see your controller's manual to learn how to switch to Xinput mode which
451-
will give you the analog information.
443+
ever be 0 or 255.
452444

453-
Note that the DPAD and STICKS registers are 8-way. You wouldn't see a
454-
4-way joystick on an early home computer unless it was custom made.
455-
Some games, like Pac-Man and Donkey Kong, are well known for using
456-
4-way joysticks. It's easy to decode the analog stick values into
457-
quadrants using only the 8-bit adder of a 6502, so go ahead and port
458-
your favorite 4-way game without worry.
445+
Applications that want to use a simple "one stick and buttons" approach
446+
are encouraged to support both the dpad and left stick (merged).
459447

460448
.. list-table::
461449
:widths: 1 1 20
@@ -491,22 +479,22 @@ your favorite 4-way game without worry.
491479
-
492480
* bit 0: A or Cross
493481
* bit 1: B or Circle
494-
* bit 2: X or Square
495-
* bit 3: Y or Triangle
496-
* bit 4: L1
497-
* bit 5: R1
498-
* bit 6: Select/Back
499-
* bit 7: Start/Menu
482+
* bit 2: C or Right Paddle
483+
* bit 3: X or Square
484+
* bit 4: Y or Triangle
485+
* bit 5: Z or Left Paddle
486+
* bit 6: L1
487+
* bit 7: R1
500488
* - 3
501489
- BTN1
502490
-
503491
* bit 0: L2
504492
* bit 1: R2
505-
* bit 2: L3
506-
* bit 3: R3
493+
* bit 2: Select/Back
494+
* bit 3: Start/Menu
507495
* bit 4: Home button
508-
* bit 5: Undefined
509-
* bit 6: Undefined
496+
* bit 5: L3
497+
* bit 6: R3
510498
* bit 7: Undefined
511499
* - 4
512500
- LX

docs/source/ria_w.rst

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,24 @@ Example AT commands:
7474

7575
A full telnet stack has yet to be written so all connections are raw TCP.
7676

77-
"Telephone Numbers" are saved immadiately and are not linked to profiles.
77+
"Telephone Numbers" are saved immediately and are not linked to profiles.
7878

7979
`Please contribute to this documentation. <https://github.com/picocomputer/picocomputer.github.io>`_
8080

81-
5. Additional Resources
82-
=======================
83-
84-
- :doc:`RIA Interface Adapter <ria>`
85-
- :doc:`API for 6502 Programming <api>`
86-
- :doc:`Schematic, PCB, and Case Files <hardware>`
81+
5. Bluetooth
82+
============
83+
84+
The RIA W supports Bluetooth LE (BLE) keyboards, mice, and gamepads.
85+
It does not support the older Bluetooth Classic aka BR/EDR.
86+
The RIA W uses BTStack which can only support one Bluetooth Classic device
87+
at a time so it's not worth the memory.
88+
BLE was introduced in June 2010 with Bluetooth 4.0 so it's not difficult
89+
to find devices but you will find an occassional oddball. Of particular
90+
note are Sony DualShock and DualSense controllers - which you can use on
91+
USB instead.
92+
93+
To add a new device, use monitor command ``set ble 2`` to enable pairing
94+
mode. The LED on the RIA W will blink when in pairing mode. See your device's
95+
manual to enable its pairing mode - probably a button and more blinking.
96+
When the blinking stops, the device is connected and will be remembered
97+
(bonded) so it reconnects automatically in the future.

0 commit comments

Comments
 (0)