├── .gitignore ├── GP2040-CE ├── .editorconfig ├── .github │ └── workflows │ │ ├── cmake.yml │ │ └── node.js.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── README.md ├── configs │ ├── BentoBox │ │ ├── BoardConfig.h │ │ └── env.ini │ ├── CMakeLists.txt │ ├── DURAL │ │ ├── BoardConfig.h │ │ ├── README.md │ │ ├── assets │ │ │ └── DURAL.jpg │ │ └── env.ini │ ├── FightboardV3 │ │ ├── BoardConfig.h │ │ ├── README.md │ │ └── assets │ │ │ └── FightboardV3.jpg │ ├── FightboardV3Mirrored │ │ ├── BoardConfig.h │ │ ├── README.md │ │ └── assets │ │ │ └── FightboardV3Mirrored.jpg │ ├── FlatboxRev4 │ │ ├── BoardConfig.h │ │ ├── Readme.md │ │ ├── assets │ │ │ ├── ButtonMapping.kra │ │ │ ├── ButtonMapping.png │ │ │ └── Flatbox-rev2b-finished-product.jpg │ │ ├── env.ini │ │ └── flatboxrev4.h │ ├── FlatboxRev5 │ │ ├── BoardConfig.h │ │ ├── Readme.md │ │ ├── assets │ │ │ └── Flatbox-rev5.jpg │ │ ├── env.ini │ │ └── flatboxrev5.h │ ├── MavercadeKeebfighter │ │ ├── BoardConfig.h │ │ ├── MavercadeKeebfighter.h │ │ ├── Readme.md │ │ └── assets │ │ │ ├── Mavercade-logo.png │ │ │ ├── keebfighter-00.png │ │ │ ├── keebfighter-01.png │ │ │ └── keebfighter-02.png │ ├── Pico │ │ ├── BoardConfig.h │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ └── assets │ │ │ ├── PinMapping.png │ │ │ └── PinMapping.xcf │ ├── PicoAnn │ │ ├── BoardConfig.h │ │ ├── README.md │ │ ├── assets │ │ │ └── PinMapping_PicoAnn.png │ │ └── env.ini │ ├── PicoFightingBoard │ │ ├── BoardConfig.h │ │ ├── README.md │ │ └── assets │ │ │ ├── PicoFightingBoard_v1.1.jpg │ │ │ ├── PinMapping.png │ │ │ └── PinMapping.xcf │ ├── RP2040AdvancedBreakoutBoard │ │ ├── BoardConfig.h │ │ ├── README.md │ │ ├── RP2040AdvancedBreakoutBoard.h │ │ ├── assets │ │ │ ├── RP2040AdvancedBreakoutBoard.jpg │ │ │ └── RP2040AdvancedBreakoutBoard_pinout.png │ │ └── env.ini │ ├── ReflexEncoder │ │ ├── BoardConfig.h │ │ ├── README.md │ │ └── assets │ │ │ └── ReflexBoard_v1.2.jpeg │ ├── SparkFunProMicro │ │ ├── BoardConfig.h │ │ ├── README.md │ │ ├── assets │ │ │ └── SparkFunProMicroRP2040.png │ │ └── env.ini │ └── WaveshareZero │ │ ├── BoardConfig.h │ │ ├── README.md │ │ ├── WaveshareRP2040Zero.png │ │ ├── assets │ │ └── WaveshareRP2040Zero.png │ │ ├── env.ini │ │ └── wavesharezero.h ├── docs │ ├── .nojekyll │ ├── CNAME │ ├── _sidebar.md │ ├── assets │ │ ├── boards │ │ │ ├── BentoBox.jpg │ │ │ ├── DURAL.jpg │ │ │ ├── FightboardV3.jpg │ │ │ ├── FlatboxRev4.jpg │ │ │ ├── FlatboxRev4.png │ │ │ ├── FlatboxRev5.jpg │ │ │ ├── MavercadeKeebfighter.jpg │ │ │ ├── Pico.jpg │ │ │ ├── PicoFightingBoard.jpg │ │ │ ├── RP2040AdvancedBreakoutBoard.jpg │ │ │ ├── ReflexEncoder.jpg │ │ │ ├── SparkFunProMicro.jpg │ │ │ └── WaveshareZero.jpg │ │ ├── images │ │ │ ├── GP2040-PFB-demo-1.jpg │ │ │ ├── GP2040-PFB-demo-2.jpg │ │ │ ├── community-splash-screens │ │ │ │ ├── BentoBox.png │ │ │ │ ├── Crush Counter v2.0.png │ │ │ │ ├── GP2040-CE 1.png │ │ │ │ ├── GP2040-CE 2.png │ │ │ │ ├── GP2040-CE 3.png │ │ │ │ ├── GP2040-CE 4.png │ │ │ │ ├── GP2040-CE 5.png │ │ │ │ ├── GP2040-CE 6.png │ │ │ │ ├── GP2040-CE 7.png │ │ │ │ ├── Sega Astro City.png │ │ │ │ ├── Street Fighter.png │ │ │ │ └── TheTrain Logo.png │ │ │ ├── gcp-display-config.png │ │ │ ├── github-sponsor-dark.png │ │ │ ├── github-sponsor-dimmed.png │ │ │ ├── github-sponsor-light.png │ │ │ ├── gp2040-ce-logo.png │ │ │ ├── gpc-add-ons-ads1219.png │ │ │ ├── gpc-add-ons-analog.png │ │ │ ├── gpc-add-ons-bootsel-button.png │ │ │ ├── gpc-add-ons-buzzer.png │ │ │ ├── gpc-add-ons-dual-directional.png │ │ │ ├── gpc-add-ons-extra-button.png │ │ │ ├── gpc-add-ons-input-reverse.png │ │ │ ├── gpc-add-ons-joystick-slider.png │ │ │ ├── gpc-add-ons-onboard-led.png │ │ │ ├── gpc-add-ons-player-number.png │ │ │ ├── gpc-add-ons-ps4-mode.png │ │ │ ├── gpc-add-ons-socd-slider.png │ │ │ ├── gpc-add-ons-turbo-shmup.png │ │ │ ├── gpc-add-ons-turbo.png │ │ │ ├── gpc-add-ons-wii-extensions.png │ │ │ ├── gpc-backup-and-restore.png │ │ │ ├── gpc-display-config.png │ │ │ ├── gpc-home.png │ │ │ ├── gpc-label-selection.png │ │ │ ├── gpc-pin-mapping.png │ │ │ ├── gpc-reset-settings.png │ │ │ ├── gpc-rgb-led-config.png │ │ │ ├── gpc-rgb-led-custom-theme.png │ │ │ ├── gpc-settings.png │ │ │ └── led-themes │ │ │ │ ├── _base-template.xcf │ │ │ │ ├── fightboard.png │ │ │ │ ├── guilty-gear-type-a.png │ │ │ │ ├── guilty-gear-type-b.png │ │ │ │ ├── guilty-gear-type-c.png │ │ │ │ ├── guilty-gear-type-d.png │ │ │ │ ├── guilty-gear-type-e.png │ │ │ │ ├── neogeo-curved.png │ │ │ │ ├── neogeo-modern.png │ │ │ │ ├── neogeo-straight.png │ │ │ │ ├── playstation-all.png │ │ │ │ ├── playstation.png │ │ │ │ ├── six-button-fighter-plus.png │ │ │ │ ├── six-button-fighter.png │ │ │ │ ├── static-rainbow.png │ │ │ │ ├── street-fighter-2.png │ │ │ │ ├── super-famicom-all.png │ │ │ │ ├── super-famicom.png │ │ │ │ ├── tekken.png │ │ │ │ ├── xbox-all.png │ │ │ │ └── xbox.png │ │ └── wiring │ │ │ ├── RaspberryPiPico_Pinout.png │ │ │ ├── SparkFunProMicroRP2040_Pinout.png │ │ │ └── WaveshareRP2040Zero_Pinout.png │ ├── community-splash-screens.md │ ├── development.md │ ├── download.md │ ├── downloads │ │ └── flash_nuke.uf2 │ ├── faq.md │ ├── favicon.ico │ ├── gp2040-shortcuts.md │ ├── index.html │ ├── installation.md │ ├── package-lock.json │ ├── package.json │ ├── site.css │ ├── usage.md │ ├── web-configurator.md │ └── wiring.md ├── headers │ ├── addonmanager.h │ ├── addons │ │ ├── analog.h │ │ ├── board_led.h │ │ ├── bootsel_button.h │ │ ├── buzzerspeaker.h │ │ ├── dualdirectional.h │ │ ├── extra_button.h │ │ ├── i2canalog1219.h │ │ ├── i2cdisplay.h │ │ ├── jslider.h │ │ ├── neopicoleds.h │ │ ├── playernum.h │ │ ├── pleds.h │ │ ├── ps4mode.h │ │ ├── reverse.h │ │ ├── slider_socd.h │ │ ├── turbo.h │ │ └── wiiext.h │ ├── bitmaps.h │ ├── configmanager.h │ ├── configs │ │ ├── base64.h │ │ ├── displayconfig.h │ │ ├── serialconfig.h │ │ └── webconfig.h │ ├── enums.h │ ├── gamepad.h │ ├── gamepad │ │ ├── GamepadConfig.h │ │ ├── GamepadDebouncer.h │ │ ├── GamepadDescriptors.h │ │ ├── GamepadEnums.h │ │ ├── GamepadOptions.h │ │ ├── GamepadState.h │ │ ├── GamepadStorage.h │ │ └── descriptors │ │ │ ├── HIDDescriptors.h │ │ │ ├── KeyboardDescriptors.h │ │ │ ├── MouseDescriptors.h │ │ │ ├── PS4Descriptors.h │ │ │ ├── SwitchDescriptors.h │ │ │ └── XInputDescriptors.h │ ├── gba │ │ ├── GBAKey.h │ │ ├── multiboot.h │ │ └── spi32.h │ ├── gp2040.h │ ├── gp2040aux.h │ ├── gpaddon.h │ ├── gpconfig.h │ ├── helper.h │ ├── mbedtls_config.h │ ├── songs.h │ ├── storagemanager.h │ ├── system.h │ ├── themes.h │ └── tusb_config.h ├── lib │ ├── ADS1219 │ │ ├── ADS1219.cpp │ │ ├── ADS1219.h │ │ ├── CMakeLists.txt │ │ └── README.md │ ├── AnimationStation │ │ ├── .editorconfig │ │ ├── CMakeLists.txt │ │ ├── library.json │ │ └── src │ │ │ ├── Animation.cpp │ │ │ ├── Animation.hpp │ │ │ ├── AnimationStation.cpp │ │ │ ├── AnimationStation.hpp │ │ │ ├── AnimationStorage.hpp │ │ │ ├── Effects │ │ │ ├── Chase.cpp │ │ │ ├── Chase.hpp │ │ │ ├── CustomTheme.cpp │ │ │ ├── CustomTheme.hpp │ │ │ ├── CustomThemePressed.cpp │ │ │ ├── CustomThemePressed.hpp │ │ │ ├── Rainbow.cpp │ │ │ ├── Rainbow.hpp │ │ │ ├── StaticColor.cpp │ │ │ ├── StaticColor.hpp │ │ │ ├── StaticTheme.cpp │ │ │ └── StaticTheme.hpp │ │ │ └── Pixel.hpp │ ├── BitBang_I2C │ │ ├── BitBang_I2C.c │ │ ├── BitBang_I2C.h │ │ ├── CMakeLists.txt │ │ └── README.md │ ├── CMakeLists.txt │ ├── CRC32 │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── CRC32.cpp │ │ │ └── CRC32.h │ ├── FlashPROM │ │ ├── CMakeLists.txt │ │ ├── library.json │ │ └── src │ │ │ ├── FlashPROM.cpp │ │ │ └── FlashPROM.h │ ├── NeoPico │ │ ├── .editorconfig │ │ ├── CMakeLists.txt │ │ ├── library.json │ │ └── src │ │ │ ├── NeoPico.cpp │ │ │ ├── NeoPico.hpp │ │ │ ├── generated │ │ │ └── ws2812.pio.h │ │ │ └── ws2812.pio │ ├── OneBitDisplay │ │ ├── CMakeLists.txt │ │ ├── OneBitDisplay.cpp │ │ ├── OneBitDisplay.h │ │ ├── README.md │ │ ├── fonts │ │ │ └── FreeSerif12pt7b.h │ │ └── obd.inl │ ├── PlayerLEDs │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── PlayerLEDs.cpp │ │ │ └── PlayerLEDs.h │ ├── TinyUSB_Gamepad │ │ ├── CMakeLists.txt │ │ ├── library.json │ │ └── src │ │ │ ├── hid_driver.cpp │ │ │ ├── hid_driver.h │ │ │ ├── net_driver.cpp │ │ │ ├── net_driver.h │ │ │ ├── ps4_driver.cpp │ │ │ ├── ps4_driver.h │ │ │ ├── tusb_driver.cpp │ │ │ ├── usb_descriptors.cpp │ │ │ ├── usb_driver.h │ │ │ ├── webserver_descriptors.h │ │ │ ├── xinput_driver.cpp │ │ │ └── xinput_driver.h │ ├── WiiExtension │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── WiiExtension.cpp │ │ └── WiiExtension.h │ ├── httpd │ │ ├── CMakeLists.txt │ │ ├── fs.c │ │ ├── fs.h │ │ ├── fscustom.h │ │ ├── fsdata.c │ │ └── fsdata.h │ ├── lwip-port │ │ ├── CMakeLists.txt │ │ ├── arch │ │ │ └── cc.h │ │ └── lwipopts.h │ └── rndis │ │ ├── CMakeLists.txt │ │ ├── rndis.c │ │ └── rndis.h ├── modules │ ├── FindNPM.cmake │ └── FindNodeJS.cmake ├── pico_sdk_import.cmake ├── src │ ├── addonmanager.cpp │ ├── addons │ │ ├── analog.cpp │ │ ├── board_led.cpp │ │ ├── bootsel_button.cpp │ │ ├── buzzerspeaker.cpp │ │ ├── dualdirectional.cpp │ │ ├── extra_button.cpp │ │ ├── i2canalog1219.cpp │ │ ├── i2cdisplay.cpp │ │ ├── jslider.cpp │ │ ├── neopicoleds.cpp │ │ ├── playerleds.cpp │ │ ├── playernum.cpp │ │ ├── ps4mode.cpp │ │ ├── reverse.cpp │ │ ├── slider_socd.cpp │ │ ├── turbo.cpp │ │ └── wiiext.cpp │ ├── configmanager.cpp │ ├── configs │ │ └── webconfig.cpp │ ├── gamepad.cpp │ ├── gamepad │ │ ├── GamepadDebouncer.cpp │ │ └── GamepadDescriptors.cpp │ ├── gba │ │ ├── multiboot.cpp │ │ └── spi32.cpp │ ├── gp2040.cpp │ ├── gp2040aux.cpp │ ├── main.cpp │ ├── storagemanager.cpp │ └── system.cpp └── tools │ ├── linux_compile_makefsdata.sh │ ├── makefsdata │ ├── makefsdata.darwin │ └── makefsdata.exe ├── README.md ├── build.sh └── gba-link-connection ├── .gitignore ├── .licenses ├── libgba-sprite-engine.txt ├── libtonc.txt └── libugba.txt ├── LICENSE ├── README.md ├── docs ├── gbatek.md ├── img │ ├── 0x10.png │ ├── 0x11.png │ ├── 0x16.png │ ├── 0x17.png │ ├── 0x1d.png │ ├── 0x1f.png │ ├── 0x20.png │ ├── 0x21.png │ ├── 0x25.png │ ├── 0x26.png │ ├── 0x27.png │ ├── 0x30.png │ ├── broadcast.png │ ├── first_nintendo_32.png │ ├── first_single_u32.png │ ├── full_initialisation.png │ ├── init.png │ ├── logic2.png │ ├── multiboot.jpg │ ├── wake-up.png │ └── wirelessadapter.jpg ├── multiboot.md ├── wireless.txt └── wireless_adapter.md ├── examples ├── LinkCableMultiboot_demo │ ├── Makefile │ ├── pad16.sh │ └── src │ │ └── main.cpp ├── LinkCable_basic │ ├── Makefile │ └── src │ │ └── main.cpp ├── LinkCable_full │ ├── Makefile │ └── src │ │ ├── main.cpp │ │ ├── main.h │ │ ├── scenes │ │ ├── TestScene.cpp │ │ └── TestScene.h │ │ └── utils │ │ ├── BackgroundUtils.h │ │ ├── InputHandler.h │ │ ├── SceneUtils.cpp │ │ ├── SceneUtils.h │ │ └── SpriteUtils.h ├── LinkCable_stress │ ├── Makefile │ └── src │ │ └── main.cpp ├── LinkGPIO_demo │ ├── Makefile │ └── src │ │ └── main.cpp ├── LinkSPI_demo │ ├── Makefile │ ├── Master.ino │ ├── Slave.ino │ ├── pad16.sh │ └── src │ │ └── main.cpp ├── LinkUniversal_basic │ ├── Makefile │ └── src │ │ └── main.cpp ├── LinkUniversal_full │ └── README.md ├── LinkWireless_demo │ ├── Makefile │ └── src │ │ └── main.cpp ├── _lib │ ├── interrupt.cpp │ ├── interrupt.h │ ├── libgba-sprite-engine │ │ ├── include │ │ │ └── libgba-sprite-engine │ │ │ │ ├── allocator.h │ │ │ │ ├── background │ │ │ │ ├── background.h │ │ │ │ ├── text.h │ │ │ │ └── text_stream.h │ │ │ │ ├── effects │ │ │ │ ├── fade_out_scene.h │ │ │ │ └── scene_effect.h │ │ │ │ ├── gba │ │ │ │ ├── tonc_asminc.h │ │ │ │ ├── tonc_bios.h │ │ │ │ ├── tonc_core.h │ │ │ │ ├── tonc_core_stub.h │ │ │ │ ├── tonc_math.h │ │ │ │ ├── tonc_math_stub.h │ │ │ │ ├── tonc_memdef.h │ │ │ │ ├── tonc_memmap.h │ │ │ │ ├── tonc_oam.h │ │ │ │ └── tonc_types.h │ │ │ │ ├── gba_engine.h │ │ │ │ ├── gbavector.h │ │ │ │ ├── palette │ │ │ │ ├── combined_palette.h │ │ │ │ └── palette_manager.h │ │ │ │ ├── scene.h │ │ │ │ ├── sound_control.h │ │ │ │ ├── sprites │ │ │ │ ├── affine_sprite.h │ │ │ │ ├── sprite.h │ │ │ │ ├── sprite_builder.h │ │ │ │ └── sprite_manager.h │ │ │ │ └── timer.h │ │ └── lib │ │ │ └── libgba-sprite-engine.a │ └── libugba │ │ ├── include │ │ ├── background.h │ │ ├── bios.h │ │ ├── bios_wrappers.h │ │ ├── console.h │ │ ├── debug.h │ │ ├── definitions.h │ │ ├── display.h │ │ ├── dma.h │ │ ├── fp_math.h │ │ ├── hardware.h │ │ ├── input.h │ │ ├── interrupts.h │ │ ├── obj.h │ │ ├── sound.h │ │ ├── sram.h │ │ ├── timer.h │ │ ├── ugba.h │ │ ├── version.h │ │ └── vram.h │ │ └── lib │ │ └── libugba.a └── compile.sh └── lib ├── LinkCable.h ├── LinkCableMultiboot.h ├── LinkGPIO.h ├── LinkSPI.h ├── LinkUniversal.h └── LinkWireless.h /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # directory 3 | .vscode/ 4 | build/ 5 | 6 | # gba 7 | *.gba 8 | *.elf 9 | *.sav 10 | 11 | # pico 12 | *.uf2 13 | -------------------------------------------------------------------------------- /GP2040-CE/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | indent_style = tab 8 | indent_size = 2 9 | end_of_line = crlf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | [*.md, *.yml] 15 | indent_style = space 16 | indent_size = 2 17 | trim_trailing_whitespace = false 18 | 19 | [*.scss] 20 | end_of_line = lf 21 | -------------------------------------------------------------------------------- /GP2040-CE/.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | workflow_dispatch: 8 | workflow_call: 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v3 16 | - name: Checkout submodules 17 | working-directory: ${{github.workspace}} 18 | run: git submodule update --init 19 | - name: Make Executable 20 | working-directory: ${{github.workspace}}/tools 21 | run: sudo chmod +x makefsdata 22 | # - name: Delete existing file 23 | # working-directory: ${{github.workspace}}/lib/httpd/ 24 | # run: rm fsdata.c 25 | - name: Use Node.js 26 | uses: actions/setup-node@v3 27 | with: 28 | node-version: '18.x' 29 | - name: clean install 30 | working-directory: ${{github.workspace}}/www 31 | run: npm ci 32 | - name: Build WWW 33 | working-directory: ${{github.workspace}}/www 34 | run: CI=false npm run build --if-present 35 | - name: Upload www Artifact 36 | uses: actions/upload-artifact@v3.1.1 37 | with: 38 | name: fsData 39 | path: ${{github.workspace}}/lib/httpd/fsdata.c 40 | if-no-files-found: error 41 | -------------------------------------------------------------------------------- /GP2040-CE/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/ 3 | node_modules/ 4 | configs/MyBoard 5 | .DS_Store 6 | /www/package-lock.json 7 | build/ 8 | 9 | modules/Custom.cmake 10 | -------------------------------------------------------------------------------- /GP2040-CE/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "configs/PicoFightingBoard"] 2 | path = configs/PicoFightingBoard 3 | url = https://github.com/FeralAI/GP2040-Config-PicoFightingBoard.git 4 | [submodule "www"] 5 | path = www 6 | url = https://github.com/OpenStickCommunity/WebConfigurator.git 7 | -------------------------------------------------------------------------------- /GP2040-CE/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /GP2040-CE/configs/BentoBox/env.ini: -------------------------------------------------------------------------------- 1 | [env:bentobox] 2 | build_flags = 3 | ${env.build_flags} 4 | -I configs/BentoBox/ 5 | upload_port = .pio/build/bentobox/ 6 | -------------------------------------------------------------------------------- /GP2040-CE/configs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Pico) -------------------------------------------------------------------------------- /GP2040-CE/configs/DURAL/README.md: -------------------------------------------------------------------------------- 1 | # GP2040 Configuration for DURAL 2 | 3 | ![DURAL](assets/DURAL.jpg) 4 | 5 | -------------------------------------------------------------------------------- /GP2040-CE/configs/DURAL/assets/DURAL.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/DURAL/assets/DURAL.jpg -------------------------------------------------------------------------------- /GP2040-CE/configs/DURAL/env.ini: -------------------------------------------------------------------------------- 1 | [env:dural] 2 | build_flags = 3 | ${env.build_flags} 4 | -I configs/DURAL/ 5 | upload_port = .pio/build/dural/ -------------------------------------------------------------------------------- /GP2040-CE/configs/FightboardV3/README.md: -------------------------------------------------------------------------------- 1 | # GP2040 Configuration for the Fightboard v3 2 | 3 | ![Pin Mapping](assets/FightboardV3.jpg) 4 | 5 | This configuration is for the Fightboard v3 using the Waveshare RP2040 Zero. 6 | 7 | -------------------------------------------------------------------------------- /GP2040-CE/configs/FightboardV3/assets/FightboardV3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/FightboardV3/assets/FightboardV3.jpg -------------------------------------------------------------------------------- /GP2040-CE/configs/FightboardV3Mirrored/README.md: -------------------------------------------------------------------------------- 1 | # GP2040 Configuration for the mirrored Fightboard v3 2 | 3 | ![Pin Mapping](assets/FightboardV3Mirrored.jpg) 4 | 5 | This configuration is for the mirrored version of the Fightboard v3 using the Waveshare RP2040 Zero. 6 | 7 | -------------------------------------------------------------------------------- /GP2040-CE/configs/FightboardV3Mirrored/assets/FightboardV3Mirrored.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/FightboardV3Mirrored/assets/FightboardV3Mirrored.jpg -------------------------------------------------------------------------------- /GP2040-CE/configs/FlatboxRev4/Readme.md: -------------------------------------------------------------------------------- 1 | # GP2040 Configuration for Flatbox Rev 4 2 | 3 | ![Flatbox](assets/Flatbox-rev2b-finished-product.jpg) 4 | 5 | Configuration for the [Flatbox Rev 4](https://github.com/jfedor2/flatbox/tree/master/hardware-rev4), one of the excellent revisions of the [Flatbox](https://github.com/jfedor2/flatbox) design by [jfedor2](https://github.com/jfedor2) powered by an RP2040 MCU. 6 | 7 | ![Layout](assets/ButtonMapping.png) -------------------------------------------------------------------------------- /GP2040-CE/configs/FlatboxRev4/assets/ButtonMapping.kra: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/FlatboxRev4/assets/ButtonMapping.kra -------------------------------------------------------------------------------- /GP2040-CE/configs/FlatboxRev4/assets/ButtonMapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/FlatboxRev4/assets/ButtonMapping.png -------------------------------------------------------------------------------- /GP2040-CE/configs/FlatboxRev4/assets/Flatbox-rev2b-finished-product.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/FlatboxRev4/assets/Flatbox-rev2b-finished-product.jpg -------------------------------------------------------------------------------- /GP2040-CE/configs/FlatboxRev4/env.ini: -------------------------------------------------------------------------------- 1 | [env:flatbox-rev-4] 2 | upload_port = .pio/build/flatbox-rev-4/ 3 | build_flags = 4 | ${env.build_flags} 5 | -D PICO_XOSC_STARTUP_DELAY_MULTIPLIER=64 6 | -I configs/FlatboxRev4/ 7 | -------------------------------------------------------------------------------- /GP2040-CE/configs/FlatboxRev4/flatboxrev4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | // ----------------------------------------------------- 8 | // NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO 9 | // SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES 10 | // ----------------------------------------------------- 11 | 12 | 13 | #ifndef _BOARDS_FLATBOXREV4_H 14 | #define _BOARDS_FLATBOXREV4_H 15 | 16 | // For board detection 17 | #define FLATBOXREV4 18 | 19 | //For crappy crystal 20 | #ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER 21 | #define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 22 | #endif 23 | 24 | // --- UART --- 25 | #ifndef PICO_DEFAULT_UART 26 | #define PICO_DEFAULT_UART 0 27 | #endif 28 | #ifndef PICO_DEFAULT_UART_TX_PIN 29 | #define PICO_DEFAULT_UART_TX_PIN 0 30 | #endif 31 | #ifndef PICO_DEFAULT_UART_RX_PIN 32 | #define PICO_DEFAULT_UART_RX_PIN 1 33 | #endif 34 | 35 | // --- LED --- 36 | #ifndef PICO_DEFAULT_LED_PIN 37 | #define PICO_DEFAULT_LED_PIN 25 38 | #endif 39 | // no PICO_DEFAULT_WS2812_PIN 40 | 41 | // --- I2C --- 42 | #ifndef PICO_DEFAULT_I2C 43 | #define PICO_DEFAULT_I2C 0 44 | #endif 45 | #ifndef PICO_DEFAULT_I2C_SDA_PIN 46 | #define PICO_DEFAULT_I2C_SDA_PIN 4 47 | #endif 48 | #ifndef PICO_DEFAULT_I2C_SCL_PIN 49 | #define PICO_DEFAULT_I2C_SCL_PIN 5 50 | #endif 51 | 52 | // --- SPI --- 53 | #ifndef PICO_DEFAULT_SPI 54 | #define PICO_DEFAULT_SPI 0 55 | #endif 56 | #ifndef PICO_DEFAULT_SPI_SCK_PIN 57 | #define PICO_DEFAULT_SPI_SCK_PIN 18 58 | #endif 59 | #ifndef PICO_DEFAULT_SPI_TX_PIN 60 | #define PICO_DEFAULT_SPI_TX_PIN 19 61 | #endif 62 | #ifndef PICO_DEFAULT_SPI_RX_PIN 63 | #define PICO_DEFAULT_SPI_RX_PIN 16 64 | #endif 65 | #ifndef PICO_DEFAULT_SPI_CSN_PIN 66 | #define PICO_DEFAULT_SPI_CSN_PIN 17 67 | #endif 68 | 69 | // --- FLASH --- 70 | 71 | #define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 72 | 73 | #ifndef PICO_FLASH_SPI_CLKDIV 74 | #define PICO_FLASH_SPI_CLKDIV 2 75 | #endif 76 | 77 | #ifndef PICO_FLASH_SIZE_BYTES 78 | #define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024) 79 | #endif 80 | 81 | // Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads) 82 | #define PICO_SMPS_MODE_PIN 23 83 | 84 | #ifndef PICO_RP2040_B0_SUPPORTED 85 | #define PICO_RP2040_B0_SUPPORTED 1 86 | #endif 87 | 88 | #endif -------------------------------------------------------------------------------- /GP2040-CE/configs/FlatboxRev5/Readme.md: -------------------------------------------------------------------------------- 1 | # GP2040 Configuration for Flatbox rev5 2 | 3 | ![Flatbox rev5](assets/Flatbox-rev5.jpg) 4 | 5 | Configuration for the [Flatbox rev5](https://github.com/jfedor2/flatbox/tree/master/hardware-rev5), a variant of the [Flatbox](https://github.com/jfedor2/flatbox) design by [jfedor2](https://github.com/jfedor2). This revision uses an RP2040-Zero board. 6 | -------------------------------------------------------------------------------- /GP2040-CE/configs/FlatboxRev5/assets/Flatbox-rev5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/FlatboxRev5/assets/Flatbox-rev5.jpg -------------------------------------------------------------------------------- /GP2040-CE/configs/FlatboxRev5/env.ini: -------------------------------------------------------------------------------- 1 | [env:flatbox-rev-5] 2 | upload_port = .pio/build/flatbox-rev-5/ 3 | build_flags = 4 | ${env.build_flags} 5 | -D PICO_XOSC_STARTUP_DELAY_MULTIPLIER=64 6 | -I configs/FlatboxRev5/ 7 | -------------------------------------------------------------------------------- /GP2040-CE/configs/FlatboxRev5/flatboxrev5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | // ----------------------------------------------------- 8 | // NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO 9 | // SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES 10 | // ----------------------------------------------------- 11 | 12 | #ifndef _BOARDS_FLATBOXREV5_H 13 | #define _BOARDS_FLATBOXREV5_H 14 | 15 | // For board detection 16 | #define FLATBOXREV5 17 | 18 | // For crappy crystal 19 | #ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER 20 | #define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 21 | #endif 22 | 23 | // --- UART --- 24 | #ifndef PICO_DEFAULT_UART 25 | #define PICO_DEFAULT_UART 0 26 | #endif 27 | #ifndef PICO_DEFAULT_UART_TX_PIN 28 | #define PICO_DEFAULT_UART_TX_PIN 0 29 | #endif 30 | #ifndef PICO_DEFAULT_UART_RX_PIN 31 | #define PICO_DEFAULT_UART_RX_PIN 1 32 | #endif 33 | 34 | // --- LED --- 35 | #ifndef PICO_DEFAULT_LED_PIN 36 | #define PICO_DEFAULT_LED_PIN 25 37 | #endif 38 | // no PICO_DEFAULT_WS2812_PIN 39 | 40 | // --- I2C --- 41 | #ifndef PICO_DEFAULT_I2C 42 | #define PICO_DEFAULT_I2C 0 43 | #endif 44 | #ifndef PICO_DEFAULT_I2C_SDA_PIN 45 | #define PICO_DEFAULT_I2C_SDA_PIN 4 46 | #endif 47 | #ifndef PICO_DEFAULT_I2C_SCL_PIN 48 | #define PICO_DEFAULT_I2C_SCL_PIN 5 49 | #endif 50 | 51 | // --- SPI --- 52 | #ifndef PICO_DEFAULT_SPI 53 | #define PICO_DEFAULT_SPI 0 54 | #endif 55 | #ifndef PICO_DEFAULT_SPI_SCK_PIN 56 | #define PICO_DEFAULT_SPI_SCK_PIN 18 57 | #endif 58 | #ifndef PICO_DEFAULT_SPI_TX_PIN 59 | #define PICO_DEFAULT_SPI_TX_PIN 19 60 | #endif 61 | #ifndef PICO_DEFAULT_SPI_RX_PIN 62 | #define PICO_DEFAULT_SPI_RX_PIN 16 63 | #endif 64 | #ifndef PICO_DEFAULT_SPI_CSN_PIN 65 | #define PICO_DEFAULT_SPI_CSN_PIN 17 66 | #endif 67 | 68 | // --- FLASH --- 69 | 70 | #define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 71 | 72 | #ifndef PICO_FLASH_SPI_CLKDIV 73 | #define PICO_FLASH_SPI_CLKDIV 2 74 | #endif 75 | 76 | #ifndef PICO_FLASH_SIZE_BYTES 77 | #define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024) 78 | #endif 79 | 80 | // Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads) 81 | #define PICO_SMPS_MODE_PIN 23 82 | 83 | #ifndef PICO_RP2040_B0_SUPPORTED 84 | #define PICO_RP2040_B0_SUPPORTED 1 85 | #endif 86 | 87 | #endif -------------------------------------------------------------------------------- /GP2040-CE/configs/MavercadeKeebfighter/Readme.md: -------------------------------------------------------------------------------- 1 | # GP2040 Configuration for the Mavercade Keebfighter 2 | 3 | ![Mavercade logo](assets/Mavercade-logo.png) 4 | 5 | Configuration for the [Mavercade Keebfighters](https://mavercade.com/collections/mavercade-fightsticks). The Mavercade Keebfighters are based on the [Flatbox rev5](https://github.com/jfedor2/flatbox/tree/master/hardware-rev5), a variant of the [Flatbox](https://github.com/jfedor2/flatbox) design by [jfedor2](https://github.com/jfedor2). These revisions use a Waveshare RP2040-Zero board. 6 | 7 | Mavercade Keebfighter 00 - Check it out [here](https://mavercade.com/products/mavercade-keebfighter-00) 8 | ![Mavercade Keebfighter 00](assets/keebfighter-00.png) 9 | 10 | Mavercade Keebfighter 01 - Check it out [here](https://mavercade.com/products/mavercade-keebfighter-01) 11 | ![Mavercade Keebfighter 01](assets/keebfighter-01.png) 12 | 13 | Mavercade Keebfighter 02 - Check it out [here](https://mavercade.com/products/mavercade-keebfighter-02) 14 | ![Mavercade Keebfighter 02](assets/keebfighter-02.png) -------------------------------------------------------------------------------- /GP2040-CE/configs/MavercadeKeebfighter/assets/Mavercade-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/MavercadeKeebfighter/assets/Mavercade-logo.png -------------------------------------------------------------------------------- /GP2040-CE/configs/MavercadeKeebfighter/assets/keebfighter-00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/MavercadeKeebfighter/assets/keebfighter-00.png -------------------------------------------------------------------------------- /GP2040-CE/configs/MavercadeKeebfighter/assets/keebfighter-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/MavercadeKeebfighter/assets/keebfighter-01.png -------------------------------------------------------------------------------- /GP2040-CE/configs/MavercadeKeebfighter/assets/keebfighter-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/MavercadeKeebfighter/assets/keebfighter-02.png -------------------------------------------------------------------------------- /GP2040-CE/configs/Pico/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #add_executable(Pico 2 | #${CMAKE_SOURCE_DIR}/src/main.cpp) 3 | #link_libraries(${PROJECT_NAME}) -------------------------------------------------------------------------------- /GP2040-CE/configs/Pico/README.md: -------------------------------------------------------------------------------- 1 | # GP2040 Configuration for Raspberry Pi Pico 2 | 3 | ![Pin Mapping](assets/PinMapping.png) 4 | 5 | Basic pin setup for a stock Raspberry Pi Pico. Combine with a simple GPIO breakout/screw terminal board for an easy DIY arcade stick. 6 | -------------------------------------------------------------------------------- /GP2040-CE/configs/Pico/assets/PinMapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/Pico/assets/PinMapping.png -------------------------------------------------------------------------------- /GP2040-CE/configs/Pico/assets/PinMapping.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/Pico/assets/PinMapping.xcf -------------------------------------------------------------------------------- /GP2040-CE/configs/PicoAnn/README.md: -------------------------------------------------------------------------------- 1 | # GP2040-CE Configuration for PicoAnn firmware boards 2 | 3 | ![Pin Mapping](assets/PinMapping_PicoAnn.png) 4 | 5 | Basic pin setup for boards that were running PicoAnn firmware like the Pico Advanced Breakout Board v3.0. 6 | -------------------------------------------------------------------------------- /GP2040-CE/configs/PicoAnn/assets/PinMapping_PicoAnn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/PicoAnn/assets/PinMapping_PicoAnn.png -------------------------------------------------------------------------------- /GP2040-CE/configs/PicoAnn/env.ini: -------------------------------------------------------------------------------- 1 | [env:PicoAnn] 2 | upload_port = .pio/build/PicoAnn/ 3 | build_flags = 4 | ${env.build_flags} 5 | -I configs/PicoAnn/ 6 | -------------------------------------------------------------------------------- /GP2040-CE/configs/PicoFightingBoard/README.md: -------------------------------------------------------------------------------- 1 | # GP2040-CE Configuration for Pico Fighting Board 2 | 3 | * New GP2040-CE standard layout for Pico Fighting Board. 4 | 5 | Not equipped with turbo. 6 | 7 | ![Pin Mapping](assets/PicoFightingBoard_v1.1.jpg) 8 | 9 | Open source board based on the Brook board design: . The board labels are associated with the GP2040 generic labeling. The 20-pin connector, 4-pin connector and screw terminals are button-compatible with the Brook wiring harnesses and button mappings. 10 | -------------------------------------------------------------------------------- /GP2040-CE/configs/PicoFightingBoard/assets/PicoFightingBoard_v1.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/PicoFightingBoard/assets/PicoFightingBoard_v1.1.jpg -------------------------------------------------------------------------------- /GP2040-CE/configs/PicoFightingBoard/assets/PinMapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/PicoFightingBoard/assets/PinMapping.png -------------------------------------------------------------------------------- /GP2040-CE/configs/PicoFightingBoard/assets/PinMapping.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/PicoFightingBoard/assets/PinMapping.xcf -------------------------------------------------------------------------------- /GP2040-CE/configs/RP2040AdvancedBreakoutBoard/README.md: -------------------------------------------------------------------------------- 1 | # GP2040 Configuration for the RP2040 Advanced Breakout Board 2 | 3 | ![RP2040 Advanced Breakout Board](assets/RP2040AdvancedBreakoutBoard.jpg) 4 | 5 | Basic pin setup for the RP2040 Advanced Breakout Board. 6 | 7 | ![Pin Mapping](assets/RP2040AdvancedBreakoutBoard_pinout.png) 8 | -------------------------------------------------------------------------------- /GP2040-CE/configs/RP2040AdvancedBreakoutBoard/RP2040AdvancedBreakoutBoard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * SPDX-License-Identifier: BSD-3-Clause 5 | */ 6 | 7 | // ----------------------------------------------------- 8 | // NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO 9 | // SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES 10 | // ----------------------------------------------------- 11 | 12 | 13 | #ifndef _BOARDS_RP2040ADVANCEDBREAKOUTBOARD_H 14 | #define _BOARDS_RP2040ADVANCEDBREAKOUTBOARD_H 15 | 16 | // For board detection 17 | #define RP2040ADVANCEDBREAKOUTBOARD 18 | 19 | //For crappy crystal 20 | #ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER 21 | #define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 22 | #endif 23 | 24 | // --- LED --- 25 | #ifndef PICO_DEFAULT_LED_PIN 26 | #define PICO_DEFAULT_LED_PIN 25 27 | #endif 28 | // no PICO_DEFAULT_WS2812_PIN 29 | 30 | // --- FLASH --- 31 | #define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 32 | 33 | #ifndef PICO_FLASH_SPI_CLKDIV 34 | #define PICO_FLASH_SPI_CLKDIV 2 35 | #endif 36 | 37 | #ifndef PICO_FLASH_SIZE_BYTES 38 | #define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024) 39 | #endif 40 | 41 | // Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads) 42 | #define PICO_SMPS_MODE_PIN 23 43 | 44 | #ifndef PICO_RP2040_B0_SUPPORTED 45 | #define PICO_RP2040_B0_SUPPORTED 1 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /GP2040-CE/configs/RP2040AdvancedBreakoutBoard/assets/RP2040AdvancedBreakoutBoard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/RP2040AdvancedBreakoutBoard/assets/RP2040AdvancedBreakoutBoard.jpg -------------------------------------------------------------------------------- /GP2040-CE/configs/RP2040AdvancedBreakoutBoard/assets/RP2040AdvancedBreakoutBoard_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/RP2040AdvancedBreakoutBoard/assets/RP2040AdvancedBreakoutBoard_pinout.png -------------------------------------------------------------------------------- /GP2040-CE/configs/RP2040AdvancedBreakoutBoard/env.ini: -------------------------------------------------------------------------------- 1 | [env:RP2040 Advanced Breakout Board] 2 | upload_port = .pio/build/RP2040AdvancedBreakoutBoard/ 3 | build_flags = 4 | ${env.build_flags} 5 | -I configs/RP2040AdvancedBreakoutBoard/ 6 | -------------------------------------------------------------------------------- /GP2040-CE/configs/ReflexEncoder/README.md: -------------------------------------------------------------------------------- 1 | # GP2040-CE Configuration for the Reflex Board by MiSTer Addons 2 | 3 | 4 | ![Reflex Board](assets/ReflexBoard_v1.2.jpeg) 5 | 6 | Reflex Board 7 | Open source PCB for arcade sticks using Raspberry Pi Pico's RP2040 microcontroller. 8 | 9 | GitHub: https://github.com/misteraddons/ReflexFightingBoard 10 | Purchase from: https://misteraddons.com/collections/parts/products/reflex-encode-fighting-board 11 | 12 | MiSTer addons: https://misteraddons.com/ 13 | 14 | 15 | -------------------------------------------------------------------------------- /GP2040-CE/configs/ReflexEncoder/assets/ReflexBoard_v1.2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/ReflexEncoder/assets/ReflexBoard_v1.2.jpeg -------------------------------------------------------------------------------- /GP2040-CE/configs/SparkFunProMicro/README.md: -------------------------------------------------------------------------------- 1 | # GP2040 Configuration for Sparkfun Pro Micro - RP2040 2 | 3 | ![Pin Mapping](assets/SparkFunProMicroRP2040.png) 4 | 5 | Basic pin setup for a stock [Sparkfun Pro Micro - RP2040](https://www.sparkfun.com/products/18288). 6 | 7 | The pin layout is designed to be a drop in replacement for the [Daemonbite Arcade encoder](https://github.com/MickGyver/DaemonBite-Arcade-Encoder). 8 | -------------------------------------------------------------------------------- /GP2040-CE/configs/SparkFunProMicro/assets/SparkFunProMicroRP2040.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/SparkFunProMicro/assets/SparkFunProMicroRP2040.png -------------------------------------------------------------------------------- /GP2040-CE/configs/SparkFunProMicro/env.ini: -------------------------------------------------------------------------------- 1 | [env:sparkfun-pro-micro] 2 | build_flags = 3 | ${env.build_flags} 4 | -D BOARD_SPARKFUN_MICRO_RP2040 5 | -I configs/SparkFunProMicro/ 6 | upload_port = .pio/build/sparkfun-pro-micro/ -------------------------------------------------------------------------------- /GP2040-CE/configs/WaveshareZero/README.md: -------------------------------------------------------------------------------- 1 | # GP2040 Configuration for the Waveshare RP2040 Zero 2 | 3 | ![Pin Mapping](assets/WaveshareRP2040Zero.png) 4 | 5 | Basic pin setup for the Waveshare RP2040 Zero. 6 | -------------------------------------------------------------------------------- /GP2040-CE/configs/WaveshareZero/WaveshareRP2040Zero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/WaveshareZero/WaveshareRP2040Zero.png -------------------------------------------------------------------------------- /GP2040-CE/configs/WaveshareZero/assets/WaveshareRP2040Zero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/configs/WaveshareZero/assets/WaveshareRP2040Zero.png -------------------------------------------------------------------------------- /GP2040-CE/configs/WaveshareZero/env.ini: -------------------------------------------------------------------------------- 1 | [env:WaveshareZero] 2 | upload_port = .pio/build/WaveshareZero/ 3 | build_flags = 4 | ${env.build_flags} 5 | -I configs/WaveshareZero/ 6 | -------------------------------------------------------------------------------- /GP2040-CE/docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/.nojekyll -------------------------------------------------------------------------------- /GP2040-CE/docs/CNAME: -------------------------------------------------------------------------------- 1 | gp2040-ce.info -------------------------------------------------------------------------------- /GP2040-CE/docs/_sidebar.md: -------------------------------------------------------------------------------- 1 | - [Home](/ "GP2040-CE | RP2040 Gamepad Firmware Documentation") 2 | - [Download](download "GP2040-CE | Download") 3 | - [Installation](installation "GP2040-CE | Installation") 4 | - [Wiring](wiring "GP2040-CE | Wiring Guide") 5 | - [Usage](usage "GP2040-CE | Usage") 6 | - [Shortcuts](gp2040-shortcuts "GP2040-CE | Shortcuts") 7 | - [Web Configurator](web-configurator "GP2040-CE | Web Configurator") 8 | - [FAQ](faq "GP2040-CE | Frequently Asked Questions (FAQ)") 9 | - [Development](development "GP2040-CE | Development") 10 | -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/BentoBox.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/BentoBox.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/DURAL.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/DURAL.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/FightboardV3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/FightboardV3.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/FlatboxRev4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/FlatboxRev4.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/FlatboxRev4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/FlatboxRev4.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/FlatboxRev5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/FlatboxRev5.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/MavercadeKeebfighter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/MavercadeKeebfighter.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/Pico.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/Pico.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/PicoFightingBoard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/PicoFightingBoard.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/RP2040AdvancedBreakoutBoard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/RP2040AdvancedBreakoutBoard.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/ReflexEncoder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/ReflexEncoder.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/SparkFunProMicro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/SparkFunProMicro.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/boards/WaveshareZero.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/boards/WaveshareZero.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/GP2040-PFB-demo-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/GP2040-PFB-demo-1.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/GP2040-PFB-demo-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/GP2040-PFB-demo-2.jpg -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/BentoBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/BentoBox.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/Crush Counter v2.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/Crush Counter v2.0.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 1.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 2.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 3.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 4.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 5.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 6.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/GP2040-CE 7.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/Sega Astro City.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/Sega Astro City.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/Street Fighter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/Street Fighter.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/community-splash-screens/TheTrain Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/community-splash-screens/TheTrain Logo.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gcp-display-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gcp-display-config.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/github-sponsor-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/github-sponsor-dark.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/github-sponsor-dimmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/github-sponsor-dimmed.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/github-sponsor-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/github-sponsor-light.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gp2040-ce-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gp2040-ce-logo.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-ads1219.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-ads1219.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-analog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-analog.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-bootsel-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-bootsel-button.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-buzzer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-buzzer.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-dual-directional.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-dual-directional.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-extra-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-extra-button.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-input-reverse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-input-reverse.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-joystick-slider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-joystick-slider.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-onboard-led.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-onboard-led.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-player-number.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-player-number.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-ps4-mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-ps4-mode.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-socd-slider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-socd-slider.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-turbo-shmup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-turbo-shmup.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-turbo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-turbo.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-add-ons-wii-extensions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-add-ons-wii-extensions.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-backup-and-restore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-backup-and-restore.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-display-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-display-config.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-home.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-label-selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-label-selection.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-pin-mapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-pin-mapping.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-reset-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-reset-settings.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-rgb-led-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-rgb-led-config.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-rgb-led-custom-theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-rgb-led-custom-theme.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/gpc-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/gpc-settings.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/_base-template.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/_base-template.xcf -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/fightboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/fightboard.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/guilty-gear-type-a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/guilty-gear-type-a.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/guilty-gear-type-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/guilty-gear-type-b.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/guilty-gear-type-c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/guilty-gear-type-c.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/guilty-gear-type-d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/guilty-gear-type-d.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/guilty-gear-type-e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/guilty-gear-type-e.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/neogeo-curved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/neogeo-curved.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/neogeo-modern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/neogeo-modern.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/neogeo-straight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/neogeo-straight.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/playstation-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/playstation-all.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/playstation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/playstation.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/six-button-fighter-plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/six-button-fighter-plus.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/six-button-fighter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/six-button-fighter.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/static-rainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/static-rainbow.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/street-fighter-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/street-fighter-2.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/super-famicom-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/super-famicom-all.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/super-famicom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/super-famicom.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/tekken.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/tekken.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/xbox-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/xbox-all.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/images/led-themes/xbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/images/led-themes/xbox.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/wiring/RaspberryPiPico_Pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/wiring/RaspberryPiPico_Pinout.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/wiring/SparkFunProMicroRP2040_Pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/wiring/SparkFunProMicroRP2040_Pinout.png -------------------------------------------------------------------------------- /GP2040-CE/docs/assets/wiring/WaveshareRP2040Zero_Pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/assets/wiring/WaveshareRP2040Zero_Pinout.png -------------------------------------------------------------------------------- /GP2040-CE/docs/community-splash-screens.md: -------------------------------------------------------------------------------- 1 | # Community Splash Screens 2 | 3 | Here is a collection of community created splash screens that can be used with an optional OLED screen. Upload the image using the web configurator to set it up. 4 | 5 | All images been formatted to 128x64 in black / white color. 6 | 7 | | ![BentoBox](assets/images/community-splash-screens/BentoBox.png) | ![Crush_Counter](assets/images/community-splash-screens/Crush%20Counter%20v2.0.png) | ![GP2040-CE1](assets/images/community-splash-screens/GP2040-CE%201.png) | ![GP2040-CE2](assets/images/community-splash-screens/GP2040-CE%202.png) | ![GP2040-CE3](assets/images/community-splash-screens/GP2040-CE%203.png) | 8 | |---|---|---|---|---| 9 | | ![GP2040-CE4](assets/images/community-splash-screens/GP2040-CE%204.png) | ![GP2040-CE5](assets/images/community-splash-screens/GP2040-CE%205.png) | ![Sega_Astro_City](assets/images/community-splash-screens/Sega%20Astro%20City.png) | ![Street_Fighter](assets/images/community-splash-screens/Street%20Fighter.png) | ![TheTrain](assets/images/community-splash-screens/TheTrain%20Logo.png) | 10 | | ![GP2040-CE6](assets/images/community-splash-screens/GP2040-CE%206.png) | ![GP2040-CE7](assets/images/community-splash-screens/GP2040-CE%207.png) | | | | -------------------------------------------------------------------------------- /GP2040-CE/docs/download.md: -------------------------------------------------------------------------------- 1 | # Downloads 2 | 3 | 4 | -------------------------------------------------------------------------------- /GP2040-CE/docs/downloads/flash_nuke.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/downloads/flash_nuke.uf2 -------------------------------------------------------------------------------- /GP2040-CE/docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/docs/favicon.ico -------------------------------------------------------------------------------- /GP2040-CE/docs/installation.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | The instructions will slightly vary based on your device. These instructions are for a Raspberry Pi Pico. 4 | 5 | > If the device has been previously used for something other than GP2040-CE, please flash this file first to clear the on-board storage: [flash_nuke.uf2](https://raw.githubusercontent.com/OpenStickCommunity/GP2040-CE/main/docs/downloads/flash_nuke.uf2). After flashing the nuke file, wait a minute for the clear program to run and the RPI-RP2 drive to reappear. 6 | 7 | 1. Download the latest `GP2040-CE.uf2` file from the [Download](download) page for your board (e.g. `GP2040-CE_X.Y.Z_Pico.uf2` for the Raspberry Pi Pico). 8 | 2. Unplug your Pico. 9 | 3. Hold the BOOTSEL button on the Pico and plug into your computer. A new removable drive named `RPI-RP2` should appear in your file explorer. 10 | 4. Drag and drop the `GP2040-CE.uf2` file into the removable drive. This will flash the firmware file and automatically restart the Pico. 11 | 12 | Congratulations! The board is now running the GP2040-CE firmware and will appear as a controller on your computer. You can test it in a game, using the website like [Gamepad Tester](https://gamepad-tester.com/), or in another application such as the Steam Input Overlay. 13 | 14 | If you would like to customize your device, check out the built-in [Web Configurator](web-configurator). 15 | -------------------------------------------------------------------------------- /GP2040-CE/docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docs", 3 | "version": "1.0.0", 4 | "description": "", 5 | "scripts": { 6 | "start": "docsify serve ./" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "docsify-cli": "^4.4.4" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /GP2040-CE/docs/site.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --mono-hue: 0; 3 | --mono-saturation : 0%; 4 | --modular-scale : 1.25; 5 | --base-font-size: 0.875rem; 6 | --theme-color : #C73C8B; 7 | --sidebar-width : 20rem; 8 | --sidebar-padding: 0 0.75rem; 9 | /* --content-max-width: 75em; */ 10 | } 11 | 12 | hr { 13 | margin: 1.5em 0; 14 | } 15 | 16 | .form-dropdown label { 17 | display: none; 18 | margin-right: 4px; 19 | } 20 | 21 | .hotkey { 22 | text-transform: uppercase; 23 | } 24 | 25 | .label-select { 26 | display: inline-block; 27 | margin-left: 4px; 28 | } 29 | 30 | .sticky-label-select { 31 | /* width: 100%; */ 32 | position: fixed!important; 33 | top: var(--sidebar-toggle-offset-top); 34 | height: var(--sidebar-toggle-height); 35 | right: 0px; 36 | background: var(--sidebar-toggle-background, transparent); 37 | padding: 4px; 38 | border-radius: 4px; 39 | transform: translateY(-100%); 40 | opacity: 0.8; 41 | z-index: 10; 42 | } 43 | 44 | .sticky-label-select label { 45 | display: block; 46 | text-align: center; 47 | margin-top: -4px; 48 | margin-bottom: 4px; 49 | } 50 | 51 | /*************/ 52 | /* Downloads */ 53 | /*************/ 54 | 55 | .download-category { 56 | margin-bottom: 2rem; 57 | } 58 | 59 | .download-category h3 { 60 | margin-bottom: 1rem; 61 | } 62 | 63 | .download-category-list { 64 | display: flex; 65 | flex-wrap: wrap; 66 | align-items: start; 67 | width: 100%; 68 | padding-left: 1%; 69 | } 70 | 71 | .download-category-list a { 72 | display: flex; 73 | flex: 1 1 auto; 74 | max-width: 31%; 75 | margin: 0 1%; 76 | align-items: center; 77 | justify-content: center; 78 | } 79 | 80 | .download-category-list a > div { 81 | align-items: center; 82 | display: flex; 83 | flex-direction: column; 84 | } 85 | 86 | .download-category-list a > div span { 87 | display: inline-block; 88 | width: 100%; 89 | text-align: center; 90 | font-size: 1rem; 91 | font-weight: 600; 92 | } -------------------------------------------------------------------------------- /GP2040-CE/docs/wiring.md: -------------------------------------------------------------------------------- 1 | # Wiring 2 | 3 | These are the default pin mappings for each GP2040-CE supported microcontroller board. 4 | 5 | ## Raspberry Pi Pico 6 | 7 | ?> The Raspberry Pi Pico pinout can also be used on clone boards with the same form factor and pinout, such as the Pimironi Pico LiPo and the Waveshare RP2040-Plus. 8 | 9 | ![Raspberry Pi Pico Pinout](assets/wiring/RaspberryPiPico_Pinout.png) 10 | 11 | ## SparkFun Pro Micro - RP2040 12 | 13 | ![SparkFun Pro Micro - RP2040 Pinout](assets/wiring/SparkFunProMicroRP2040_Pinout.png) 14 | 15 | ## Waveshare RP2040-Zero 16 | 17 | ![Waveshare RP2040-Zero Pinout](assets/wiring/WaveshareRP2040Zero_Pinout.png) 18 | -------------------------------------------------------------------------------- /GP2040-CE/headers/addonmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADDONMANAGER_H_ 2 | #define _ADDONMANAGER_H_ 3 | 4 | #include "gpaddon.h" 5 | 6 | #include 7 | #include 8 | 9 | enum ADDON_PROCESS { 10 | CORE0_INPUT, 11 | CORE0_USBREPORT, 12 | CORE1_LOOP 13 | }; 14 | 15 | struct AddonBlock { 16 | GPAddon * ptr; 17 | ADDON_PROCESS process; 18 | }; 19 | 20 | class AddonManager { 21 | public: 22 | AddonManager() {} 23 | ~AddonManager() {} 24 | void LoadAddon(GPAddon*, ADDON_PROCESS); 25 | void PreprocessAddons(ADDON_PROCESS); 26 | void ProcessAddons(ADDON_PROCESS); 27 | GPAddon * GetAddon(std::string); // hack for NeoPicoLED 28 | private: 29 | std::vector addons; // addons currently loaded 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/analog.h: -------------------------------------------------------------------------------- 1 | #ifndef _Analog_H 2 | #define _Analog_H 3 | 4 | #include "gpaddon.h" 5 | 6 | #include "GamepadEnums.h" 7 | 8 | #include "BoardConfig.h" 9 | 10 | #ifndef ANALOG_INPUT_ENABLED 11 | #define ANALOG_INPUT_ENABLED 0 12 | #endif 13 | 14 | #ifndef ANALOG_ADC_VRX 15 | #define ANALOG_ADC_VRX -1 16 | #endif 17 | 18 | #ifndef ANALOG_ADC_VRY 19 | #define ANALOG_ADC_VRY -1 20 | #endif 21 | 22 | // Analog Module Name 23 | #define AnalogName "Analog" 24 | 25 | class AnalogInput : public GPAddon { 26 | public: 27 | virtual bool available(); 28 | virtual void setup(); // Analog Setup 29 | virtual void process(); // Analog Process 30 | virtual void preprocess() {} 31 | virtual std::string name() { return AnalogName; } 32 | private: 33 | uint8_t analogAdcPinX; 34 | uint8_t analogAdcPinY; 35 | }; 36 | 37 | #endif // _Analog_H_ -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/board_led.h: -------------------------------------------------------------------------------- 1 | #ifndef _BoardLed_H 2 | #define _BoardLed_H 3 | 4 | #include "gpaddon.h" 5 | #include "pico/stdlib.h" 6 | #include "storagemanager.h" 7 | 8 | #ifndef BOARD_LED_ENABLED 9 | #define BOARD_LED_ENABLED 0 10 | #endif 11 | 12 | #ifndef BOARD_LED_TYPE 13 | #define BOARD_LED_TYPE BOARD_LED_OFF 14 | #endif 15 | 16 | // BoardLed Module Name 17 | #define OnBoardLedName "OnBoardLed" 18 | 19 | #define BOARD_LED_PIN 25 20 | #define BLINK_INTERVAL_USB_UNMOUNTED 200 21 | #define BLINK_INTERVAL_CONFIG_MODE 1000 22 | 23 | class BoardLedAddon : public GPAddon { 24 | public: 25 | virtual bool available(); 26 | virtual void setup(); // BoardLed Setup 27 | virtual void process(); // BoardLed Process 28 | virtual void preprocess() {} 29 | virtual std::string name() { return OnBoardLedName; } 30 | private: 31 | OnBoardLedMode onBoardLedMode; 32 | bool isConfigMode; 33 | bool prevState; 34 | uint32_t timeSinceBlink; 35 | }; 36 | 37 | #endif // _BoardLed_H_ -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/bootsel_button.h: -------------------------------------------------------------------------------- 1 | #ifndef _BootselButton_H 2 | #define _BootselButton_H 3 | 4 | #include "gpaddon.h" 5 | #include "gamepad.h" 6 | 7 | #ifndef BOOTSEL_BUTTON_ENABLED 8 | #define BOOTSEL_BUTTON_ENABLED 0 9 | #endif 10 | 11 | // BootselButton Module Name 12 | #define BootselButtonName "BootselButton" 13 | 14 | class BootselButtonAddon : public GPAddon { 15 | public: 16 | virtual bool available(); 17 | virtual void setup(); // BootselButton Setup 18 | virtual void process() {} // BootselButton Process 19 | virtual void preprocess(); 20 | virtual std::string name() { return BootselButtonName; } 21 | private: 22 | bool isBootselPressed(); 23 | uint32_t bootselButtonMap; 24 | }; 25 | 26 | #endif // _BootselButton_H_ -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/extra_button.h: -------------------------------------------------------------------------------- 1 | #ifndef _ExtraButton_H 2 | #define _ExtraButton_H 3 | 4 | #include "gpaddon.h" 5 | #include "gamepad.h" 6 | 7 | #ifndef EXTRA_BUTTON_ENABLED 8 | #define EXTRA_BUTTON_ENABLED 0 9 | #endif 10 | 11 | // ExtraButton Module Name 12 | #define ExtraButtonName "ExtraButton" 13 | 14 | class ExtraButtonAddon : public GPAddon { 15 | public: 16 | virtual bool available(); 17 | virtual void setup(); // ExtraButton Setup 18 | virtual void process() {} // ExtraButton Process 19 | virtual void preprocess(); 20 | virtual std::string name() { return ExtraButtonName; } 21 | private: 22 | uint32_t extraButtonMap; 23 | uint8_t extraButtonPin; 24 | }; 25 | 26 | #endif // _ExtraButton_H_ -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/i2canalog1219.h: -------------------------------------------------------------------------------- 1 | #ifndef _I2CAnalog_H 2 | #define _I2CAnalog_H 3 | 4 | #include 5 | 6 | #include "gpaddon.h" 7 | 8 | #include "GamepadEnums.h" 9 | 10 | #ifndef I2C_ANALOG1219_ENABLED 11 | #define I2C_ANALOG1219_ENABLED 0 12 | #endif 13 | 14 | #ifndef I2C_ANALOG1219_SDA_PIN 15 | #define I2C_ANALOG1219_SDA_PIN -1 16 | #endif 17 | 18 | #ifndef I2C_ANALOG1219_SCL_PIN 19 | #define I2C_ANALOG1219_SCL_PIN -1 20 | #endif 21 | 22 | #ifndef I2C_ANALOG1219_BLOCK 23 | #define I2C_ANALOG1219_BLOCK i2c0 24 | #endif 25 | 26 | #ifndef I2C_ANALOG1219_SPEED 27 | #define I2C_ANALOG1219_SPEED 400000 28 | #endif 29 | 30 | #ifndef I2C_ANALOG1219_ADDRESS 31 | #define I2C_ANALOG1219_ADDRESS 0x40 32 | #endif 33 | 34 | // Analog Module Name 35 | #define I2CAnalog1219Name "I2CAnalog" 36 | 37 | typedef struct { 38 | float A[4]; 39 | } ADS_PINS; 40 | 41 | class I2CAnalog1219Input : public GPAddon { 42 | public: 43 | virtual bool available(); 44 | virtual void setup(); // Analog Setup 45 | virtual void preprocess() {} 46 | virtual void process(); // Analog Process 47 | virtual std::string name() { return I2CAnalog1219Name; } 48 | private: 49 | ADS1219 * ads; 50 | ADS_PINS pins; 51 | int channelHop; 52 | uint32_t uIntervalMS; // ADS1219 Interval 53 | uint32_t nextTimer; // Turbo Timer 54 | }; 55 | 56 | #endif // _I2CAnalog_H_ 57 | -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/jslider.h: -------------------------------------------------------------------------------- 1 | #ifndef _JSlider_H 2 | #define _JSlider_H 3 | 4 | #include "gpaddon.h" 5 | 6 | #include "GamepadEnums.h" 7 | 8 | #ifndef JSLIDER_ENABLED 9 | #define JSLIDER_ENABLED 0 10 | #endif 11 | 12 | #ifndef PIN_SLIDER_LS 13 | #define PIN_SLIDER_LS -1 14 | #endif 15 | 16 | #ifndef PIN_SLIDER_RS 17 | #define PIN_SLIDER_RS -1 18 | #endif 19 | 20 | // JSlider Module Name 21 | #define JSliderName "JSlider" 22 | 23 | class JSliderInput : public GPAddon { 24 | public: 25 | virtual bool available(); 26 | virtual void setup(); // JSlider Button Setup 27 | virtual void preprocess() {} 28 | virtual void process(); // JSlider process 29 | virtual std::string name() { return JSliderName; } 30 | private: 31 | DpadMode read(); 32 | void debounce(); 33 | DpadMode dpadState; // Saved locally for debounce 34 | DpadMode dDebState; // Debounce JSlider State 35 | uint32_t uDebTime; // Debounce JSlider Time 36 | uint8_t pinSliderLS; 37 | uint8_t pinSliderRS; 38 | }; 39 | 40 | #endif // _JSlider_H_ -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/playernum.h: -------------------------------------------------------------------------------- 1 | #ifndef _PlayerNum_H 2 | #define _PlayerNum_H 3 | 4 | #include "gpaddon.h" 5 | 6 | #include "GamepadEnums.h" 7 | 8 | #include "BoardConfig.h" 9 | 10 | #ifndef PLAYERNUM_ADDON_ENABLED 11 | #define PLAYERNUM_ADDON_ENABLED 0 12 | #endif 13 | 14 | #ifndef PLAYER_NUMBER 15 | #define PLAYER_NUMBER 1 16 | #endif 17 | 18 | // Analog Module Name 19 | #define PlayerNumName "PlayerNum" 20 | 21 | class PlayerNumAddon : public GPAddon { 22 | public: 23 | virtual bool available(); 24 | virtual void setup(); // Analog Setup 25 | virtual void process(); // Analog Process 26 | virtual void preprocess() {} 27 | virtual std::string name() { return PlayerNumName; } 28 | private: 29 | void handleLED(int); 30 | uint8_t assigned; 31 | uint8_t playerNum; 32 | uint8_t xinputIDs[4]; 33 | }; 34 | 35 | #endif // _PlayerNum_H -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/pleds.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #ifndef _PLEDS_H_ 7 | #define _PLEDS_H_ 8 | 9 | #include "BoardConfig.h" 10 | #include 11 | #include "AnimationStation.hpp" 12 | #include "PlayerLEDs.h" 13 | #include "gpaddon.h" 14 | #include "helper.h" 15 | 16 | // This needs to be moved to storage if we're going to share between modules 17 | extern NeoPico *neopico; 18 | extern AnimationStation as; 19 | 20 | class PWMPlayerLEDs : public PlayerLEDs 21 | { 22 | public: 23 | void setup(); 24 | void display(); 25 | }; 26 | 27 | // Player LED Module 28 | #define PLEDName "PLED" 29 | 30 | // Player LED Module 31 | class PlayerLEDAddon : public GPAddon 32 | { 33 | public: 34 | virtual bool available(); 35 | virtual void setup(); 36 | virtual void preprocess() {} 37 | virtual void process(); 38 | virtual std::string name() { return PLEDName; } 39 | PlayerLEDAddon() : type(PLED_TYPE) {} 40 | PlayerLEDAddon(PLEDType type) : type(type) {} 41 | 42 | protected: 43 | PLEDType type; 44 | PWMPlayerLEDs *pwmLEDs = nullptr; 45 | PLEDAnimationState animationState; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/ps4mode.h: -------------------------------------------------------------------------------- 1 | #ifndef PS4MODE_H_ 2 | #define PS4MODE_H_ 3 | 4 | #include "gpaddon.h" 5 | #include "storagemanager.h" 6 | 7 | #ifndef PS4MODE_ADDON_ENABLED 8 | #define PS4MODE_ADDON_ENABLED 0 9 | #endif 10 | 11 | // Turbo Module Name 12 | #define PS4ModeName "PS4Mode" 13 | 14 | class PS4ModeAddon : public GPAddon { 15 | public: 16 | virtual bool available(); 17 | virtual void setup(); // TURBO Button Setup 18 | virtual void preprocess() {} 19 | virtual void process(); // TURBO Setting of buttons (Enable/Disable) 20 | virtual std::string name() { return PS4ModeName; } 21 | private: 22 | struct mbedtls_rsa_context rsa_context; 23 | uint8_t hashed_nonce[32]; 24 | PS4Options ps4Options; 25 | }; 26 | 27 | #endif // PS4MODE_H_ 28 | -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/reverse.h: -------------------------------------------------------------------------------- 1 | #ifndef _Reverse_H 2 | #define _Reverse_H 3 | 4 | #include "gpaddon.h" 5 | 6 | #include "GamepadEnums.h" 7 | 8 | #ifndef REVERSE_ENABLED 9 | #define REVERSE_ENABLED 0 10 | #endif 11 | 12 | #ifndef PIN_REVERSE 13 | #define PIN_REVERSE -1 14 | #endif 15 | 16 | // Reverse Module Name 17 | #define ReverseName "Input Reverse" 18 | 19 | class ReverseInput : public GPAddon { 20 | public: 21 | virtual bool available(); 22 | virtual void setup(); // Reverse Button Setup 23 | virtual void preprocess() {} 24 | virtual void process(); // Reverse process 25 | virtual std::string name() { return ReverseName; } 26 | private: 27 | void update(); 28 | uint8_t input(uint8_t valueMask, uint16_t buttonMask, uint16_t buttonMaskReverse, uint8_t action, bool invertAxis); 29 | 30 | bool state; 31 | 32 | uint8_t pinLED; 33 | 34 | GamepadButtonMapping *mapDpadUp; 35 | GamepadButtonMapping *mapDpadDown; 36 | GamepadButtonMapping *mapDpadLeft; 37 | GamepadButtonMapping *mapDpadRight; 38 | 39 | bool invertXAxis; 40 | bool invertYAxis; 41 | 42 | // 0 - Ignore, 1 - Enabled, 2 - Neutral 43 | uint8_t actionUp; 44 | uint8_t actionDown; 45 | uint8_t actionLeft; 46 | uint8_t actionRight; 47 | 48 | uint8_t pinButtonReverse; 49 | }; 50 | 51 | #endif // _Reverse_H_ -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/slider_socd.h: -------------------------------------------------------------------------------- 1 | #ifndef _SliderSOCD_H 2 | #define _SliderSOCD_H 3 | 4 | #include "gpaddon.h" 5 | 6 | #include "GamepadEnums.h" 7 | 8 | #ifndef SLIDER_SOCD_ENABLED 9 | #define SLIDER_SOCD_ENABLED 0 10 | #endif 11 | 12 | #ifndef PIN_SLIDER_SOCD_ONE 13 | #define PIN_SLIDER_SOCD_ONE -1 14 | #endif 15 | 16 | #ifndef PIN_SLIDER_SOCD_TWO 17 | #define PIN_SLIDER_SOCD_TWO -1 18 | #endif 19 | 20 | #ifndef SLIDER_SOCD_SLOT_ONE 21 | #define SLIDER_SOCD_SLOT_ONE SOCD_MODE_UP_PRIORITY 22 | #endif 23 | 24 | #ifndef SLIDER_SOCD_SLOT_TWO 25 | #define SLIDER_SOCD_SLOT_TWO SOCD_MODE_SECOND_INPUT_PRIORITY 26 | #endif 27 | 28 | #ifndef SLIDER_SOCD_SLOT_DEFAULT 29 | #define SLIDER_SOCD_SLOT_DEFAULT SOCD_MODE_NEUTRAL 30 | #endif 31 | 32 | // Slider Module Name 33 | #define SliderSOCDName "SliderSOCD" 34 | 35 | class SliderSOCDInput : public GPAddon { 36 | public: 37 | virtual bool available(); 38 | virtual void setup(); // SliderSOCD Button Setup 39 | virtual void preprocess() {} 40 | virtual void process(); // SliderSOCD process 41 | virtual std::string name() { return SliderSOCDName; } 42 | private: 43 | SOCDMode read(); 44 | void debounce(); 45 | SOCDMode socdState; // Saved locally for debounce 46 | SOCDMode dDebState; // Debounce SliderSOCD State 47 | uint32_t uDebTime; // Debounce SliderSOCD Time 48 | SOCDMode sliderSOCDModeOne; 49 | SOCDMode sliderSOCDModeTwo; 50 | SOCDMode sliderSOCDModeDefault; 51 | uint8_t pinSliderSOCDOne; 52 | uint8_t pinSliderSOCDTwo; 53 | }; 54 | 55 | #endif // _SliderSOCD_H_ -------------------------------------------------------------------------------- /GP2040-CE/headers/addons/wiiext.h: -------------------------------------------------------------------------------- 1 | #ifndef _WIIExtensionAddon_H 2 | #define _WIIExtensionAddon_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "BoardConfig.h" 8 | #include "gpaddon.h" 9 | #include "gamepad.h" 10 | #include "storagemanager.h" 11 | #include "WiiExtension.h" 12 | 13 | // WiiExtension Module Name 14 | #define WiiExtensionName "WiiExtension" 15 | 16 | #ifndef WII_EXTENSION_ENABLED 17 | #define WII_EXTENSION_ENABLED 0 18 | #endif 19 | 20 | #ifndef WII_EXTENSION_I2C_ADDR 21 | #define WII_EXTENSION_I2C_ADDR 0x52 22 | #endif 23 | 24 | #ifndef WII_EXTENSION_I2C_SDA_PIN 25 | #define WII_EXTENSION_I2C_SDA_PIN -1 26 | #endif 27 | 28 | #ifndef WII_EXTENSION_I2C_SCL_PIN 29 | #define WII_EXTENSION_I2C_SCL_PIN -1 30 | #endif 31 | 32 | #ifndef WII_EXTENSION_I2C_BLOCK 33 | #define WII_EXTENSION_I2C_BLOCK i2c0 34 | #endif 35 | 36 | #ifndef WII_EXTENSION_I2C_SPEED 37 | #define WII_EXTENSION_I2C_SPEED 400000 38 | #endif 39 | 40 | class WiiExtensionInput : public GPAddon { 41 | public: 42 | virtual bool available(); 43 | virtual void setup(); // WiiExtension Setup 44 | virtual void process(); // WiiExtension Process 45 | virtual void preprocess() {} 46 | virtual std::string name() { return WiiExtensionName; } 47 | private: 48 | WiiExtension * wii; 49 | uint32_t uIntervalMS; 50 | uint32_t nextTimer; 51 | 52 | bool buttonC = false; 53 | bool buttonZ = false; 54 | 55 | bool buttonA = false; 56 | bool buttonB = false; 57 | bool buttonX = false; 58 | bool buttonY = false; 59 | bool buttonL = false; 60 | bool buttonZL = false; 61 | bool buttonR = false; 62 | bool buttonZR = false; 63 | 64 | bool buttonSelect = false; 65 | bool buttonStart = false; 66 | bool buttonHome = false; 67 | 68 | bool dpadUp = false; 69 | bool dpadDown = false; 70 | bool dpadLeft = false; 71 | bool dpadRight = false; 72 | 73 | uint16_t triggerLeft = 0; 74 | uint16_t triggerRight = 0; 75 | uint16_t whammyBar = 0; 76 | 77 | uint16_t leftX = 0; 78 | uint16_t leftY = 0; 79 | uint16_t rightX = 0; 80 | uint16_t rightY = 0; 81 | 82 | uint16_t map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max); 83 | }; 84 | 85 | #endif // _WIIExtensionAddon_H 86 | -------------------------------------------------------------------------------- /GP2040-CE/headers/configmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONFIG_H_ 2 | #define _CONFIG_H_ 3 | 4 | #include "enums.h" 5 | #include "gpconfig.h" 6 | #include "storagemanager.h" 7 | 8 | class ConfigManager { 9 | public: 10 | ConfigManager(ConfigManager const&) = delete; 11 | void operator=(ConfigManager const&) = delete; 12 | static ConfigManager& getInstance() {// Thread-safe storage ensures cross-thread talk 13 | static ConfigManager instance; // Guaranteed to be destroyed. // Instantiated on first use. 14 | return instance; 15 | } 16 | void setup(ConfigType); 17 | void loop(); // If anything needs to update in the gpconfig driver 18 | void setGamepadOptions(Gamepad*); 19 | void setBoardOptions(BoardOptions); 20 | void setPreviewBoardOptions(BoardOptions); 21 | void setLedOptions(LEDOptions); 22 | void setSplashImage(const SplashImage&); 23 | private: 24 | ConfigManager() {} 25 | void setupConfig(GPConfig*); 26 | ConfigType cType; 27 | GPConfig * config; 28 | }; 29 | 30 | #endif -------------------------------------------------------------------------------- /GP2040-CE/headers/configs/displayconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISPLAYCONFIG_H_ 2 | #define _DISPLAYCONFIG_H_ 3 | 4 | #include "gpconfig.h" 5 | 6 | #include 7 | 8 | class DisplayState { 9 | public: 10 | private: 11 | std::vector options; 12 | }; 13 | 14 | class DisplayMenu { 15 | public: 16 | 17 | private: 18 | }; 19 | 20 | class DisplayConfig : public GPConfig 21 | { 22 | public: 23 | virtual void setup(); 24 | virtual void loop(); 25 | private: 26 | std::vector menu_data; 27 | }; 28 | 29 | #endif -------------------------------------------------------------------------------- /GP2040-CE/headers/configs/serialconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _SERIALCONFIG_H_ 2 | #define _SERIALCONFIG_H_ 3 | 4 | #include "gpconfig.h" 5 | 6 | class SerialConfig : public GPConfig 7 | { 8 | public: 9 | virtual void setup(); 10 | virtual void loop(); 11 | private: 12 | }; 13 | 14 | #endif -------------------------------------------------------------------------------- /GP2040-CE/headers/configs/webconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _WEBCONFIG_H_ 2 | #define _WEBCONFIG_H_ 3 | 4 | #include "gpconfig.h" 5 | 6 | class WebConfig : public GPConfig 7 | { 8 | public: 9 | virtual void setup(); 10 | virtual void loop(); 11 | 12 | enum BootModes { 13 | GAMEPAD, 14 | WEBCONFIG, 15 | BOOTSEL 16 | }; 17 | private: 18 | }; 19 | 20 | #endif -------------------------------------------------------------------------------- /GP2040-CE/headers/enums.h: -------------------------------------------------------------------------------- 1 | #ifndef _ENUMS_H_ 2 | #define _ENUMS_H_ 3 | 4 | typedef enum 5 | { 6 | BUTTON_LAYOUT_STICK, 7 | BUTTON_LAYOUT_STICKLESS, 8 | BUTTON_LAYOUT_BUTTONS_ANGLED, 9 | BUTTON_LAYOUT_BUTTONS_BASIC, 10 | BUTTON_LAYOUT_KEYBOARD_ANGLED, 11 | BUTTON_LAYOUT_KEYBOARDA, 12 | BUTTON_LAYOUT_DANCEPADA, 13 | BUTTON_LAYOUT_TWINSTICKA, 14 | BUTTON_LAYOUT_BLANKA, 15 | BUTTON_LAYOUT_VLXA, 16 | BUTTON_LAYOUT_FIGHTBOARD_STICK, 17 | BUTTON_LAYOUT_FIGHTBOARD_MIRRORED, 18 | BUTTON_LAYOUT_CUSTOMA, 19 | } ButtonLayout; 20 | 21 | typedef enum 22 | { 23 | BUTTON_LAYOUT_ARCADE, 24 | BUTTON_LAYOUT_STICKLESSB, 25 | BUTTON_LAYOUT_BUTTONS_ANGLEDB, 26 | BUTTON_LAYOUT_VEWLIX, 27 | BUTTON_LAYOUT_VEWLIX7, 28 | BUTTON_LAYOUT_CAPCOM, 29 | BUTTON_LAYOUT_CAPCOM6, 30 | BUTTON_LAYOUT_SEGA2P, 31 | BUTTON_LAYOUT_NOIR8, 32 | BUTTON_LAYOUT_KEYBOARDB, 33 | BUTTON_LAYOUT_DANCEPADB, 34 | BUTTON_LAYOUT_TWINSTICKB, 35 | BUTTON_LAYOUT_BLANKB, 36 | BUTTON_LAYOUT_VLXB, 37 | BUTTON_LAYOUT_FIGHTBOARD, 38 | BUTTON_LAYOUT_FIGHTBOARD_STICK_MIRRORED, 39 | BUTTON_LAYOUT_CUSTOMB, 40 | } ButtonLayoutRight; 41 | 42 | typedef enum 43 | { 44 | STATICSPLASH, 45 | CLOSEIN, 46 | CLOSEINCUSTOM, 47 | NOSPLASH, 48 | } SplashMode; 49 | 50 | typedef enum 51 | { 52 | MAIN, 53 | X, 54 | Y, 55 | Z, 56 | CUSTOM, 57 | LEGACY 58 | } SplashChoice; 59 | 60 | typedef enum 61 | { 62 | BOARD_LED_OFF, 63 | MODE_INDICATOR, 64 | INPUT_TEST 65 | } OnBoardLedMode; 66 | 67 | typedef enum 68 | { 69 | CONFIG_TYPE_WEB = 0, 70 | CONFIG_TYPE_SERIAL, 71 | CONFIG_TYPE_DISPLAY 72 | } ConfigType; 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gamepad/GamepadConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #pragma once 7 | 8 | #ifndef DEFAULT_SOCD_MODE 9 | #define DEFAULT_SOCD_MODE SOCD_MODE_NEUTRAL 10 | #endif 11 | 12 | #ifndef DEFAULT_DPAD_MODE 13 | #define DEFAULT_DPAD_MODE DPAD_MODE_DIGITAL 14 | #endif 15 | 16 | #ifndef DEFAULT_INPUT_MODE 17 | #define DEFAULT_INPUT_MODE INPUT_MODE_XINPUT 18 | #endif 19 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gamepad/GamepadDebouncer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include "GamepadState.h" 11 | 12 | // Implement this wrapper function for your platform 13 | // TODO: Make this a pure virtual member instead. 14 | uint32_t getMillis(); 15 | 16 | class GamepadDebouncer 17 | { 18 | public: 19 | GamepadDebouncer(const uint8_t debounceMS = 5) : debounceMS(debounceMS) { } 20 | 21 | void debounce(GamepadState *state); 22 | 23 | const uint8_t debounceMS; 24 | GamepadState debounceState; 25 | uint32_t dpadTime[4]; 26 | uint32_t buttonTime[GAMEPAD_BUTTON_COUNT]; 27 | }; 28 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gamepad/GamepadEnums.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #pragma once 7 | 8 | // The available input modes 9 | // TODO: Think about making enums "class enum" instead. This will keep them out of the global namespace 10 | // and provide strong type assurance instead of being treated as ints. Also, modern c++ would tend towards 11 | // using Pascal-case naming for the individual declarations. 12 | typedef enum 13 | { 14 | INPUT_MODE_XINPUT, 15 | INPUT_MODE_SWITCH, 16 | INPUT_MODE_HID, 17 | INPUT_MODE_KEYBOARD, 18 | INPUT_MODE_PS4, 19 | INPUT_MODE_CONFIG = 255, 20 | } InputMode; 21 | 22 | // The available stick emulation modes 23 | typedef enum 24 | { 25 | DPAD_MODE_DIGITAL, 26 | DPAD_MODE_LEFT_ANALOG, 27 | DPAD_MODE_RIGHT_ANALOG, 28 | } DpadMode; 29 | 30 | // The available SOCD cleaning methods 31 | typedef enum 32 | { 33 | SOCD_MODE_UP_PRIORITY, // U+D=U, L+R=N 34 | SOCD_MODE_NEUTRAL, // U+D=N, L+R=N 35 | SOCD_MODE_SECOND_INPUT_PRIORITY, // U>D=D, L>R=R (Last Input Priority, aka Last Win) 36 | SOCD_MODE_FIRST_INPUT_PRIORITY, // U>D=U, L>R=L (First Input Priority, aka First Win) 37 | SOCD_MODE_BYPASS, // U+D=UD, L+R=LR (No cleaning applied) 38 | } SOCDMode; 39 | 40 | // Enum for tracking last direction state of Second Input SOCD method 41 | typedef enum 42 | { 43 | DIRECTION_NONE, 44 | DIRECTION_UP, 45 | DIRECTION_DOWN, 46 | DIRECTION_LEFT, 47 | DIRECTION_RIGHT 48 | } DpadDirection; 49 | 50 | // The available hotkey actions 51 | typedef enum 52 | { 53 | HOTKEY_NONE, 54 | HOTKEY_DPAD_DIGITAL, 55 | HOTKEY_DPAD_LEFT_ANALOG, 56 | HOTKEY_DPAD_RIGHT_ANALOG, 57 | HOTKEY_HOME_BUTTON, 58 | HOTKEY_CAPTURE_BUTTON, 59 | HOTKEY_SOCD_UP_PRIORITY, 60 | HOTKEY_SOCD_NEUTRAL, 61 | HOTKEY_SOCD_LAST_INPUT, 62 | HOTKEY_INVERT_X_AXIS, 63 | HOTKEY_INVERT_Y_AXIS, 64 | HOTKEY_SOCD_FIRST_INPUT, 65 | HOTKEY_SOCD_BYPASS 66 | } GamepadHotkey; 67 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gamepad/GamepadOptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "GamepadEnums.h" 10 | 11 | typedef struct 12 | { 13 | uint8_t dpadMask; 14 | GamepadHotkey action; 15 | } GamepadHotkeyEntry; 16 | 17 | struct GamepadOptions 18 | { 19 | InputMode inputMode {InputMode::INPUT_MODE_XINPUT}; 20 | DpadMode dpadMode {DpadMode::DPAD_MODE_DIGITAL}; 21 | SOCDMode socdMode {SOCDMode::SOCD_MODE_NEUTRAL}; 22 | bool invertXAxis; 23 | bool invertYAxis; 24 | 25 | uint8_t keyDpadUp; 26 | uint8_t keyDpadDown; 27 | uint8_t keyDpadLeft; 28 | uint8_t keyDpadRight; 29 | uint8_t keyButtonB1; 30 | uint8_t keyButtonB2; 31 | uint8_t keyButtonB3; 32 | uint8_t keyButtonB4; 33 | uint8_t keyButtonL1; 34 | uint8_t keyButtonR1; 35 | uint8_t keyButtonL2; 36 | uint8_t keyButtonR2; 37 | uint8_t keyButtonS1; 38 | uint8_t keyButtonS2; 39 | uint8_t keyButtonL3; 40 | uint8_t keyButtonR3; 41 | uint8_t keyButtonA1; 42 | uint8_t keyButtonA2; 43 | 44 | GamepadHotkeyEntry hotkeyF1Up; 45 | GamepadHotkeyEntry hotkeyF1Down; 46 | GamepadHotkeyEntry hotkeyF1Left; 47 | GamepadHotkeyEntry hotkeyF1Right; 48 | GamepadHotkeyEntry hotkeyF2Up; 49 | GamepadHotkeyEntry hotkeyF2Down; 50 | GamepadHotkeyEntry hotkeyF2Left; 51 | GamepadHotkeyEntry hotkeyF2Right; 52 | 53 | uint32_t checksum; 54 | }; 55 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gamepad/GamepadStorage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #include "GamepadOptions.h" 11 | 12 | #define STORAGE_FIRST_AVAILBLE_INDEX 2048 13 | 14 | class GamepadStorage 15 | { 16 | public: 17 | virtual void start(); // TODO: Should be pure virtual. 18 | virtual void save(); // TODO: Should be pure virtual. 19 | 20 | GamepadOptions getGamepadOptions(); 21 | void setGamepadOptions(GamepadOptions options); 22 | }; 23 | 24 | static GamepadStorage GamepadStore; 25 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gamepad/descriptors/MouseDescriptors.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/headers/gamepad/descriptors/MouseDescriptors.h -------------------------------------------------------------------------------- /GP2040-CE/headers/gba/GBAKey.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum GBAKey : uint32_t { 4 | A = 1 << 0, 5 | B = 1 << 1, 6 | SELECT = 1 << 2, 7 | START = 1 << 3, 8 | RIGHT = 1 << 4, 9 | LEFT = 1 << 5, 10 | UP = 1 << 6, 11 | DOWN = 1 << 7, 12 | R = 1 << 8, 13 | L = 1 << 9 14 | }; 15 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gba/multiboot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: CC0-1.0 3 | * 4 | * This is a port of `gba_03_multiboot` to the RPi Pico. 5 | * https://github.com/akkera102/gba_03_multiboot 6 | */ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | namespace gba 13 | { 14 | 15 | /// @return `true` if ROM is sent 16 | /// @return `false` if GBA program is already running, and only `Start` is pressed on it 17 | bool sendGBARom(const uint8_t* romAddr, uint32_t romSize); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gba/spi32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: CC0-1.0 3 | */ 4 | 5 | #pragma once 6 | 7 | // Pico SPI 8 | #include "hardware/spi.h" 9 | 10 | namespace gba 11 | { 12 | 13 | uint32_t swapByte32(uint32_t val); 14 | 15 | void initSpi32(); 16 | void deinitSpi32(); 17 | uint32_t spi32(uint32_t val); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gp2040.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #ifndef GP2040_H_ 7 | #define GP2040_H_ 8 | 9 | // GP2040 Classes 10 | #include "gamepad.h" 11 | #include "addonmanager.h" 12 | 13 | #include "pico/types.h" 14 | 15 | class GP2040 { 16 | public: 17 | GP2040(); 18 | ~GP2040(); 19 | void setup(); // setup core0 20 | void run(); // loop core0 21 | private: 22 | uint64_t nextRuntime; 23 | Gamepad snapshot; 24 | AddonManager addons; 25 | 26 | struct WebConfigHotkey { 27 | WebConfigHotkey(); 28 | void process(Gamepad* gamepad, bool configMode); 29 | 30 | bool active; 31 | 32 | absolute_time_t noButtonsPressedTimeout; 33 | uint16_t webConfigHotkeyMask; 34 | absolute_time_t webConfigHotkeyHoldTimeout; 35 | }; 36 | WebConfigHotkey webConfigHotkey; 37 | 38 | enum class BootAction { 39 | NONE, 40 | ENTER_WEBCONFIG_MODE, 41 | ENTER_USB_MODE, 42 | SET_INPUT_MODE_HID, 43 | SET_INPUT_MODE_SWITCH, 44 | SET_INPUT_MODE_XINPUT, 45 | SET_INPUT_MODE_KEYBOARD, 46 | SET_INPUT_MODE_PS4 47 | }; 48 | static BootAction getBootAction(); 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gp2040aux.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #ifndef GP2040CORE1_H_ 7 | #define GP2040CORE1_H_ 8 | 9 | #include 10 | 11 | #include "gpaddon.h" 12 | #include "addonmanager.h" 13 | 14 | class GP2040Aux { 15 | public: 16 | GP2040Aux(); 17 | ~GP2040Aux(); 18 | void setup(); // setup core1 19 | void run(); // loop core1 20 | private: 21 | uint64_t nextRuntime; 22 | AddonManager addons; 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /GP2040-CE/headers/gpaddon.h: -------------------------------------------------------------------------------- 1 | #ifndef _GPAddon_H_ 2 | #define _GPAddon_H_ 3 | 4 | #include "gamepad.h" 5 | 6 | #include 7 | 8 | class GPAddon 9 | { 10 | public: 11 | virtual bool available() = 0; 12 | virtual void setup() = 0; 13 | virtual void process() = 0; 14 | virtual void preprocess() = 0; 15 | virtual std::string name() = 0; 16 | }; 17 | 18 | #endif -------------------------------------------------------------------------------- /GP2040-CE/headers/gpconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _GPCONFIG_H_ 2 | #define _GPCONFIG_H_ 3 | 4 | class GPConfig { 5 | public: 6 | virtual void setup() = 0; 7 | virtual void loop() = 0; 8 | private: 9 | }; 10 | 11 | #endif -------------------------------------------------------------------------------- /GP2040-CE/headers/helper.h: -------------------------------------------------------------------------------- 1 | #ifndef _HELPER_H_ 2 | #define _HELPER_H_ 3 | 4 | #include "pico/time.h" 5 | #include 6 | 7 | #include "BoardConfig.h" 8 | #include 9 | #include "AnimationStation.hpp" 10 | #include "PlayerLEDs.h" 11 | #include "xinput_driver.h" 12 | 13 | // GP2040-CE Version (32 character limit) 14 | #define GP2040VERSION "v0.7.1" 15 | 16 | const std::string BUTTON_LABEL_UP = "Up"; 17 | const std::string BUTTON_LABEL_DOWN = "Down"; 18 | const std::string BUTTON_LABEL_LEFT = "Left"; 19 | const std::string BUTTON_LABEL_RIGHT = "Right"; 20 | const std::string BUTTON_LABEL_B1 = "B1"; 21 | const std::string BUTTON_LABEL_B2 = "B2"; 22 | const std::string BUTTON_LABEL_B3 = "B3"; 23 | const std::string BUTTON_LABEL_B4 = "B4"; 24 | const std::string BUTTON_LABEL_L1 = "L1"; 25 | const std::string BUTTON_LABEL_R1 = "R1"; 26 | const std::string BUTTON_LABEL_L2 = "L2"; 27 | const std::string BUTTON_LABEL_R2 = "R2"; 28 | const std::string BUTTON_LABEL_S1 = "S1"; 29 | const std::string BUTTON_LABEL_S2 = "S2"; 30 | const std::string BUTTON_LABEL_L3 = "L3"; 31 | const std::string BUTTON_LABEL_R3 = "R3"; 32 | const std::string BUTTON_LABEL_A1 = "A1"; 33 | const std::string BUTTON_LABEL_A2 = "A2"; 34 | 35 | #define PLED_REPORT_SIZE 32 36 | 37 | #ifndef PLED1_PIN 38 | #define PLED1_PIN -1 39 | #endif 40 | #ifndef PLED2_PIN 41 | #define PLED2_PIN -1 42 | #endif 43 | #ifndef PLED3_PIN 44 | #define PLED3_PIN -1 45 | #endif 46 | #ifndef PLED4_PIN 47 | #define PLED4_PIN -1 48 | #endif 49 | #ifndef PLED_TYPE 50 | #define PLED_TYPE PLED_TYPE_NONE 51 | #endif 52 | 53 | #define PLED_MASK_ALL ((1U << PLED1_PIN) | (1U << PLED2_PIN) | (1U << PLED3_PIN) | (1U << PLED4_PIN)) 54 | 55 | const int PLED_PINS[] = {PLED1_PIN, PLED2_PIN, PLED3_PIN, PLED4_PIN}; 56 | 57 | #endif -------------------------------------------------------------------------------- /GP2040-CE/headers/mbedtls_config.h: -------------------------------------------------------------------------------- 1 | /* This can be enabled lated when we use SNTP */ 2 | #undef MBEDTLS_HAVE_TIME_DATE 3 | 4 | #define MBEDTLS_CHECK_PARAMS 5 | #define MBEDTLS_CHECK_PARAMS_ASSERT 6 | #define MBEDTLS_ENTROPY_HARDWARE_ALT 7 | #define MBEDTLS_AES_ROM_TABLES 8 | #define MBEDTLS_AES_FEWER_TABLES 9 | #define MBEDTLS_CAMELLIA_SMALL_MEMORY 10 | #define MBEDTLS_CHECK_RETURN_WARNING 11 | #undef MBEDTLS_FS_IO 12 | #define MBEDTLS_NO_PLATFORM_ENTROPY 13 | #define MBEDTLS_PSA_CRYPTO_CLIENT 14 | #define MBEDTLS_PSA_CRYPTO_DRIVERS 15 | #define MBEDTLS_SHA256_C 16 | #define MBEDTLS_RSA_C 17 | #define MBEDTLS_X509_RSASSA_PSS_SUPPORT 18 | #define MBEDTLS_PKCS1_V21 19 | #define MBEDTLS_BIGNUM_C 20 | #define MBEDTLS_MD_C 21 | #define MBEDTLS_SSL_ASYNC_PRIVATE 22 | #define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH 23 | #define MBEDTLS_USE_PSA_CRYPTO 24 | #undef MBEDTLS_NET_C 25 | #undef MBEDTLS_PSA_CRYPTO_STORAGE_C 26 | #undef MBEDTLS_PSA_ITS_FILE_C 27 | #undef MBEDTLS_TIMING_C 28 | -------------------------------------------------------------------------------- /GP2040-CE/headers/songs.h: -------------------------------------------------------------------------------- 1 | #ifndef SONGS_H_ 2 | #define SONGS_H_ 3 | 4 | #include "addons/buzzerspeaker.h" 5 | 6 | // Intro example 7 | Song introSong{ 8 | 100, 9 | { 10 | D5, 11 | AS5, 12 | B5, 13 | C6, 14 | CS6, 15 | D6, 16 | DS6, 17 | E6, 18 | C7, 19 | CS7, 20 | D7, 21 | DS7, 22 | E7, 23 | F7, 24 | D8, 25 | DS8, 26 | } 27 | }; 28 | 29 | Song configModeSong{ 30 | 150, 31 | { 32 | E5, 33 | E5, 34 | G4, 35 | FS5, 36 | E5 37 | } 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /GP2040-CE/headers/system.h: -------------------------------------------------------------------------------- 1 | #ifndef SYSTEM_H_ 2 | #define SYSTEM_H_ 3 | 4 | #include 5 | 6 | namespace System { 7 | // Returns the size of on-board flash memory in bytes 8 | uint32_t getTotalFlash(); 9 | // Returns the amount of on-board flash memory used by the firmware in bytes 10 | uint32_t getUsedFlash(); 11 | // Returns the amount of memory used for static allocations in bytes 12 | uint32_t getStaticAllocs(); 13 | // Returns the total size of heap memory in bytes 14 | uint32_t getTotalHeap(); 15 | // Returns the about of heap memory currently allocated in bytes 16 | uint32_t getUsedHeap(); 17 | 18 | enum class BootMode : uint32_t { 19 | DEFAULT = 0, 20 | GAMEPAD = 0x43d566cd, 21 | WEBCONFIG = 0xe77784a5, 22 | USB = 0xf737e4e1, 23 | }; 24 | 25 | // Reboots the device and places the supplied BootMode value in a watchdog scratch register 26 | // This value can be retrieved after reboot by client code, which can then take the required actions 27 | void reboot(BootMode bootMode); 28 | // Retrieves the BootMode value from the watchdog scratch register and resets its value to BootMode::DEFAULT 29 | BootMode takeBootMode(); 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /GP2040-CE/lib/ADS1219/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(ADS1219 ADS1219.cpp) 2 | target_link_libraries(ADS1219 PUBLIC BitBang_I2C) 3 | target_include_directories(ADS1219 INTERFACE .) 4 | target_include_directories(ADS1219 PUBLIC 5 | BitBang_I2C 6 | ) 7 | -------------------------------------------------------------------------------- /GP2040-CE/lib/ADS1219/README.md: -------------------------------------------------------------------------------- 1 | # ADS1219 2 | # Ported to BitBangI2C 3 | # 4 | # Ported/Written by: 5 | # Luke Arntson 6 | # -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = crlf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | [*.md] 15 | indent_style = space 16 | indent_size = 2 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(AnimationStation 2 | src/Effects/Chase.cpp 3 | src/Effects/CustomTheme.cpp 4 | src/Effects/CustomThemePressed.cpp 5 | src/Effects/Rainbow.cpp 6 | src/Effects/StaticColor.cpp 7 | src/Effects/StaticTheme.cpp 8 | src/AnimationStation.cpp 9 | src/Animation.cpp 10 | ) 11 | target_include_directories(AnimationStation PUBLIC 12 | src 13 | src/Effects 14 | ) 15 | target_link_libraries(AnimationStation PUBLIC 16 | pico_stdlib 17 | hardware_clocks 18 | hardware_timer 19 | NeoPico 20 | ) 21 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AnimationStation", 3 | "version": "0.0.1", 4 | "description": "LED Handling for GP2040", 5 | "keywords": "c c++ baremetal neopixel led", 6 | "authors": [ 7 | { 8 | "name": "Jonathan Barket", 9 | "url": "https://jonathanbarket.com" 10 | } 11 | ], 12 | "license": "MIT" 13 | } 14 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Animation.cpp: -------------------------------------------------------------------------------- 1 | #include "Animation.hpp" 2 | 3 | LEDFormat Animation::format; 4 | 5 | Animation::Animation(PixelMatrix &matrix) : matrix(&matrix) { 6 | } 7 | 8 | void Animation::UpdatePixels(std::vector pixels) { 9 | this->pixels = pixels; 10 | } 11 | 12 | void Animation::ClearPixels() { 13 | this->pixels.clear(); 14 | } 15 | 16 | /* Some of these animations are filtered to specific pixels, such as button press animations. 17 | This somewhat backwards named method determines if a specific pixel is _not_ included in the filter */ 18 | bool Animation::notInFilter(Pixel pixel) { 19 | if (!this->filtered) { 20 | return false; 21 | } 22 | 23 | for (size_t i = 0; i < this->pixels.size(); i++) { 24 | if (pixel == this->pixels.at(i)) { 25 | return false; 26 | } 27 | } 28 | 29 | return true; 30 | } 31 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/AnimationStorage.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _CONFIG_STORAGE_H_ 2 | #define _CONFIG_STORAGE_H_ 3 | 4 | #include "AnimationStation.hpp" 5 | 6 | class AnimationStorage 7 | { 8 | public: 9 | void save(); 10 | 11 | AnimationOptions getAnimationOptions(); 12 | void setAnimationOptions(AnimationOptions options); 13 | }; 14 | 15 | static AnimationStorage AnimationStore; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/Chase.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _CHASE_H_ 2 | #define _CHASE_H_ 3 | 4 | #include "../Animation.hpp" 5 | #include "hardware/clocks.h" 6 | #include 7 | #include 8 | #include 9 | #include "../AnimationStation.hpp" 10 | 11 | class Chase : public Animation { 12 | public: 13 | Chase(PixelMatrix &matrix); 14 | ~Chase() {}; 15 | 16 | void Animate(RGB (&frame)[100]); 17 | void ParameterUp(); 18 | void ParameterDown(); 19 | 20 | protected: 21 | bool IsChasePixel(int i); 22 | int WheelFrame(int i); 23 | int currentFrame = 0; 24 | int currentPixel = 0; 25 | bool reverse = false; 26 | absolute_time_t nextRunTime = nil_time; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/CustomTheme.cpp: -------------------------------------------------------------------------------- 1 | #include "CustomTheme.hpp" 2 | 3 | std::map CustomTheme::theme; 4 | 5 | CustomTheme::CustomTheme(PixelMatrix &matrix) : Animation(matrix) { 6 | 7 | } 8 | 9 | void CustomTheme::Animate(RGB (&frame)[100]) { 10 | for (size_t r = 0; r != matrix->pixels.size(); r++) { 11 | for (size_t c = 0; c != matrix->pixels[r].size(); c++) { 12 | if (matrix->pixels[r][c].index == NO_PIXEL.index) 13 | continue; 14 | 15 | auto itr = theme.find(matrix->pixels[r][c].mask); 16 | if (itr != theme.end()) 17 | for (size_t p = 0; p != matrix->pixels[r][c].positions.size(); p++) 18 | frame[matrix->pixels[r][c].positions[p]] = itr->second; 19 | else 20 | for (size_t p = 0; p != matrix->pixels[r][c].positions.size(); p++) 21 | frame[matrix->pixels[r][c].positions[p]] = defaultColor; 22 | } 23 | } 24 | } 25 | 26 | bool CustomTheme::HasTheme() { 27 | return CustomTheme::theme.size() > 0; 28 | } 29 | 30 | void CustomTheme::SetCustomTheme(std::map customTheme) { 31 | CustomTheme::theme = customTheme; 32 | AnimationStation::effectCount = TOTAL_EFFECTS + 1; 33 | } 34 | 35 | void CustomTheme::ParameterUp() { 36 | 37 | } 38 | 39 | void CustomTheme::ParameterDown() { 40 | 41 | } 42 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/CustomTheme.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CUSTOM_THEME_H_ 2 | #define CUSTOM_THEME_H_ 3 | 4 | #include 5 | #include "../Animation.hpp" 6 | #include "../AnimationStation.hpp" 7 | 8 | class CustomTheme : public Animation { 9 | public: 10 | CustomTheme(PixelMatrix &matrix); 11 | ~CustomTheme() {}; 12 | 13 | static bool HasTheme(); 14 | static void SetCustomTheme(std::map customTheme); 15 | void Animate(RGB (&frame)[100]); 16 | void ParameterUp(); 17 | void ParameterDown(); 18 | protected: 19 | RGB defaultColor = ColorBlack; 20 | static std::map theme; 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/CustomThemePressed.cpp: -------------------------------------------------------------------------------- 1 | #include "CustomThemePressed.hpp" 2 | 3 | std::map CustomThemePressed::theme; 4 | 5 | CustomThemePressed::CustomThemePressed(PixelMatrix &matrix) : Animation(matrix) { 6 | this->filtered = true; 7 | } 8 | 9 | CustomThemePressed::CustomThemePressed(PixelMatrix &matrix, std::vector &pixels) : Animation(matrix), pixels(&pixels) { 10 | this->filtered = true; 11 | } 12 | 13 | void CustomThemePressed::Animate(RGB (&frame)[100]) { 14 | for (size_t r = 0; r != matrix->pixels.size(); r++) { 15 | for (size_t c = 0; c != matrix->pixels[r].size(); c++) { 16 | if (matrix->pixels[r][c].index == NO_PIXEL.index || this->notInFilter(matrix->pixels[r][c])) 17 | continue; 18 | 19 | auto itr = theme.find(matrix->pixels[r][c].mask); 20 | if (itr != theme.end()) 21 | for (size_t p = 0; p != matrix->pixels[r][c].positions.size(); p++) 22 | frame[matrix->pixels[r][c].positions[p]] = itr->second; 23 | else 24 | for (size_t p = 0; p != matrix->pixels[r][c].positions.size(); p++) 25 | frame[matrix->pixels[r][c].positions[p]] = defaultColor; 26 | } 27 | } 28 | } 29 | 30 | bool CustomThemePressed::HasTheme() { 31 | return CustomThemePressed::theme.size() > 0; 32 | } 33 | 34 | void CustomThemePressed::SetCustomTheme(std::map customTheme) { 35 | CustomThemePressed::theme = customTheme; 36 | } 37 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/CustomThemePressed.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _CUSTOM_THEME_PRESSED_H_ 2 | #define _CUSTOM_THEME_PRESSED_H_ 3 | 4 | #include 5 | #include 6 | #include "../Animation.hpp" 7 | #include "../AnimationStation.hpp" 8 | 9 | class CustomThemePressed : public Animation { 10 | public: 11 | CustomThemePressed(PixelMatrix &matrix); 12 | CustomThemePressed(PixelMatrix &matrix, std::vector &pixels); 13 | ~CustomThemePressed() { pixels = nullptr; }; 14 | 15 | static bool HasTheme(); 16 | static void SetCustomTheme(std::map customTheme); 17 | void UpdatePixels(std::vector pixels); 18 | void Animate(RGB (&frame)[100]); 19 | void ParameterUp() { } 20 | void ParameterDown() { } 21 | protected: 22 | std::vector *pixels; 23 | RGB defaultColor = ColorBlack; 24 | static std::map theme; 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/Rainbow.cpp: -------------------------------------------------------------------------------- 1 | #include "Rainbow.hpp" 2 | 3 | Rainbow::Rainbow(PixelMatrix &matrix) : Animation(matrix) { 4 | } 5 | 6 | void Rainbow::Animate(RGB (&frame)[100]) { 7 | if (!time_reached(this->nextRunTime)) { 8 | return; 9 | } 10 | 11 | for (auto &col : matrix->pixels) { 12 | for (auto &pixel : col) { 13 | if (pixel.index == NO_PIXEL.index) 14 | continue; 15 | 16 | RGB color = RGB::wheel(this->currentFrame); 17 | for (auto &pos : pixel.positions) 18 | frame[pos] = color; 19 | } 20 | } 21 | 22 | if (reverse) { 23 | currentFrame--; 24 | 25 | if (currentFrame < 0) { 26 | currentFrame = 1; 27 | reverse = false; 28 | } 29 | } else { 30 | currentFrame++; 31 | 32 | if (currentFrame > 255) { 33 | currentFrame = 254; 34 | reverse = true; 35 | } 36 | } 37 | 38 | this->nextRunTime = make_timeout_time_ms(AnimationStation::options.rainbowCycleTime); 39 | } 40 | 41 | void Rainbow::ParameterUp() { 42 | AnimationStation::options.rainbowCycleTime =AnimationStation::options.rainbowCycleTime + 10; 43 | } 44 | 45 | void Rainbow::ParameterDown() { 46 | if (AnimationStation::options.rainbowCycleTime > 0) { 47 | AnimationStation::options.rainbowCycleTime = AnimationStation::options.rainbowCycleTime - 10; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/Rainbow.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _RAINBOW_H_ 2 | #define _RAINBOW_H_ 3 | 4 | #include "../Animation.hpp" 5 | #include "hardware/clocks.h" 6 | #include 7 | #include 8 | #include 9 | #include "../AnimationStation.hpp" 10 | 11 | class Rainbow : public Animation { 12 | public: 13 | Rainbow(PixelMatrix &matrix); 14 | ~Rainbow() {}; 15 | 16 | void Animate(RGB (&frame)[100]); 17 | void ParameterUp(); 18 | void ParameterDown(); 19 | 20 | protected: 21 | int currentFrame = 0; 22 | bool reverse = false; 23 | absolute_time_t nextRunTime = nil_time; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/StaticColor.cpp: -------------------------------------------------------------------------------- 1 | #include "StaticColor.hpp" 2 | 3 | StaticColor::StaticColor(PixelMatrix &matrix) : Animation(matrix) { 4 | } 5 | 6 | StaticColor::StaticColor(PixelMatrix &matrix, std::vector &pixels) : Animation(matrix), pixels(&pixels) { 7 | this->filtered = true; 8 | } 9 | 10 | void StaticColor::Animate(RGB (&frame)[100]) { 11 | for (size_t r = 0; r != matrix->pixels.size(); r++) { 12 | for (size_t c = 0; c != matrix->pixels[r].size(); c++) { 13 | if (matrix->pixels[r][c].index == NO_PIXEL.index || this->notInFilter(matrix->pixels[r][c])) 14 | continue; 15 | 16 | for (size_t p = 0; p != matrix->pixels[r][c].positions.size(); p++) { 17 | frame[matrix->pixels[r][c].positions[p]] = colors[this->GetColor()]; 18 | } 19 | } 20 | } 21 | } 22 | 23 | uint8_t StaticColor::GetColor() { 24 | if (this->filtered) { 25 | return AnimationStation::options.buttonColorIndex; 26 | } 27 | else { 28 | return AnimationStation::options.staticColorIndex; 29 | } 30 | } 31 | 32 | void StaticColor::ParameterUp() { 33 | uint8_t colorIndex; 34 | if (this->filtered) { 35 | colorIndex = AnimationStation::options.buttonColorIndex; 36 | } 37 | else { 38 | colorIndex = AnimationStation::options.staticColorIndex; 39 | } 40 | 41 | if (colorIndex < colors.size() - 1) 42 | { 43 | colorIndex++; 44 | } 45 | else { 46 | colorIndex = 0; 47 | } 48 | 49 | this->SaveIndexOptions(colorIndex); 50 | } 51 | 52 | void StaticColor::SaveIndexOptions(uint8_t colorIndex) { 53 | if (this->filtered) { 54 | AnimationStation::options.buttonColorIndex = colorIndex; 55 | } 56 | else { 57 | AnimationStation::options.staticColorIndex = colorIndex; 58 | } 59 | } 60 | 61 | void StaticColor::ParameterDown() { 62 | uint8_t colorIndex; 63 | if (this->filtered) { 64 | colorIndex = AnimationStation::options.buttonColorIndex; 65 | } 66 | else { 67 | colorIndex = AnimationStation::options.staticColorIndex; 68 | } 69 | 70 | if (colorIndex > 0) { 71 | colorIndex--; 72 | } 73 | else { 74 | colorIndex = colors.size() - 1; 75 | } 76 | this->SaveIndexOptions(colorIndex); 77 | } 78 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/StaticColor.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _STATIC_COLOR_H_ 2 | #define _STATIC_COLOR_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "../Animation.hpp" 8 | #include "../AnimationStation.hpp" 9 | 10 | class StaticColor : public Animation { 11 | public: 12 | StaticColor(PixelMatrix &matrix); 13 | StaticColor(PixelMatrix &matrix, std::vector &pixels); 14 | ~StaticColor() { pixels = nullptr; }; 15 | 16 | void Animate(RGB (&frame)[100]); 17 | void SaveIndexOptions(uint8_t colorIndex); 18 | uint8_t GetColor(); 19 | void ParameterUp(); 20 | void ParameterDown(); 21 | protected: 22 | std::vector *pixels; 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/StaticTheme.cpp: -------------------------------------------------------------------------------- 1 | #include "StaticTheme.hpp" 2 | 3 | std::vector> StaticTheme::themes = {}; 4 | 5 | StaticTheme::StaticTheme(PixelMatrix &matrix) : Animation(matrix) { 6 | if (AnimationStation::options.themeIndex >= StaticTheme::themes.size()) { 7 | AnimationStation::options.themeIndex = 0; 8 | } 9 | } 10 | 11 | void StaticTheme::Animate(RGB (&frame)[100]) { 12 | if (StaticTheme::themes.size() > 0) { 13 | for (size_t r = 0; r != matrix->pixels.size(); r++) { 14 | for (size_t c = 0; c != matrix->pixels[r].size(); c++) { 15 | if (matrix->pixels[r][c].index == NO_PIXEL.index) 16 | continue; 17 | 18 | std::map theme = 19 | StaticTheme::themes.at(AnimationStation::options.themeIndex); 20 | auto itr = theme.find(matrix->pixels[r][c].mask); 21 | if (itr != theme.end()) { 22 | for (size_t p = 0; p != matrix->pixels[r][c].positions.size(); p++) { 23 | frame[matrix->pixels[r][c].positions[p]] = itr->second; 24 | } 25 | } else { 26 | for (size_t p = 0; p != matrix->pixels[r][c].positions.size(); p++) { 27 | frame[matrix->pixels[r][c].positions[p]] = defaultColor; 28 | } 29 | } 30 | } 31 | } 32 | } 33 | } 34 | 35 | void StaticTheme::ParameterUp() { 36 | if (AnimationStation::options.themeIndex < StaticTheme::themes.size() - 1) { 37 | AnimationStation::options.themeIndex++; 38 | } else { 39 | AnimationStation::options.themeIndex = 0; 40 | } 41 | } 42 | 43 | void StaticTheme::ParameterDown() { 44 | 45 | if (AnimationStation::options.themeIndex > 0) { 46 | AnimationStation::options.themeIndex--; 47 | } else { 48 | AnimationStation::options.themeIndex = StaticTheme::themes.size() - 1; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Effects/StaticTheme.hpp: -------------------------------------------------------------------------------- 1 | #ifndef STATIC_THEME_H_ 2 | #define STATIC_THEME_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "../Animation.hpp" 11 | #include "../AnimationStation.hpp" 12 | 13 | class StaticTheme : public Animation { 14 | public: 15 | StaticTheme(PixelMatrix &matrix); 16 | ~StaticTheme() {}; 17 | 18 | static void AddTheme(const std::map& theme) { themes.push_back(theme); } 19 | static void ClearThemes() { themes.clear(); } 20 | void Animate(RGB (&frame)[100]); 21 | void ParameterUp(); 22 | void ParameterDown(); 23 | protected: 24 | RGB defaultColor = ColorBlack; 25 | static std::vector> themes; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /GP2040-CE/lib/AnimationStation/src/Pixel.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PIXEL_HPP_ 2 | #define PIXEL_HPP_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | struct Pixel { 10 | Pixel(int index, uint32_t mask = 0) : index(index), mask(mask) { } 11 | Pixel(int index, std::vector positions) : index(index), positions(positions) { } 12 | Pixel(int index, uint32_t mask, std::vector positions) : index(index), mask(mask), positions(positions) { } 13 | 14 | int index; // The pixel index 15 | uint32_t mask; // Used to detect per-pixel lighting 16 | std::vector positions; // The actual LED indexes on the chain 17 | }; 18 | 19 | const Pixel NO_PIXEL(-1); 20 | 21 | struct PixelMatrix { 22 | PixelMatrix() { } 23 | 24 | std::vector> pixels; 25 | uint8_t ledsPerPixel; 26 | void setup(std::vector> pixels, int ledsPerPixel = -1) { 27 | this->pixels = pixels; 28 | this->ledsPerPixel = ledsPerPixel; 29 | } 30 | 31 | inline int getLedCount() { 32 | int count = 0; 33 | for (auto &col : pixels) 34 | for (auto &pixel : col) 35 | if (pixel.index == NO_PIXEL.index) 36 | continue; 37 | else 38 | count += pixel.positions.size(); 39 | 40 | return count; 41 | } 42 | 43 | inline uint16_t getPixelCount() const { 44 | uint16_t count = 0; 45 | for (auto &col : pixels) 46 | count += col.size(); 47 | 48 | return count; 49 | } 50 | 51 | }; 52 | 53 | inline bool operator==(const Pixel &lhs, const Pixel &rhs) { 54 | return lhs.index == rhs.index; 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /GP2040-CE/lib/BitBang_I2C/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(BitBang_I2C BitBang_I2C.c) 2 | target_include_directories(BitBang_I2C INTERFACE .) 3 | target_link_libraries(BitBang_I2C 4 | pico_stdlib 5 | hardware_i2c 6 | hardware_spi 7 | ) -------------------------------------------------------------------------------- /GP2040-CE/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(ADS1219) 2 | add_subdirectory(AnimationStation) 3 | add_subdirectory(BitBang_I2C) 4 | add_subdirectory(CRC32) 5 | add_subdirectory(FlashPROM) 6 | add_subdirectory(httpd) 7 | add_subdirectory(lwip-port) 8 | add_subdirectory(NeoPico) 9 | add_subdirectory(OneBitDisplay) 10 | add_subdirectory(PlayerLEDs) 11 | add_subdirectory(rndis) 12 | add_subdirectory(TinyUSB_Gamepad) 13 | add_subdirectory(WiiExtension) -------------------------------------------------------------------------------- /GP2040-CE/lib/CRC32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(CRC32 2 | src/CRC32.cpp 3 | ) 4 | target_include_directories(CRC32 INTERFACE 5 | src 6 | ) -------------------------------------------------------------------------------- /GP2040-CE/lib/CRC32/src/CRC32.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 Christopher Baker 3 | // 4 | // SPDX-License-Identifier: MIT 5 | // 6 | 7 | #include "CRC32.h" 8 | 9 | static const uint32_t crc32_table[] = { 10 | 0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 11 | 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, 12 | 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 13 | 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c 14 | }; 15 | 16 | CRC32::CRC32() { 17 | reset(); 18 | } 19 | 20 | void CRC32::reset() { 21 | _state = ~0L; 22 | } 23 | 24 | void CRC32::update(const uint8_t &data) { 25 | // via http://forum.arduino.cc/index.php?topic=91179.0 26 | uint8_t tbl_idx = 0; 27 | 28 | tbl_idx = _state ^ (data >> (0 * 4)); 29 | _state = *(uint32_t *)(crc32_table + (tbl_idx & 0x0f)) ^ (_state >> 4); 30 | tbl_idx = _state ^ (data >> (1 * 4)); 31 | _state = *(uint32_t *)(crc32_table + (tbl_idx & 0x0f)) ^ (_state >> 4); 32 | } 33 | 34 | uint32_t CRC32::finalize() const 35 | { 36 | return ~_state; 37 | } 38 | -------------------------------------------------------------------------------- /GP2040-CE/lib/CRC32/src/CRC32.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2013 Christopher Baker 3 | // 4 | // SPDX-License-Identifier: MIT 5 | // 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | /// \brief A class for calculating the CRC32 checksum from arbitrary data. 12 | /// \sa http://forum.arduino.cc/index.php?topic=91179.0 13 | class CRC32 { 14 | public: 15 | /// \brief Initialize an empty CRC32 checksum. 16 | CRC32(); 17 | 18 | /// \brief Reset the checksum claculation. 19 | void reset(); 20 | 21 | /// \brief Update the current checksum caclulation with the given data. 22 | /// \param data The data to add to the checksum. 23 | void update(const uint8_t &data); 24 | 25 | /// \brief Update the current checksum caclulation with the given data. 26 | /// \tparam Type The data type to read. 27 | /// \param data The data to add to the checksum. 28 | template 29 | void update(const Type &data) { 30 | update(&data, 1); 31 | } 32 | 33 | /// \brief Update the current checksum caclulation with the given data. 34 | /// \tparam Type The data type to read. 35 | /// \param data The array to add to the checksum. 36 | /// \param size Size of the array to add. 37 | template 38 | void update(const Type *data, uint16_t size) { 39 | uint16_t nBytes = size * sizeof(Type); 40 | const uint8_t *pData = (const uint8_t *)data; 41 | 42 | for (uint16_t i = 0; i < nBytes; i++) 43 | { 44 | update(pData[i]); 45 | } 46 | } 47 | 48 | /// \returns the caclulated checksum. 49 | uint32_t finalize() const; 50 | 51 | /// \brief Calculate the checksum of an arbitrary data array. 52 | /// \tparam Type The data type to read. 53 | /// \param data A pointer to the data to add to the checksum. 54 | /// \param size The size of the data to add to the checksum. 55 | /// \returns the calculated checksum. 56 | template 57 | static uint32_t calculate(const Type *data, uint16_t size = 1) { 58 | CRC32 crc; 59 | crc.update(data, size); 60 | return crc.finalize(); 61 | } 62 | 63 | private: 64 | /// \brief The internal checksum state. 65 | uint32_t _state = ~0L; 66 | }; 67 | -------------------------------------------------------------------------------- /GP2040-CE/lib/FlashPROM/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(FlashPROM 2 | src/FlashPROM.cpp 3 | ) 4 | target_include_directories(FlashPROM INTERFACE 5 | src 6 | ) 7 | target_link_libraries(FlashPROM 8 | pico_stdlib 9 | pico_multicore 10 | hardware_flash 11 | ) -------------------------------------------------------------------------------- /GP2040-CE/lib/FlashPROM/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FlashPROM", 3 | "version": "0.0.1", 4 | "description": "Basic EEPROM-like interface for saving to flash memory on the RP2040.", 5 | "keywords": "pico rp2040 eeprom flash", 6 | "authors": [ 7 | { 8 | "name": "Jason Skuby", 9 | "url": "https://mytechtoybox.com" 10 | } 11 | ], 12 | "license": "MIT" 13 | } 14 | -------------------------------------------------------------------------------- /GP2040-CE/lib/FlashPROM/src/FlashPROM.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #include "FlashPROM.h" 7 | 8 | uint8_t FlashPROM::cache[EEPROM_SIZE_BYTES] = { }; 9 | volatile static alarm_id_t flashWriteAlarm = 0; 10 | volatile static spin_lock_t *flashLock = nullptr; 11 | 12 | int64_t writeToFlash(alarm_id_t id, void *flashCache) 13 | { 14 | while (is_spin_locked(flashLock)); 15 | 16 | multicore_lockout_start_blocking(); 17 | uint32_t interrupts = spin_lock_blocking(flashLock); 18 | 19 | flash_range_erase((intptr_t)EEPROM_ADDRESS_START - (intptr_t)XIP_BASE, EEPROM_SIZE_BYTES); 20 | flash_range_program((intptr_t)EEPROM_ADDRESS_START - (intptr_t)XIP_BASE, reinterpret_cast(flashCache), EEPROM_SIZE_BYTES); 21 | 22 | flashWriteAlarm = 0; 23 | 24 | multicore_lockout_end_blocking(); 25 | spin_unlock(flashLock, interrupts); 26 | 27 | return 0; 28 | } 29 | 30 | void FlashPROM::start() 31 | { 32 | if (flashLock == nullptr) 33 | flashLock = spin_lock_instance(spin_lock_claim_unused(true)); 34 | 35 | memcpy(cache, reinterpret_cast(EEPROM_ADDRESS_START), EEPROM_SIZE_BYTES); 36 | 37 | // When flash is new/reset, all bits are set to 1. 38 | // If all bits from the FlashPROM section are 1's then set to 0's. 39 | bool reset = true; 40 | for (int i = 0; i < EEPROM_SIZE_BYTES; i++) 41 | { 42 | if (cache[i] != 0xFF) 43 | { 44 | reset = false; 45 | break; 46 | } 47 | } 48 | 49 | if (reset) 50 | this->reset(); 51 | } 52 | 53 | /* We don't have an actual EEPROM, so we need to be extra careful about minimizing writes. Instead 54 | of writing when a commit is requested, we update a time to actually commit. That way, if we receive multiple requests 55 | to commit in that timeframe, we'll hold off until the user is done sending changes. */ 56 | void FlashPROM::commit() 57 | { 58 | while (is_spin_locked(flashLock)); 59 | if (flashWriteAlarm != 0) 60 | cancel_alarm(flashWriteAlarm); 61 | flashWriteAlarm = add_alarm_in_ms(EEPROM_WRITE_WAIT, writeToFlash, cache, true); 62 | } 63 | 64 | void FlashPROM::reset() 65 | { 66 | memset(cache, 0, EEPROM_SIZE_BYTES); 67 | commit(); 68 | } 69 | -------------------------------------------------------------------------------- /GP2040-CE/lib/FlashPROM/src/FlashPROM.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #ifndef FLASHPROM_H_ 7 | #define FLASHPROM_H_ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #define EEPROM_SIZE_BYTES 0x2000 // Reserve 8k of flash memory (ensure this value is divisible by 256) 17 | #define EEPROM_ADDRESS_START _u(0x101FE000) // The arduino-pico EEPROM lib starts here, so we'll do the same 18 | // Warning: If the write wait is too long it can stall other processes 19 | #define EEPROM_WRITE_WAIT 50 // Amount of time in ms to wait before blocking core1 and committing to flash 20 | 21 | class FlashPROM 22 | { 23 | public: 24 | void start(); 25 | void commit(); 26 | void reset(); 27 | 28 | template 29 | T &get(uint16_t const index, T &value) 30 | { 31 | if (index < EEPROM_SIZE_BYTES) 32 | memcpy(&value, &cache[index], sizeof(T)); 33 | 34 | return value; 35 | } 36 | 37 | template 38 | void set(uint16_t const index, const T &value) 39 | { 40 | uint16_t size = sizeof(T); 41 | 42 | if ((index + size) <= EEPROM_SIZE_BYTES) 43 | memcpy(&cache[index], &value, sizeof(T)); 44 | } 45 | 46 | private: 47 | static uint8_t cache[EEPROM_SIZE_BYTES]; 48 | }; 49 | 50 | static FlashPROM EEPROM; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /GP2040-CE/lib/NeoPico/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = crlf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | [*.md] 15 | indent_style = space 16 | indent_size = 2 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /GP2040-CE/lib/NeoPico/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(NeoPico 2 | src/NeoPico.cpp 3 | ) 4 | target_include_directories(NeoPico PUBLIC 5 | src 6 | ) 7 | 8 | pico_generate_pio_header(NeoPico ${CMAKE_CURRENT_LIST_DIR}/src/ws2812.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/src/generated) 9 | 10 | target_link_libraries(NeoPico PUBLIC 11 | pico_stdlib 12 | hardware_pio 13 | hardware_clocks 14 | hardware_timer 15 | ) 16 | -------------------------------------------------------------------------------- /GP2040-CE/lib/NeoPico/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "NeoPico", 3 | "version": "0.0.1", 4 | "description": "WS2812 PIO handling based on official Pico examples", 5 | "keywords": "c c++ baremetal neopixel led", 6 | "authors": [ 7 | { 8 | "name": "Jonathan Barket", 9 | "url": "https://jonathanbarket.com" 10 | } 11 | ], 12 | "license": "MIT" 13 | } 14 | -------------------------------------------------------------------------------- /GP2040-CE/lib/NeoPico/src/NeoPico.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 | * 4 | * Modified by Jonathan Barket - 2021 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "pico/stdlib.h" 13 | #include "hardware/pio.h" 14 | #include "hardware/clocks.h" 15 | #include "NeoPico.hpp" 16 | 17 | LEDFormat NeoPico::GetFormat() { 18 | return format; 19 | } 20 | 21 | void NeoPico::PutPixel(uint32_t pixelData) { 22 | switch (format) { 23 | case LED_FORMAT_GRB: 24 | case LED_FORMAT_RGB: 25 | pio_sm_put_blocking(pio0, 0, pixelData << 8u); 26 | break; 27 | case LED_FORMAT_GRBW: 28 | case LED_FORMAT_RGBW: 29 | pio_sm_put_blocking(pio0, 0, pixelData); 30 | break; 31 | } 32 | } 33 | 34 | NeoPico::NeoPico(int ledPin, int numPixels, LEDFormat format) : format(format), numPixels(numPixels) { 35 | PIO pio = pio0; 36 | int sm = 0; 37 | uint offset = pio_add_program(pio, &ws2812_program); 38 | bool rgbw = (format == LED_FORMAT_GRBW) || (format == LED_FORMAT_RGBW); 39 | ws2812_program_init(pio, sm, offset, ledPin, 800000, rgbw); 40 | this->Clear(); 41 | sleep_ms(10); 42 | } 43 | 44 | void NeoPico::Clear() { 45 | memset(frame, 0, sizeof(frame)); 46 | } 47 | 48 | void NeoPico::SetFrame(uint32_t newFrame[100]) { 49 | memcpy(frame, newFrame, sizeof(frame)); 50 | } 51 | 52 | void NeoPico::Show() { 53 | for (int i = 0; i < this->numPixels; ++i) { 54 | this->PutPixel(this->frame[i]); 55 | } 56 | sleep_ms(10); 57 | } 58 | 59 | void NeoPico::Off() { 60 | Clear(); 61 | for (int i = 0; i < this->numPixels; ++i) { 62 | this->PutPixel(this->frame[i]); 63 | } 64 | sleep_ms(10); 65 | } 66 | -------------------------------------------------------------------------------- /GP2040-CE/lib/NeoPico/src/NeoPico.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _NEO_PICO_H_ 2 | #define _NEO_PICO_H_ 3 | 4 | #include "ws2812.pio.h" 5 | #include 6 | 7 | typedef enum 8 | { 9 | LED_FORMAT_GRB = 0, 10 | LED_FORMAT_RGB = 1, 11 | LED_FORMAT_GRBW = 2, 12 | LED_FORMAT_RGBW = 3, 13 | } LEDFormat; 14 | 15 | class NeoPico 16 | { 17 | public: 18 | NeoPico(int ledPin, int numPixels, LEDFormat format = LED_FORMAT_GRB); 19 | void Show(); 20 | void Clear(); 21 | void Off(); 22 | LEDFormat GetFormat(); 23 | // void SetPixel(int pixel, uint32_t color); 24 | void SetFrame(uint32_t newFrame[100]); 25 | private: 26 | void PutPixel(uint32_t pixel_grb); 27 | LEDFormat format; 28 | PIO pio = pio0; 29 | int numPixels = 0; 30 | uint32_t frame[100]; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /GP2040-CE/lib/OneBitDisplay/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(OneBitDisplay 2 | OneBitDisplay.cpp 3 | ) 4 | target_include_directories(OneBitDisplay INTERFACE 5 | . 6 | fonts 7 | ) 8 | target_link_libraries(OneBitDisplay 9 | pico_stdlib 10 | BitBang_I2C 11 | ) -------------------------------------------------------------------------------- /GP2040-CE/lib/PlayerLEDs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(PlayerLEDs 2 | src/PlayerLEDs.cpp 3 | ) 4 | target_include_directories(PlayerLEDs PUBLIC 5 | src 6 | ) 7 | target_link_libraries(PlayerLEDs 8 | pico_stdlib 9 | hardware_pwm 10 | ) -------------------------------------------------------------------------------- /GP2040-CE/lib/PlayerLEDs/src/PlayerLEDs.cpp: -------------------------------------------------------------------------------- 1 | #include "PlayerLEDs.h" 2 | #include "pico/stdlib.h" 3 | #include "hardware/pwm.h" 4 | 5 | void PlayerLEDs::animate(PLEDAnimationState animationState) 6 | { 7 | // Reset state and bypass timer check if animation changed 8 | if (animationState.animation != selectedAnimation) 9 | { 10 | reset(); 11 | selectedAnimation = animationState.animation; 12 | } 13 | else if (!time_reached(nextAnimationTime)) 14 | { 15 | return; 16 | } 17 | 18 | parseState(animationState.state); 19 | 20 | switch (selectedAnimation) 21 | { 22 | case PLED_ANIM_BLINK: 23 | handleBlink(animationState.speed); 24 | break; 25 | 26 | case PLED_ANIM_CYCLE: 27 | handleCycle(animationState.speed); 28 | break; 29 | 30 | case PLED_ANIM_FADE: 31 | handleFade(); 32 | break; 33 | 34 | default: 35 | break; 36 | } 37 | 38 | for (int i = 0; i < PLED_COUNT; i++) 39 | ledLevels[i] = PLED_MAX_LEVEL - (currentPledState[i] ? (brightness * brightness) : 0); 40 | } 41 | -------------------------------------------------------------------------------- /GP2040-CE/lib/TinyUSB_Gamepad/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(TinyUSB_Gamepad 2 | src/hid_driver.cpp 3 | src/net_driver.cpp 4 | src/tusb_driver.cpp 5 | src/usb_descriptors.cpp 6 | src/xinput_driver.cpp 7 | src/ps4_driver.cpp 8 | ) 9 | target_include_directories(TinyUSB_Gamepad PUBLIC 10 | src 11 | ${CMAKE_SOURCE_DIR}/headers 12 | ${CMAKE_SOURCE_DIR}/lib/CRC32/src 13 | ${CMAKE_SOURCE_DIR}/lib/mbedtls/include 14 | ) 15 | target_link_libraries(TinyUSB_Gamepad 16 | pico_stdlib 17 | pico_mbedtls 18 | tinyusb_device 19 | rndis 20 | ) -------------------------------------------------------------------------------- /GP2040-CE/lib/TinyUSB_Gamepad/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tinyusb-gamepad-driver", 3 | "version": "0.0.1", 4 | "description": "C library for handling USB HID/XID gamepads via TinyUSB.", 5 | "keywords": "tinyusb gamepad hid xinput switch", 6 | "authors": [ 7 | { 8 | "name": "Jason Skuby", 9 | "url": "https://mytechtoybox.com" 10 | } 11 | ], 12 | "license": "MIT" 13 | } 14 | -------------------------------------------------------------------------------- /GP2040-CE/lib/TinyUSB_Gamepad/src/hid_driver.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #include "hid_driver.h" 7 | #include "usb_driver.h" 8 | #include "device/usbd.h" 9 | 10 | #include "device/usbd_pvt.h" 11 | #include "class/hid/hid_device.h" 12 | #include "gamepad/GamepadDescriptors.h" 13 | 14 | // Magic byte sequence to enable PS button on PS3 15 | static const uint8_t magic_init_bytes[8] = {0x21, 0x26, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00}; 16 | 17 | bool send_hid_report(uint8_t report_id, void *report, uint8_t report_size) 18 | { 19 | if (tud_hid_ready()) 20 | return tud_hid_report(report_id, report, report_size); 21 | 22 | return false; 23 | } 24 | 25 | bool hid_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request) 26 | { 27 | if ( 28 | get_input_mode() == INPUT_MODE_HID && 29 | request->bmRequestType == 0xA1 && 30 | request->bRequest == HID_REQ_CONTROL_GET_REPORT && 31 | request->wValue == 0x0300 32 | ) 33 | { 34 | return tud_control_xfer(rhport, request, (void *) magic_init_bytes, sizeof(magic_init_bytes)); 35 | } 36 | else 37 | { 38 | return hidd_control_xfer_cb(rhport, stage, request); 39 | } 40 | } 41 | 42 | const usbd_class_driver_t hid_driver = { 43 | #if CFG_TUSB_DEBUG >= 2 44 | .name = "HID", 45 | #endif 46 | .init = hidd_init, 47 | .reset = hidd_reset, 48 | .open = hidd_open, 49 | .control_xfer_cb = hid_control_xfer_cb, 50 | .xfer_cb = hidd_xfer_cb, 51 | .sof = NULL}; -------------------------------------------------------------------------------- /GP2040-CE/lib/TinyUSB_Gamepad/src/hid_driver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #pragma once 7 | 8 | #include "device/usbd_pvt.h" 9 | #include "gamepad/descriptors/HIDDescriptors.h" 10 | #include "gamepad/descriptors/SwitchDescriptors.h" 11 | 12 | extern const usbd_class_driver_t hid_driver; 13 | 14 | bool send_hid_report(uint8_t report_id, void *report, uint8_t report_size); 15 | -------------------------------------------------------------------------------- /GP2040-CE/lib/TinyUSB_Gamepad/src/net_driver.cpp: -------------------------------------------------------------------------------- 1 | #include "net_driver.h" 2 | 3 | const usbd_class_driver_t net_driver = { 4 | #if CFG_TUSB_DEBUG >= 2 5 | .name = "NET", 6 | #endif 7 | .init = netd_init, 8 | .reset = netd_reset, 9 | .open = netd_open, 10 | .control_xfer_cb = netd_control_xfer_cb, 11 | .xfer_cb = netd_xfer_cb, 12 | .sof = NULL, 13 | }; 14 | -------------------------------------------------------------------------------- /GP2040-CE/lib/TinyUSB_Gamepad/src/net_driver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #pragma once 7 | 8 | #include "device/usbd_pvt.h" 9 | #include "class/net/net_device.h" 10 | 11 | extern const usbd_class_driver_t net_driver; 12 | 13 | bool send_hid_report(uint8_t report_id, uint8_t *report, uint8_t report_size); 14 | -------------------------------------------------------------------------------- /GP2040-CE/lib/TinyUSB_Gamepad/src/usb_driver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #pragma once 7 | 8 | #include "gamepad/GamepadDescriptors.h" 9 | 10 | typedef enum 11 | { 12 | USB_MODE_HID, 13 | USB_MODE_NET, 14 | } UsbMode; 15 | 16 | InputMode get_input_mode(void); 17 | bool get_usb_mounted(void); 18 | void initialize_driver(InputMode mode); 19 | void receive_report(uint8_t *buffer); 20 | void send_report(void *report, uint16_t report_size); 21 | 22 | -------------------------------------------------------------------------------- /GP2040-CE/lib/TinyUSB_Gamepad/src/xinput_driver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "tusb.h" 10 | #include "device/usbd_pvt.h" 11 | 12 | #include "gamepad/descriptors/XInputDescriptors.h" 13 | 14 | #define XINPUT_OUT_SIZE 32 15 | 16 | typedef enum 17 | { 18 | XINPUT_PLED_OFF = 0x00, // All off 19 | XINPUT_PLED_BLINKALL = 0x01, // All blinking 20 | XINPUT_PLED_FLASH1 = 0x02, // 1 flashes, then on 21 | XINPUT_PLED_FLASH2 = 0x03, // 2 flashes, then on 22 | XINPUT_PLED_FLASH3 = 0x04, // 3 flashes, then on 23 | XINPUT_PLED_FLASH4 = 0x05, // 4 flashes, then on 24 | XINPUT_PLED_ON1 = 0x06, // 1 on 25 | XINPUT_PLED_ON2 = 0x07, // 2 on 26 | XINPUT_PLED_ON3 = 0x08, // 3 on 27 | XINPUT_PLED_ON4 = 0x09, // 4 on 28 | XINPUT_PLED_ROTATE = 0x0A, // Rotating (e.g. 1-2-4-3) 29 | XINPUT_PLED_BLINK = 0x0B, // Blinking* 30 | XINPUT_PLED_SLOWBLINK = 0x0C, // Slow blinking* 31 | XINPUT_PLED_ALTERNATE = 0x0D, // Alternating (e.g. 1+4-2+3), then back to previous* 32 | } XInputPLEDPattern; 33 | 34 | // USB endpoint state vars 35 | extern uint8_t endpoint_in; 36 | extern uint8_t endpoint_out; 37 | extern uint8_t xinput_out_buffer[XINPUT_OUT_SIZE]; 38 | extern const usbd_class_driver_t xinput_driver; 39 | 40 | void receive_xinput_report(void); 41 | bool send_xinput_report(void *report, uint8_t report_size); 42 | 43 | #pragma once 44 | -------------------------------------------------------------------------------- /GP2040-CE/lib/WiiExtension/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(WiiExtension WiiExtension.cpp) 2 | target_link_libraries(WiiExtension PUBLIC BitBang_I2C) 3 | target_include_directories(WiiExtension INTERFACE .) 4 | target_include_directories(WiiExtension PUBLIC 5 | BitBang_I2C 6 | ) 7 | -------------------------------------------------------------------------------- /GP2040-CE/lib/WiiExtension/README.md: -------------------------------------------------------------------------------- 1 | # WiiExtension 2 | # Ported to BitBangI2C 3 | # 4 | # Written by: 5 | # Mike Parks 6 | # -------------------------------------------------------------------------------- /GP2040-CE/lib/httpd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(httpd 2 | fs.c 3 | fsdata.c 4 | ${PICO_SDK_PATH}/lib/lwip/src/apps/http/httpd.c 5 | ) 6 | target_include_directories(httpd INTERFACE 7 | . 8 | ) 9 | target_link_libraries(httpd 10 | pico_stdlib 11 | lwip-port 12 | pico_lwip 13 | ) -------------------------------------------------------------------------------- /GP2040-CE/lib/httpd/fscustom.h: -------------------------------------------------------------------------------- 1 | #ifndef FSCUSTOM_H_ 2 | #define FSCUSTOM_H_ 3 | 4 | #include "fs.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | int fs_open_custom(struct fs_file *file, const char *name); 11 | void fs_close_custom(struct fs_file *file); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /GP2040-CE/lib/httpd/fsdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __FSDATA_H__ 33 | #define __FSDATA_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "fs.h" 37 | 38 | struct fsdata_file { 39 | const struct fsdata_file *next; 40 | const unsigned char *name; 41 | const unsigned char *data; 42 | int len; 43 | u8_t http_header_included; 44 | #if HTTPD_PRECALCULATED_CHECKSUM 45 | u16_t chksum_count; 46 | const struct fsdata_chksum *chksum; 47 | #endif /* HTTPD_PRECALCULATED_CHECKSUM */ 48 | }; 49 | 50 | #endif /* __FSDATA_H__ */ 51 | -------------------------------------------------------------------------------- /GP2040-CE/lib/lwip-port/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(lwip-port 2 | ${PICO_SDK_PATH}/lib/tinyusb/lib/networking/dhserver.c 3 | ${PICO_SDK_PATH}/lib/tinyusb/lib/networking/dnserver.c 4 | ) 5 | target_include_directories(lwip-port INTERFACE 6 | . 7 | arch 8 | ${PICO_SDK_PATH}/lib/tinyusb/lib/networking 9 | ) 10 | target_link_libraries(lwip-port 11 | pico_stdlib 12 | pico_lwip 13 | ) 14 | target_include_directories(pico_lwip INTERFACE 15 | . 16 | ) -------------------------------------------------------------------------------- /GP2040-CE/lib/rndis/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(rndis 2 | rndis.c 3 | ${PICO_SDK_PATH}/lib/tinyusb/lib/networking/rndis_reports.c 4 | ) 5 | target_include_directories(rndis PUBLIC 6 | ${CMAKE_CURRENT_LIST_DIR} 7 | ${CMAKE_SOURCE_DIR}/headers 8 | ${PICO_SDK_PATH}/lib/tinyusb/lib/networking 9 | ) 10 | target_link_libraries(rndis 11 | pico_stdlib 12 | tinyusb_device 13 | lwip-port 14 | httpd 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /GP2040-CE/lib/rndis/rndis.h: -------------------------------------------------------------------------------- 1 | #ifndef RNDIS_H_ 2 | #define RNDIS_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | int rndis_init(void); 9 | void rndis_task(void); 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /GP2040-CE/modules/FindNPM.cmake: -------------------------------------------------------------------------------- 1 | # Find the Node.js executable 2 | # 3 | # The following variables are set: 4 | # NPM_FOUND True if npm was found 5 | # NPM_EXECUTABLE Path to the npm executable 6 | # NPM_VERSION npm version 7 | 8 | find_program(NPM_EXECUTABLE NAMES npm) 9 | 10 | if (${NPM_EXECUTABLE} MATCHES "NOTFOUND") 11 | message(STATUS "Could not find npm") 12 | set(NPM_FOUND FALSE CACHE INTERNAL "") 13 | unset(NPM_EXECUTABLE) 14 | else() 15 | if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") 16 | set(NPM_EXECUTABLE ${NPM_EXECUTABLE}.cmd) 17 | endif() 18 | execute_process(COMMAND ${NPM_EXECUTABLE} --version 19 | OUTPUT_VARIABLE VERSION_VAR 20 | ERROR_VARIABLE ERROR_VAR 21 | RESULT_VARIABLE RESULT_VAR) 22 | if (RESULT_VAR EQUAL 0) 23 | string(REGEX REPLACE "[v]" "" VERSION_VAR ${VERSION_VAR}) 24 | string(STRIP ${VERSION_VAR} VERSION_VAR) 25 | set(NPM_VERSION ${VERSION_VAR} CACHE INTERNAL "") 26 | set(NPM_FOUND TRUE CACHE INTERNAL "") 27 | message(STATUS "Found npm version ${NPM_VERSION}: ${NPM_EXECUTABLE}") 28 | else() 29 | message(WARNING "Failed to execute npm --version command: ${ERROR_VAR}") 30 | endif() 31 | endif() -------------------------------------------------------------------------------- /GP2040-CE/modules/FindNodeJS.cmake: -------------------------------------------------------------------------------- 1 | # Find the Node.js executable 2 | # 3 | # The following variables are set: 4 | # NODEJS_FOUND True if Node.js was found 5 | # NODEJS_EXECUTABLE Path to the Node.js executable 6 | # NODEJS_VERSION Node.js version 7 | 8 | find_program(NODEJS_EXECUTABLE NAMES node nodejs) 9 | 10 | if (${NODEJS_EXECUTABLE} MATCHES "NOTFOUND") 11 | message(STATUS "Could not find Node.js") 12 | set(NODEJS_FOUND FALSE CACHE INTERNAL "") 13 | unset(NODEJS_EXECUTABLE) 14 | else() 15 | execute_process(COMMAND ${NODEJS_EXECUTABLE} --version 16 | OUTPUT_VARIABLE VERSION_VAR 17 | ERROR_VARIABLE ERROR_VAR 18 | RESULT_VARIABLE RESULT_VAR) 19 | 20 | if (RESULT_VAR EQUAL 0) 21 | string(REGEX REPLACE "[v]" "" VERSION_VAR ${VERSION_VAR}) 22 | string(STRIP ${VERSION_VAR} VERSION_VAR) 23 | set(NODEJS_VERSION ${VERSION_VAR} CACHE INTERNAL "") 24 | set(NODEJS_FOUND TRUE CACHE INTERNAL "") 25 | message(STATUS "Found Node.js version ${NODEJS_VERSION}: ${NODEJS_EXECUTABLE}") 26 | else() 27 | message(WARNING "Failed to execute NodeJS --version command: ${ERROR_VAR}") 28 | endif() 29 | endif() -------------------------------------------------------------------------------- /GP2040-CE/src/addonmanager.cpp: -------------------------------------------------------------------------------- 1 | #include "addonmanager.h" 2 | 3 | void AddonManager::LoadAddon(GPAddon* addon, ADDON_PROCESS processAt) { 4 | if (addon->available()) { 5 | AddonBlock * block = new AddonBlock; 6 | addon->setup(); 7 | block->ptr = addon; 8 | block->process = processAt; 9 | addons.push_back(block); 10 | } else { 11 | delete addon; // Don't use the memory if we don't have to 12 | } 13 | } 14 | 15 | 16 | void AddonManager::PreprocessAddons(ADDON_PROCESS processType) { 17 | // Loop through all addons and process any that match our type 18 | for (std::vector::iterator it = addons.begin(); it != addons.end(); it++) { 19 | if ( (*it)->process == processType ) 20 | (*it)->ptr->preprocess(); 21 | } 22 | } 23 | 24 | void AddonManager::ProcessAddons(ADDON_PROCESS processType) { 25 | // Loop through all addons and process any that match our type 26 | for (std::vector::iterator it = addons.begin(); it != addons.end(); it++) { 27 | if ( (*it)->process == processType ) 28 | (*it)->ptr->process(); 29 | } 30 | } 31 | 32 | // HACK : change this for NeoPicoLED 33 | GPAddon * AddonManager::GetAddon(std::string name) { // hack for NeoPicoLED 34 | for (std::vector::iterator it = addons.begin(); it != addons.end(); it++) { 35 | if ( (*it)->ptr->name() == name ) 36 | return (*it)->ptr; 37 | } 38 | return nullptr; 39 | } 40 | -------------------------------------------------------------------------------- /GP2040-CE/src/addons/analog.cpp: -------------------------------------------------------------------------------- 1 | #include "addons/analog.h" 2 | #include "storagemanager.h" 3 | 4 | #include "hardware/adc.h" 5 | 6 | #define ADC_MAX ((1 << 12) - 1) 7 | #define ANALOG_CENTER 0.5f // 0.5f is center 8 | #define ANALOG_DEADZONE 0.05f // move to config (future release) 9 | 10 | bool AnalogInput::available() { 11 | const AddonOptions& options = Storage::getInstance().getAddonOptions(); 12 | analogAdcPinX = Storage::getInstance().getAddonOptions().analogAdcPinX; 13 | analogAdcPinY = Storage::getInstance().getAddonOptions().analogAdcPinY; 14 | return options.AnalogInputEnabled; 15 | } 16 | 17 | void AnalogInput::setup() { 18 | // Make sure GPIO is high-impedance, no pullups etc 19 | if ( analogAdcPinX != (uint8_t)-1 ) 20 | adc_gpio_init(analogAdcPinX); 21 | if ( analogAdcPinY != (uint8_t)-1) 22 | adc_gpio_init(analogAdcPinY); 23 | } 24 | 25 | void AnalogInput::process() 26 | { 27 | Gamepad * gamepad = Storage::getInstance().GetGamepad(); 28 | float adc_x = ANALOG_CENTER; 29 | float adc_y = ANALOG_CENTER; 30 | if ( analogAdcPinX != (uint8_t)-1) { 31 | adc_select_input(analogAdcPinX-26); // ANALOG-X 32 | adc_x = ((float)adc_read())/ADC_MAX; 33 | } 34 | if ( analogAdcPinY != (uint8_t)-1) { 35 | adc_select_input(analogAdcPinY-26); // ANALOG-Y 36 | adc_y = ((float)adc_read())/ADC_MAX; 37 | } 38 | if ( abs(adc_x - ANALOG_CENTER) < ANALOG_DEADZONE ) // deadzones 39 | adc_x = ANALOG_CENTER; 40 | if ( abs(adc_y - ANALOG_CENTER) < ANALOG_DEADZONE ) // deadzones 41 | adc_y = ANALOG_CENTER; 42 | 43 | // Convert to 16-bit value 44 | gamepad->state.lx = (uint16_t)(65535.0f*adc_x); 45 | gamepad->state.ly = (uint16_t)(65535.0f*adc_y); 46 | } 47 | -------------------------------------------------------------------------------- /GP2040-CE/src/addons/extra_button.cpp: -------------------------------------------------------------------------------- 1 | #include "addons/extra_button.h" 2 | #include "storagemanager.h" 3 | #include "hardware/gpio.h" 4 | 5 | bool ExtraButtonAddon::available() { 6 | const AddonOptions& options = Storage::getInstance().getAddonOptions(); 7 | extraButtonMap = options.extraButtonMap; 8 | extraButtonPin = options.extraButtonPin; 9 | return options.ExtraButtonAddonEnabled && 10 | extraButtonMap != 0 && 11 | extraButtonPin != (uint8_t)-1; 12 | } 13 | 14 | void ExtraButtonAddon::setup() { 15 | gpio_init(extraButtonPin); // Initialize pin 16 | gpio_set_dir(extraButtonPin, GPIO_IN); // Set as INPUT 17 | gpio_pull_up(extraButtonPin); // Set as PULLUP 18 | } 19 | 20 | void ExtraButtonAddon::preprocess() { 21 | Gamepad * gamepad = Storage::getInstance().GetGamepad(); 22 | if (!gpio_get(extraButtonPin)) { 23 | if (extraButtonMap > (GAMEPAD_MASK_A2)) { 24 | switch (extraButtonMap) { 25 | case (GAMEPAD_MASK_DU): 26 | gamepad->state.dpad |= GAMEPAD_MASK_UP; 27 | break; 28 | case (GAMEPAD_MASK_DD): 29 | gamepad->state.dpad |= GAMEPAD_MASK_DOWN; 30 | break; 31 | case (GAMEPAD_MASK_DL): 32 | gamepad->state.dpad |= GAMEPAD_MASK_LEFT; 33 | break; 34 | case (GAMEPAD_MASK_DR): 35 | gamepad->state.dpad |= GAMEPAD_MASK_RIGHT; 36 | break; 37 | } 38 | } 39 | else gamepad->state.buttons |= extraButtonMap; 40 | } 41 | } -------------------------------------------------------------------------------- /GP2040-CE/src/addons/playernum.cpp: -------------------------------------------------------------------------------- 1 | #include "addons/playernum.h" 2 | #include "storagemanager.h" 3 | #include "system.h" 4 | 5 | bool PlayerNumAddon::available() { 6 | const AddonOptions& options = Storage::getInstance().getAddonOptions(); 7 | return options.PlayerNumAddonEnabled; 8 | } 9 | 10 | void PlayerNumAddon::setup() { 11 | const AddonOptions& options = Storage::getInstance().getAddonOptions(); 12 | xinputIDs[0] = XINPUT_PLED_ON1; 13 | xinputIDs[1] = XINPUT_PLED_ON2; 14 | xinputIDs[2] = XINPUT_PLED_ON3; 15 | xinputIDs[3] = XINPUT_PLED_ON4; 16 | playerNum = options.playerNumber; 17 | if ( playerNum < 1 || playerNum > 4 ) { 18 | playerNum = 1; // error checking, set to 1 if we're off 19 | } 20 | assigned = 0; // what player ID did we get assigned to 21 | } 22 | 23 | void PlayerNumAddon::process() 24 | { 25 | if ( assigned == 0 ) { 26 | Gamepad * gamepad = Storage::getInstance().GetGamepad(); 27 | InputMode inputMode = gamepad->options.inputMode; 28 | if ( inputMode == INPUT_MODE_XINPUT ) { 29 | uint8_t * featureData = Storage::getInstance().GetFeatureData(); 30 | if (featureData[0] == 0x01) { 31 | XInputPLEDPattern ledAction = (XInputPLEDPattern)featureData[2]; 32 | if ( ledAction == XINPUT_PLED_ON1 ) 33 | handleLED(1); 34 | else if ( ledAction == XINPUT_PLED_ON2 ) 35 | handleLED(2); 36 | else if ( ledAction == XINPUT_PLED_ON3 ) 37 | handleLED(3); 38 | else if ( ledAction == XINPUT_PLED_ON4 ) 39 | handleLED(4); 40 | } 41 | } else { 42 | assigned = 1; 43 | } 44 | } 45 | } 46 | 47 | void PlayerNumAddon::handleLED(int num) { 48 | if ( playerNum != num ) { 49 | tud_disconnect(); 50 | sleep_ms(2000 * playerNum); 51 | System::reboot(System::BootMode::GAMEPAD); 52 | } else { 53 | assigned = 1; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /GP2040-CE/src/gamepad/GamepadDebouncer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | #include "gamepad/GamepadDebouncer.h" 7 | 8 | void GamepadDebouncer::debounce(GamepadState *state) 9 | { 10 | uint32_t now = getMillis(); 11 | 12 | for (int i = 0; i < 4; i++) 13 | { 14 | if ((debounceState.dpad & dpadMasks[i]) != (state->dpad & dpadMasks[i]) && (now - dpadTime[i]) > debounceMS) 15 | { 16 | debounceState.dpad ^= dpadMasks[i]; 17 | dpadTime[i] = now; 18 | } 19 | } 20 | 21 | for (int i = 0; i < GAMEPAD_BUTTON_COUNT; i++) 22 | { 23 | if ((debounceState.buttons & buttonMasks[i]) != (state->buttons & buttonMasks[i]) && (now - buttonTime[i]) > debounceMS) 24 | { 25 | debounceState.buttons ^= buttonMasks[i]; 26 | buttonTime[i] = now; 27 | } 28 | } 29 | 30 | state->dpad = debounceState.dpad; 31 | state->buttons = debounceState.buttons; 32 | } 33 | -------------------------------------------------------------------------------- /GP2040-CE/src/gba/spi32.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: CC0-1.0 3 | */ 4 | 5 | #include "gba/spi32.h" 6 | 7 | #include "pico/stdlib.h" 8 | 9 | namespace gba 10 | { 11 | 12 | uint32_t swapByte32(uint32_t val) { 13 | union { 14 | uint32_t u32; 15 | uint8_t u8[4]; 16 | } x; 17 | 18 | x.u32 = val; 19 | 20 | uint8_t tmp, tmp2; 21 | tmp = x.u8[0]; 22 | tmp2 = x.u8[3]; 23 | x.u8[0] = tmp2; 24 | x.u8[3] = tmp; 25 | tmp = x.u8[1]; 26 | tmp2 = x.u8[2]; 27 | x.u8[1] = tmp2; 28 | x.u8[2] = tmp; 29 | 30 | return x.u32; 31 | } 32 | 33 | void initSpi32() { 34 | spi_init(spi_default, 1000 * 1000); 35 | gpio_set_function(PICO_DEFAULT_SPI_RX_PIN, GPIO_FUNC_SPI); 36 | gpio_set_function(PICO_DEFAULT_SPI_SCK_PIN, GPIO_FUNC_SPI); 37 | gpio_set_function(PICO_DEFAULT_SPI_TX_PIN, GPIO_FUNC_SPI); 38 | gpio_set_function(PICO_DEFAULT_SPI_CSN_PIN, GPIO_FUNC_SPI); 39 | spi_set_format(spi0, 8, SPI_CPOL_1, SPI_CPHA_1, SPI_MSB_FIRST); 40 | } 41 | 42 | void deinitSpi32() { 43 | spi_deinit(spi_default); 44 | } 45 | 46 | uint32_t spi32(uint32_t val) { 47 | union { 48 | uint32_t u32; 49 | uint8_t u8[4]; 50 | } send, recv; 51 | 52 | send.u32 = swapByte32(val); 53 | spi_write_read_blocking(spi_default, send.u8, recv.u8, 4); 54 | 55 | return swapByte32(recv.u32); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /GP2040-CE/src/gp2040aux.cpp: -------------------------------------------------------------------------------- 1 | // GP2040 includes 2 | #include "gp2040aux.h" 3 | #include "gamepad.h" 4 | 5 | #include "storagemanager.h" // Global Managers 6 | #include "addonmanager.h" 7 | 8 | #include "addons/i2cdisplay.h" // Add-Ons 9 | #include "addons/neopicoleds.h" 10 | #include "addons/pleds.h" 11 | #include "addons/board_led.h" 12 | #include "addons/buzzerspeaker.h" 13 | #include "addons/ps4mode.h" 14 | 15 | #include 16 | 17 | GP2040Aux::GP2040Aux() : nextRuntime(0) { 18 | } 19 | 20 | GP2040Aux::~GP2040Aux() { 21 | } 22 | 23 | void GP2040Aux::setup() { 24 | addons.LoadAddon(new I2CDisplayAddon(), CORE1_LOOP); 25 | addons.LoadAddon(new NeoPicoLEDAddon(), CORE1_LOOP); 26 | addons.LoadAddon(new PlayerLEDAddon(), CORE1_LOOP); 27 | addons.LoadAddon(new BoardLedAddon(), CORE1_LOOP); 28 | addons.LoadAddon(new BuzzerSpeakerAddon(), CORE1_LOOP); 29 | addons.LoadAddon(new PS4ModeAddon(), CORE1_LOOP); 30 | } 31 | 32 | void GP2040Aux::run() { 33 | while (1) { 34 | if (nextRuntime > getMicro()) { // fix for unsigned 35 | sleep_us(50); // Give some time back to our CPU (lower power consumption) 36 | continue; 37 | } 38 | addons.ProcessAddons(CORE1_LOOP); 39 | nextRuntime = getMicro() + GAMEPAD_POLL_MICRO; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /GP2040-CE/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: MIT 3 | * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) 4 | */ 5 | 6 | // Pi Pico includes 7 | #include "pico/multicore.h" 8 | 9 | // GP2040 includes 10 | #include "gp2040.h" 11 | #include "gp2040aux.h" 12 | 13 | // GBA multiboot includes 14 | #include "gba/multiboot.h" 15 | #include "../../build/gba_rom.hpp" 16 | 17 | // Launch our second core with additional modules loaded in 18 | void core1() { 19 | multicore_lockout_victim_init(); // block core 1 20 | 21 | // Create GP2040 w/ Additional Modules for Core 1 22 | GP2040Aux * gp2040Core1 = new GP2040Aux(); 23 | gp2040Core1->setup(); 24 | gp2040Core1->run(); 25 | } 26 | 27 | int main() { 28 | // Send GBA program via SPI, which sends its key presses to the RPi Pico 29 | bool isAlreadyRunning = !gba::sendGBARom(LinkSPI_demo_mb_gba, LinkSPI_demo_mb_gba_len); 30 | // Give user some time to change Input Mode (https://gp2040-ce.info/#/usage?id=input-modes) 31 | if (!isAlreadyRunning) 32 | sleep_ms(3000); 33 | 34 | // Create GP2040 Main Core (core0), Core1 is dependent on Core0 35 | GP2040 * gp2040 = new GP2040(); 36 | gp2040->setup(); 37 | 38 | // Create GP2040 Thread for Core1 39 | multicore_launch_core1(core1); 40 | 41 | // Start Core0 Loop 42 | gp2040->run(); 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /GP2040-CE/tools/linux_compile_makefsdata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This compiles makefsdata for Linux statically linking against musl 4 | # - Make sure that you have the required packages installed (for Ubuntu these are: musl and musl-tools) 5 | # - Download the latest release ZIP from https://github.com/richgel999/miniz/releases and copy miniz.c and miniz.h to 6 | # $PICO_SDK_PATH/lib/lwip/src/apps/http 7 | 8 | musl-gcc \ 9 | $PICO_SDK_PATH/lib/lwip/src/apps/http/makefsdata/makefsdata.c \ 10 | --no-pie -static \ 11 | -o makefsdata \ 12 | -I$PICO_SDK_PATH/lib/lwip/src/include \ 13 | -I$PICO_SDK_PATH/lib/lwip/contrib/ports/unix/lib \ 14 | -I$PICO_SDK_PATH/lib/lwip/contrib/ports/unix/port/include \ 15 | -DMAKEFS_SUPPORT_DEFLATE=1 16 | -------------------------------------------------------------------------------- /GP2040-CE/tools/makefsdata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/tools/makefsdata -------------------------------------------------------------------------------- /GP2040-CE/tools/makefsdata.darwin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/tools/makefsdata.darwin -------------------------------------------------------------------------------- /GP2040-CE/tools/makefsdata.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/GP2040-CE/tools/makefsdata.exe -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p build/ 4 | 5 | cd gba-link-connection/examples/LinkSPI_demo/ 6 | make rebuild 7 | cp LinkSPI_demo.mb.gba ../../../build/ 8 | 9 | cd ../../../build/ 10 | echo -e "#pragma once\ninline constexpr " > gba_rom.hpp 11 | xxd -i LinkSPI_demo.mb.gba >> gba_rom.hpp 12 | 13 | cd ../GP2040-CE/ 14 | mkdir -p build/ 15 | cd build/ 16 | cmake ../ -D PICO_SDK_FETCH_FROM_GIT=true 17 | make -j16 18 | cp GP2040-CE_0.7.1_Pico.uf2 ../../build/gba-pico-gamepad.uf2 19 | -------------------------------------------------------------------------------- /gba-link-connection/.gitignore: -------------------------------------------------------------------------------- 1 | # Directories 2 | build 3 | .vscode 4 | 5 | # Files 6 | *.elf 7 | *.gba 8 | *.sav 9 | -------------------------------------------------------------------------------- /gba-link-connection/.licenses/libgba-sprite-engine.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Rodrigo Alfonso 4 | Copyright (c) 2018 Wouter Groeneveld 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /gba-link-connection/.licenses/libtonc.txt: -------------------------------------------------------------------------------- 1 | Copyright 2005-2009 J Vijn 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /gba-link-connection/.licenses/libugba.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2015, 2019-2020 Antonio Niño Díaz 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /gba-link-connection/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Rodrigo Alfonso 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x10.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x11.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x16.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x17.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x1d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x1d.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x1f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x1f.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x20.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x21.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x25.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x26.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x27.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/0x30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/0x30.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/broadcast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/broadcast.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/first_nintendo_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/first_nintendo_32.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/first_single_u32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/first_single_u32.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/full_initialisation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/full_initialisation.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/init.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/logic2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/logic2.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/multiboot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/multiboot.jpg -------------------------------------------------------------------------------- /gba-link-connection/docs/img/wake-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/wake-up.png -------------------------------------------------------------------------------- /gba-link-connection/docs/img/wirelessadapter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/docs/img/wirelessadapter.jpg -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkCableMultiboot_demo/pad16.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SIZE=$(wc -c < $1) 4 | DIFF=$(($SIZE % 16)) 5 | if (($DIFF > 0)); then 6 | PAD_NEEDED=$((16 - $DIFF)) 7 | dd if=/dev/zero bs=1 count=$PAD_NEEDED >> $1 8 | fi 9 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkCable_full/src/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_H 2 | #define MAIN_H 3 | 4 | #include 5 | #include "../../../lib/LinkCable.h" 6 | #include "../../../lib/LinkUniversal.h" 7 | 8 | // #define USE_LINK_UNIVERSAL 9 | 10 | #ifndef USE_LINK_UNIVERSAL 11 | extern LinkCable* link; 12 | #endif 13 | #ifdef USE_LINK_UNIVERSAL 14 | extern LinkUniversal* link; 15 | #endif 16 | 17 | #endif // MAIN_H 18 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkCable_full/src/scenes/TestScene.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST_SCENE_H 2 | #define TEST_SCENE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | class TestScene : public Scene { 12 | public: 13 | TestScene(std::shared_ptr engine); 14 | 15 | std::vector backgrounds() override; 16 | std::vector sprites() override; 17 | 18 | void load() override; 19 | void tick(u16 keys) override; 20 | 21 | private: 22 | u32 counter = 0; 23 | bool isConnected = false; 24 | bool initialized = false; 25 | u32 frameCounter = 0; 26 | }; 27 | 28 | #endif // TEST_SCENE_H 29 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkCable_full/src/utils/BackgroundUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef BACKGROUND_UTILS_H 2 | #define BACKGROUND_UTILS_H 3 | 4 | #include 5 | #include 6 | 7 | inline void BACKGROUND_enable(bool bg0, bool bg1, bool bg2, bool bg3) { 8 | REG_DISPCNT = bg0 ? REG_DISPCNT | DCNT_BG0 : REG_DISPCNT & ~DCNT_BG0; 9 | REG_DISPCNT = bg1 ? REG_DISPCNT | DCNT_BG1 : REG_DISPCNT & ~DCNT_BG1; 10 | REG_DISPCNT = bg2 ? REG_DISPCNT | DCNT_BG2 : REG_DISPCNT & ~DCNT_BG2; 11 | REG_DISPCNT = bg3 ? REG_DISPCNT | DCNT_BG3 : REG_DISPCNT & ~DCNT_BG3; 12 | } 13 | 14 | #endif // BACKGROUND_UTILS_H 15 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkCable_full/src/utils/InputHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef INPUT_HANDLER_H 2 | #define INPUT_HANDLER_H 3 | 4 | #include 5 | 6 | class InputHandler { 7 | public: 8 | InputHandler() { this->isPressed = false; } 9 | 10 | inline bool getIsPressed() { return isPressed; } 11 | 12 | inline bool hasBeenPressedNow() { return isNewPressEvent; } 13 | inline bool hasBeenReleasedNow() { return isNewReleaseEvent; } 14 | 15 | inline bool getHandledFlag() { return handledFlag; } 16 | inline void setHandledFlag(bool value) { handledFlag = value; } 17 | 18 | inline void setIsPressed(bool isPressed) { 19 | bool isNewPressEvent = !this->isPressed && isPressed; 20 | bool isNewReleaseEvent = this->isPressed && !isPressed; 21 | this->isPressed = isPressed; 22 | 23 | this->isNewPressEvent = isNewPressEvent; 24 | this->isNewReleaseEvent = isNewReleaseEvent; 25 | } 26 | 27 | protected: 28 | bool isPressed = false; 29 | bool isNewPressEvent = false; 30 | bool isNewReleaseEvent; 31 | bool handledFlag = false; 32 | }; 33 | 34 | #endif // INPUT_HANDLER_H 35 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkCable_full/src/utils/SceneUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "SceneUtils.h" 2 | 3 | #include 4 | 5 | int DEBULOG_LINE = 2; 6 | 7 | void DEBULOG(std::string string) { 8 | TextStream::instance().setText(string, DEBULOG_LINE, -3); 9 | DEBULOG_LINE++; 10 | for (u32 i = DEBULOG_LINE; i < 20; i++) 11 | TextStream::instance().setText(" ", i, -3); 12 | if (DEBULOG_LINE >= 20) 13 | DEBULOG_LINE = 2; 14 | } 15 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkCable_full/src/utils/SceneUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef SCENE_UTILS_H 2 | #define SCENE_UTILS_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include "BackgroundUtils.h" 9 | #include "SpriteUtils.h" 10 | 11 | const u32 TEXT_MIDDLE_COL = 12; 12 | 13 | extern int DEBULOG_LINE; 14 | void DEBULOG(std::string string); 15 | 16 | inline std::string asStr(u16 data) { 17 | return std::to_string(data); 18 | } 19 | 20 | inline bool isBitHigh(u16 data, u8 bit) { 21 | return (data >> bit) & 1; 22 | } 23 | 24 | inline void SCENE_init() { 25 | TextStream::instance().clear(); 26 | TextStream::instance().scroll(0, 0); 27 | TextStream::instance().setMosaic(false); 28 | 29 | BACKGROUND_enable(false, false, false, false); 30 | SPRITE_disable(); 31 | } 32 | 33 | inline void SCENE_write(std::string text, u32 row) { 34 | TextStream::instance().setText(text, row, 35 | TEXT_MIDDLE_COL - text.length() / 2); 36 | } 37 | 38 | inline void SCENE_wait(u32 verticalLines) { 39 | u32 count = 0; 40 | u32 vCount = REG_VCOUNT; 41 | 42 | while (count < verticalLines) { 43 | if (REG_VCOUNT != vCount) { 44 | count++; 45 | vCount = REG_VCOUNT; 46 | } 47 | }; 48 | } 49 | 50 | #endif // SCENE_UTILS_H 51 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkCable_full/src/utils/SpriteUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITE_UTILS_H 2 | #define SPRITE_UTILS_H 3 | 4 | #include 5 | #include 6 | 7 | inline void SPRITE_disable() { 8 | REG_DISPCNT = REG_DISPCNT & ~DCNT_OBJ; 9 | } 10 | 11 | #endif // SPRITE_UTILS_H 12 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkSPI_demo/Master.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // PIN 11 - YELLOW - SI / MOSI 4 | // PIN 12 - RED - SO / MISO 5 | // PIN 13 - WHITE - SC / CLK 6 | // PIN GND - BLUE - GND / GND 7 | 8 | void setup() { 9 | SPI.setDataMode(SPI_MODE1); 10 | SPI.setClockDivider(128); // (16Mhz / 128 = 128Khz) 11 | SPI.begin(); 12 | Serial.begin(9600); 13 | } 14 | 15 | uint32_t transfer(uint32_t value) { 16 | uint8_t a = (value >> 24) & 0xff; 17 | uint8_t b = (value >> 16) & 0xff; 18 | uint8_t c = (value >> 8) & 0xff; 19 | uint8_t d = (value >> 0) & 0xff; 20 | 21 | a = SPI.transfer(a); 22 | b = SPI.transfer(b); 23 | c = SPI.transfer(c); 24 | d = SPI.transfer(d); 25 | 26 | return ((uint32_t)a << 24) | ((uint32_t)b << 16) | ((uint32_t)c << 8) | 27 | ((uint32_t)d << 0); 28 | } 29 | 30 | void loop() { 31 | uint32_t received = transfer(0xaabbccdd); // (2864434397) 32 | 33 | Serial.println(received); 34 | 35 | delay(100); 36 | } 37 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkSPI_demo/Slave.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // PIN 11 - RED - SO / MOSI 4 | // PIN 12 - YELLOW - SI / MISO 5 | // PIN 13 - WHITE - SC / CLK 6 | // PIN GND - BLUE - GND / GND 7 | 8 | void setup() { 9 | pinMode(MISO, OUTPUT); 10 | SPI.setDataMode(SPI_MODE3); 11 | SPCR |= _BV(SPE); 12 | 13 | Serial.begin(9600); 14 | } 15 | 16 | uint8_t transferByte(uint8_t value) { 17 | SPDR = value; 18 | while (!(SPSR & _BV(SPIF))) 19 | ; 20 | return SPDR; 21 | } 22 | 23 | uint32_t transfer(uint32_t value) { 24 | uint8_t a = (value >> 24) & 0xff; 25 | uint8_t b = (value >> 16) & 0xff; 26 | uint8_t c = (value >> 8) & 0xff; 27 | uint8_t d = (value >> 0) & 0xff; 28 | 29 | a = transferByte(a); 30 | b = transferByte(b); 31 | c = transferByte(c); 32 | d = transferByte(d); 33 | 34 | return ((uint32_t)a << 24) | ((uint32_t)b << 16) | ((uint32_t)c << 8) | 35 | ((uint32_t)d << 0); 36 | } 37 | 38 | void loop() { 39 | uint32_t received = transfer(0xaabbccdd); // (2864434397) 40 | 41 | Serial.println(received); 42 | } 43 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkSPI_demo/pad16.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SIZE=$(wc -c < $1) 4 | DIFF=$(($SIZE % 16)) 5 | if (($DIFF > 0)); then 6 | PAD_NEEDED=$((16 - $DIFF)) 7 | dd if=/dev/zero bs=1 count=$PAD_NEEDED >> $1 8 | fi 9 | -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkSPI_demo/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "../../_lib/interrupt.h" 4 | 5 | // (0) Include the header 6 | #include "../../../lib/LinkSPI.h" 7 | 8 | void log(std::string text); 9 | void wait(u32 verticalLines); 10 | inline void VBLANK() {} 11 | 12 | // (1) Create a LinkSPI instance 13 | LinkSPI* linkSPI = new LinkSPI(); 14 | 15 | void init() { 16 | REG_DISPCNT = DCNT_MODE0 | DCNT_BG0; 17 | tte_init_se_default(0, BG_CBB(0) | BG_SBB(31)); 18 | 19 | // (2) Add the interrupt service routines 20 | interrupt_init(); 21 | interrupt_set_handler(INTR_VBLANK, VBLANK); 22 | interrupt_enable(INTR_VBLANK); 23 | interrupt_set_handler(INTR_SERIAL, LINK_SPI_ISR_SERIAL); 24 | interrupt_enable(INTR_SERIAL); 25 | } 26 | 27 | int main() { 28 | init(); 29 | 30 | bool firstTransfer = true; 31 | 32 | linkSPI->activate(LinkSPI::Mode::SLAVE); 33 | 34 | while (true) { 35 | std::string output = "[gba-pico-gamepad]\n\n"; 36 | u16 keys = ~REG_KEYS & KEY_ANY; 37 | 38 | if (firstTransfer) { 39 | log(output + "Waiting..."); 40 | firstTransfer = false; 41 | } 42 | 43 | // Exchange 32-bit data with the other end 44 | u32 remoteKeys = linkSPI->transfer(keys); 45 | output += "send: " + std::to_string(keys) + "\n"; 46 | output += "recv: " + std::to_string(remoteKeys) + "\n"; 47 | 48 | // Print 49 | // VBlankIntrWait(); 50 | log(output); 51 | } 52 | 53 | return 0; 54 | } 55 | 56 | void log(std::string text) { 57 | tte_erase_screen(); 58 | tte_write("#{P:0,0}"); 59 | tte_write(text.c_str()); 60 | } 61 | 62 | void wait(u32 verticalLines) { 63 | u32 count = 0; 64 | u32 vCount = REG_VCOUNT; 65 | 66 | while (count < verticalLines) { 67 | if (REG_VCOUNT != vCount) { 68 | count++; 69 | vCount = REG_VCOUNT; 70 | } 71 | }; 72 | } -------------------------------------------------------------------------------- /gba-link-connection/examples/LinkUniversal_full/README.md: -------------------------------------------------------------------------------- 1 | # LinkUniversal_full 2 | 3 | - Reuse code from `examples/LinkCable_full` 4 | - Uncomment `USE_LINK_UNIVERSAL` in `src/main.h` 5 | - Compile! -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/interrupt.cpp: -------------------------------------------------------------------------------- 1 | #include "interrupt.h" 2 | #include 3 | 4 | void interrupt_init(void) { 5 | IRQ_Init(); 6 | } 7 | 8 | void interrupt_set_handler(interrupt_index index, interrupt_vector function) { 9 | IRQ_SetHandler((irq_index)index, function); 10 | } 11 | 12 | void interrupt_enable(interrupt_index index) { 13 | IRQ_Enable((irq_index)index); 14 | } 15 | 16 | void interrupt_disable(interrupt_index index) { 17 | IRQ_Disable((irq_index)index); 18 | } 19 | 20 | void interrupt_set_reference_vcount(unsigned long y) { 21 | IRQ_SetReferenceVCOUNT(y); 22 | } -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/interrupt.h: -------------------------------------------------------------------------------- 1 | #ifndef INTERRUPT_H 2 | #define INTERRUPT_H 3 | 4 | typedef enum { 5 | INTR_VBLANK = 0, 6 | INTR_HBLANK = 1, 7 | INTR_VCOUNT = 2, 8 | INTR_TIMER0 = 3, 9 | INTR_TIMER1 = 4, 10 | INTR_TIMER2 = 5, 11 | INTR_TIMER3 = 6, 12 | INTR_SERIAL = 7, 13 | INTR_DMA0 = 8, 14 | INTR_DMA1 = 9, 15 | INTR_DMA2 = 10, 16 | INTR_DMA3 = 11, 17 | INTR_KEYPAD = 12, 18 | INTR_GAMEPAK = 13, 19 | INTR_NUMBER 20 | } interrupt_index; 21 | 22 | typedef void (*interrupt_vector)(void); 23 | 24 | void interrupt_init(void); 25 | void interrupt_set_handler(interrupt_index index, interrupt_vector function); 26 | void interrupt_enable(interrupt_index index); 27 | void interrupt_disable(interrupt_index index); 28 | void interrupt_set_reference_vcount(unsigned long y); 29 | 30 | #endif // INTERRUPT_H -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/include/libgba-sprite-engine/allocator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wouter Groeneveld on 27/07/18. 3 | // very loosely based on: 4 | // https://github.com/Jambo51/GBA-Pokemon-Engine/blob/master/source/Entities/OAMObject.cpp 5 | // 6 | 7 | #ifndef GBA_SPRITE_ENGINE_ALLOCATOR_H 8 | #define GBA_SPRITE_ENGINE_ALLOCATOR_H 9 | 10 | #pragma GCC system_header 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #define MEM_OBJ_VRAM_BASE (MEM_VRAM + VRAM_BG_SIZE) 17 | 18 | u32 voidPtrToU32(void* ptr); 19 | 20 | class AllocatedData { 21 | public: 22 | void* pointer() const { return (void*)currentAddress; }; 23 | u32 size, currentAddress, baseAddress; 24 | 25 | const int getTileLocation() const { 26 | return (currentAddress - baseAddress) >> 5; 27 | } 28 | 29 | AllocatedData(u32 address, u32 size, u32 base) 30 | : currentAddress(address), size(size), baseAddress(base) {} 31 | }; 32 | 33 | class Allocator { 34 | private: 35 | Allocator() = delete; 36 | Allocator(Allocator& other) = delete; 37 | Allocator(Allocator&& other) = delete; 38 | 39 | static u32 currentSpriteIndex; 40 | 41 | public: 42 | static void free(); 43 | static u32 getCurrentSpriteIndex() { return currentSpriteIndex; } 44 | static int getAllocatedSprites() { return allocatedSprites.size(); } 45 | static AllocatedData& allocateObjectTiles(u32 size); 46 | static std::vector allocatedSprites; 47 | }; 48 | 49 | #endif // GBA_SPRITE_ENGINE_ALLOCATOR_H 50 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/include/libgba-sprite-engine/background/text_stream.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wouter Groeneveld on 28/07/18. 3 | // 4 | 5 | #ifndef GBA_SPRITE_ENGINE_TEXT_STREAM_H 6 | #define GBA_SPRITE_ENGINE_TEXT_STREAM_H 7 | 8 | #pragma GCC system_header 9 | 10 | #include "background.h" 11 | #include "text.h" 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #define CHAR_OFFSET_INDEX 32 18 | #define TILE_WIDTH 32 19 | #define PALETTE_COLOR_INDEX 15 20 | #define PALETTE_TEXT_BANK 15 21 | 22 | #define failure_gba(__mess) \ 23 | (consoleLog_func(__FILE__, __LINE__, __PRETTY_FUNCTION__, #__mess)) 24 | void log_text(const char* text); 25 | void consoleLog_func(const char* fileName, 26 | const int lineNr, 27 | const char* fnName, 28 | const char* msg); 29 | 30 | class TextStream : public Background { 31 | private: 32 | int currRow, currCol; 33 | std::unique_ptr palette; 34 | 35 | static TextStream* inst; 36 | TextStream(); 37 | TextStream(TextStream& other) = delete; 38 | TextStream(TextStream&& other) = delete; 39 | 40 | public: 41 | void clear(); 42 | void setText(std::string text, int row, int col); 43 | void setText(const char* text, int row, int col); 44 | 45 | void setFontColor(COLOR color); 46 | void setFontStyle(const void* data, int size); 47 | 48 | static TextStream& instance(); 49 | 50 | void persist() override; 51 | 52 | TextStream& operator<<(const char* s); 53 | TextStream& operator<<(const int s); 54 | TextStream& operator<<(const u32 s); 55 | TextStream& operator<<(const bool s); 56 | }; 57 | 58 | #endif // GBA_SPRITE_ENGINE_TEXT_STREAM_H 59 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/include/libgba-sprite-engine/effects/fade_out_scene.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wouter Groeneveld on 04/08/18. 3 | // 4 | 5 | #ifndef GBA_SPRITE_ENGINE_FADE_OUT_SCENE_H 6 | #define GBA_SPRITE_ENGINE_FADE_OUT_SCENE_H 7 | 8 | #pragma GCC system_header 9 | 10 | #include 11 | 12 | #include "scene_effect.h" 13 | 14 | enum FadeOutType { ToWhite, ToBlack }; 15 | 16 | class FadeOutScene : public SceneEffect { 17 | private: 18 | FadeOutType type; 19 | int timesUpdated; 20 | int speed; 21 | std::unique_ptr palette; 22 | 23 | public: 24 | FadeOutScene(int speed); 25 | FadeOutScene(int speed, FadeOutType type); 26 | void update() override; 27 | bool isDone() override { return timesUpdated >= (32 / speed); } 28 | }; 29 | 30 | #endif // GBA_SPRITE_ENGINE_FADE_OUT_SCENE_H 31 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/include/libgba-sprite-engine/effects/scene_effect.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wouter Groeneveld on 04/08/18. 3 | // 4 | 5 | #ifndef GBA_SPRITE_ENGINE_SCENE_EFFECT_H 6 | #define GBA_SPRITE_ENGINE_SCENE_EFFECT_H 7 | 8 | #pragma GCC system_header 9 | 10 | #include 11 | 12 | class SceneEffect { 13 | protected: 14 | // WHY no reference? Scene& operator= is implicitly deleted and no intentions 15 | // to use that 16 | Scene* sceneToAffect; 17 | 18 | public: 19 | void setSceneToAffect(Scene* scene) { sceneToAffect = scene; }; 20 | 21 | virtual void update() = 0; 22 | virtual bool isDone() = 0; 23 | }; 24 | 25 | #endif // GBA_SPRITE_ENGINE_SCENE_EFFECT_H 26 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/include/libgba-sprite-engine/gbavector.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wouter Groeneveld on 14/12/18. 3 | // 4 | 5 | #ifndef GBA_SPRITE_ENGINE_PROJECT_MATH_H 6 | #define GBA_SPRITE_ENGINE_PROJECT_MATH_H 7 | 8 | #pragma GCC system_header 9 | 10 | #include 11 | 12 | #ifdef CODE_COMPILED_AS_PART_OF_TEST 13 | #include 14 | #else 15 | #include 16 | #endif 17 | 18 | #include 19 | 20 | class GBAVector { 21 | private: 22 | VECTOR v; 23 | 24 | public: 25 | GBAVector() : v({}) {} 26 | GBAVector(VECTOR v) : v(v) {} 27 | 28 | std::deque bresenhamLineTo(VECTOR dest); 29 | VECTOR rotateAsCenter(VECTOR point, uint angle); 30 | 31 | std::string to_string() { 32 | return "(" + std::to_string(v.x) + "," + std::to_string(v.y) + ")"; 33 | } 34 | }; 35 | 36 | #endif // GBA_SPRITE_ENGINE_PROJECT_MATH_H 37 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/include/libgba-sprite-engine/palette/combined_palette.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wouter Groeneveld on 05/08/18. 3 | // 4 | 5 | #ifndef GBA_SPRITE_ENGINE_COMBINED_PALETTE_H 6 | #define GBA_SPRITE_ENGINE_COMBINED_PALETTE_H 7 | 8 | #pragma GCC system_header 9 | 10 | class PaletteManager; 11 | 12 | class CombinedPalette { 13 | private: 14 | // WHY use references here? lifetimes not bound, not owned by CombinedPalette 15 | PaletteManager& palette1; 16 | PaletteManager& palette2; 17 | 18 | void changeBrightness(PaletteManager& palette, 19 | int bank, 20 | int index, 21 | int intensity); 22 | 23 | public: 24 | CombinedPalette(PaletteManager& one, PaletteManager& two) 25 | : palette1(one), palette2(two) {} 26 | CombinedPalette(const CombinedPalette& other) = delete; 27 | 28 | void changeBrightness(int intensity); 29 | }; 30 | 31 | #endif // GBA_SPRITE_ENGINE_COMBINED_PALETTE_H 32 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/include/libgba-sprite-engine/scene.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wouter Groeneveld on 28/07/18. 3 | // 4 | 5 | #ifndef GBA_SPRITE_ENGINE_SCRENE_H 6 | #define GBA_SPRITE_ENGINE_SCRENE_H 7 | 8 | #pragma GCC system_header 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | class GBAEngine; 17 | 18 | class Scene { 19 | protected: 20 | std::unique_ptr foregroundPalette; 21 | std::unique_ptr backgroundPalette; 22 | std::shared_ptr engine; 23 | 24 | void addSprite(Sprite* sprite); 25 | 26 | public: 27 | ForegroundPaletteManager* getForegroundPalette() { 28 | return foregroundPalette.get(); 29 | } 30 | BackgroundPaletteManager* getBackgroundPalette() { 31 | return backgroundPalette.get(); 32 | } 33 | 34 | // WHY raw pointers? they're unwrapped unique_ptrs managed by the scene 35 | // implementation - will be cleaned up in engine 36 | virtual std::vector sprites() = 0; 37 | virtual std::vector backgrounds() = 0; 38 | 39 | virtual void load() = 0; 40 | virtual void tick(u16 keys) = 0; 41 | 42 | Scene(std::shared_ptr engine) 43 | : engine(engine), 44 | foregroundPalette(std::unique_ptr( 45 | new ForegroundPaletteManager())), 46 | backgroundPalette(std::unique_ptr( 47 | new BackgroundPaletteManager())) {} 48 | virtual ~Scene() { 49 | // scenes should manage their own resources - use std::unique_ptr 50 | } 51 | }; 52 | 53 | #endif // GBA_SPRITE_ENGINE_SCRENE_H 54 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/include/libgba-sprite-engine/sprites/affine_sprite.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wouter Groeneveld on 28/07/18. 3 | // 4 | 5 | #ifndef GBA_SPRITE_ENGINE_AFFINE_SPRITE_H 6 | #define GBA_SPRITE_ENGINE_AFFINE_SPRITE_H 7 | 8 | #pragma GCC system_header 9 | 10 | #include "sprite.h" 11 | 12 | class SpriteManager; 13 | 14 | class AffineSprite : public Sprite { 15 | private: 16 | int affIndex; 17 | std::unique_ptr affine; 18 | void setTransformationMatrix(OBJ_AFFINE* matrix); 19 | 20 | void rebuildOamAttr1ForAffineIndex(); 21 | 22 | protected: 23 | void buildOam(int tileIndex) override; 24 | void syncOam() override; 25 | 26 | public: 27 | void setAffineIndex(int index) { this->affIndex = index; } 28 | void identity(); 29 | void rotate(u16 alpha); 30 | explicit AffineSprite(const AffineSprite& other); 31 | explicit AffineSprite(const void* imgData, 32 | int imgSize, 33 | int xC, 34 | int yC, 35 | SpriteSize spriteSize); 36 | OBJ_AFFINE* getMatrix() { return affine.get(); } 37 | 38 | friend class SpriteManager; 39 | }; 40 | 41 | #endif // GBA_SPRITE_ENGINE_AFFINE_SPRITE_H 42 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/include/libgba-sprite-engine/sprites/sprite_manager.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wouter Groeneveld on 26/07/18. 3 | // 4 | 5 | #ifndef GBA_SPRITE_ENGINE_SPRITE_MANAGER_H 6 | #define GBA_SPRITE_ENGINE_SPRITE_MANAGER_H 7 | 8 | #pragma GCC system_header 9 | 10 | #include 11 | 12 | #include 13 | 14 | #include "sprite.h" 15 | 16 | class SpriteManager { 17 | private: 18 | bool initialized; 19 | std::vector sprites; 20 | 21 | inline void copyOverSpriteOAMToVRAM() { 22 | int i = 0; 23 | 24 | for (auto sprite : this->sprites) { 25 | if (sprite->enabled) { 26 | sprite->update(); 27 | oam_mem[i] = sprite->oam; 28 | } 29 | 30 | i++; 31 | } 32 | } 33 | 34 | void copyOverImageDataToVRAM(Sprite* s); 35 | void copyOverImageDataToVRAM(); 36 | 37 | public: 38 | int getSpriteSize() { return sprites.size(); } 39 | 40 | void hideAll(); 41 | void add(Sprite* sprite); 42 | void set(std::vector sprites); 43 | void persist(); // copies over image and palette data to VRAM, modifies 44 | // sprite OAM indiches 45 | 46 | inline void 47 | render() { // copies over OAM buffer to OAM RAM, called in game loop 48 | // WARNING - This is called every time in the main update loop; keep amount 49 | // of instructions as minimal as possible in here! 50 | copyOverSpriteOAMToVRAM(); 51 | } 52 | }; 53 | 54 | #endif // GBA_SPRITE_ENGINE_SPRITE_MANAGER_H 55 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/include/libgba-sprite-engine/timer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Wouter Groeneveld on 06/12/18. 3 | // 4 | 5 | #ifndef GBA_SPRITE_ENGINE_PROJECT_TIMER_H 6 | #define GBA_SPRITE_ENGINE_PROJECT_TIMER_H 7 | 8 | #pragma GCC system_header 9 | 10 | #include 11 | 12 | class Timer { 13 | private: 14 | int microsecs, msecs, secs, minutes, hours; 15 | bool active; 16 | 17 | public: 18 | Timer() : active(false) { reset(); } 19 | 20 | void reset(); 21 | void start(); 22 | void toggle() { 23 | if (isActive()) 24 | stop(); 25 | else 26 | start(); 27 | } 28 | bool isActive() { return active; } 29 | void stop(); 30 | void onvblank(); 31 | 32 | std::string to_string(); 33 | 34 | int getTotalMsecs(); 35 | int getMsecs() { return msecs; } 36 | int getSecs() { return secs; } 37 | int getMinutes() { return minutes; } 38 | int getHours() { return hours; } 39 | 40 | friend std::ostream& operator<<(std::ostream& os, Timer& timer); 41 | }; 42 | 43 | #endif // GBA_SPRITE_ENGINE_PROJECT_TIMER_H 44 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libgba-sprite-engine/lib/libgba-sprite-engine.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/examples/_lib/libgba-sprite-engine/lib/libgba-sprite-engine.a -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/bios_wrappers.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | #ifndef BIOS_WRAPPERS_H__ 6 | #define BIOS_WRAPPERS_H__ 7 | 8 | #include 9 | 10 | #include "bios.h" 11 | 12 | // Note: This file contains wrappers to use some BIOS services easier than with 13 | // the actual interface. 14 | 15 | // Copy from source to destination in 16-bit chunks. 16 | EXPORT_API void SWI_CpuSet_Copy16(const void *src, void *dst, size_t len); 17 | 18 | // Fill destination with the 16-bit value from source. 19 | EXPORT_API void SWI_CpuSet_Fill16(const void *src, void *dst, size_t len); 20 | 21 | // Copy from source to destination in 32-bit chunks. 22 | EXPORT_API void SWI_CpuSet_Copy32(const void *src, void *dst, size_t len); 23 | 24 | // Fill destination with the 32-bit value from source. 25 | EXPORT_API void SWI_CpuSet_Fill32(const void *src, void *dst, size_t len); 26 | 27 | 28 | // Copy from source to destination in 32-bit chunks. 29 | EXPORT_API void SWI_CpuFastSet_Copy32(const void *src, void *dst, size_t len); 30 | 31 | // Fill destination with the 32-bit value from source. 32 | EXPORT_API void SWI_CpuFastSet_Fill32(const void *src, void *dst, size_t len); 33 | 34 | 35 | // Fills an array of object affine matrices from an array of transformations. 36 | EXPORT_API void SWI_ObjAffineSet_OAM(const obj_affine_src *src, 37 | oam_matrix_entry *dst, uint32_t count); 38 | 39 | #endif // BIOS_WRAPPERS_H__ 40 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/console.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | #ifndef CONSOLE_H__ 6 | #define CONSOLE_H__ 7 | 8 | #include "definitions.h" 9 | 10 | // Initialize the console by loading the needed tileset and map to the last tile 11 | // block in VRAM. 12 | EXPORT_API void CON_InitDefault(void); 13 | 14 | // Print a character. 15 | EXPORT_API void CON_PutChar(char c); 16 | 17 | // Print an unformatted string. 18 | EXPORT_API void CON_Print(const char *string); 19 | 20 | // Set cursor at the specified coordinates. 21 | EXPORT_API void CON_CursorSet(int x, int y); 22 | 23 | // Clear the console. 24 | EXPORT_API void CON_Clear(void); 25 | 26 | #endif // CONSOLE_H__ 27 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/debug.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | #ifndef DEBUG_H__ 6 | #define DEBUG_H__ 7 | 8 | // This file has debug utilities that don't work on GBA binaries. However, there 9 | // are defines here that remove them automatically so that code that uses them 10 | // can still build without errors. 11 | 12 | #include 13 | 14 | #include "definitions.h" 15 | 16 | // Take a screenshot. If the specified name is NULL, it defaults to 17 | // "screenshot.png". 18 | #ifdef __GBA__ 19 | #define Debug_Screenshot(n) do { (void)(n); } while (0) 20 | #else 21 | EXPORT_API void Debug_Screenshot(const char *name); 22 | #endif 23 | 24 | // Custom assert() that works on GBA and PC. 25 | #ifndef UGBA_DEBUG 26 | # define UGBA_Assert(expr) ((void)0) 27 | #else 28 | # define UGBA_Assert(expr) \ 29 | ((expr) ? (void)0 : \ 30 | UGBA_AssertFunction(__FILE__, __LINE__, __func__, #expr)) 31 | #endif // UGBA_DEBUG 32 | 33 | EXPORT_API void UGBA_AssertFunction(const char *file, int line, 34 | const char *func, const char *expr); 35 | #endif // DEBUG_H__ 36 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/definitions.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | #ifndef DEFINITIONS_H__ 6 | #define DEFINITIONS_H__ 7 | 8 | #define BIT(n) (1 << (n)) 9 | 10 | // For functions with unused arguments, for example 11 | #if defined(_MSC_VER) 12 | # define UNUSED 13 | #else 14 | # define UNUSED __attribute__((unused)) 15 | #endif 16 | 17 | #if defined(_MSC_VER) 18 | # define ALIGNED(x) __declspec(align(x)) 19 | #else 20 | # define ALIGNED(x) __attribute__((aligned(x))) 21 | #endif 22 | 23 | #if defined(_MSC_VER) 24 | # define NORETURN __declspec(noreturn) 25 | #else 26 | # define NORETURN __attribute__((noreturn)) 27 | #endif 28 | 29 | // The library is built static for GBA and shared for PC 30 | #if defined(__GBA__) 31 | # define EXPORT_API 32 | #else 33 | # if defined(_MSC_VER) 34 | # define EXPORT_API __declspec(dllexport) 35 | # else 36 | # define EXPORT_API __attribute__((visibility("default"))) 37 | //# define EXPORT_API __attribute__((dllexport)) 38 | # endif 39 | #endif 40 | 41 | // NOTE: To use the following defines: 42 | // 43 | // ARM_CODE IWRAM_CODE int add(int a, int b) 44 | // { 45 | // return a + b; 46 | // } 47 | // 48 | // IWRAM_BSS int empty_array[100]; 49 | // 50 | // IWRAM_DATA int non_empty_array[3] = { 1, 2, 3 }; 51 | #ifdef __GBA__ 52 | # define ARM_CODE __attribute__((target("arm"))) 53 | # define THUMB_CODE __attribute__((target("thumb"))) 54 | # define IWRAM_BSS // IWRAM is the default location for .bss symbols 55 | # define IWRAM_DATA // IWRAM is the default location for .data symbols 56 | # define IWRAM_CODE __attribute__((section(".iwram_code"), long_call)) 57 | # define EWRAM_BSS __attribute__((section(".sbss"))) 58 | # define EWRAM_DATA __attribute__((section(".ewram_data"))) 59 | # define EWRAM_CODE __attribute__((section(".ewram_code"), long_call)) 60 | #else 61 | # define ARM_CODE 62 | # define THUMB_CODE 63 | # define IWRAM_BSS 64 | # define IWRAM_DATA 65 | # define IWRAM_CODE 66 | # define EWRAM_BSS 67 | # define EWRAM_DATA 68 | # define EWRAM_CODE 69 | #endif 70 | 71 | #endif // DEFINITIONS_H__ 72 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/dma.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | #ifndef DMA_H__ 6 | #define DMA_H__ 7 | 8 | #include "definitions.h" 9 | 10 | // Important note: The only DMA channel that can read from ROM is 3. 11 | 12 | // Generic DMA transfer function. It is needed to start repeating transfers or 13 | // anything other than a simple copy, as there are only helpers for simple 14 | // copy scenarios. 15 | // 16 | // Returns 0 on success. A transfer can fail if: 17 | // - The channel number isn't valid 18 | // - the source address is set in ROM/SRAM and the specified channel isn't 3. 19 | // This check only works on GBA binaries. 20 | EXPORT_API 21 | int DMA_Transfer(int channel, const void *src, void *dst, size_t size, 22 | uint16_t flags); 23 | 24 | // Stop DMA transfers that repeat. Returns 0 on success. 25 | EXPORT_API 26 | int DMA_Stop(int channel); 27 | 28 | // Copy from source to destination in 16-bit chunks. Returns 0 on success. 29 | EXPORT_API 30 | int DMA_Copy16(int channel, const void *src, void *dst, size_t size); 31 | 32 | // Copy from source to destination in 32-bit chunks. Returns 0 on success. 33 | EXPORT_API 34 | int DMA_Copy32(int channel, const void *src, void *dst, size_t size); 35 | 36 | // During the next HBL do a copy, in 16-bit chunks. Returns 0 on success. 37 | EXPORT_API 38 | int DMA_HBLCopy16(int channel, const void *src, void *dst, size_t size); 39 | 40 | // During the next HBL do a copy, in 32-bit chunks. Returns 0 on success. 41 | EXPORT_API 42 | int DMA_HBLCopy32(int channel, const void *src, void *dst, size_t size); 43 | 44 | // During the next VBL do a copy, in 16-bit chunks. Returns 0 on success. 45 | EXPORT_API 46 | int DMA_VBLCopy16(int channel, const void *src, void *dst, size_t size); 47 | 48 | // During the next VBL do a copy, in 32-bit chunks. Returns 0 on success. 49 | EXPORT_API 50 | int DMA_VBLCopy32(int channel, const void *src, void *dst, size_t size); 51 | 52 | #endif // DMA_H__ 53 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/fp_math.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | #ifndef FP_MATH_H__ 6 | #define FP_MATH_H__ 7 | 8 | #include "definitions.h" 9 | 10 | #define FP_PI (0x8000) 11 | #define FP_PI_2 (FP_PI / 2) 12 | #define FP_2_PI (2 * FP_PI) 13 | 14 | // Input: A full cirle is 0x10000 (PI = 0x8000) 15 | // Output: Between 1 << 16 and -1 << 16 (1.0 to -1.0) 16 | EXPORT_API IWRAM_CODE int32_t FP_Sin(int32_t x); 17 | EXPORT_API IWRAM_CODE int32_t FP_Cos(int32_t x); 18 | 19 | #endif // FP_MATH_H__ 20 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/input.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | #ifndef INPUT_H__ 6 | #define INPUT_H__ 7 | 8 | #include 9 | 10 | #include "definitions.h" 11 | 12 | // Update keypad state. 13 | EXPORT_API void KEYS_Update(void); 14 | 15 | // Returns keys that have just been pressed. 16 | EXPORT_API uint16_t KEYS_Pressed(void); 17 | 18 | // Returns keys that are pressed. 19 | EXPORT_API uint16_t KEYS_Held(void); 20 | 21 | // Returns keys that have just been released. 22 | EXPORT_API uint16_t KEYS_Released(void); 23 | 24 | // Enable keypad interrupt that is triggered when all specified keys are pressed 25 | // at the same time. 26 | EXPORT_API void KEYS_IRQEnablePressedAll(uint16_t keys); 27 | 28 | // Enable keypad interrupt that is triggered when any of the specified keys is 29 | // pressed at any time. 30 | EXPORT_API void KEYS_IRQEnablePressedAny(uint16_t keys); 31 | 32 | // Disable keypad interrupt. 33 | EXPORT_API void KEYS_IRQDisable(void); 34 | 35 | #endif // INPUT_H__ 36 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/interrupts.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | #ifndef INTERRUPTS_H__ 6 | #define INTERRUPTS_H__ 7 | 8 | #include 9 | #include 10 | 11 | #include "definitions.h" 12 | 13 | typedef enum { 14 | IRQ_VBLANK = 0, 15 | IRQ_HBLANK = 1, 16 | IRQ_VCOUNT = 2, 17 | IRQ_TIMER0 = 3, 18 | IRQ_TIMER1 = 4, 19 | IRQ_TIMER2 = 5, 20 | IRQ_TIMER3 = 6, 21 | IRQ_SERIAL = 7, 22 | IRQ_DMA0 = 8, 23 | IRQ_DMA1 = 9, 24 | IRQ_DMA2 = 10, 25 | IRQ_DMA3 = 11, 26 | IRQ_KEYPAD = 12, 27 | IRQ_GAMEPAK = 13, 28 | IRQ_NUMBER 29 | } irq_index; 30 | 31 | typedef void (*irq_vector)(void); 32 | 33 | // Initialize global interrupt handling. This is called before reaching 34 | // GBA_main(), so it isn't normally needed to call it. 35 | EXPORT_API void IRQ_Init(void); 36 | 37 | // Set interrupt handler for the specified interrupt. 38 | EXPORT_API void IRQ_SetHandler(irq_index index, irq_vector function); 39 | 40 | // Enable the specified interrupt. For VBLANK, HBLANK and VCOUNT, this function 41 | // also sets the corresponding flags in DISPSTAT automatically. 42 | EXPORT_API void IRQ_Enable(irq_index index); 43 | 44 | // Disable the specified interrupt. 45 | EXPORT_API void IRQ_Disable(irq_index index); 46 | 47 | // Set the reference VCOUNT that triggers the VCOUNT interrupt. 48 | EXPORT_API void IRQ_SetReferenceVCOUNT(uint32_t y); 49 | 50 | #endif // INTERRUPTS_H__ 51 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/sound.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020-2021 Antonio Niño Díaz 4 | 5 | #ifndef SOUND_H__ 6 | #define SOUND_H__ 7 | 8 | #include "definitions.h" 9 | 10 | // Enable or disable sound hardware. It must be enabled before doing anything 11 | // else with sound hardware. 12 | EXPORT_API void SOUND_MasterEnable(int enable); 13 | 14 | // Set volume of DMA channels. Valid values are 100 and 50. Any other value will 15 | // be treated as 50%. 16 | EXPORT_API void SOUND_DMA_Volume(int dma_a_max, int dma_b_max); 17 | 18 | // Set master volume of all PSG channels. Valid values are 100, 50 and 25.. Any 19 | // other value will be treated as 25%. 20 | EXPORT_API void SOUND_PSG_MasterVolume(int volume); 21 | 22 | // Set left and right volume of all PSG channels. Valid values are 0 to 7. 23 | EXPORT_API void SOUND_PSG_Volume(int volume_left, int volume_right); 24 | 25 | // Specify which DMA channels are heard from which speakers. 26 | EXPORT_API 27 | void SOUND_DMA_Pan(int dma_a_left, int dma_a_right, 28 | int dma_b_left, int dma_b_right); 29 | 30 | // Specify which PSG channels are heard from which speakers. 31 | EXPORT_API 32 | void SOUND_PSG_Pan(int left_1, int right_1, int left_2, int right_2, 33 | int left_3, int right_3, int left_4, int right_4); 34 | 35 | // Set buffer that will be streamed to DMA channel A. The buffer needs to be 36 | // aligned to 32 bits. 37 | EXPORT_API void SOUND_DMA_Stream_A(const void *source); 38 | 39 | // Set buffer that will be streamed to DMA channel B. The buffer needs to be 40 | // aligned to 32 bits. 41 | EXPORT_API void SOUND_DMA_Stream_B(const void *source); 42 | 43 | // Set buffers that will be streamed to DMA channels A and B. The buffers need 44 | // to be aligned to 32 bits. 45 | EXPORT_API void SOUND_DMA_Setup_AB(const void *source_a, const void *source_b); 46 | 47 | // Restart DMA transfer used for audio. 48 | EXPORT_API void SOUND_DMA_Retrigger_AB(void); 49 | 50 | // Specify which timer is assigned to each one of the DMA channels. Only timers 51 | // 0 and 1 are valid. 52 | EXPORT_API void SOUND_DMA_TimerSetup(int dma_a_timer, int dma_b_timer); 53 | 54 | #endif // SOUND_H__ 55 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/sram.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2022 Antonio Niño Díaz 4 | 5 | #ifndef SRAM_H__ 6 | #define SRAM_H__ 7 | 8 | #include 9 | 10 | #include "definitions.h" 11 | 12 | // SRAM can only be accessed in 8-bits reads and writes. 13 | // 14 | // The functions in this file are placed in EWRAM. According to some sources, 15 | // reading SRAM from code in ROM doesn't work (even though it hasn't been 16 | // verified). 17 | // 18 | // If you are going to use SRAM, you should try to make it easier for emulators 19 | // and flashcarts to detect your save type: 20 | // 21 | // - Add a string like "SRAM_V111" to your ROM, preferably close to the start. 22 | // Magic strings like that are found in commercial games developed with the 23 | // SDK of Nintendo. Emulators look for them when loading ROMs. 24 | // 25 | // - The game code of your ROM should start with "2" for the EverDrive GBA to 26 | // detect it as SRAM: 27 | // 28 | // 1 - EEPROM || 2 - SRAM || 3 - FLASH-64 || 4 - FLASH-128 29 | // 30 | // https://krikzz.com/pub/support/everdrive-gba/OS/changelist.txt 31 | 32 | // Writes a buffer into SRAM. The destination must be inside SRAM, and the size 33 | // of the buffer must be at most MEM_SRAM_SIZE bytes long. Returns 0 on success. 34 | EXPORT_API EWRAM_CODE int SRAM_Write(void *dst, const void *src, size_t size); 35 | 36 | // Reads a buffer from SRAM. The source must be inside SRAM, and the size of the 37 | // buffer must be at most MEM_SRAM_SIZE bytes long. Returns 0 on success. 38 | EXPORT_API EWRAM_CODE int SRAM_Read(void *dst, const void *src, size_t size); 39 | 40 | #endif // SRAM_H__ 41 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/timer.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | #ifndef TIMER_H__ 6 | #define TIMER_H__ 7 | 8 | #include "definitions.h" 9 | 10 | // Start timer. The value passed to prescaler can be 1, 64, 256 or 1024. 11 | EXPORT_API 12 | void TM_TimerStart(int index, uint16_t reload_value, int prescaler, 13 | int enable_irq); 14 | 15 | // Start timer in cascade mode. Note that the prescaler value is ignored in this 16 | // mode, so it isn't needed. 17 | EXPORT_API 18 | void TM_TimerStartCascade(int index, uint16_t period_ticks, int enable_irq); 19 | 20 | // Start timer that is triggered every `period_ms` milliseconds. Internally it 21 | // looks for the lowest prescaler that allows this period (to have the best 22 | // accuracy). It returns 0 on success. 23 | EXPORT_API 24 | int TM_TimerStartMs(int index, uint32_t period_ms, int enable_irq); 25 | 26 | // Stop the specified timer. 27 | EXPORT_API 28 | void TM_TimerStop(int index); 29 | 30 | #endif // TIMER_H__ 31 | 32 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/ugba.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | #ifndef UGBA_H__ 6 | #define UGBA_H__ 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #include "background.h" 13 | #include "bios.h" 14 | #include "bios_wrappers.h" 15 | #include "console.h" 16 | #include "debug.h" 17 | #include "definitions.h" 18 | #include "display.h" 19 | #include "dma.h" 20 | #include "fp_math.h" 21 | #include "hardware.h" 22 | #include "input.h" 23 | #include "interrupts.h" 24 | #include "obj.h" 25 | #include "sound.h" 26 | #include "sram.h" 27 | #include "timer.h" 28 | #include "vram.h" 29 | 30 | // Initialize library. This function needs to be called at the start of main(). 31 | EXPORT_API void UGBA_Init(int* argc, char** argv[]); 32 | 33 | #ifndef __GBA__ 34 | // Initialize library with no video output (for testing). This function needs to 35 | // be called at the start of main(). Not implemented in GBA as it isn't usedul 36 | // there. 37 | EXPORT_API void UGBA_InitHeadless(int* argc, char** argv[]); 38 | #endif 39 | 40 | // This function tries to detect specific flashcarts with special needs and 41 | // returns a value to be written to REG_WAITCNT based on the flashcart. The best 42 | // possible returned value is WAITCNT_OPTIMIZED. 43 | EXPORT_API uint16_t UGBA_FlashcartOptimizedWaitstates(void); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif // UGBA_H__ 50 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/version.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | #ifndef VERSION_H__ 6 | #define VERSION_H__ 7 | 8 | #include 9 | 10 | // This library follows the Semantic Versioning rules: https://semver.org/ 11 | 12 | #define LIBUGBA_VERSION_MAJOR (0U) 13 | #define LIBUGBA_VERSION_MINOR (2U) 14 | #define LIBUGBA_VERSION_PATCH (0U) 15 | 16 | #define LIBUGBA_VERSION ((LIBUGBA_VERSION_MAJOR << 16) | \ 17 | (LIBUGBA_VERSION_MINOR << 8) | \ 18 | (LIBUGBA_VERSION_PATCH << 0)) 19 | 20 | // Returns the version of the shared library when it was compiled. 21 | EXPORT_API uint32_t UGBA_VersionCompiledGet(void); 22 | 23 | // This function can ve used to see if the version of the shared library is the 24 | // same as the one that the program was compiled with. It isn't needed for the 25 | // GBA version because it is linked statically. 26 | // 27 | // You should use the following right at the start of main() before UGBA_Init(): 28 | // 29 | // if (!UGBA_VersionIsCompatible(LIBUGBA_VERSION)) 30 | // VersionCheckFailed(); 31 | // 32 | // It follows the rules of Semantic Versioning. 33 | EXPORT_API int UGBA_VersionIsCompatible(uint32_t version); 34 | 35 | #endif // VERSION_H__ 36 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/include/vram.h: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // 3 | // Copyright (c) 2020 Antonio Niño Díaz 4 | 5 | #ifndef VRAM_H__ 6 | #define VRAM_H__ 7 | 8 | #include 9 | #include 10 | 11 | #include "definitions.h" 12 | 13 | // Copy 16-color object tiles to VRAM (0x06010000) starting at the given 14 | // index (0 - 1023). 15 | EXPORT_API 16 | void VRAM_OBJTiles16Copy(const void *src, size_t size, uint32_t tile_index); 17 | 18 | // Copy 256-color object tiles to VRAM (0x06010000) starting at the given 19 | // index (0 - 511). 20 | EXPORT_API 21 | void VRAM_OBJTiles256Copy(const void *src, size_t size, uint32_t tile_index); 22 | 23 | // Copy a 16-bit palette to object palette memory. 24 | EXPORT_API 25 | void VRAM_OBJPalette16Copy(const void *src, size_t size, uint32_t pal_index); 26 | 27 | // Copy a 256-bit palette to object palette memory. 28 | EXPORT_API 29 | void VRAM_OBJPalette256Copy(const void *src, size_t size); 30 | 31 | // Copy 16-color background tiles to VRAM (0x06000000) starting at the given 32 | // index (0 - 2047). 33 | EXPORT_API 34 | void VRAM_BGTiles16Copy(const void *src, size_t size, uint32_t tile_index); 35 | 36 | // Copy 256-color background tiles to VRAM (0x06000000) starting at the given 37 | // index (0 - 1023). 38 | EXPORT_API 39 | void VRAM_BGTiles256Copy(const void *src, size_t size, uint32_t tile_index); 40 | 41 | // Copy a 16-bit palette to background palette memory. 42 | EXPORT_API 43 | void VRAM_BGPalette16Copy(const void *src, size_t size, uint32_t pal_index); 44 | 45 | // Copy a 256-bit palette to background palette memory. 46 | EXPORT_API 47 | void VRAM_BGPalette256Copy(const void *src, size_t size); 48 | 49 | #endif // VRAM_H__ 50 | -------------------------------------------------------------------------------- /gba-link-connection/examples/_lib/libugba/lib/libugba.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/copyrat90/gba-pico-gamepad/449c027bd421b1b002382246f7452691712751a1/gba-link-connection/examples/_lib/libugba/lib/libugba.a -------------------------------------------------------------------------------- /gba-link-connection/examples/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd LinkCable_basic/ 4 | make rebuild 5 | cp LinkCable_basic.gba ../ 6 | cd .. 7 | 8 | cd LinkCable_full/ 9 | make rebuild 10 | cp LinkCable_full.gba ../ 11 | cd .. 12 | 13 | cd LinkCable_stress/ 14 | make rebuild 15 | cp LinkCable_stress.gba ../ 16 | cd .. 17 | 18 | cd LinkCableMultiboot_demo/ 19 | make rebuild 20 | cp LinkCableMultiboot_demo.mb.gba ../ 21 | cd .. 22 | 23 | cd LinkGPIO_demo/ 24 | make rebuild 25 | cp LinkGPIO_demo.gba ../ 26 | cd .. 27 | 28 | cd LinkSPI_demo/ 29 | make rebuild 30 | cp LinkSPI_demo.gba ../ 31 | cd .. 32 | 33 | cd LinkUniversal_basic/ 34 | make rebuild 35 | cp LinkUniversal_basic.gba ../ 36 | cd .. 37 | 38 | cd LinkCable_full/ 39 | sed -i -e "s/\/\/ #define USE_LINK_UNIVERSAL/#define USE_LINK_UNIVERSAL/g" src/main.h 40 | make rebuild 41 | cp LinkCable_full.gba ../LinkUniversal_full.gba 42 | sed -i -e "s/#define USE_LINK_UNIVERSAL/\/\/ #define USE_LINK_UNIVERSAL/g" src/main.h 43 | cd .. 44 | 45 | cd LinkWireless_demo/ 46 | make rebuild 47 | cp LinkWireless_demo.gba ../ 48 | cd .. 49 | --------------------------------------------------------------------------------