[riot-notifications] [RIOT-OS/RIOT] nrf52: Implement EasyDMA-based SPI peripheral implemenation (#14057)

benpicco notifications at github.com
Tue May 12 13:23:51 CEST 2020


@benpicco commented on this pull request.



> +void spi_transfer_bytes(spi_t bus, spi_cs_t cs, bool cont,
+                        const void *out, void *in, size_t len)
+{
+    const uint8_t *out_buf = out;
+    uint8_t *in_buf = in;
+
+    assert(out_buf || in_buf);
+
+    if (cs != SPI_CS_UNDEF) {
+        gpio_clear((gpio_t)cs);
+    }
+
+    /* Enable the workaround when the length is only 1 byte */
+#ifdef CPU_MODEL_NRF52832XXAA
+    size_t _len = len;
+    if (_len == 1) {

> Unless you want me to add a dummy function for `_enable_workaround`

I'd say it's just personal preference, but with a dummy function you'll keep all the ifdefs contained in one place.

But I'm undecided if that makes the code easier to read, there are not that many in the first place - you can decide what's more pretty.

-- 
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/14057#discussion_r423657816
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200512/bf6ac9d8/attachment.htm>


More information about the notifications mailing list