[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 17:15:19 CEST 2020


@benpicco commented on this pull request.



> +void spi_pm_cb_enter(int deep)
+{
+    if (deep) {
+        for (size_t i = 0; i < SPI_NUMOF; i++) {
+            spi_t bus = SPI_DEV(i);
+            if (spi_pins_muxed & (1 << bus)) {
+                gpio_disable_mux(spi_config[bus].mosi_pin);
+                gpio_disable_mux(spi_config[bus].clk_pin);
+            }
+        }
+    }
+}
+
+void spi_pm_cb_leave(int deep)
+{
+    if (deep) {

Minor nit:

```suggestion
    if (!deep) {
        return;
    }
```

saves you unnececary nesting.

-- 
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/14105#pullrequestreview-415443271
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200520/41564e07/attachment.htm>


More information about the notifications mailing list