diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-05-29 16:08:20 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-05-29 16:08:20 +0200 |
commit | 5cf7922107da55380e0cbc9c26d518db76eaf3ed (patch) | |
tree | 0f2ade7fe180cbadba596637f08d4efa6e683a6a /src/ppu | |
parent | 151ef82382104cfef375d8c1d256d72cb61b16fd (diff) |
???
Diffstat (limited to 'src/ppu')
-rw-r--r-- | src/ppu/stm.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/ppu/stm.c b/src/ppu/stm.c index 7f60aed..146d275 100644 --- a/src/ppu/stm.c +++ b/src/ppu/stm.c @@ -5,17 +5,30 @@ #include "stm32/setup.h" void hh_ppu_init() { - hh_ppu_update_aux((hh_s_ppu_loc_aux) { .sysreset = 1 }); - hh_ppu_vram_buffer((uint8_t[4]) { 0xff, 0xff, 0xff, 0xff }); - hh_ppu_flush(); + // hh_ppu_update_aux((hh_s_ppu_loc_aux) { .sysreset = 1 }); + // hh_ppu_vram_buffer((uint8_t[4]) { 0xff, 0xff, 0xff, 0xff }); + // hh_ppu_flush(); HAL_Delay(10); } void hh_ppu_deinit() {} +// void hh_ppu_vram_dwrite(uint8_t* data, size_t size) { +// HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET); +// HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET); +// HAL_SPI_Transmit_DMA(&hspi1, data, size); +// } + void hh_ppu_vram_dwrite(uint8_t* data, size_t size) { + // HAL_SPI_Transmit(&hspi1, data, size, HAL_MAX_DELAY); + for (size_t i = 0; i < size; i += 4) { + if (i+4 > size) break; + uint8_t test[4] = { data[i+0], data[i+1], data[i+2], data[i+3], }; + HAL_SPI_Transmit(&hspi1, test, 4, HAL_MAX_DELAY); + // HAL_Delay(100); + } + HAL_SPI_Transmit(&hspi1, (uint8_t[4]){ 0xff, 0xff, 0xff, 0xff }, 4, HAL_MAX_DELAY); + // reset SPI HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET); - HAL_SPI_Transmit_DMA(&hspi1, data, size); } - |