diff --git a/boards/b-l072z-lrwan1/include/periph_conf.h b/boards/b-l072z-lrwan1/include/periph_conf.h index 80d28470c4..dd988e14c4 100644 --- a/boards/b-l072z-lrwan1/include/periph_conf.h +++ b/boards/b-l072z-lrwan1/include/periph_conf.h @@ -109,7 +109,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 15), .miso_pin = GPIO_PIN(PORT_B, 14), .sclk_pin = GPIO_PIN(PORT_B, 13), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, @@ -128,7 +128,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, diff --git a/boards/b-l475e-iot01a/include/periph_conf.h b/boards/b-l475e-iot01a/include/periph_conf.h index 6b129e041c..65c79b52d1 100644 --- a/boards/b-l475e-iot01a/include/periph_conf.h +++ b/boards/b-l475e-iot01a/include/periph_conf.h @@ -146,7 +146,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/im880b/include/periph_conf.h b/boards/im880b/include/periph_conf.h index 778a5b273b..1bd1b771b0 100644 --- a/boards/im880b/include/periph_conf.h +++ b/boards/im880b/include/periph_conf.h @@ -84,7 +84,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/iotlab-a8-m3/include/periph_conf.h b/boards/iotlab-a8-m3/include/periph_conf.h index 0b31b05493..8b7c6f469a 100644 --- a/boards/iotlab-a8-m3/include/periph_conf.h +++ b/boards/iotlab-a8-m3/include/periph_conf.h @@ -37,7 +37,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 15), .miso_pin = GPIO_PIN(PORT_B, 14), .sclk_pin = GPIO_PIN(PORT_B, 13), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .rccmask = RCC_APB1ENR_SPI2EN, .apbbus = APB1 } diff --git a/boards/iotlab-m3/include/periph_conf.h b/boards/iotlab-m3/include/periph_conf.h index 791a09859d..6e6ed6b9b4 100644 --- a/boards/iotlab-m3/include/periph_conf.h +++ b/boards/iotlab-m3/include/periph_conf.h @@ -37,7 +37,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .rccmask = RCC_APB2ENR_SPI1EN, .apbbus = APB2, #ifdef MODULE_PERIPH_DMA @@ -53,7 +53,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 15), .miso_pin = GPIO_PIN(PORT_B, 14), .sclk_pin = GPIO_PIN(PORT_B, 13), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .rccmask = RCC_APB1ENR_SPI2EN, .apbbus = APB1, #ifdef MODULE_PERIPH_DMA diff --git a/boards/limifrog-v1/include/periph_conf.h b/boards/limifrog-v1/include/periph_conf.h index a3fdd27e8f..b492bf7bae 100644 --- a/boards/limifrog-v1/include/periph_conf.h +++ b/boards/limifrog-v1/include/periph_conf.h @@ -88,7 +88,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, @@ -101,7 +101,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF6, .miso_af = GPIO_AF6, .sclk_af = GPIO_AF6, diff --git a/boards/lora-e5-dev/include/periph_conf.h b/boards/lora-e5-dev/include/periph_conf.h index 35fd68360b..8c7e6c94c8 100644 --- a/boards/lora-e5-dev/include/periph_conf.h +++ b/boards/lora-e5-dev/include/periph_conf.h @@ -100,7 +100,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_UNDEF, .miso_pin = GPIO_UNDEF, .sclk_pin = GPIO_UNDEF, - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF_UNDEF, .miso_af = GPIO_AF_UNDEF, .sclk_af = GPIO_AF_UNDEF, @@ -115,7 +115,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 10), .miso_pin = GPIO_PIN(PORT_B, 14), .sclk_pin = GPIO_PIN(PORT_B, 13), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/lsn50/include/periph_conf.h b/boards/lsn50/include/periph_conf.h index e6e6df7a17..7995000a7b 100644 --- a/boards/lsn50/include/periph_conf.h +++ b/boards/lsn50/include/periph_conf.h @@ -108,7 +108,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, diff --git a/boards/maple-mini/include/periph_conf.h b/boards/maple-mini/include/periph_conf.h index d642b103c6..2a4782829f 100644 --- a/boards/maple-mini/include/periph_conf.h +++ b/boards/maple-mini/include/periph_conf.h @@ -134,7 +134,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .rccmask = RCC_APB2ENR_SPI1EN, .apbbus = APB2 }, @@ -143,7 +143,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 15), .miso_pin = GPIO_PIN(PORT_B, 14), .sclk_pin = GPIO_PIN(PORT_B, 13), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .rccmask = RCC_APB1ENR_SPI2EN, .apbbus = APB1 } diff --git a/boards/nucleo-f031k6/include/periph_conf.h b/boards/nucleo-f031k6/include/periph_conf.h index 1bc732e4d4..725157ffca 100644 --- a/boards/nucleo-f031k6/include/periph_conf.h +++ b/boards/nucleo-f031k6/include/periph_conf.h @@ -100,7 +100,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, diff --git a/boards/nucleo-f042k6/include/periph_conf.h b/boards/nucleo-f042k6/include/periph_conf.h index 5d2c69a0ec..d63db22037 100644 --- a/boards/nucleo-f042k6/include/periph_conf.h +++ b/boards/nucleo-f042k6/include/periph_conf.h @@ -110,7 +110,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, diff --git a/boards/nucleo-f103rb/include/periph_conf.h b/boards/nucleo-f103rb/include/periph_conf.h index c5db89ef2c..665fd38d93 100644 --- a/boards/nucleo-f103rb/include/periph_conf.h +++ b/boards/nucleo-f103rb/include/periph_conf.h @@ -154,7 +154,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .rccmask = RCC_APB2ENR_SPI1EN, .apbbus = APB2 }, @@ -163,7 +163,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 15), .miso_pin = GPIO_PIN(PORT_B, 14), .sclk_pin = GPIO_PIN(PORT_B, 13), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .rccmask = RCC_APB1ENR_SPI2EN, .apbbus = APB1 } diff --git a/boards/nucleo-f303k8/include/periph_conf.h b/boards/nucleo-f303k8/include/periph_conf.h index 7022048783..dc8eca27cd 100644 --- a/boards/nucleo-f303k8/include/periph_conf.h +++ b/boards/nucleo-f303k8/include/periph_conf.h @@ -148,7 +148,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-f303re/include/periph_conf.h b/boards/nucleo-f303re/include/periph_conf.h index 2519800bc9..3a8c5e956d 100644 --- a/boards/nucleo-f303re/include/periph_conf.h +++ b/boards/nucleo-f303re/include/periph_conf.h @@ -161,7 +161,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_C, 12), .miso_pin = GPIO_PIN(PORT_C, 11), .sclk_pin = GPIO_PIN(PORT_C, 10), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF6, .miso_af = GPIO_AF6, .sclk_af = GPIO_AF6, diff --git a/boards/nucleo-f303ze/include/periph_conf.h b/boards/nucleo-f303ze/include/periph_conf.h index 0b36610fe5..1109a35248 100644 --- a/boards/nucleo-f303ze/include/periph_conf.h +++ b/boards/nucleo-f303ze/include/periph_conf.h @@ -158,7 +158,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-f446ze/include/periph_conf.h b/boards/nucleo-f446ze/include/periph_conf.h index c970b4cf51..d9db59adc1 100644 --- a/boards/nucleo-f446ze/include/periph_conf.h +++ b/boards/nucleo-f446ze/include/periph_conf.h @@ -150,7 +150,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-f746zg/include/periph_conf.h b/boards/nucleo-f746zg/include/periph_conf.h index fa37b626f9..134c10a42d 100644 --- a/boards/nucleo-f746zg/include/periph_conf.h +++ b/boards/nucleo-f746zg/include/periph_conf.h @@ -175,7 +175,7 @@ static const spi_conf_t spi_config[] = { #endif .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, @@ -194,7 +194,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_E, 6), .miso_pin = GPIO_PIN(PORT_E, 5), .sclk_pin = GPIO_PIN(PORT_E, 2), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-f767zi/include/periph_conf.h b/boards/nucleo-f767zi/include/periph_conf.h index c7625abae4..fad6af755c 100644 --- a/boards/nucleo-f767zi/include/periph_conf.h +++ b/boards/nucleo-f767zi/include/periph_conf.h @@ -135,7 +135,7 @@ static const spi_conf_t spi_config[] = { #endif .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, @@ -148,7 +148,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_E, 6), .miso_pin = GPIO_PIN(PORT_E, 5), .sclk_pin = GPIO_PIN(PORT_E, 2), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-l011k4/include/periph_conf.h b/boards/nucleo-l011k4/include/periph_conf.h index 27282c674e..daee04d74f 100644 --- a/boards/nucleo-l011k4/include/periph_conf.h +++ b/boards/nucleo-l011k4/include/periph_conf.h @@ -68,7 +68,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, diff --git a/boards/nucleo-l031k6/include/periph_conf.h b/boards/nucleo-l031k6/include/periph_conf.h index e5b4f563bc..cbab34377b 100644 --- a/boards/nucleo-l031k6/include/periph_conf.h +++ b/boards/nucleo-l031k6/include/periph_conf.h @@ -90,7 +90,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, diff --git a/boards/nucleo-l053r8/include/periph_conf.h b/boards/nucleo-l053r8/include/periph_conf.h index a9fced3ce3..a9cbce20f7 100644 --- a/boards/nucleo-l053r8/include/periph_conf.h +++ b/boards/nucleo-l053r8/include/periph_conf.h @@ -102,7 +102,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, diff --git a/boards/nucleo-l073rz/include/periph_conf.h b/boards/nucleo-l073rz/include/periph_conf.h index 54adcabf02..da052fa06e 100644 --- a/boards/nucleo-l073rz/include/periph_conf.h +++ b/boards/nucleo-l073rz/include/periph_conf.h @@ -120,7 +120,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, diff --git a/boards/nucleo-l152re/include/periph_conf.h b/boards/nucleo-l152re/include/periph_conf.h index 10d3b8fc37..a76be9c581 100644 --- a/boards/nucleo-l152re/include/periph_conf.h +++ b/boards/nucleo-l152re/include/periph_conf.h @@ -143,7 +143,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-l412kb/include/periph_conf.h b/boards/nucleo-l412kb/include/periph_conf.h index 9657369c72..1323e43a42 100644 --- a/boards/nucleo-l412kb/include/periph_conf.h +++ b/boards/nucleo-l412kb/include/periph_conf.h @@ -105,7 +105,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-l432kc/include/periph_conf.h b/boards/nucleo-l432kc/include/periph_conf.h index 9b8c31022d..40fd526183 100644 --- a/boards/nucleo-l432kc/include/periph_conf.h +++ b/boards/nucleo-l432kc/include/periph_conf.h @@ -103,7 +103,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-l433rc/include/periph_conf.h b/boards/nucleo-l433rc/include/periph_conf.h index 6f818daf75..9afa75259d 100644 --- a/boards/nucleo-l433rc/include/periph_conf.h +++ b/boards/nucleo-l433rc/include/periph_conf.h @@ -104,7 +104,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 15), .miso_pin = GPIO_PIN(PORT_B, 14), .sclk_pin = GPIO_PIN(PORT_B, 13), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-l452re/include/periph_conf.h b/boards/nucleo-l452re/include/periph_conf.h index b290c0c483..d653623143 100644 --- a/boards/nucleo-l452re/include/periph_conf.h +++ b/boards/nucleo-l452re/include/periph_conf.h @@ -107,7 +107,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-l476rg/include/periph_conf.h b/boards/nucleo-l476rg/include/periph_conf.h index bfc304eaa2..72ffa469ca 100644 --- a/boards/nucleo-l476rg/include/periph_conf.h +++ b/boards/nucleo-l476rg/include/periph_conf.h @@ -187,7 +187,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-l496zg/include/periph_conf.h b/boards/nucleo-l496zg/include/periph_conf.h index 819775158e..600725936a 100644 --- a/boards/nucleo-l496zg/include/periph_conf.h +++ b/boards/nucleo-l496zg/include/periph_conf.h @@ -143,7 +143,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-l4r5zi/include/periph_conf.h b/boards/nucleo-l4r5zi/include/periph_conf.h index 2758e68376..2f0fb4c89f 100644 --- a/boards/nucleo-l4r5zi/include/periph_conf.h +++ b/boards/nucleo-l4r5zi/include/periph_conf.h @@ -104,7 +104,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nucleo-wl55jc/include/periph_conf.h b/boards/nucleo-wl55jc/include/periph_conf.h index 2d6551ca52..89156bd782 100644 --- a/boards/nucleo-wl55jc/include/periph_conf.h +++ b/boards/nucleo-wl55jc/include/periph_conf.h @@ -89,7 +89,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_UNDEF, .miso_pin = GPIO_UNDEF, .sclk_pin = GPIO_UNDEF, - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF_UNDEF, .miso_af = GPIO_AF_UNDEF, .sclk_af = GPIO_AF_UNDEF, @@ -104,7 +104,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/nz32-sc151/include/periph_conf.h b/boards/nz32-sc151/include/periph_conf.h index 86a5abf280..d8a2b1a69d 100644 --- a/boards/nz32-sc151/include/periph_conf.h +++ b/boards/nz32-sc151/include/periph_conf.h @@ -101,7 +101,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, @@ -114,7 +114,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 15), .miso_pin = GPIO_PIN(PORT_B, 14), .sclk_pin = GPIO_PIN(PORT_B, 13), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, @@ -127,7 +127,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_C, 12), .miso_pin = GPIO_PIN(PORT_C, 11), .sclk_pin = GPIO_PIN(PORT_C, 10), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF6, .miso_af = GPIO_AF6, .sclk_af = GPIO_AF6, diff --git a/boards/p-l496g-cell02/include/periph_conf.h b/boards/p-l496g-cell02/include/periph_conf.h index 6036d97ec5..d02b48b945 100644 --- a/boards/p-l496g-cell02/include/periph_conf.h +++ b/boards/p-l496g-cell02/include/periph_conf.h @@ -135,7 +135,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/p-nucleo-wb55/include/periph_conf.h b/boards/p-nucleo-wb55/include/periph_conf.h index 18129271c4..aa71095987 100644 --- a/boards/p-nucleo-wb55/include/periph_conf.h +++ b/boards/p-nucleo-wb55/include/periph_conf.h @@ -91,7 +91,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/spark-core/include/periph_conf.h b/boards/spark-core/include/periph_conf.h index c697802656..5e14320191 100644 --- a/boards/spark-core/include/periph_conf.h +++ b/boards/spark-core/include/periph_conf.h @@ -83,7 +83,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 17), .miso_pin = GPIO_PIN(PORT_B, 16), .sclk_pin = GPIO_PIN(PORT_B, 15), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .rccmask = RCC_APB2ENR_SPI1EN, .apbbus = APB2 } diff --git a/boards/stm32f0discovery/include/periph_conf.h b/boards/stm32f0discovery/include/periph_conf.h index 5560dc6bcf..80ed7af6fb 100644 --- a/boards/stm32f0discovery/include/periph_conf.h +++ b/boards/stm32f0discovery/include/periph_conf.h @@ -112,7 +112,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, @@ -125,7 +125,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 15), .miso_pin = GPIO_PIN(PORT_B, 14), .sclk_pin = GPIO_PIN(PORT_B, 13), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, diff --git a/boards/stm32f3discovery/include/periph_conf.h b/boards/stm32f3discovery/include/periph_conf.h index 8c480da712..ea7f7d9ccf 100644 --- a/boards/stm32f3discovery/include/periph_conf.h +++ b/boards/stm32f3discovery/include/periph_conf.h @@ -145,7 +145,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_A, 7), .miso_pin = GPIO_PIN(PORT_A, 6), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/stm32f723e-disco/include/periph_conf.h b/boards/stm32f723e-disco/include/periph_conf.h index 035112f29c..3e7f4dabbe 100644 --- a/boards/stm32f723e-disco/include/periph_conf.h +++ b/boards/stm32f723e-disco/include/periph_conf.h @@ -173,7 +173,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/stm32f746g-disco/include/periph_conf.h b/boards/stm32f746g-disco/include/periph_conf.h index 026f06dbfd..6664a527fd 100644 --- a/boards/stm32f746g-disco/include/periph_conf.h +++ b/boards/stm32f746g-disco/include/periph_conf.h @@ -128,7 +128,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 15), .miso_pin = GPIO_PIN(PORT_B, 14), .sclk_pin = GPIO_PIN(PORT_I, 1), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF5, .miso_af = GPIO_AF5, .sclk_af = GPIO_AF5, diff --git a/boards/stm32l0538-disco/include/periph_conf.h b/boards/stm32l0538-disco/include/periph_conf.h index d71c85b863..f1eb325511 100644 --- a/boards/stm32l0538-disco/include/periph_conf.h +++ b/boards/stm32l0538-disco/include/periph_conf.h @@ -79,7 +79,7 @@ static const spi_conf_t spi_config[] = { .mosi_pin = GPIO_PIN(PORT_B, 5), .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), - .cs_pin = GPIO_UNDEF, + .cs_pin = SPI_CS_UNDEF, .mosi_af = GPIO_AF0, .miso_af = GPIO_AF0, .sclk_af = GPIO_AF0, diff --git a/cpu/stm32/include/periph/cpu_spi.h b/cpu/stm32/include/periph/cpu_spi.h index b3155a202e..2ead5233e0 100644 --- a/cpu/stm32/include/periph/cpu_spi.h +++ b/cpu/stm32/include/periph/cpu_spi.h @@ -48,6 +48,21 @@ extern "C" { */ #define SPI_HWCS(x) (SPI_HWCS_MASK | x) +/** + * @brief Define value for unused CS line + */ +#define SPI_CS_UNDEF (GPIO_UNDEF) + +#ifndef DOXYGEN +/** + * @brief Overwrite the default spi_cs_t type definition + * @{ + */ +#define HAVE_SPI_CS_T +typedef uint32_t spi_cs_t; +/** @} */ +#endif + /** * @brief Use the shared SPI functions * @{ @@ -87,7 +102,7 @@ typedef struct { gpio_t mosi_pin; /**< MOSI pin */ gpio_t miso_pin; /**< MISO pin */ gpio_t sclk_pin; /**< SCLK pin */ - gpio_t cs_pin; /**< HWCS pin, set to GPIO_UNDEF if not mapped */ + spi_cs_t cs_pin; /**< HWCS pin, set to SPI_CS_UNDEF if not mapped */ #ifndef CPU_FAM_STM32F1 gpio_af_t mosi_af; /**< MOSI pin alternate function */ gpio_af_t miso_af; /**< MISO pin alternate function */ diff --git a/cpu/stm32/periph/spi.c b/cpu/stm32/periph/spi.c index 856257e97c..cd8fcc82a8 100644 --- a/cpu/stm32/periph/spi.c +++ b/cpu/stm32/periph/spi.c @@ -31,6 +31,7 @@ #include "bitarithm.h" #include "cpu.h" #include "mutex.h" +#include "periph/gpio.h" #include "periph/spi.h" #include "pm_layered.h" @@ -166,13 +167,13 @@ int spi_init_cs(spi_t bus, spi_cs_t cs) if (bus >= SPI_NUMOF) { return SPI_NODEV; } - if (cs == SPI_CS_UNDEF || + if (!gpio_is_valid(cs) || (((cs & SPI_HWCS_MASK) == SPI_HWCS_MASK) && (cs & ~(SPI_HWCS_MASK)))) { return SPI_NOCS; } if (cs == SPI_HWCS_MASK) { - if (spi_config[bus].cs_pin == GPIO_UNDEF) { + if (!gpio_is_valid(spi_config[bus].cs_pin)) { return SPI_NOCS; } #ifdef CPU_FAM_STM32F1 @@ -393,7 +394,7 @@ void spi_transfer_bytes(spi_t bus, spi_cs_t cs, bool cont, /* active the given chip select line */ dev(bus)->CR1 |= (SPI_CR1_SPE); /* this pulls the HW CS line low */ - if ((cs != SPI_HWCS_MASK) && (cs != SPI_CS_UNDEF)) { + if ((cs != SPI_HWCS_MASK) && gpio_is_valid(cs)) { gpio_clear((gpio_t)cs); } @@ -409,7 +410,7 @@ void spi_transfer_bytes(spi_t bus, spi_cs_t cs, bool cont, #endif /* release the chip select if not specified differently */ - if ((!cont) && (cs != SPI_CS_UNDEF)) { + if ((!cont) && gpio_is_valid(cs)) { dev(bus)->CR1 &= ~(SPI_CR1_SPE); /* pull HW CS line high */ if (cs != SPI_HWCS_MASK) { gpio_set((gpio_t)cs);