Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions components/retro-go/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "targets/esplay-micro/config.h"
#elif defined(RG_TARGET_FRI3D_2024)
#include "targets/fri3d-2024/config.h"
#elif defined(RG_TARGET_GB300_P4)
#include "targets/gb300-p4/config.h"
#elif defined(RG_TARGET_MRGC_G32)
#include "targets/mrgc-g32/config.h"
#elif defined(RG_TARGET_MRGC_GBM)
Expand Down
125 changes: 84 additions & 41 deletions components/retro-go/targets/crokpocket/config.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,61 @@
// Target definition
/****************************************************************************
* Target definition for CrokPocket by Megazoid *
* Info: www.instructables.com/CrokPocket/ *
****************************************************************************/
#define RG_TARGET_NAME "CROKPOCKET"

// Storage

/****************************************************************************
* Status LED *
****************************************************************************/
#define RG_LED_DRIVER 1 // 1 = GPIO
#define RG_GPIO_LED GPIO_NUM_38
// #define RG_GPIO_LED_INVERT // Uncomment if the LED is active LOW


/****************************************************************************
* I2C / GPIO Extender *
****************************************************************************/
// #define RG_I2C_GPIO_DRIVER 0 // 1 = AW9523, 2 = PCF9539, 3 = MCP23017, 4 = PCF8575, 5 = PCF8574
// #define RG_I2C_GPIO_ADDR 0x00
// #define RG_GPIO_I2C_SDA GPIO_NUM_NC
// #define RG_GPIO_I2C_SCL GPIO_NUM_NC


/****************************************************************************
* Storage *
****************************************************************************/
#define RG_STORAGE_ROOT "/sd"
#define RG_STORAGE_SDSPI_HOST SPI3_HOST
#define RG_STORAGE_SDSPI_SPEED SDMMC_FREQ_DEFAULT
#define RG_GPIO_SDSPI_MISO GPIO_NUM_9
#define RG_GPIO_SDSPI_MOSI GPIO_NUM_11
#define RG_GPIO_SDSPI_CLK GPIO_NUM_13
#define RG_GPIO_SDSPI_CS GPIO_NUM_10
// #define RG_STORAGE_SDMMC_HOST SDMMC_HOST_SLOT_1
// #define RG_STORAGE_SDMMC_SPEED SDMMC_FREQ_DEFAULT
// #define RG_STORAGE_FLASH_PARTITION "vfs"

// Audio

/****************************************************************************
* Audio *
****************************************************************************/
#define RG_AUDIO_USE_INT_DAC 0 // 0 = Disable, 1 = GPIO25, 2 = GPIO26, 3 = Both
#define RG_AUDIO_USE_EXT_DAC 1 // 0 = Disable, 1 = Enable
#define RG_AUDIO_USE_BUZZER_PIN 0 // See drivers/audio/buzzer.c for details
#define RG_GPIO_SND_I2S_BCK GPIO_NUM_41
#define RG_GPIO_SND_I2S_WS GPIO_NUM_42
#define RG_GPIO_SND_I2S_DATA GPIO_NUM_40
#define RG_GPIO_SND_AMP_ENABLE GPIO_NUM_21
// #define RG_GPIO_SND_AMP_ENABLE_INVERT // Uncomment if the mute = HIGH


// Video
#define RG_SCREEN_DRIVER 0 // 0 = ILI9341
/****************************************************************************
* Video *
****************************************************************************/
#define RG_SCREEN_DRIVER 0 // 0 = ILI9341/ST7789
#define RG_SCREEN_HOST SPI2_HOST
#define RG_SCREEN_SPEED SPI_MASTER_FREQ_40M // SPI_MASTER_FREQ_80M
#define RG_SCREEN_SPEED SPI_MASTER_FREQ_40M
#define RG_SCREEN_BACKLIGHT 1
#define RG_SCREEN_WIDTH 320
#define RG_SCREEN_HEIGHT 240
Expand All @@ -25,27 +64,33 @@
#define RG_SCREEN_PIXEL_FORMAT 0 // Possible values are 0=565_BE, 1=565_LE
#define RG_SCREEN_VISIBLE_AREA {0, 0, 0, 0} // Left, Top, Right, Bottom
#define RG_SCREEN_SAFE_AREA {0, 0, 0, 0} // Left, Top, Right, Bottom

