aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c34
1 files changed, 25 insertions, 9 deletions
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 <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++;
-}