miniFOC 1.0.3
This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.
Functions
spi.c File Reference

this file contains the initialization of SPI peripherals and the code implementation of reading and writing half words. More...

#include "spi.h"
#include "gd32f1x0.h"
#include "config.h"

Go to the source code of this file.

Functions

unsigned short spi_readwrite_halfworld (unsigned short data)
 spi0 transmit data for sc60228 More...
 
void spi_config (void)
 configure spi0 periph and its gpios More...
 

Detailed Description

this file contains the initialization of SPI peripherals and the code implementation of reading and writing half words.

Author
Lao·Zhu
Version
V1.0.2
Date
29. October 2021

Definition in file spi.c.

Function Documentation

◆ spi_config()

void spi_config ( void  )

configure spi0 periph and its gpios

Definition at line 35 of file spi.c.

References SPI_PRESCALE.

Referenced by main().

◆ spi_readwrite_halfworld()

unsigned short spi_readwrite_halfworld ( unsigned short  data)

spi0 transmit data for sc60228

Parameters
[in]datadata to transmit
Return values
datareceived from slave

Definition at line 19 of file spi.c.

Referenced by encoder_read_data().