mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 10:12:45 +01:00
cpu/gd32v: allow SPI pin remapping in config
This commit is contained in:
parent
ebc869a83f
commit
ae984b0bea
@ -120,6 +120,15 @@ void spi_init(spi_t bus)
|
||||
|
||||
void spi_init_pins(spi_t bus)
|
||||
{
|
||||
if (spi_config[bus].sclk_pin == GPIO_PIN(PORT_B, 3) &&
|
||||
spi_config[bus].miso_pin == GPIO_PIN(PORT_B, 4) &&
|
||||
spi_config[bus].mosi_pin == GPIO_PIN(PORT_B, 5)) {
|
||||
/* The remapping periph clock must first be enabled */
|
||||
RCU->APB2EN |= RCU_APB2EN_AFEN_Msk;
|
||||
/* Then the remap can occur */
|
||||
AFIO->PCF0 |= AFIO_PCF0_SPI0_REMAP_Msk;
|
||||
}
|
||||
|
||||
if (gpio_is_valid(spi_config[bus].sclk_pin)) {
|
||||
gpio_init_af(spi_config[bus].sclk_pin, GPIO_AF_OUT_PP);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user