summaryrefslogtreecommitdiffstats
path: root/app/i2c_hw.c
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2020-06-14 10:55:07 +0100
committerfishsoupisgood <github@madingley.org>2020-06-14 10:55:07 +0100
commit0060468326b7ab0cd07d0d80a84118e7c5bcf348 (patch)
tree8be8ad7b1cb23be4765b9d94a7b8fcefa4d67e27 /app/i2c_hw.c
parentdbc21c1e5dfd95248fe2cd7da6d96c92bdbb97a4 (diff)
downloadrobs_speedo-0060468326b7ab0cd07d0d80a84118e7c5bcf348.tar.gz
robs_speedo-0060468326b7ab0cd07d0d80a84118e7c5bcf348.tar.bz2
robs_speedo-0060468326b7ab0cd07d0d80a84118e7c5bcf348.zip
add tacho
Diffstat (limited to 'app/i2c_hw.c')
-rw-r--r--app/i2c_hw.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/app/i2c_hw.c b/app/i2c_hw.c
index d7989a9..7fc901e 100644
--- a/app/i2c_hw.c
+++ b/app/i2c_hw.c
@@ -5,6 +5,8 @@
#define SCL GPIO6
#define SDA GPIO7
+#define SCL_PORT GPIOB
+#define SDA_PORT GPIOB
void
i2c_clear_start (uint32_t i2c)
@@ -121,33 +123,31 @@ i2cp_reset_sm (void)
{
int i;
- gpio_set_mode (GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
- GPIO_CNF_OUTPUT_PUSHPULL, GPIO_I2C1_SCL | GPIO_I2C1_SDA);
+ MAP_OUTPUT_PP(SCL);
+ MAP_OUTPUT_PP(SDA);
- gpio_set (GPIOB, GPIO_I2C1_SDA);
- gpio_set (GPIOB, GPIO_I2C1_SCL);
+ SET(SDA);
+ SET(SCL);
delay_us (10);
- gpio_clear (GPIOB, GPIO_I2C1_SDA);
+ CLEAR(SDA);
delay_us (10);
- gpio_clear (GPIOB, GPIO_I2C1_SCL);
+ CLEAR(SCL);
for (i = 0; i < 9; ++i)
{
delay_us (10);
- gpio_set (GPIOB, GPIO_I2C1_SCL);
+ SET(SCL);
delay_us (10);
- gpio_clear (GPIOB, GPIO_I2C1_SCL);
+ CLEAR(SCL);
delay_us (10);
}
- gpio_set (GPIOB, GPIO_I2C1_SCL);
+ SET(SCL);
delay_us (10);
- gpio_set (GPIOB, GPIO_I2C1_SDA);
+ SET(SDA);
delay_us (10);
- gpio_set_mode (GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
- GPIO_CNF_OUTPUT_ALTFN_OPENDRAIN,
- GPIO_I2C1_SCL | GPIO_I2C1_SDA);
-
+ MAP_AF_OD(SCL);
+ MAP_AF_OD(SDA);
}