[riot-notifications] [RIOT-OS/RIOT] [RFC, WIP] drivers/periph_spi: improve API of spi_acquire (#15904)

Marian Buschsieweke notifications at github.com
Wed Sep 1 17:45:02 CEST 2021

@maribu commented on this pull request.

>   *                      select should not be handled by the SPI driver
- * @param[in] mode      mode to use for the new transaction
- * @param[in] clk       bus clock speed to use for the transaction
- *
- * @return              SPI_OK on success
- * @return              SPI_NOMODE if given mode is not supported
- * @return              SPI_NOCLK if given clock speed is not supported
+ * @param[in]   mode    mode to use for the new transaction
+ * @param[in]   clk     maximum bus clock to use in Hz
+ *
+ * @return  The actually used clock frequency in Hz

Note that the API was not only changed to return the frequency used, but also changes the way to specify frequencies (for performance reasons). As a result, the implementation will have to figure out which prescaler to use to generate the requested maximum frequency. I expect that at this point, the actually used frequency value is already available anyway without additional computation.

I believe that a dedicated function will cause more ROM being used than just changing `spi_acquire()` to just return the frequency value it has computed (for picking the right prescaler) anyway.

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/20210901/84e26add/attachment.htm>

More information about the notifications mailing list