#define RG_SCREEN_INIT() \
ILI9341_CMD(0xCF, 0x00, 0xc3, 0x30); \
ILI9341_CMD(0xED, 0x64, 0x03, 0x12, 0x81); \
ILI9341_CMD(0xE8, 0x85, 0x00, 0x78); \
ILI9341_CMD(0xCB, 0x39, 0x2c, 0x00, 0x34, 0x02); \
ILI9341_CMD(0xF7, 0x20); \
ILI9341_CMD(0xEA, 0x00, 0x00); \
ILI9341_CMD(0xC0, 0x1B); /* Power control //VRH[5:0] */ \
ILI9341_CMD(0xC1, 0x12); /* Power control //SAP[2:0];BT[3:0] */ \
ILI9341_CMD(0xC5, 0x32, 0x3C); /* VCM control */ \
ILI9341_CMD(0xC7, 0x91); /* VCM control2 */ \
ILI9341_CMD(0xB1, 0x00, 0x10); /* Frame Rate Control (1B=70, 1F=61, 10=119) */ \
ILI9341_CMD(0xB6, 0x0A, 0xA2); /* Display Function Control */ \
ILI9341_CMD(0xF6, 0x01, 0x30); \
ILI9341_CMD(0xF2, 0x00); /* 3Gamma Function Disable */ \
ILI9341_CMD(0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33); /* Porch Setting (0x0C, 0x0C=Std or 0x0F, 0x0F=Slow */ \
ILI9341_CMD(0xC6, 0x03); /* ST7789 Frame Rate Control (0F=60, 07 to 00=75 to 119, 6Hz steps) */ \
ILI9341_CMD(0xB6, 0x0A, 0x82); /* Gate Scan Direction (82=Std, A2=Inv, 22=Alt) */ \
ILI9341_CMD(0xF6, 0x01, 0x00); /* Interface Control (01=Std, 21=Interleave */ \
ILI9341_CMD(0xE0, 0xD0, 0x00, 0x05, 0x0E, 0x15, 0x0D, 0x37, 0x43, 0x47, 0x09, 0x15, 0x12, 0x16, 0x19); \
ILI9341_CMD(0xE1, 0xD0, 0x00, 0x05, 0x0D, 0x0C, 0x06, 0x2D, 0x44, 0x40, 0x0E, 0x1C, 0x18, 0x16, 0x19);
ILI9341_CMD(0xE1, 0xD0, 0x00, 0x05, 0x0D, 0x0C, 0x06, 0x2D, 0x44, 0x40, 0x0E, 0x1C, 0x18, 0x16, 0x19); \



#define RG_GPIO_LCD_MISO GPIO_NUM_NC
#define RG_GPIO_LCD_MOSI GPIO_NUM_12
#define RG_GPIO_LCD_CLK GPIO_NUM_48
#define RG_GPIO_LCD_CS GPIO_NUM_14
#define RG_GPIO_LCD_DC GPIO_NUM_47
#define RG_GPIO_LCD_BCKL GPIO_NUM_39
#define RG_GPIO_LCD_RST GPIO_NUM_3
// #define RG_GPIO_LCD_BCKL_INVERT // Uncomment if the LED is active LOW


// Input
/****************************************************************************
* Input *
****************************************************************************/
// Refer to rg_input.h to see all available RG_KEY_* and RG_GAMEPAD_*_MAP types
#define RG_GAMEPAD_GPIO_MAP {\
{RG_KEY_UP, .num = GPIO_NUM_7, .pullup = 1, .level = 0},\
Expand All @@ -60,33 +105,31 @@
{RG_KEY_B, .num = GPIO_NUM_5, .pullup = 1, .level = 0},\
}

// Battery
#define RG_BATTERY_DRIVER 1

/****************************************************************************
* Battery *
****************************************************************************/
#define RG_BATTERY_DRIVER 1 // 1 = ADC, 2 = MRGC
#define RG_BATTERY_ADC_UNIT ADC_UNIT_1
#define RG_BATTERY_ADC_CHANNEL ADC_CHANNEL_3
#define RG_BATTERY_CALC_PERCENT(raw) (((raw) * 2.f - 3150.f) / (4100.f - 3150.f) * 100.f)
#define RG_BATTERY_CALC_VOLTAGE(raw) ((raw) * 2.f * 0.001f)

