1+ /* Configuration for the ESP32-P4 dev board
2+ * The GPIOs were chosen arbitrarily, but you can choose whatever you want thanks to the I/O MUX
3+ * command to build: python rg_tool.py --target esp32-p4 build-img --no-networking
4+ */
5+
6+ /****************************************************************************
7+ * Target definition for ESP32-P4 Dev-Board *
8+ ****************************************************************************/
9+ #define RG_TARGET_NAME "ESP32-P4"
10+
11+
12+ /****************************************************************************
13+ * Status LED *
14+ ****************************************************************************/
15+ // #define RG_LED_DRIVER 1 // 1 = GPIO
16+ // #define RG_GPIO_LED GPIO_NUM_NC
17+ // #define RG_GPIO_LED_INVERT // Uncomment if the LED is active LOW
18+
19+
20+ /****************************************************************************
21+ * I2C / GPIO Extender *
22+ ****************************************************************************/
23+ // #define RG_I2C_GPIO_DRIVER 0 // 1 = AW9523, 2 = PCF9539, 3 = MCP23017, 4 = PCF8575
24+ // #define RG_I2C_GPIO_ADDR 0x00
25+ // #define RG_GPIO_I2C_SDA GPIO_NUM_15
26+ // #define RG_GPIO_I2C_SCL GPIO_NUM_4
27+
28+
29+ /****************************************************************************
30+ * Storage *
31+ ****************************************************************************/
32+ #define RG_STORAGE_ROOT "/sd"
33+ // #define RG_STORAGE_SDSPI_HOST SPI2_HOST
34+ // #define RG_STORAGE_SDSPI_SPEED SDMMC_FREQ_DEFAULT
35+ // #define RG_GPIO_SDSPI_MISO GPIO_NUM_19
36+ // #define RG_GPIO_SDSPI_MOSI GPIO_NUM_23
37+ // #define RG_GPIO_SDSPI_CLK GPIO_NUM_18
38+ // #define RG_GPIO_SDSPI_CS GPIO_NUM_22
39+ #define RG_STORAGE_SDMMC_HOST SDMMC_HOST_SLOT_1
40+ #define RG_STORAGE_SDMMC_SPEED SDMMC_FREQ_HIGHSPEED
41+ #define RG_GPIO_SDMMC_CLK GPIO_NUM_43
42+ #define RG_GPIO_SDMMC_CMD GPIO_NUM_44
43+ #define RG_GPIO_SDMMC_D0 GPIO_NUM_39
44+ #define RG_GPIO_SDMMC_D1 GPIO_NUM_40
45+ #define RG_GPIO_SDMMC_D2 GPIO_NUM_41
46+ #define RG_GPIO_SDMMC_D3 GPIO_NUM_42
47+ // #define RG_STORAGE_FLASH_PARTITION "vfs"
48+
49+
50+ /****************************************************************************
51+ * Audio *
52+ ****************************************************************************/
53+ #define RG_AUDIO_USE_INT_DAC 0 // 0 = Disable, 1 = GPIO25, 2 = GPIO26, 3 = Both
54+ #define RG_AUDIO_USE_EXT_DAC 1 // 0 = Disable, 1 = Enable
55+ #define RG_GPIO_SND_I2S_BCK GPIO_NUM_48
56+ #define RG_GPIO_SND_I2S_WS GPIO_NUM_49
57+ #define RG_GPIO_SND_I2S_DATA GPIO_NUM_46
58+ #define RG_GPIO_SND_AMP_ENABLE GPIO_NUM_47
59+ // #define RG_GPIO_SND_AMP_ENABLE_INVERT // Uncomment if the mute = HIGH
60+
61+
62+ /****************************************************************************
63+ * Video *
64+ ****************************************************************************/
65+ #define RG_SCREEN_DRIVER 0 // 0 = ILI9341/ST7789
66+ #define RG_SCREEN_HOST SPI3_HOST
67+ #define RG_SCREEN_SPEED SPI_MASTER_FREQ_80M // SPI_MASTER_FREQ_40M
68+ #define RG_SCREEN_BACKLIGHT 0
69+ #define RG_SCREEN_WIDTH 320
70+ #define RG_SCREEN_HEIGHT 240
71+ #define RG_SCREEN_ROTATE 0
72+ #define RG_SCREEN_VISIBLE_AREA {0, 0, 0, 0} // Left, Top, Right, Bottom
73+ #define RG_SCREEN_SAFE_AREA {0, 0, 0, 0} // Left, Top, Right, Bottom
74+ #define RG_SCREEN_PARTIAL_UPDATES 1
75+ #define RG_SCREEN_INIT () \
76+ ILI9341_CMD(0xCF, 0x00, 0xc3, 0x30); \
77+ ILI9341_CMD(0xED, 0x64, 0x03, 0x12, 0x81); \
78+ ILI9341_CMD(0xE8, 0x85, 0x00, 0x78); \
79+ ILI9341_CMD(0xCB, 0x39, 0x2c, 0x00, 0x34, 0x02); \
80+ ILI9341_CMD(0xF7, 0x20); \
81+ ILI9341_CMD(0xEA, 0x00, 0x00); \
82+ ILI9341_CMD(0xC0, 0x1B); /* Power control //VRH[5:0] */ \
83+ ILI9341_CMD (0xC1 , 0x12 ); /* Power control //SAP[2:0];BT[3:0] */ \
84+ ILI9341_CMD (0xC5 , 0x32 , 0x3C ); /* VCM control */ \
85+ ILI9341_CMD (0xC7 , 0x91 ); /* VCM control2 */ \
86+ ILI9341_CMD (0x36 , 0x08 ); /* Memory Access Control */ \
87+ ILI9341_CMD (0xB1 , 0x00 , 0x10 ); /* Frame Rate Control (1B=70, 1F=61, 10=119) */ \
88+ ILI9341_CMD (0xB6 , 0x0A , 0xA2 ); /* Display Function Control */ \
89+ ILI9341_CMD (0xF6 , 0x01 , 0x30 ); \
90+ ILI9341_CMD (0xF2 , 0x00 ); /* 3Gamma Function Disable */ \
91+ ILI9341_CMD (0x26 , 0x01 ); /* Gamma curve selected */ \
92+ ILI9341_CMD (0xE0 , 0xD0 , 0x00 , 0x02 , 0x07 , 0x0a , 0x28 , 0x32 , 0x44 , 0x42 , 0x06 , 0x0e , 0x12 , 0x14 , 0x17 ); \
93+ ILI9341_CMD (0xE1 , 0xD0 , 0x00 , 0x02 , 0x07 , 0x0a , 0x28 , 0x31 , 0x54 , 0x47 , 0x0E , 0x1C , 0x17 , 0x1b , 0x1e );
94+
95+ //#define RG_GPIO_LCD_MISO GPIO_NUM_NC
96+ #define RG_GPIO_LCD_MOSI GPIO_NUM_22
97+ #define RG_GPIO_LCD_CLK GPIO_NUM_23
98+ #define RG_GPIO_LCD_CS GPIO_NUM_24
99+ #define RG_GPIO_LCD_DC GPIO_NUM_25
100+ #define RG_GPIO_LCD_RST GPIO_NUM_26
101+ // #define RG_GPIO_LCD_BCKL GPIO_NUM_NC
102+ // #define RG_GPIO_LCD_BCKL_INVERT // Uncomment if the LED is active LOW
103+
104+
105+ /****************************************************************************
106+ * Input *
107+ ****************************************************************************/
108+ // Refer to rg_input.h to see all available RG_KEY_* and RG_GAMEPAD_*_MAP types
109+ #define RG_GAMEPAD_GPIO_MAP {\
110+ {RG_KEY_LEFT, .num = GPIO_NUM_13, .pullup = 1, .level = 0},\
111+ {RG_KEY_RIGHT, .num = GPIO_NUM_14, .pullup = 1, .level = 0},\
112+ {RG_KEY_UP, .num = GPIO_NUM_15, .pullup = 1, .level = 0},\
113+ {RG_KEY_DOWN, .num = GPIO_NUM_16, .pullup = 1, .level = 0},\
114+ {RG_KEY_SELECT, .num = GPIO_NUM_17, .pullup = 1, .level = 0},\
115+ {RG_KEY_START, .num = GPIO_NUM_18, .pullup = 1, .level = 0},\
116+ {RG_KEY_MENU, .num = GPIO_NUM_19, .pullup = 1, .level = 0},\
117+ {RG_KEY_A, .num = GPIO_NUM_20, .pullup = 1, .level = 0},\
118+ {RG_KEY_B, .num = GPIO_NUM_21, .pullup = 1, .level = 0},\
119+ {RG_KEY_X, .num = GPIO_NUM_12, .pullup = 1, .level = 0},\
120+ {RG_KEY_Y, .num = GPIO_NUM_11, .pullup = 1, .level = 0},\
121+ {RG_KEY_L, .num = GPIO_NUM_10, .pullup = 1, .level = 0},\
122+ {RG_KEY_R, .num = GPIO_NUM_9, .pullup = 1, .level = 0},\
123+ }
124+
125+
126+ /****************************************************************************
127+ * Battery *
128+ ****************************************************************************/
129+ // #define RG_BATTERY_DRIVER 1 // 1 = ADC, 2 = MRGC
130+ // #define RG_BATTERY_ADC_UNIT ADC_UNIT_1
131+ // #define RG_BATTERY_ADC_CHANNEL ADC_CHANNEL_0
132+ // #define RG_BATTERY_CALC_PERCENT(raw) (((raw) * 2.f - 3500.f) / (4200.f - 3500.f) * 100.f)
133+ // #define RG_BATTERY_CALC_VOLTAGE(raw) ((raw) * 2.f * 0.001f)
134+
135+
136+ /****************************************************************************
137+ * Updater *
138+ ****************************************************************************/
139+ // #define RG_UPDATER_ENABLE 1
140+ // #define RG_UPDATER_APPLICATION RG_APP_FACTORY
141+ // #define RG_UPDATER_DOWNLOAD_LOCATION RG_STORAGE_ROOT "/odroid/firmware"
142+
143+
144+
145+ /****************************************************************************
146+ * Miscellaneous *
147+ ****************************************************************************/
148+ #define RG_RECOVERY_BTN RG_KEY_MENU // Keep this button pressed to open the recovery menu
149+
150+ #define RG_CUSTOM_PLATFORM_INIT () \
151+ /* Arbitrary code executed very early during retro-go init */
152+
153+ // See components/retro-go/config.h for more things you can define here!
0 commit comments