summaryrefslogtreecommitdiff
path: root/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'i2c')
-rw-r--r--i2c/i2c.cpp12
-rw-r--r--i2c/i2c.h3
2 files changed, 2 insertions, 13 deletions
diff --git a/i2c/i2c.cpp b/i2c/i2c.cpp
index a395b13..6aa25fc 100644
--- a/i2c/i2c.cpp
+++ b/i2c/i2c.cpp
@@ -90,17 +90,7 @@ void I2C_t::handle_error() {
busy = 0;
}
-void I2C_t::enable(Pin& scl, Pin& sda) {
- RCC.enable(RCC.I2C1);
- asm volatile("nop");
-
- scl.set_af(4);
- sda.set_af(4);
- scl.set_type(Pin::OpenDrain);
- sda.set_type(Pin::OpenDrain);
- scl.set_mode(Pin::AF);
- sda.set_mode(Pin::AF);
-
+void I2C_t::enable() {
reg.CR1 = 0x8000;
reg.CR1 = 0;
diff --git a/i2c/i2c.h b/i2c/i2c.h
index f4d6949..ed72aa3 100644
--- a/i2c/i2c.h
+++ b/i2c/i2c.h
@@ -3,7 +3,6 @@
#include <stdint.h>
#include <interrupt/interrupt.h>
-#include <gpio/pin.h>
struct I2C_reg_t {
volatile uint32_t CR1;
@@ -42,7 +41,7 @@ class I2C_t {
void handle_error();
- void enable(Pin& scl, Pin& sda);
+ void enable();
void write_reg(uint8_t addr_, uint8_t reg_, uint8_t data);
void read_reg(uint8_t addr_, uint8_t reg_, uint8_t len, uint8_t* buf);