// Status LED
#define RG_GPIO_LED GPIO_NUM_38

// SPI Display
#define RG_GPIO_LCD_MISO GPIO_NUM_NC
#define RG_GPIO_LCD_MOSI GPIO_NUM_12
#define RG_GPIO_LCD_CLK GPIO_NUM_48
#define RG_GPIO_LCD_CS GPIO_NUM_14
#define RG_GPIO_LCD_DC GPIO_NUM_47
#define RG_GPIO_LCD_BCKL GPIO_NUM_39
#define RG_GPIO_LCD_RST GPIO_NUM_3
/****************************************************************************
* Updater *
****************************************************************************/
#define RG_UPDATER_ENABLE 1
#define RG_UPDATER_APPLICATION RG_APP_FACTORY
#define RG_UPDATER_DOWNLOAD_LOCATION RG_STORAGE_ROOT "/retro-go/updates"

// SPI SD Card
#define RG_GPIO_SDSPI_MISO GPIO_NUM_9
#define RG_GPIO_SDSPI_MOSI GPIO_NUM_11
#define RG_GPIO_SDSPI_CLK GPIO_NUM_13
#define RG_GPIO_SDSPI_CS GPIO_NUM_10

// External I2S DAC
#define RG_GPIO_SND_I2S_BCK 41
#define RG_GPIO_SND_I2S_WS 42
#define RG_GPIO_SND_I2S_DATA 40
// #define RG_GPIO_SND_AMP_ENABLE 18
/****************************************************************************
* Miscellaneous *
****************************************************************************/
#define RG_RECOVERY_BTN RG_KEY_SELECT // Keep this button pressed to open the recovery menu

#define RG_CUSTOM_PLATFORM_INIT() \
/* Arbitrary code executed very early during retro-go init */

// See components/retro-go/config.h for more things you can define here!
149 changes: 149 additions & 0 deletions components/retro-go/targets/gb300-p4/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/****************************************************************************
* Target definition for GB300-P4
* Guide: https://www.instructables.com/GB300-P4-a-ESP32-P4-Based-Retro-Handheld-Using-the
* Command to build: python rg_tool.py --target gb300-p4 build-img --no-networking
****************************************************************************/
#define RG_TARGET_NAME "GB300-P4"


/****************************************************************************
* Status LED *
****************************************************************************/
// #define RG_LED_DRIVER 1 // 1 = GPIO
// #define RG_GPIO_LED GPIO_NUM_NC
// #define RG_GPIO_LED_INVERT // Uncomment if the LED is active LOW


/****************************************************************************
* I2C / GPIO Extender *
****************************************************************************/
// #define RG_I2C_GPIO_DRIVER 0 // 1 = AW9523, 2 = PCF9539, 3 = MCP23017, 4 = PCF8575
// #define RG_I2C_GPIO_ADDR 0x00
// #define RG_GPIO_I2C_SDA GPIO_NUM_NC
// #define RG_GPIO_I2C_SCL GPIO_NUM_NC


/****************************************************************************
* Storage *
****************************************************************************/
#define RG_STORAGE_ROOT "/sd"
// #define RG_STORAGE_SDSPI_HOST SPI3_HOST
// #define RG_STORAGE_SDSPI_SPEED SDMMC_FREQ_DEFAULT
// #define RG_GPIO_SDSPI_MISO GPIO_NUM_NC
// #define RG_GPIO_SDSPI_MOSI GPIO_NUM_NC
// #define RG_GPIO_SDSPI_CLK GPIO_NUM_NC
// #define RG_GPIO_SDSPI_CS GPIO_NUM_NC
#define RG_STORAGE_SDMMC_HOST SDMMC_HOST_SLOT_1
#define RG_STORAGE_SDMMC_SPEED SDMMC_FREQ_HIGHSPEED // SDMMC_FREQ_PROBING, SDMMC_FREQ_HIGHSPEED or SDMMC_FREQ_DEFAULT
#define RG_GPIO_SDMMC_CLK GPIO_NUM_42
#define RG_GPIO_SDMMC_CMD GPIO_NUM_41
#define RG_GPIO_SDMMC_D0 GPIO_NUM_43
#define RG_GPIO_SDMMC_D1 GPIO_NUM_44
#define RG_GPIO_SDMMC_D2 GPIO_NUM_39
#define RG_GPIO_SDMMC_D3 GPIO_NUM_40
// #define RG_STORAGE_FLASH_PARTITION "vfs"


