aboutsummaryrefslogtreecommitdiffstats
path: root/src/atsamd/i2c.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-01-14 18:21:50 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-01-28 20:02:16 -0500
commit8cd83b4c2dcaeac1fe68f18eadd7f25ff42476c2 (patch)
tree780a7aa17ffd41969e5e6d63751b0efe7a9d108c /src/atsamd/i2c.c
parentf6ce875818a1341ff7a0279699505453d8ca0db4 (diff)
downloadkutter-8cd83b4c2dcaeac1fe68f18eadd7f25ff42476c2.tar.gz
kutter-8cd83b4c2dcaeac1fe68f18eadd7f25ff42476c2.tar.xz
kutter-8cd83b4c2dcaeac1fe68f18eadd7f25ff42476c2.zip
atsamd: Initial support for SAMD51
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/atsamd/i2c.c')
-rw-r--r--src/atsamd/i2c.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/atsamd/i2c.c b/src/atsamd/i2c.c
index 57374443..03a75f11 100644
--- a/src/atsamd/i2c.c
+++ b/src/atsamd/i2c.c
@@ -1,13 +1,12 @@
-// i2c support on samd21
+// i2c support on samd
//
-// Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU GPLv3 license.
#include "internal.h" // enable_pclock
#include "command.h" // shutdown
#include "gpio.h" // i2c_setup
-#include "samd21.h" // SERCOM3
#include "sched.h" // sched_shutdown
#define TIME_RISE 125ULL // 125 nanoseconds
@@ -35,7 +34,7 @@ i2c_init(void)
| SERCOM_I2CM_CTRLA_INACTOUT(3)
| SERCOM_I2CM_STATUS_SEXTTOUT
| SERCOM_I2CM_STATUS_MEXTTOUT
- | SERCOM_I2CM_CTRLA_MODE_I2C_MASTER);
+ | SERCOM_I2CM_CTRLA_MODE(5));
si->CTRLA.reg = areg;
uint32_t freq = get_pclock_frequency(SERCOM3_GCLK_ID_CORE);
uint32_t baud = (freq/I2C_FREQ - 10 - freq*TIME_RISE/1000000000) / 2;