[riot-notifications] [RIOT-OS/RIOT] stm32/spi : Add check for GPIO_UNDEF (#16625)

benpicco notifications at github.com
Wed Jul 7 17:45:20 CEST 2021


@benpicco commented on this pull request.



> @@ -134,12 +134,20 @@ void spi_init_pins(spi_t bus)
     gpio_init_af(spi_config[bus].mosi_pin, GPIO_AF_OUT_PP);
     gpio_init(spi_config[bus].miso_pin, GPIO_IN);
 #else
-    gpio_init(spi_config[bus].mosi_pin, GPIO_OUT);
-    gpio_init(spi_config[bus].miso_pin, GPIO_IN);
-    gpio_init(spi_config[bus].sclk_pin, GPIO_OUT);
-    gpio_init_af(spi_config[bus].mosi_pin, spi_config[bus].mosi_af);
-    gpio_init_af(spi_config[bus].miso_pin, spi_config[bus].miso_af);
-    gpio_init_af(spi_config[bus].sclk_pin, spi_config[bus].sclk_af);
+    if (spi_config[bus].mosi_pin != GPIO_UNDEF) {

```suggestion
    if (gpio_is_valid(spi_config[bus].mosi_pin)) {
```

should be more future-proof 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16625#pullrequestreview-701172021
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210707/513aaff8/attachment-0001.htm>


More information about the notifications mailing list