diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 34 | ||||
-rw-r--r-- | src/makefile | 14 |
2 files changed, 27 insertions, 21 deletions
@@ -1,21 +1,37 @@ #include <stdlib.h> +#include <stm32f0xx_hal.h> -#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) |