aboutsummaryrefslogtreecommitdiff
path: root/core/include/drivers/stm32_i2c.h
diff options
context:
space:
mode:
authorEtienne Carriere <etienne.carriere@linaro.org>2019-04-29 11:12:13 +0200
committerJérôme Forissier <jerome.forissier@linaro.org>2019-05-06 11:30:37 +0200
commit61e7d84c595d1f4ca64075d6579d99ac0748c05c (patch)
tree508b601d409b4ab3f67a3869650dd238bf0bc37a /core/include/drivers/stm32_i2c.h
parent563f62491b9cad2e147df3ffdb31d67c9e06be9b (diff)
stm32_i2c: expose standard speed in driver API
Move definition of I2C standard speeds configuration means from driver source file to its header file. This change allows bus owners to use appropriate value for bus configuration. Exposes struct i2c_speed_e and enum i2c_speed_e This change fixes the driver API as enum i2c_speed_e is expected by the API. Fixes: b844655c9519 ("stm32_i2c: driver for STM32 I2C bus") Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Diffstat (limited to 'core/include/drivers/stm32_i2c.h')
-rw-r--r--core/include/drivers/stm32_i2c.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/include/drivers/stm32_i2c.h b/core/include/drivers/stm32_i2c.h
index ac0ea225..6efcf00e 100644
--- a/core/include/drivers/stm32_i2c.h
+++ b/core/include/drivers/stm32_i2c.h
@@ -14,6 +14,23 @@
#include <types_ext.h>
/*
+ * I2C specification values as per version 6.0, 4th of April 2014 [1],
+ * table 10 page 48: Characteristics of the SDA and SCL bus lines for
+ * Standard, Fast, and Fast-mode Plus I2C-bus devices.
+ *
+ * [1] https://www.nxp.com/docs/en/user-guide/UM10204.pdf
+ */
+enum i2c_speed_e {
+ I2C_SPEED_STANDARD, /* 100 kHz */
+ I2C_SPEED_FAST, /* 400 kHz */
+ I2C_SPEED_FAST_PLUS, /* 1 MHz */
+};
+
+#define I2C_STANDARD_RATE 100000
+#define I2C_FAST_RATE 400000
+#define I2C_FAST_PLUS_RATE 1000000
+
+/*
* Initialization configuration structure for the STM32 I2C bus.
* Refer to the SoC Reference Manual for more details on configuration items.
*