We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e6b6622 commit 2a55f09Copy full SHA for 2a55f09
1 file changed
examples/spi_slave/spi_slave.c
@@ -1,13 +1,6 @@
1
#include "ch32fun.h"
2
#include <stdio.h>
3
4
-#define CH32V003_SPI_SPEED_HZ 1000000
5
-#define CH32V003_SPI_DIRECTION_2LINE_TXRX
6
-#define CH32V003_SPI_CLK_MODE_POL0_PHA0
7
-#define CH32V003_SPI_NSS_SOFTWARE_ANY_MANUAL
8
-
9
-#include "../../extralibs/ch32v003_SPI.h"
10
11
#define PIN_CS PC1
12
// Useful to determine the cycle duration with a scope. Goes high the moment CS goes low, and back to low at the last
13
// action within the while loop. Can be removed otherwise.
@@ -36,6 +29,16 @@ void wait_for_state( SpiState desired_state )
36
29
}
37
30
38
31
32
+static uint8_t SPI_read_8()
33
+{
34
+ return SPI1->DATAR;
35
+}
+
+static void SPI_write_8( uint8_t data )
39
+ SPI1->DATAR = data;
40
41
42
void SPI_Configure()
43
{
44
// reset control register
0 commit comments