/****************************************************************************
* Audio *
****************************************************************************/
#define RG_AUDIO_USE_INT_DAC 0 // 0 = Disable, 1 = GPIO25, 2 = GPIO26, 3 = Both
#define RG_AUDIO_USE_EXT_DAC 1 // 0 = Disable, 1 = Enable
#define RG_GPIO_SND_I2S_BCK GPIO_NUM_49
#define RG_GPIO_SND_I2S_WS GPIO_NUM_48
#define RG_GPIO_SND_I2S_DATA GPIO_NUM_50
#define RG_GPIO_SND_AMP_ENABLE GPIO_NUM_47
// #define RG_GPIO_SND_AMP_ENABLE_INVERT // Uncomment if the mute = HIGH


/****************************************************************************
* Video *
****************************************************************************/
#define RG_SCREEN_DRIVER 0 // 0 = ILI9341/ST7789
#define RG_SCREEN_HOST SPI2_HOST
#define RG_SCREEN_SPEED SPI_MASTER_FREQ_80M // SPI_MASTER_FREQ_40M or SPI_MASTER_FREQ_80M
#define RG_SCREEN_BACKLIGHT 1
#define RG_SCREEN_WIDTH 320
#define RG_SCREEN_HEIGHT 240
#define RG_SCREEN_ROTATION 6 // Possible values are 0-7 (you'll have to experiment)
#define RG_SCREEN_RGB_BGR 1 // Possible values are 0-1 (change if colors are bad)
#define RG_SCREEN_PIXEL_FORMAT 0 // Possible values are 0=565_BE, 1=565_LE
#define RG_SCREEN_VISIBLE_AREA {0, 0, 0, 0} // Left, Top, Right, Bottom
#define RG_SCREEN_SAFE_AREA {0, 0, 0, 0} // Left, Top, Right, Bottom
#define RG_SCREEN_PARTIAL_UPDATES 1
#define RG_SCREEN_INIT() \
ILI9341_CMD(0x21); /* Inversion */ \
ILI9341_CMD(0xC0, 0x1B); /* Power control //VRH[5:0] */ \
ILI9341_CMD(0xC1, 0x12); /* Power control //SAP[2:0];BT[3:0] */ \
ILI9341_CMD(0xC5, 0x32, 0x3C); /* VCM control */ \
ILI9341_CMD(0xC7, 0x91); /* VCM control2 */ \
ILI9341_CMD(0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33); /* Porch Setting (0x0C, 0x0C=Std or 0x0F, 0x0F=Slow */ \
ILI9341_CMD(0xC6, 0x03); /* ST7789 Frame Rate Control (0F=60, 07 to 00=75 to 119, 6Hz steps) */ \
ILI9341_CMD(0xB6, 0x0A, 0x82); /* Gate Scan Direction (82=Std, A2=Inv, 22=Alt) */ \
ILI9341_CMD(0xF6, 0x01, 0x00); /* Interface Control (01=Std, 21=Interleave */ \
ILI9341_CMD(0xE0, 0xD0, 0x00, 0x05, 0x0E, 0x15, 0x0D, 0x37, 0x43, 0x47, 0x09, 0x15, 0x12, 0x16, 0x19); \
ILI9341_CMD(0xE1, 0xD0, 0x00, 0x05, 0x0D, 0x0C, 0x06, 0x2D, 0x44, 0x40, 0x0E, 0x1C, 0x18, 0x16, 0x19); \


#define RG_GPIO_LCD_MISO GPIO_NUM_18
#define RG_GPIO_LCD_MOSI GPIO_NUM_19
#define RG_GPIO_LCD_CLK GPIO_NUM_22
#define RG_GPIO_LCD_CS GPIO_NUM_20
#define RG_GPIO_LCD_DC GPIO_NUM_21
#define RG_GPIO_LCD_RST GPIO_NUM_23
#define RG_GPIO_LCD_BCKL GPIO_NUM_17
// #define RG_GPIO_LCD_BCKL_INVERT // Uncomment if the LED is active LOW


