[riot-notifications] [RIOT-OS/RIOT] stm32-common/spi: allow custom pin modes on spi to minimize power consumption (#11542)

Francisco notifications at github.com
Thu May 23 16:06:24 CEST 2019


fjmolinas commented on this pull request.



> @@ -339,6 +339,15 @@ static int _init_spi(sx127x_t *dev)
     /* Setup SPI for SX127X */
     res = spi_init_cs(dev->params.spi, dev->params.nss_pin);
 
+#ifdef MODULE_PERIPH_SPI_GPIO_MODE
+    spi_gpio_mode_t gpio_modes = {
+        .mosi = (GPIO_OUT | SX127X_DIO_PULL_MODE),
+        .miso = (SX127X_DIO_PULL_MODE),
+        .sclk = (GPIO_OUT | SX127X_DIO_PULL_MODE),

@aabadie Found the reason, when  calling `gpio_init(gpio_t pin, gpio_mode_t mode)` MODER register is set to mode (MODER = b'01), which erases the old Alternate function mode (MODER = b'10).

-- 
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/11542#discussion_r286960245
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190523/6fe4db04/attachment.html>


More information about the notifications mailing list