Loading...
Searching...
No Matches
cfg_spi_default.h File Reference

Common peripheral configuration for GD32VF103 boards. More...

Detailed Description

Common peripheral configuration for GD32VF103 boards.

Author
Koen Zandberg koen@.nosp@m.berg.nosp@m.zand..nosp@m.net
Gunar Schorcht gunar.nosp@m.@sch.nosp@m.orcht.nosp@m..net

Definition in file cfg_spi_default.h.

#include "periph_cpu.h"
+ Include dependency graph for cfg_spi_default.h:

Go to the source code of this file.

SPI configuration

#define SPI_DEV_1_USED   0
 Disable the second SPI device SPI_DEV(1) by default.
 
#define SPI_DEV_0_CS   GPIO_PIN(PORT_B, 12)
 Defines PB12 as the default CS signal for SPI_DEV(0)
 
#define SPI_DEV_1_CS   GPIO_PIN(PORT_B, 5)
 Defines PA4 as the default CS signal for SPI_DEV(1)
 
#define SPI_NUMOF   ARRAY_SIZE(spi_config)
 
static const spi_conf_t spi_config []
 Default SPI device configuration.
 

Macro Definition Documentation

◆ SPI_DEV_0_CS

#define SPI_DEV_0_CS   GPIO_PIN(PORT_B, 12)

Defines PB12 as the default CS signal for SPI_DEV(0)

Overriding this default allows the use of another pin as CS signal if the default CS signal is connected to an unused hardware.

Definition at line 55 of file cfg_spi_default.h.

◆ SPI_DEV_1_CS

#define SPI_DEV_1_CS   GPIO_PIN(PORT_B, 5)

Defines PA4 as the default CS signal for SPI_DEV(1)

Overriding this default allows the use of another pin as CS signal if the default CS signal is connected to an unused hardware.

Definition at line 65 of file cfg_spi_default.h.

◆ SPI_DEV_1_USED

#define SPI_DEV_1_USED   0

Disable the second SPI device SPI_DEV(1) by default.

The second SPI device SPI_DEV(1) is only defined if SPI_DEV_1_USED is set to 1 by the board. This allows to use the default configuration with one or two SPI devices depending on whether other peripherals are enabled that would collide with the SPI devices.

Definition at line 45 of file cfg_spi_default.h.

◆ SPI_NUMOF

#define SPI_NUMOF   ARRAY_SIZE(spi_config)

Definition at line 102 of file cfg_spi_default.h.

Variable Documentation

◆ spi_config

const spi_conf_t spi_config[]
static
Initial value:
= {
{
.dev = SPI1,
.mosi_pin = GPIO_PIN(PORT_B, 15),
.miso_pin = GPIO_PIN(PORT_B, 14),
.sclk_pin = GPIO_PIN(PORT_B, 13),
.cs_pin = SPI_DEV_0_CS,
.rcumask = RCU_APB1EN_SPI1EN_Msk,
.apbbus = APB1,
},
}
@ PORT_B
port B
Definition periph_cpu.h:48
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
#define SPI_DEV_0_CS
Defines PB12 as the default CS signal for SPI_DEV(0)
@ APB1
Advanced Peripheral Bus 1
Definition periph_cpu.h:79

Default SPI device configuration.

The default SPI device configuration allows to define up to two SPI devices SPI_DEV(0) and SPI_DEV(1). SPI_DEV(0) is always defined if the SPI peripheral is enabled by the module periph_spi. The second SPI device SPI_DEV(1) is only defined if SPI_DEV_1_USED is set to 1 by the board. This allows to use the default configuration with one or two SPI devices depending on whether other peripherals are enabled that would collide with the SPI devices.

Definition at line 79 of file cfg_spi_default.h.