From 2ac788fbf2bfc6e130cda324a638b9022498119e Mon Sep 17 00:00:00 2001 From: David Kuder Date: Sun, 16 Apr 2023 23:37:12 -0400 Subject: [PATCH] UART initialization for Z80 mode --- common/main.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/common/main.c b/common/main.c index bca5ea4..4f0bd2e 100644 --- a/common/main.c +++ b/common/main.c @@ -1,4 +1,3 @@ -#include #include #include #include @@ -10,6 +9,10 @@ #include "common/flash.h" #include "common/dmacopy.h" +#ifdef FUNCTION_Z80 +#include +#endif + #ifdef RASPBERRYPI_PICO_W #include #endif @@ -185,7 +188,23 @@ int main() { // Load the config from flash, or defaults read_config(); - + +#ifdef FUNCTION_Z80 + uart_init(uart0, sio[0].baudrate); + + gpio_set_function(0, GPIO_FUNC_UART); + gpio_set_function(1, GPIO_FUNC_UART); + gpio_set_function(2, GPIO_FUNC_UART); + gpio_set_function(3, GPIO_FUNC_UART); + + uart_init(uart1, sio[1].baudrate); + + gpio_set_function(4, GPIO_FUNC_UART); + gpio_set_function(5, GPIO_FUNC_UART); + gpio_set_function(6, GPIO_FUNC_UART); + gpio_set_function(7, GPIO_FUNC_UART); +#endif + core0_loop(); return 0;