[riot-notifications] [RIOT-OS/RIOT] cpu/qn908x: Implement blocking SPI support (#15689)

iosabi notifications at github.com
Sun Jan 24 20:01:31 CET 2021


@iosabi commented on this pull request.



> +    return SPI_OK;
+}
+
+#ifdef MODULE_PERIPH_SPI_RECONFIGURE
+void spi_deinit_pins(spi_t bus)
+{
+    assert(bus < SPI_NUMOF);
+    mutex_lock(&locks[bus]);
+    const spi_conf_t *const conf = &spi_config[bus];
+
+    /* Disables the SPI block. It must be already idle. */
+    conf->dev->CFG &= ~SPI_CFG_ENABLE_MASK;
+
+    gpio_init(conf->copi_pin, GPIO_IN);
+    gpio_init(conf->cipo_pin, GPIO_IN);
+    gpio_init(conf->clk_pin, GPIO_IN);

That's a good question, I don't know. There is a `spi_init_pins` and a `spi_init_cs` but there's no `spi_deinit_cs` and the `spi_deinit_pins` documentation doesn't say anything about CS. I guess you are free to call `gpio_init` on a CS line whenever you want? The only other CPU that implements deinit is sam0_common and that doesn't touch the CS lines.

You are also free to call gpio_init on any of these pins without de-initializing them for this particular CPU, but calling deinit doesn't hurt to make sure the mutex is held.

-- 
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/15689#discussion_r563334745
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210124/61e0e1b6/attachment.htm>


More information about the notifications mailing list