Skip to content

Commit eecf11b

Browse files
committed
Updated PORTING.md
1 parent df40d74 commit eecf11b

2 files changed

Lines changed: 25 additions & 31 deletions

File tree

PORTING.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ This document describes the process of adding support for a new ESP32 device (wh
1111

1212

1313
# Prerequisites
14-
Before doing anything, make sure that your development environment is working properly and that you can build retro-go for the default target. Please read [BUILDING.md](BUILDING.md) carefully for more information.
14+
15+
## Hardware prerequisites
16+
Retro-Go will run on any device that use an esp32 chip (including variants like s2, s3, p4), as long as it has PSRAM (also called SPIRAM or external RAM). You will also need a serial cable (most esp32 devices expose the serial interface over USB).
17+
18+
19+
## Software prerequisites
20+
You will need a working installation of esp-idf. Retro-Go supports many versions, refer to [BUILDING.md](BUILDING.md) for more information. If you are new to esp-idf/esp32 development, you might want to try flashing a few sample programs to your device to make sure that everything works, before attempting a complicated project like retro-go.
1521

1622

1723
# Targets
@@ -34,48 +40,43 @@ To get started, locate a target that is the most similar to your device and use
3440

3541
### config.h
3642

37-
This file contains the bulk of your configurations.
38-
39-
First, change `RG_TARGET_NAME` to match the name of your target folder.
43+
This file contains the bulk of your configurations. There is currently no exhaustive documentation of all the options you can define in this file, but you can refer to odroid-go's config.h that contains most of them.
4044

41-
Most of it, you will need to figure out the correct parameters for (eg. Storage and Audio)
45+
Don't forget to change `RG_TARGET_NAME` to match the name of your target folder.
4246

47+
#### Display
4348

44-
##### Display
49+
Retro-Go has a single output driver: ILI9341/ST7789. Thankfully most screens out there use this controller!
4550

46-
If you aren't using the ILI9341/ST7789 screen driver, you will need to change the `SCREEN_DRIVER` parameter. (Otherwise, just change the following settings and continue).
51+
You will need to define the correct pinout (RG_GPIO_LCD_*) and the corrent init sequence (RG_SCREEN_INIT). To find the required sequence of commands you can refer to other example code meant for your display/device.
4752

4853

49-
(You will find more display configuration in the `SPI Display` section below)
54+
If you aren't using the ILI9341/ST7789 screen driver, you will need to write your own.
5055

56+
You can clone `components/retro-go/drivers/ili9341.h` to use as a starting point. Don't forget to add it to the top of `rg_display.c`:
5157

52-
For now, only the ILI9341/ST7789 driver is included. Increment the number. Then in `components/retro-go/rg_display.c`, find this part
53-
```
58+
```c
5459
#if RG_SCREEN_DRIVER == 0 /* ILI9341/ST7789 */
5560
#include "drivers/display/ili9341.h"
61+
#elif RG_SCREEN_DRIVER == 2 // <--
62+
#include "drivers/display/my-driver.h" // <--
5663
#elif RG_SCREEN_DRIVER == 99
5764
#include "drivers/display/sdl2.h"
5865
#else
5966
#include "drivers/display/dummy.h"
6067
#endif
6168
```
6269

70+
#### Input
6371

64-
Add a `#elif` for your RG_SCREEN_DRIVER. In the body, use `#include "drivers/display/(YOUR DISPLAY DRIVER).h"` (eg. `ssd1306.h`).
65-
66-
67-
You will need to create that file for your display. Unfortunately, there is no one-for-all way to make this. It will need the same template as the other display drivers there, but it will differ for each display. To start, check the Retro-Go issues on GitHub and try searching on Google.
68-
69-
70-
Make this driver in `components/retro-go/drivers/display`
71-
72-
73-
##### Input
74-
75-
Back in `config.h`, you will see the configuration for an I2C gamepad. If you aren't using that, you can make your own parameters based on the existing input forms in `components/retro-go/rg_input.c`
76-
72+
Retro-Go has five input drivers:
73+
- GPIO: This is a button connected to a pin of the esp32
74+
- ADC: This is usually used with a voltage divider to put multiple buttons on a single esp32 pin
75+
- I2C: Also known as a GPIO extender, retro-go supports many chips (AW9523, PCF9539, MCP23017, PCF8575)
76+
- Shift register: Like a SNES controller or a 74HC165
77+
- Virtual: If your device doesn't have enough button, you can map combos to the missing keys. eg start+select = menu
7778

78-
You can also write your own input driver for unique input forms. Just look at the existing code in `rg_input.c` and match that
79+
You can combine any of them by defining the appropriate `RG_GAMEPAD_*_MAP` in your `config.h`. Refer to `rg_input.h` or other targets to see how configuration is done.
7980

8081

8182
### sdkconfig

components/retro-go/targets/odroid-go/config.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,6 @@
6565
{RG_KEY_A, .num = GPIO_NUM_32, .pullup = 1, .level = 0},\
6666
{RG_KEY_B, .num = GPIO_NUM_33, .pullup = 1, .level = 0},\
6767
}
68-
// #define RG_GAMEPAD_I2C_MAP {\
69-
// {RG_KEY_A, .num = 6, .pullup = 1, .level = 0},\
70-
// {RG_KEY_B, .num = 7, .pullup = 1, .level = 0},\
71-
// }
72-
// #define RG_GAMEPAD_VIRT_MAP {\
73-
// {RG_KEY_MENU, .src = RG_KEY_SELECT|RG_KEY_START},\
74-
// }
7568

7669
// Battery
7770
#define RG_BATTERY_DRIVER 1

0 commit comments

Comments
 (0)