Skip to content

Commit

Permalink
Picozxreal (#33)
Browse files Browse the repository at this point in the history
* start picozxreal

* Refactor

* First pass Bootsel

* Update PicoDVI

* No serial for picozxreal

* Testing zxpico with LCD

* Testing picozx variants

* Update Readme

* Update Readme

* Readme update

* Update Readme for back power

* Add more tested applications

* Add 3DMM image

* Update images

* Correct link

* add image credit

* SPI bus speed

---------

Co-authored-by: ikjordan <[email protected]>
  • Loading branch information
ikjordan and ikjordan authored May 3, 2024
1 parent 064e861 commit 47fcc42
Show file tree
Hide file tree
Showing 39 changed files with 565 additions and 208 deletions.
28 changes: 22 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ project(${PROJECT} C CXX ASM)
OPTION(TIME_SPARE "Set to true to measure idle time" OFF)
OPTION(OVER_VOLT "Set to true to increase the Pico voltage" OFF)
OPTION(HDMI_SOUND "Set to true to deliver sound over hdmi" OFF)
OPTION(PICOZX_LCD "Set to true to enable LCD for PICOZX" OFF)

# Look for board file first in local board directory
set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards)
Expand Down Expand Up @@ -36,6 +37,9 @@ endif()
# e.g. cmake -DPICO_BOARD=picozxboard
# Set to "picozxrealboard" for vga 222 with csync based on picozxreal board
# e.g. cmake -DPICO_BOARD=picozxrealboard
#
# To enable HDMI sound add -DHDMI_SOUND
# To enable LCD display in addition to VGA for picozx add -DPICOZX_LCD

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -80,16 +84,21 @@ set(ZX8X_SOURCES
set(INI_SOURCES
inih/ini.c)

set(DISPLAY_COMMON_SOURCES
display/display_common.c)

if ((${PICO_BOARD} STREQUAL "dviboard") OR (${PICO_BOARD} STREQUAL "olimexpcboard") OR (${PICO_BOARD} STREQUAL "wspizeroboard"))
set(DISPLAY_SOURCES
display/display_dvi.c
display/tmds_double.S
display/tmds_double.h
display/tmds_chroma.S
display/tmds_chroma.h)
display/tmds_chroma.S)
elseif ((${PICO_BOARD} STREQUAL "lcdws28board") OR (${PICO_BOARD} STREQUAL "lcdmakerboard"))
set(DISPLAY_SOURCES
display/display_lcd.c)
elseif ((${PICO_BOARD} STREQUAL "picozxboard") AND (${PICOZX_LCD}))
set(DISPLAY_SOURCES
display/display_lcd.c
display/display_vga.c)
else ()
set(DISPLAY_SOURCES
display/display_vga.c)
Expand All @@ -106,6 +115,7 @@ set(USB_SOURCES
add_executable(${PROJECT}
${ZX8X_SOURCES}
${INI_SOURCES}
${DISPLAY_COMMON_SOURCES}
${DISPLAY_SOURCES}
${USB_SOURCES})

Expand Down Expand Up @@ -181,8 +191,14 @@ else()
elseif (${PICO_BOARD} STREQUAL "vgamaker222cboard")
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "picozx81_vgamaker222c")
elseif (${PICO_BOARD} STREQUAL "picozxboard")
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "picozx81_picozx")
elseif (${PICO_BOARD} STREQUAL "picozxrealboard")
if (${PICOZX_LCD})
pico_generate_pio_header(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}/display/spi_lcd.pio)
target_compile_definitions(${PROJECT} PRIVATE -DPICOZX_LCD)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "picozx81_picozx_lcd")
else ()
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "picozx81_picozx")
endif ()
elseif (${PICO_BOARD} STREQUAL "picozxrealboard")
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "picozx81_picozxreal")
endif()

Expand Down Expand Up @@ -211,7 +227,7 @@ target_link_libraries(${PROJECT}
tinyusb_host
tinyusb_board)

# Cannot use serial port with Pimoroni vga
# Cannot use serial port with Pimoroni vga or picozx boards
if ((${PICO_BOARD} STREQUAL "vgaboard") OR (${PICO_BOARD} STREQUAL "picozxboard") OR (${PICO_BOARD} STREQUAL "picozxrealboard"))
pico_enable_stdio_uart(${PROJECT} 0)
else()
Expand Down
110 changes: 82 additions & 28 deletions README.md

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions boards/picozxboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,35 @@
#define CP_SHIFT 19
#define CP_JOIN(a) ((a & 0xF) | ((a >> 3) & (0x7 << 4)))
#define TP 2800

