From ec7b1726e60f6077fc90d736e8224b9473534d79 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 13 Mar 2023 20:38:34 +0100 Subject: untested POC --- src/main.c | 34 +++++++++++++++++++++++++--------- src/makefile | 14 ++------------ 2 files changed, 27 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 191d5d9..8d36bf5 100644 --- a/src/main.c +++ b/src/main.c @@ -1,21 +1,37 @@ #include +#include -#include "demo.h" -#include "input.h" #include "main.h" +#include "stm32/setup.h" +#include "../test/ppu-stm-integration-demo/data.h" bool g_hh_run = true; int main() { hh_setup(); - hh_loop(); + + while (1) { + for (unsigned long i = 0; i < HH_PPUINTDEMO_LENGTH; i++) { + uint16_t addr = HH_PPUINTDEMO_ADDR[i]; + uint16_t data = HH_PPUINTDEMO_DATA[i]; + + uint8_t spi_data[4] = { + (addr & 0xff00) >> 8, + (addr & 0x00ff) >> 0, + (data & 0xff00) >> 8, + (data & 0x00ff) >> 0, + }; + + HAL_SPI_Transmit(&hspi1, spi_data, 4, HAL_MAX_DELAY); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, true); + // HAL_Delay(1); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, false); + // HAL_Delay(1); + } + HAL_Delay(1e3); + } + hh_exit(); return 0; } -void hh_ppu_vblank_interrupt() { - static unsigned long frame = 0; - hh_input_read(); - hh_demo_loop(frame); - frame++; -} diff --git a/src/makefile b/src/makefile index d7d9087..e2fc1d3 100644 --- a/src/makefile +++ b/src/makefile @@ -3,7 +3,7 @@ RM = rm -f TARGET = main # platform is ds (desktop) or stm (stm32) -PLATFORM = ds +PLATFORM = stm # if your editor uses compile_commands.json for autocomplete, you should run `make compile_commands.json` again HOST=$(strip $(shell uname -o)) @@ -27,17 +27,7 @@ LFLAGS += -lm CFLAGS += $(if $(STM), -DHH_TARGET_STM32, ) CFLAGS += $(if $(DESKTOP), -DHH_TARGET_DESKTOP, ) -LOCAL_SRCS += main.c \ - ppu/internals.c \ - ppu/ppu.c \ - demo.c \ - engine/engine.c \ - engine/sprite_controller.c \ - engine/player_controller.c \ - engine/draw_screen.c \ - engine/camera.c \ - engine/maths.c \ - engine/entity.c +LOCAL_SRCS += main.c CFLAGS += $(SHARED_FLAGS) LFLAGS += $(SHARED_FLAGS) -- cgit v1.2.3