/****************************************************************************
* Input *
****************************************************************************/
// Refer to rg_input.h to see all available RG_KEY_* and RG_GAMEPAD_*_MAP types
#define RG_GAMEPAD_GPIO_MAP {\
{RG_KEY_LEFT, .num = GPIO_NUM_4, .pullup = 1, .level = 0},\
{RG_KEY_RIGHT, .num = GPIO_NUM_2, .pullup = 1, .level = 0},\
{RG_KEY_UP, .num = GPIO_NUM_5, .pullup = 1, .level = 0},\
{RG_KEY_DOWN, .num = GPIO_NUM_3, .pullup = 1, .level = 0},\
{RG_KEY_START, .num = GPIO_NUM_46, .pullup = 1, .level = 0},\
{RG_KEY_SELECT, .num = GPIO_NUM_45, .pullup = 1, .level = 0},\
{RG_KEY_A, .num = GPIO_NUM_26, .pullup = 1, .level = 0},\
{RG_KEY_B, .num = GPIO_NUM_27, .pullup = 1, .level = 0},\
{RG_KEY_X, .num = GPIO_NUM_13, .pullup = 1, .level = 0},\
{RG_KEY_Y, .num = GPIO_NUM_12, .pullup = 1, .level = 0},\
{RG_KEY_L, .num = GPIO_NUM_11, .pullup = 1, .level = 0},\
{RG_KEY_R, .num = GPIO_NUM_14, .pullup = 1, .level = 0},\
}
#define RG_GAMEPAD_VIRT_MAP {\
{RG_KEY_MENU, .src = RG_KEY_START | RG_KEY_SELECT},\
{RG_KEY_OPTION, .src = RG_KEY_START | RG_KEY_A},\
}


/****************************************************************************
* Battery *
****************************************************************************/
#define RG_BATTERY_DRIVER 1 // 1 = ADC, 2 = MRGC
#define RG_BATTERY_ADC_UNIT ADC_UNIT_1
#define RG_BATTERY_ADC_CHANNEL ADC_CHANNEL_0
#define RG_BATTERY_CALC_PERCENT(raw) (((raw) * 2.f - 3300.f) / (4100.f - 3300.f) * 100.f)
#define RG_BATTERY_CALC_VOLTAGE(raw) ((raw) * 2.f * 0.001f)


/****************************************************************************
* Updater *
****************************************************************************/
#define RG_UPDATER_ENABLE 1
#define RG_UPDATER_APPLICATION RG_APP_FACTORY
#define RG_UPDATER_DOWNLOAD_LOCATION RG_STORAGE_ROOT "/retro-go/updates"



/****************************************************************************
* Miscellaneous *
****************************************************************************/
#define RG_RECOVERY_BTN RG_KEY_SELECT // Keep this button pressed to open the recovery menu

#define RG_CUSTOM_PLATFORM_INIT() \
/* Arbitrary code executed very early during retro-go init */

// See components/retro-go/config.h for more things you can define here!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
22 changes: 22 additions & 0 deletions components/retro-go/targets/gb300-p4/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# GB300-P4
- Build Guide & BOM: [Instructables guide](https://www.instructables.com/GB300-P4-a-ESP32-P4-Based-Retro-Handheld-Using-the/)
- Status: Complete

Command to build (ESP-IDF v5.5): `python rg_tool.py --target gb300-p4 build-img --no-networking`

## Hardware
- Sup+/Datafrog GB300 - Uses its shell, buttons, membranes, speaker, 18650 battery etc
- Wireless-Tag ESP32-P4 WT0132P4-A1-N16R32
- ST7789V 320*240 2.8" SPI Display - STP0280A2-240320
- SD card over SDMMC (4 bits)
- NS4168 DAC
- TP4056 charge chip
- 2.5mm audio jack
- Volume wheel
- USB-C for charging and firmware updates


## Images

![GB300-P4.jpg](GB300-P4.jpg)
![GB300-P4-back.jpg](GB300-P4-back.jpg)
9 changes: 9 additions & 0 deletions components/retro-go/targets/gb300-p4/env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is injected late into rg_tool.py, you can run arbitrary python code here
# For example override python variables or set environment variables with os.putenv

# Espressif chip in the device
IDF_TARGET = "esp32p4"
# .fw file format, if supported by the device
# FW_FORMAT = "odroid"
# Default apps to build when none is specified (comment to build all)
# DEFAULT_APPS = " ".join(PROJECT_APPS.keys()) # All of them all the time!
Loading