diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-03-31 16:28:17 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-03-31 16:28:17 +0200 |
commit | 46bf4306575fa31fccaff19f0a592f8b40dd46cb (patch) | |
tree | 0f317374e4d81af5862804d588ca05f44c7fb325 /src/ppu | |
parent | fa296fbc6fe1c423932189116bd0cb949de0beef (diff) |
it's working
Diffstat (limited to 'src/ppu')
-rw-r--r-- | src/ppu/stm.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ppu/stm.c b/src/ppu/stm.c index 8292d3c..8334090 100644 --- a/src/ppu/stm.c +++ b/src/ppu/stm.c @@ -8,9 +8,16 @@ void hh_ppu_init() {} void hh_ppu_deinit() {} void hh_ppu_vram_dwrite(uint8_t* data, size_t size) { - HAL_SPI_Transmit(&hspi1, data, size, HAL_MAX_DELAY); + // 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 }, size, HAL_MAX_DELAY); // reset SPI - HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, true); - HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, false); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET); } |