Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS4 Passthrough Add-on w/ PS5 Compatibility #457

Merged
merged 27 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
de315f8
Initial working version of PS pass-through. This will require some re…
arntsonl Aug 9, 2023
6d0d1a3
Merge branch 'OpenStickCommunity:main' into passthru
arntsonl Aug 9, 2023
0aa353b
Added missing TinyUSB library calls to pspassthrough.cpp for now
arntsonl Aug 11, 2023
4ab7761
Merge branch 'passthru' of https://github.com/arntsonl/GP2040-CE into…
arntsonl Aug 11, 2023
d51543d
Moving GPAddons over to USBAddon then running a USB Host manager to h…
arntsonl Aug 11, 2023
b46b70c
Set the PS passthrough add-on to default off
arntsonl Aug 12, 2023
a511712
Added i2c display upgrade for PS4/PS5, fixed up usb add-ons a bit, mo…
arntsonl Aug 12, 2023
7aafe0a
Extra add-ons are still causing issues in Core1. Investigate further.…
arntsonl Aug 12, 2023
64a5b47
Moving tuh_task() to core0 seems to fix all the issues i was having
arntsonl Aug 12, 2023
3b373a9
Working on Hori PS4, need to update for Magic-S Ultimate
arntsonl Aug 12, 2023
32236d1
Pulled correct interface number for tuh_hid_mount_cb() (support for n…
arntsonl Aug 13, 2023
5388646
Fixed timing issues with tuh_task, keyboard host is now working again…
arntsonl Aug 13, 2023
66997ca
Added PS Passthrough to the BoardConfig.h file
arntsonl Aug 13, 2023
0804696
Force PS4 mode to arcade stick for now, will make this a toggle switc…
arntsonl Aug 13, 2023
74e721e
Broke this as well
arntsonl Aug 13, 2023
0a0d4ad
Added proper race conditions, updated web page, updated toggle mode i…
arntsonl Aug 14, 2023
7252371
Added #define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER to board configs
arntsonl Aug 14, 2023
e592863
Fix PS4 controller type error
arntsonl Aug 14, 2023
3e84ba2
Match capitalization to WebConfig
arntsonl Aug 14, 2023
9002f67
Set "ALWAYS" vs. "LOOP" add-ons for core1
arntsonl Aug 14, 2023
3767847
Moved CPU Frequency to start of setup() and removed alarm pool as it …
arntsonl Aug 14, 2023
c8abb2a
Fixed Core0/Core1 sync issues, all usb host add-ons should live on Co…
arntsonl Aug 14, 2023
761d3b8
Might be a timing issue, but running start() in core0 causes a lock-up.
arntsonl Aug 14, 2023
2e2e49a
Missed some refactoring changes
arntsonl Aug 14, 2023
be9b1f4
Merge branch 'OpenStickCommunity:main' into passthru
arntsonl Aug 14, 2023
4941ae8
Set PS4 controller default for configs that do not have default
arntsonl Aug 14, 2023
fb4ff64
Code clean-up, more revisions after this is confirmed working
arntsonl Aug 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ src/addonmanager.cpp
src/configmanager.cpp
src/storagemanager.cpp
src/system.cpp
src/usbhostmanager.cpp
src/config_legacy.cpp
src/config_utils.cpp
src/configs/webconfig.cpp
Expand All @@ -143,6 +144,7 @@ src/addons/neopicoleds.cpp
src/addons/playernum.cpp
src/addons/playerleds.cpp
src/addons/ps4mode.cpp
src/addons/pspassthrough.cpp
src/addons/reverse.cpp
src/addons/turbo.cpp
src/addons/slider_socd.cpp
Expand Down
2 changes: 2 additions & 0 deletions configs/AlpacaOwO/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
#define DEFAULT_INPUT_MODE INPUT_MODE_XINPUT //INPUT_MODE_XINPUT (XInput), INPUT_MODE_SWITCH (Nintendo Switch), INPUT_MODE_HID (D-Input), INPUT_MODE_KEYBOARD (Keyboard)
#define DEFAULT_DPAD_MODE DPAD_MODE_DIGITAL //DPAD_MODE_DIGITAL, DPAD_MODE_LEFT_ANALOG, DPAD_MODE_RIGHT_ANALOG,

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/BentoBox/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/DURAL/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/FightboardV3/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/FightboardV3Mirrored/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/FlatboxRev4/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/FlatboxRev5/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/FlatboxRev5RGB/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/KB2040/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
#define DEFAULT_INPUT_MODE INPUT_MODE_XINPUT //INPUT_MODE_XINPUT (XInput), INPUT_MODE_SWITCH (Nintendo Switch), INPUT_MODE_HID (D-Input), INPUT_MODE_KEYBOARD (Keyboard)
#define DEFAULT_DPAD_MODE DPAD_MODE_DIGITAL //DPAD_MODE_DIGITAL, DPAD_MODE_LEFT_ANALOG, DPAD_MODE_RIGHT_ANALOG,

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF
#define DEFAULT_LOCK_HOTKEYS false// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
Expand Down
2 changes: 2 additions & 0 deletions configs/KeyboardConverter/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/MavercadeKeebfighter/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
7 changes: 7 additions & 0 deletions configs/Pico/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
#define DEFAULT_INPUT_MODE INPUT_MODE_XINPUT //INPUT_MODE_XINPUT (XInput), INPUT_MODE_SWITCH (Nintendo Switch), INPUT_MODE_HID (D-Input), INPUT_MODE_KEYBOARD (Keyboard)
#define DEFAULT_DPAD_MODE DPAD_MODE_DIGITAL //DPAD_MODE_DIGITAL, DPAD_MODE_LEFT_ANALOG, DPAD_MODE_RIGHT_ANALOG,

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down Expand Up @@ -296,6 +298,11 @@
#define KEYBOARD_HOST_PIN_DPLUS -1
#define KEYBOARD_HOST_PIN_5V -1

// PS Passthrough Host Addon defaults
#define PSPASSTHROUGH_HOST_ENABLED 0
#define PSPASSTHROUGH_HOST_PIN_DPLUS -1
#define PSPASSTHROUGH_HOST_PIN_5V -1

// For details on this, see: https://gp2040-ce.info/#/development?id=i2c-display-splash
#define DEFAULT_SPLASH \
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
Expand Down
2 changes: 2 additions & 0 deletions configs/PicoAnn/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/PicoFightingBoard/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/RP2040AdvancedBreakoutBoard/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/RP2040MiniBreakoutBoard/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/ReflexEncoder/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
1 change: 1 addition & 0 deletions configs/SGFDevices/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
Expand Down
3 changes: 3 additions & 0 deletions configs/SparkFunProMicro/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@

#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/Stress/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
2 changes: 2 additions & 0 deletions configs/WaveshareZero/BoardConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
#define DEFAULT_FORCED_SETUP_MODE FORCED_SETUP_MODE_OFF // FORCED_SETUP_MODE_OFF, FORCED_SETUP_MODE_LOCK_MODE_SWITCH, FORCED_SETUP_MODE_LOCK_WEB_CONFIG, FORCED_SETUP_MODE_LOCK_BOTH
#define DEFAULT_LOCK_HOTKEYS false // or true

#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER

// This is the LEDs section.
// The default `TURBO_LED_PIN` pin is set to `15` ( it is recommended to run through 3V3(OUT) with a resistor)
// The Turbo LED will flash at a speed consistant with the set speed of the Turbo when a Turbo button is active.
Expand Down
3 changes: 3 additions & 0 deletions headers/addonmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
#define _ADDONMANAGER_H_

#include "gpaddon.h"
#include "usbaddon.h"

#include <vector>
#include <pico/mutex.h>

enum ADDON_PROCESS {
CORE0_INPUT,
CORE0_USBREPORT,
CORE1_ALWAYS,
CORE1_LOOP
};

Expand All @@ -22,6 +24,7 @@ class AddonManager {
AddonManager() {}
~AddonManager() {}
void LoadAddon(GPAddon*, ADDON_PROCESS);
void LoadUSBAddon(USBAddon*, ADDON_PROCESS);
void PreprocessAddons(ADDON_PROCESS);
void ProcessAddons(ADDON_PROCESS);
GPAddon * GetAddon(std::string); // hack for NeoPicoLED
Expand Down
46 changes: 37 additions & 9 deletions headers/addons/keyboard_host.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _KeyboardHost_H
#define _KeyboardHost_H

#include "gpaddon.h"
#include "usbaddon.h"
#include "gamepad.h"

#ifndef KEYBOARD_HOST_ENABLED
Expand All @@ -21,12 +21,12 @@

struct KeyboardButtonMapping
{
KeyboardButtonMapping(uint16_t bm) :
buttonMask(bm)
{}

uint8_t key;
const uint16_t buttonMask;
uint16_t buttonMask;

inline void setMask(uint16_t m) {
buttonMask = m;
}

inline void setKey(uint8_t p)
{
Expand All @@ -36,14 +36,42 @@ struct KeyboardButtonMapping
bool isAssigned() const { return key != 0xff; }
};

class KeyboardHostAddon : public GPAddon {
class KeyboardHostAddon : public USBAddon {
public:
virtual bool available();
virtual void setup(); // KeyboardHost Setup
virtual void process() {} // KeyboardHost Process
virtual void process() {} // KeyboardHost Process
virtual void preprocess();
virtual std::string name() { return KeyboardHostName; }
private:
// USB Add-on Features
virtual void mount(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len);
virtual void unmount(uint8_t dev_addr);
virtual void report_received(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len);
virtual void set_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) {}
virtual void get_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) {}
private:
bool _keyboard_host_enabled;
uint8_t getKeycodeFromModifier(uint8_t modifier);
void process_kbd_report(uint8_t dev_addr, hid_keyboard_report_t const *report);
GamepadState _keyboard_host_state;
KeyboardButtonMapping _keyboard_host_mapDpadUp;
KeyboardButtonMapping _keyboard_host_mapDpadDown;
KeyboardButtonMapping _keyboard_host_mapDpadLeft;
KeyboardButtonMapping _keyboard_host_mapDpadRight;
KeyboardButtonMapping _keyboard_host_mapButtonB1;
KeyboardButtonMapping _keyboard_host_mapButtonB2;
KeyboardButtonMapping _keyboard_host_mapButtonB3;
KeyboardButtonMapping _keyboard_host_mapButtonB4;
KeyboardButtonMapping _keyboard_host_mapButtonL1;
KeyboardButtonMapping _keyboard_host_mapButtonR1;
KeyboardButtonMapping _keyboard_host_mapButtonL2;
KeyboardButtonMapping _keyboard_host_mapButtonR2;
KeyboardButtonMapping _keyboard_host_mapButtonS1;
KeyboardButtonMapping _keyboard_host_mapButtonS2;
KeyboardButtonMapping _keyboard_host_mapButtonL3;
KeyboardButtonMapping _keyboard_host_mapButtonR3;
KeyboardButtonMapping _keyboard_host_mapButtonA1;
KeyboardButtonMapping _keyboard_host_mapButtonA2;
};

#endif // _KeyboardHost_H_
46 changes: 46 additions & 0 deletions headers/addons/pspassthrough.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef _PSPassthrough_H
#define _PSPassthrough_H

#include "usbaddon.h"

#include "ps4_driver.h"

#ifndef PSPASSTHROUGH_ENABLED
#define PSPASSTHROUGH_ENABLED 0
#endif

#ifndef PPSPASSTHROUGH_PIN_DPLUS
#define PSPASSTHROUGH_PIN_DPLUS -1
#endif

#ifndef PSPASSTHROUGH_PIN_5V
#define PSPASSTHROUGH_PIN_5V -1
#endif

// KeyboardHost Module Name
#define PSPassthroughName "PSPassthrough"

class PSPassthroughAddon : public USBAddon {
public:
virtual bool available();
virtual void setup(); // PSPassthrough Setup
virtual void process(); // PSPassthrough Process
virtual void preprocess() {}
virtual std::string name() { return PSPassthroughName; }
// USB Add-on Features
virtual void mount(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len);
virtual void unmount(uint8_t dev_addr);
virtual void set_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len);
virtual void get_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len);
virtual void report_received(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) {}
private:
uint8_t ps_dev_addr;
uint8_t ps_instance;
int8_t nonce_page;
PS4State passthrough_state;
int8_t send_nonce_part;
uint8_t report_buffer[64];
bool awaiting_cb;
};

#endif // _PSPassthrough_H_
4 changes: 4 additions & 0 deletions headers/gamepad/GamepadConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#define DEFAULT_INPUT_MODE INPUT_MODE_XINPUT
#endif

#ifndef DEFAULT_PS4CONTROLLER_TYPE
#define DEFAULT_PS4CONTROLLER_TYPE PS4_CONTROLLER
#endif

/* hotkeys */
#ifndef HOTKEY_01_AUX_MASK
#define HOTKEY_01_AUX_MASK 0
Expand Down
23 changes: 23 additions & 0 deletions headers/usbaddon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef _USBAddon_H_
#define _USBAddon_H_

#include "gpaddon.h"

#include <string>

class USBAddon : public GPAddon
{
public:
virtual bool available() = 0;
virtual void setup() = 0;
virtual void process() = 0;
virtual void preprocess() = 0;
virtual std::string name() = 0;
virtual void mount(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len) = 0;
virtual void unmount(uint8_t dev_addr) = 0;
virtual void report_received(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len) = 0;
virtual void set_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) = 0;
virtual void get_report_complete(uint8_t dev_addr, uint8_t instance, uint8_t report_id, uint8_t report_type, uint16_t len) = 0;
};

#endif
Loading