[riot-notifications] [RIOT-OS/RIOT] cpu/sam0_common/spi: demux SPI output pins before entering deep sleep (#14105)

benpicco notifications at github.com
Wed May 20 16:21:43 CEST 2020

@benpicco commented on this pull request.

> +        for (size_t i = 0; i < SPI_NUMOF; i++) {
+            spi_t bus = SPI_DEV(i);
+            gpio_init_mux(spi_config[bus].mosi_pin, spi_config[bus].mosi_mux);
+            gpio_init_mux(spi_config[bus].clk_pin, spi_config[bus].clk_mux);

The problem here is that not all SPI buses from the board configuration are necessarily used by the application, so those pins might be used for something else.

I don't see any register that we can reliably query here, so how about introducing a `static uint8_t spi_enabled;` bit field that gets set in `spi_init()`

    spi_enabled |= 1 << bus;

Then you can skip those entries that are not enabled in the loop here and in `spi_pm_cb_enter`.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200520/1abb65e2/attachment.htm>

More information about the notifications mailing list