[riot-notifications] [RIOT-OS/RIOT] periph/spi: add support for printing and testing SPI clock rate (#16727)

Marian Buschsieweke notifications at github.com
Tue Sep 21 15:54:43 CEST 2021

@maribu commented on this pull request.

>   */
-#ifndef HAVE_SPI_CLK_T
-typedef enum {
-    SPI_CLK_100KHZ = 0,     /**< drive the SPI bus with 100KHz */
-    SPI_CLK_400KHZ,         /**< drive the SPI bus with 400KHz */
-    SPI_CLK_1MHZ,           /**< drive the SPI bus with 1MHz */
-    SPI_CLK_5MHZ,           /**< drive the SPI bus with 5MHz */
-    SPI_CLK_10MHZ           /**< drive the SPI bus with 10MHz */
-} spi_clk_t;
+enum {
+    SPI_CLK_100KHZ  = KHZ(100), /**< drive the SPI bus with 100KHz */

Btw: We could implement all backends for now so that `spi_clk_t` will always hold the correct clock divider for the first SPI peripheral and convert it as needed if `spi_acquire()` is called on a bus that is clocked differently.

This would leave some potential for optimization unused, but it would be fully backward compatible. Once the deprecated frequency constants are fully phased out, this optimization potential could be used. Non-breaking API changes are always easier to sell :-)

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/20210921/07321ef7/attachment.htm>

More information about the notifications mailing list