aboutsummaryrefslogtreecommitdiff
path: root/drivers/arm/i2c_master.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/arm/i2c_master.h')
-rw-r--r--drivers/arm/i2c_master.h28
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/arm/i2c_master.h b/drivers/arm/i2c_master.h
index 31cbfb977..346513ad8 100644
--- a/drivers/arm/i2c_master.h
+++ b/drivers/arm/i2c_master.h
@@ -27,10 +27,6 @@
27#include "ch.h" 27#include "ch.h"
28#include <hal.h> 28#include <hal.h>
29 29
30#if defined(STM32F1XX) || defined(STM32F1xx) || defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32F4XX) || defined(STM32L0xx) || defined(STM32L1xx)
31# define USE_I2CV1
32#endif
33
34#ifdef I2C1_BANK 30#ifdef I2C1_BANK
35# define I2C1_SCL_BANK I2C1_BANK 31# define I2C1_SCL_BANK I2C1_BANK
36# define I2C1_SDA_BANK I2C1_BANK 32# define I2C1_SDA_BANK I2C1_BANK
@@ -51,20 +47,6 @@
51# define I2C1_SDA 7 47# define I2C1_SDA 7
52#endif 48#endif
53 49
54#if defined(STM32F1XX) || defined(STM32F1xx)
55# define USE_GPIOV1
56#endif
57
58#ifndef USE_GPIOV1
59// The default PAL alternate modes are used to signal that the pins are used for I2C
60# ifndef I2C1_SCL_PAL_MODE
61# define I2C1_SCL_PAL_MODE 4
62# endif
63# ifndef I2C1_SDA_PAL_MODE
64# define I2C1_SDA_PAL_MODE 4
65# endif
66#endif
67
68#ifdef USE_I2CV1 50#ifdef USE_I2CV1
69# ifndef I2C1_OPMODE 51# ifndef I2C1_OPMODE
70# define I2C1_OPMODE OPMODE_I2C 52# define I2C1_OPMODE OPMODE_I2C
@@ -99,6 +81,16 @@
99# define I2C_DRIVER I2CD1 81# define I2C_DRIVER I2CD1
100#endif 82#endif
101 83
84#ifndef USE_GPIOV1
85// The default PAL alternate modes are used to signal that the pins are used for I2C
86# ifndef I2C1_SCL_PAL_MODE
87# define I2C1_SCL_PAL_MODE 4
88# endif
89# ifndef I2C1_SDA_PAL_MODE
90# define I2C1_SDA_PAL_MODE 4
91# endif
92#endif
93
102typedef int16_t i2c_status_t; 94typedef int16_t i2c_status_t;
103 95
104#define I2C_STATUS_SUCCESS (0) 96#define I2C_STATUS_SUCCESS (0)