From 32b54298310845be6786d90456a568cc7e3e4b64 Mon Sep 17 00:00:00 2001 From: Jason Skuby Date: Wed, 6 Oct 2021 22:04:26 -0500 Subject: [PATCH] Add config for Pico Fighting Board --- .github/workflows/main.yml | 2 + .github/workflows/release.yml | 3 ++ configs/PicoFightingBoard/BoardConfig.h | 68 +++++++++++++++++++++++++ platformio.ini | 8 ++- 4 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 configs/PicoFightingBoard/BoardConfig.h diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5f4f2801..6877286c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,3 +36,5 @@ jobs: mv .pio/build/raspberry-pi-pico/APPLICATION.uf2 .pio/build/raspberry-pi-pico/GP2040-PiPico.uf2 pio run -e pimoroni-pico-lipo mv .pio/build/pimoroni-pico-lipo/APPLICATION.uf2 .pio/build/pimoroni-pico-lipo/GP2040-PimoroniPicoLipo.uf2 + pio run -e pico-fighting-board + mv .pio/build/pico-fighting-board/APPLICATION.uf2 .pio/build/pico-fighting-board/GP2040-PicoFightingBoard.uf2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 905f2800..cf19bfcb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,6 +40,8 @@ jobs: mv .pio/build/raspberry-pi-pico/APPLICATION.uf2 .pio/build/raspberry-pi-pico/GP2040-PiPico_${{ steps.tagName.outputs.tag }}.uf2 pio run -e pimoroni-pico-lipo mv .pio/build/pimoroni-pico-lipo/APPLICATION.uf2 .pio/build/pimoroni-pico-lipo/GP2040-PimoroniPicoLipo_${{ steps.tagName.outputs.tag }}.uf2 + pio run -e pico-fighting-board + mv .pio/build/pico-fighting-board/APPLICATION.uf2 .pio/build/pico-fighting-board/GP2040-PicoFightingBoard_${{ steps.tagName.outputs.tag }}.uf2 - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') @@ -48,3 +50,4 @@ jobs: .pio/build/osfrd/GP2040-OSFRD_${{ steps.tagName.outputs.tag }}.uf2 .pio/build/raspberry-pi-pico/GP2040-PiPico_${{ steps.tagName.outputs.tag }}.uf2 .pio/build/pimoroni-pico-lipo/GP2040-PimoroniPicoLipo_${{ steps.tagName.outputs.tag }}.uf2 + .pio/build/pico-fighting-board/GP2040-PicoFightingBoard_${{ steps.tagName.outputs.tag }}.uf2 diff --git a/configs/PicoFightingBoard/BoardConfig.h b/configs/PicoFightingBoard/BoardConfig.h new file mode 100644 index 00000000..84f77cf2 --- /dev/null +++ b/configs/PicoFightingBoard/BoardConfig.h @@ -0,0 +1,68 @@ +/* + * SPDX-License-Identifier: MIT + * SPDX-FileCopyrightText: Copyright (c) 2021 Jason Skuby (mytechtoybox.com) + */ + +#ifndef PICO_FIGHTING_BOARD_CONFIG_H_ +#define PICO_FIGHTING_BOARD_CONFIG_H_ + +#include +#include +#include +#include "Pixel.hpp" + +#define PIN_DPAD_UP 1 +#define PIN_DPAD_DOWN 2 +#define PIN_DPAD_LEFT 0 +#define PIN_DPAD_RIGHT 3 +#define PIN_BUTTON_B1 11 +#define PIN_BUTTON_B2 12 +#define PIN_BUTTON_B3 7 +#define PIN_BUTTON_B4 8 +#define PIN_BUTTON_L1 10 +#define PIN_BUTTON_R1 9 +#define PIN_BUTTON_L2 14 +#define PIN_BUTTON_R2 13 +#define PIN_BUTTON_S1 5 +#define PIN_BUTTON_S2 6 +#define PIN_BUTTON_L3 21 +#define PIN_BUTTON_R3 22 +#define PIN_BUTTON_A1 4 +#define PIN_BUTTON_A2 20 + +#define DEFAULT_SOCD_MODE SOCD_MODE_NEUTRAL + +#define BOARD_LEDS_PIN 15 +#define LED_BRIGHTNESS_MAXIMUM 200 +#define LED_BRIGHTNESS_STEPS 5 + +#define LEDS_DPAD_LEFT 0 +#define LEDS_DPAD_DOWN 1 +#define LEDS_DPAD_RIGHT 2 +#define LEDS_DPAD_UP 3 +#define LEDS_BUTTON_03 4 +#define LEDS_BUTTON_04 5 +#define LEDS_BUTTON_06 6 +#define LEDS_BUTTON_05 7 +#define LEDS_BUTTON_01 8 +#define LEDS_BUTTON_02 9 +#define LEDS_BUTTON_07 11 +#define LEDS_BUTTON_08 10 + +const static std::vector pixels = +{ + { .index = LEDS_DPAD_LEFT, .mask = GAMEPAD_MASK_DL, .positions = { 22, 23 } }, + { .index = LEDS_DPAD_DOWN, .mask = GAMEPAD_MASK_DD, .positions = { 20, 21 } }, + { .index = LEDS_DPAD_RIGHT, .mask = GAMEPAD_MASK_DR, .positions = { 18, 19 } }, + { .index = LEDS_DPAD_UP, .mask = GAMEPAD_MASK_DU, .positions = { 0, 1 } }, + { .index = LEDS_BUTTON_03, .mask = GAMEPAD_MASK_B3, .positions = { 16, 17 } }, + { .index = LEDS_BUTTON_04, .mask = GAMEPAD_MASK_B4, .positions = { 14, 15 } }, + { .index = LEDS_BUTTON_06, .mask = GAMEPAD_MASK_R1, .positions = { 12, 13 } }, + { .index = LEDS_BUTTON_05, .mask = GAMEPAD_MASK_L1, .positions = { 10, 11 } }, + { .index = LEDS_BUTTON_01, .mask = GAMEPAD_MASK_B1, .positions = { 2, 3 } }, + { .index = LEDS_BUTTON_02, .mask = GAMEPAD_MASK_B2, .positions = { 4, 5 } }, + { .index = LEDS_BUTTON_08, .mask = GAMEPAD_MASK_R2, .positions = { 6, 7 } }, + { .index = LEDS_BUTTON_07, .mask = GAMEPAD_MASK_L2, .positions = { 8, 9 } }, +}; + +#endif diff --git a/platformio.ini b/platformio.ini index adf071f9..96182bc3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -21,7 +21,7 @@ build_flags = lib_deps = pico_bootsel_via_double_reset pico_multicore - feralai/MPG@^0.1.0 + feralai/MPG@^0.1.1 targets = upload board_build.pio = lib/NeoPico/src/ws2812.pio @@ -57,6 +57,12 @@ build_flags = -I configs/GeeekPiStick/ upload_port = .pio/build/geeek-pi-stick/ +[env:pico-fighting-board] +build_flags = + ${env.build_flags} + -I configs/PicoFightingBoard/ +upload_port = .pio/build/pico-fighting-board/ + [env:debug] debug_tool = picoprobe upload_protocol = picoprobe