aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 8bf8e15..5f883f9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,7 @@
#include <stdint.h>
#include <stdio.h>
+#include "string.h"
#include "ch573/gpio.h"
#include "ch573/pwr.h"
#include "ch573/uart.h"
@@ -127,9 +128,24 @@ int main(void)
{
printf("Running SPI.\n");
+ set_system_clock_60Mhz();
+
enable_spi();
- run_spi();
+ char buf[1024];
+ memset(buf, 0xf0, sizeof(buf));
+ for (int i = 0; i < 50; ++ i) {
+ buf[i] = 0xaa;
+ buf[sizeof(buf) - i] = 0xaa;
+ }
+
+ while (1) {
+ printf("Xfer.\n");
+ dma_transfer(buf, sizeof(buf));
+ wait_for_dma();
+ }
+
+ // run_spi();
// GPIO_PORT.dir.set(GPIO_PORT_A, DIR_OUT, 8);
// GPIO_PORT.pd_drv.set(GPIO_PORT_A, 0, 8);