[riot-notifications] [RIOT-OS/RIOT] TI CC3200 SimpleLink RIOT support (#11866)

benpicco notifications at github.com
Sat May 30 19:42:54 CEST 2020


@benpicco commented on this pull request.



> +}
+
+void spi_init(spi_t bus)
+{
+    /* assert(bus >= SPI_NUMOF); */
+    mutex_init(&locks[bus]);
+
+    /* CC3100 module does not require pin config */
+    if (bus != CC3100_SPI) {
+        /* trigger pin initialization */
+        spi_init_pins(bus);
+    }
+
+    /* enable clock */
+    switch (bus) {
+    case EXTERNAL_SPI:

There is no need to get rid of the switch case.
But the `bus` variable will only tell you the index in the `spi_config` struct.

Couldn't you do

```C
if (spi(bus) == GSPI_BASE) {
    ARCM->MCSPI_A1.clk_gating |= PRCM_RUN_MODE_CLK;
else if (spi(bus) == LSPI_BASE) {
     ARCM->MCSPI_A2.clk_gating |= PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK;
}
```

so the index does not matter?

-- 
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/11866#discussion_r432873144
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200530/e04e5090/attachment.htm>


More information about the notifications mailing list