diff --git a/CMakeLists.txt b/CMakeLists.txt index e653460..65be3ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ set(SD_SCK 2 CACHE STRING "SD SPI SCK pin") set(SD_CS 5 CACHE STRING "SD SPI CS pin") set(SD_MHZ 5 CACHE STRING "SD SPI speed in MHz") option(USE_VGA_RES "Video uses VGA (640x480) resolution" OFF) +set(VIDEO_PIN 18 CACHE STRING "Video GPIO base pin (followed by VS, CLK, HS)") # See below, -DMEMSIZE= will configure umac's memory size, # overriding defaults. @@ -93,6 +94,7 @@ else() add_compile_definitions(DISP_WIDTH=512) add_compile_definitions(DISP_HEIGHT=342) endif() +add_compile_definitions(GPIO_VID_BASE=${VIDEO_PIN}) if (TARGET tinyusb_device) add_executable(firmware diff --git a/README.md b/README.md index 9ede2a4..541faf8 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,8 @@ mkdir build (cd build ; PICO_SDK_PATH=/path/to/sdk cmake .. ) ``` -Options are required if you want SD support, or more than the default 128K of memory: +Options are required if you want SD support, more than the default 128K of memory, +higher resolution, to change pin configs, etc.: * `-DUSE_SD=true`: Include SD card support. The GPIOs default to `spi0` running at 5MHz, and GPIOs 2,3,4,5 for @@ -106,6 +107,8 @@ Options are required if you want SD support, or more than the default 128K of me option makes a _Mac 128K_ configuration virtually unusable. It is recommended only to use this when configuring >208K using the option above. + * `-DVIDEO_PIN=`: Move the video output pins; defaults + to the pinout shown below. Tip: `cmake` caches these variables, so if you see weird behaviour having built previously and then changed an option, delete the `build` @@ -235,13 +238,19 @@ board with 2MB+ flash as long as all required GPIOs are pinned out: | ------------ | ------------ | -------------- | | GP0 | 1 | UART0 TX | | GP1 | 2 | UART0 RX | -| GP18 | 24 | Video output | +| GP18 | 24 | Video output % | | GP19 | 25 | VSYNC | | GP21 | 27 | HSYNC | | Gnd | 23, 28 | Video ground | | VBUS (5V) | 40 | +5V supply | | Gnd | 38 | Supply ground | +%: The video pins default here, but can be moved by building with the + `-DVIDEO_PIN` option. This sets the position of the Video pin, + which is immediately followed by VSYNC, then a gap, then HSYNC. + For example, `-DVIDEO_PIN=20` configures the Video pin at 20, + VSYNC at 21, HSYNC at 23. + Method: * Wire 5V supply to VBUS/Gnd diff --git a/include/hw.h b/include/hw.h index 26f208c..5ce583b 100644 --- a/include/hw.h +++ b/include/hw.h @@ -29,9 +29,9 @@ #define GPIO_LED_PIN PICO_DEFAULT_LED_PIN -#define GPIO_VID_DATA 18 -#define GPIO_VID_VS 19 -#define GPIO_VID_CLK 20 -#define GPIO_VID_HS 21 +#define GPIO_VID_DATA GPIO_VID_BASE +#define GPIO_VID_VS (GPIO_VID_DATA + 1) +#define GPIO_VID_CLK (GPIO_VID_VS + 1) +#define GPIO_VID_HS (GPIO_VID_CLK + 1) #endif