aboutsummaryrefslogtreecommitdiffstats
path: root/src/atsamd/spi.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-01-18 18:52:44 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-01-28 20:02:16 -0500
commitc5fc264a075b5458cb68ffff5bced2a9d5ba8385 (patch)
treed6a94c88d47f7eeecc3211f13771b27af31d9f87 /src/atsamd/spi.c
parent8f763d80b7c46d467050a5c7696749a23beaf0b0 (diff)
downloadkutter-c5fc264a075b5458cb68ffff5bced2a9d5ba8385.tar.gz
kutter-c5fc264a075b5458cb68ffff5bced2a9d5ba8385.tar.xz
kutter-c5fc264a075b5458cb68ffff5bced2a9d5ba8385.zip
atsamd: Add a get_pclock_frequency() helper function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/atsamd/spi.c')
-rw-r--r--src/atsamd/spi.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/atsamd/spi.c b/src/atsamd/spi.c
index 9c82de1b..e0860576 100644
--- a/src/atsamd/spi.c
+++ b/src/atsamd/spi.c
@@ -4,7 +4,6 @@
//
// This file may be distributed under the terms of the GNU GPLv3 license.
-#include "autoconf.h" // CONFIG_CLOCK_FREQ
#include "internal.h" // enable_pclock
#include "command.h" // shutdown
#include "gpio.h" // spi_setup
@@ -47,7 +46,7 @@ spi_setup(uint32_t bus, uint8_t mode, uint32_t rate)
| SERCOM_SPI_CTRLA_DIPO(0)
| SERCOM_SPI_CTRLA_DOPO(1)
| SERCOM_SPI_CTRLA_ENABLE);
- uint32_t baud = CONFIG_CLOCK_FREQ / (2 * rate) - 1;
+ uint32_t baud = get_pclock_frequency(SERCOM4_GCLK_ID_CORE) / (2 * rate) - 1;
spi_init(ctrla, baud);
return (struct spi_config){ .ctrla = ctrla, .baud = baud };
}