You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2018/12/06 19:42:29 UTC

[mynewt-core] 02/03: fe310: Change spi freqnency to kHz

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 2c0459086f11d458f39e79fc88a342c77984c7a6
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Thu Dec 6 15:44:21 2018 +0100

    fe310: Change spi freqnency to kHz
    
    SPI frequency was sepcified in Hz unlike other MCU's.
---
 hw/mcu/sifive/fe310/src/hal_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/mcu/sifive/fe310/src/hal_spi.c b/hw/mcu/sifive/fe310/src/hal_spi.c
index 5f13edb..851f7ed 100644
--- a/hw/mcu/sifive/fe310/src/hal_spi.c
+++ b/hw/mcu/sifive/fe310/src/hal_spi.c
@@ -254,7 +254,7 @@ hal_spi_config(int spi_num, struct hal_spi_settings *settings)
     if (settings->data_order == HAL_SPI_LSB_FIRST) {
         fmt |= SPI_FMT_ENDIAN(1);
     }
-    div = get_cpu_freq() / (2 * settings->baudrate);
+    div = get_cpu_freq() / (2 * settings->baudrate * 1000);
     if (div) {
         div--;
     }