![]() |
MatrixMiniR4 1.1.5
Matrix Mini R4 Arduino Library API Documentation
|
Class to interface with the MJ2 or PS2 controller. More...
#include <MiniR4PS2X_lib.h>
Public Member Functions | |
boolean | Button (uint16_t) |
Checks if a button is currently pressed. | |
unsigned int | ButtonDataByte () |
Reads the button data byte. | |
boolean | NewButtonState () |
Checks for new button state. | |
boolean | NewButtonState (unsigned int) |
Checks for new button state for a specific button. | |
boolean | ButtonPressed (unsigned int) |
Checks if a button was just pressed. | |
boolean | ButtonReleased (unsigned int) |
Checks if a button was just released. | |
void | read_gamepad () |
Reads the gamepad state. | |
boolean | read_gamepad (boolean, byte) |
Reads the gamepad state with options. | |
byte | readType () |
Returns the controller type. | |
byte | config_gamepad (uint8_t, uint8_t, uint8_t, uint8_t) |
Configures the gamepad. | |
byte | config_gamepad (uint8_t, uint8_t, uint8_t, uint8_t, bool, bool) |
Configures the gamepad with additional options. | |
void | enableRumble () |
Enables rumble functionality on the controller. | |
bool | enablePressures () |
Enables pressure sensitivity on the controller. | |
byte | Analog (byte) |
Reads the analog value from the specified analog stick. | |
void | reconfig_gamepad () |
Reconfigures the gamepad. | |
Class to interface with the MJ2 or PS2 controller.
Once you call MiniR4.begin(), PS2X will auto begin. Note: Please Connect 4p wire to D2 (Left: DAT, Right: CMD, V, G), 2p wire to D3 (Left: CSS/SET, Right: CLK)
This class provides methods to read button states, configure the controller, and handle analog inputs.
Definition at line 180 of file MiniR4PS2X_lib.h.
byte PS2X::Analog | ( | byte | button | ) |
Reads the analog value from the specified analog stick.
stick | The analog stick identifier. |
Definition at line 62 of file MiniR4PS2X_lib.cpp.
boolean PS2X::Button | ( | uint16_t | button | ) |
Checks if a button is currently pressed.
button | The button constant to check. |
Definition at line 50 of file MiniR4PS2X_lib.cpp.
unsigned int PS2X::ButtonDataByte | ( | ) |
Reads the button data byte.
Definition at line 56 of file MiniR4PS2X_lib.cpp.
boolean PS2X::ButtonPressed | ( | unsigned int | button | ) |
Checks if a button was just pressed.
button | The button constant to check. |
Definition at line 38 of file MiniR4PS2X_lib.cpp.
boolean PS2X::ButtonReleased | ( | unsigned int | button | ) |
Checks if a button was just released.
button | The button constant to check. |
Definition at line 44 of file MiniR4PS2X_lib.cpp.
byte PS2X::config_gamepad | ( | uint8_t | clk, |
uint8_t | cmd, | ||
uint8_t | att, | ||
uint8_t | dat ) |
Configures the gamepad.
clk | Pin for clock. |
cmd | Pin for command. |
att | Pin for attention. |
dat | Pin for data. |
Definition at line 178 of file MiniR4PS2X_lib.cpp.
byte PS2X::config_gamepad | ( | uint8_t | clk, |
uint8_t | cmd, | ||
uint8_t | att, | ||
uint8_t | dat, | ||
bool | pressures, | ||
bool | rumble ) |
Configures the gamepad with additional options.
clk | Pin for clock. |
cmd | Pin for command. |
att | Pin for attention. |
dat | Pin for data. |
pressures | Enable pressure sensitivity. (MJ2 not avaiable) |
rumble | Enable rumble functionality. (MJ2 not avaiable) |
Definition at line 184 of file MiniR4PS2X_lib.cpp.
bool PS2X::enablePressures | ( | ) |
Enables pressure sensitivity on the controller.
Definition at line 360 of file MiniR4PS2X_lib.cpp.
void PS2X::enableRumble | ( | ) |
Enables rumble functionality on the controller.
Definition at line 351 of file MiniR4PS2X_lib.cpp.
boolean PS2X::NewButtonState | ( | ) |
Checks for new button state.
Definition at line 26 of file MiniR4PS2X_lib.cpp.
boolean PS2X::NewButtonState | ( | unsigned int | button | ) |
Checks for new button state for a specific button.
button | The button constant to check. |
Definition at line 32 of file MiniR4PS2X_lib.cpp.
void PS2X::read_gamepad | ( | ) |
Reads the gamepad state.
Definition at line 94 of file MiniR4PS2X_lib.cpp.
boolean PS2X::read_gamepad | ( | boolean | motor1, |
byte | motor2 ) |
Reads the gamepad state with options.
motor1 | Motor1. |
motor2 | Motor2. |
Definition at line 100 of file MiniR4PS2X_lib.cpp.
byte PS2X::readType | ( | ) |
Returns the controller type.
Definition at line 308 of file MiniR4PS2X_lib.cpp.
void PS2X::reconfig_gamepad | ( | ) |
Reconfigures the gamepad.
Definition at line 376 of file MiniR4PS2X_lib.cpp.