#ifdef PICOZX_LCD
#define PICOZXBOARD_LCD_DC_PIN 6
#define PICOZXBOARD_LCD_CS_PIN 5
#define PICOZXBOARD_LCD_CMD_PIN 3 // MOSI
#define PICOZXBOARD_LCD_BL_PIN 4
#define PICOZXBOARD_LCD_CLK_PIN 2

#ifndef PICO_LCD_DC_PIN
#define PICO_LCD_DC_PIN PICOZXBOARD_LCD_DC_PIN
#endif

#ifndef PICO_LCD_CS_PIN
#define PICO_LCD_CS_PIN PICOZXBOARD_LCD_CS_PIN
#endif

#ifndef PICO_LCD_BL_PIN
#define PICO_LCD_BL_PIN PICOZXBOARD_LCD_BL_PIN
#endif

#ifndef PICO_LCD_CMD_PIN
#define PICO_LCD_CMD_PIN PICOZXBOARD_LCD_CMD_PIN
#endif

#ifndef PICO_LCD_CLK_PIN
#define PICO_LCD_CLK_PIN PICOZXBOARD_LCD_CLK_PIN
#endif
#endif

#define PICO_PICOZX_BOARD

// Maker board has a Pico on it, so default anything we haven't set above
Expand Down
7 changes: 5 additions & 2 deletions boards/wspizeroboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#define _BOARDS_WSPIZEROBOARD_H

// For board detection
#define RASPBERRYPI_BOARDS_WSPIZEROBOARD

#define WAVESHARE_BOARDS_PIZEROBOARD

#define WSPIZEROBOARD_SD_CLK_PIN 18
#define WSPIZEROBOARD_SD_CMD_PIN 19
Expand Down Expand Up @@ -58,6 +57,10 @@
#define PICO_AUDIO_PWM_R_PIN WSPIZEROBOARD_PWM_R_PIN
#endif

#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
#endif

#define NINEPIN_JOYSTICK

#define NINEPIN_UP 11
Expand Down
12 changes: 12 additions & 0 deletions buildall
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ build_uf2_hdmi()
make -j4
cp ./${uf2} ../uf2/${uf2}
}

build_uf2_lcd()
{
board=$1"board .."
uf2="picozx81_"$1"_lcd.uf2"

cmake -DPICOZX_LCD=ON -DPICO_BOARD=${board}
make -j4
cp ./${uf2} ../uf2/${uf2}
}

# Create the directories
mkdir -p build
mkdir -p uf2
Expand All @@ -39,3 +50,4 @@ build_uf2 picozxreal
build_uf2_hdmi dvi
build_uf2_hdmi olimexpc
build_uf2_hdmi wspizero
build_uf2_lcd picozx
11 changes: 10 additions & 1 deletion display/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ typedef struct
} info;
} DisplayExtraInfo_T;

#ifdef PICOZX_LCD
extern bool useLCD;
#endif

/*
fivesevensix if true request resolution 720x576, else 640x480
match if true request refresh frequency of PAL ZX81 (50.65 Hz)
Expand All @@ -41,10 +45,15 @@ typedef struct
stridebit The actual number of bits between start of adjacent lines (pixel width + bufferbits)
info Extra information for HDMI audio and LCD displays
*/

/* Display specific, defined for all display types */
extern uint displayInitialise(bool fiveSevenSix, bool match, uint16_t minBuffByte, uint16_t* pixelWidth,
uint16_t* pixelHeight, uint16_t* strideBit, DisplayExtraInfo_T* info);
extern void displayStart(void);

extern bool displayShowKeyboard(bool zx81);

/* Common */
extern void displayGetFreeBuffer(uint8_t** buff);
extern void displayBuffer(uint8_t* buff, bool sync, bool free, bool chroma);
extern void displayGetCurrentBuffer(uint8_t** buff);
Expand All @@ -55,7 +64,6 @@ extern void displaySetInterlace(bool on);
extern void displayBlank(bool black);
extern bool displayIsBlank(bool* isBlack);

extern bool displayShowKeyboard(bool zx81);
extern bool displayHideKeyboard(void);

#ifdef PICO_SPI_LCD_SD_SHARE
Expand All @@ -66,6 +74,7 @@ extern void displayGrantSPIBus(void);
#ifdef SOUND_HDMI
void getAudioRing(audio_ring_t** ring);
#endif

#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit 47fcc42

Please sign in to comment.