summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-09-12 15:41:33 +0100
committerGitHub <noreply@github.com>2021-09-12 15:41:33 +0100
commit0fa217a5b7cdd035105387fd31c506fda4cfb945 (patch)
tree1ba0df8f6cb8462fcc3517f7a090ad7c72123038
parentbb841087bbd47b0be6dffafa8a4f7a361867f71d (diff)
downloadqmk_firmware-0fa217a5b7cdd035105387fd31c506fda4cfb945.tar.gz
qmk_firmware-0fa217a5b7cdd035105387fd31c506fda4cfb945.zip
Align ChibiOS I2C defs with other drivers (#14399)
* Align ChibiOS I2C defs with other drivers * Update keyboards/xelus/valor_frl_tkl/config.h Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Ryan <fauxpark@gmail.com>
-rw-r--r--docs/i2c_driver.md17
-rw-r--r--docs/ja/i2c_driver.md11
-rwxr-xr-xkeyboards/aeboards/constellation/rev2/config.h4
-rw-r--r--keyboards/aeboards/ext65/rev2/config.h4
-rw-r--r--keyboards/cannonkeys/satisfaction75/config.h5
-rw-r--r--keyboards/clueboard/66_hotswap/gen1/config.h4
-rw-r--r--keyboards/dekunukem/duckypad/config.h4
-rw-r--r--keyboards/ergodox_infinity/config.h5
-rw-r--r--keyboards/ez_maker/directpins/teensy_32/config.h4
-rw-r--r--keyboards/ez_maker/directpins/teensy_lc/config.h4
-rw-r--r--keyboards/ferris/0_2/config.h6
-rw-r--r--keyboards/ferris/0_2/matrix.c5
-rw-r--r--keyboards/handwired/onekey/blackpill_f401/blackpill_f401.c2
-rw-r--r--keyboards/handwired/onekey/teensy_32/config.h4
-rw-r--r--keyboards/handwired/onekey/teensy_lc/config.h4
-rw-r--r--keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h6
-rw-r--r--keyboards/matrix/m20add/config.h4
-rw-r--r--keyboards/matrix/m20add/m20add.c8
-rw-r--r--keyboards/matrix/noah/config.h4
-rw-r--r--keyboards/whitefox/config.h5
-rw-r--r--keyboards/xelus/kangaroo/config.h4
-rw-r--r--keyboards/xelus/pachi/rgb/config.h4
-rw-r--r--keyboards/xelus/valor/rev2/config.h4
-rw-r--r--keyboards/xelus/valor_frl_tkl/config.h4
-rw-r--r--platforms/chibios/drivers/i2c_master.c12
-rw-r--r--platforms/chibios/drivers/i2c_master.h21
26 files changed, 64 insertions, 95 deletions
diff --git a/docs/i2c_driver.md b/docs/i2c_driver.md
index 3ec34a0f87..9017b44ed7 100644
--- a/docs/i2c_driver.md
+++ b/docs/i2c_driver.md
@@ -62,16 +62,13 @@ Then, modify your board's `mcuconf.h` to enable the peripheral you've chosen, fo
Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303.
-|`config.h` Overrride |Description |Default|
-|------------------------|-------------------------------------------------------------------------------------------|-------|
-|`I2C_DRIVER` |I2C peripheral to use - I2C1 -> `I2CD1`, I2C2 -> `I2CD2` etc. |`I2CD1`|
-|`I2C1_BANK` (deprecated)|The bank of pins (`GPIOA`, `GPIOB`, `GPIOC`), superseded by `I2C1_SCL_BANK`/`I2C1_SDA_BANK`|`GPIOB`|
-|`I2C1_SCL_BANK` |The bank of pins (`GPIOA`, `GPIOB`, `GPIOC`) to use for SCL |`GPIOB`|
-|`I2C1_SCL` |The pin number for SCL (0-15) |`6` |
-|`I2C1_SCL_PAL_MODE` |The alternate function mode for SCL |`4` |
-|`I2C1_SDA_BANK` |The bank of pins (`GPIOA`, `GPIOB`, `GPIOC`) to use for SDA |`GPIOB`|
-|`I2C1_SDA` |The pin number for SDA (0-15) |`7` |
-|`I2C1_SDA_PAL_MODE` |The alternate function mode for SDA |`4` |
+|`config.h` Overrride |Description |Default|
+|------------------------|--------------------------------------------------------------|-------|
+|`I2C_DRIVER` |I2C peripheral to use - I2C1 -> `I2CD1`, I2C2 -> `I2CD2` etc. |`I2CD1`|
+|`I2C1_SCL_PIN` |The pin definition for SCL |`B6` |
+|`I2C1_SCL_PAL_MODE` |The alternate function mode for SCL |`4` |
+|`I2C1_SDA_PIN` |The pin definition for SDA |`B7` |
+|`I2C1_SDA_PAL_MODE` |The alternate function mode for SDA |`4` |
The following configuration values depend on the specific MCU in use.
diff --git a/docs/ja/i2c_driver.md b/docs/ja/i2c_driver.md
index 9d348d5803..1d8f70e163 100644
--- a/docs/ja/i2c_driver.md
+++ b/docs/ja/i2c_driver.md
@@ -79,13 +79,10 @@ ARM MCU 用の設定はしばしば非常に複雑です。これは、多くの
STM32 MCU では、使用するハードウェアドライバにより、さまざまなピンを I2C ピンとして設定できます。標準では `B6`, `B7` ピンが I2C 用のピンです。 I2C 用のピンを設定するために次の定義が使えます:
-| 変数 | 説明 | 既定値 |
-|-----------------------|--------------------------------------------------------------------------------------------------|---------|
-| `I2C1_SCL_BANK` | SCL に使うピンのバンク (`GPIOA`, `GPIOB`, `GPIOC`) | `GPIOB` |
-| `I2C1_SDA_BANK` | SDA に使うピンのバンク (`GPIOA`, `GPIOB`, `GPIOC`) | `GPIOB` |
-| `I2C1_SCL` | SCL のピン番号 (0-15) | `6` |
-| `I2C1_SDA` | SDA のピン番号 (0-15) | `7` |
-| `I2C1_BANK`(非推奨) | 使用するピンのバンク (`GPIOA`, `GPIOB`, `GPIOC`)。後継は `I2C1_SCL_BANK`, `I2C1_SDA_BANK` です。 | `GPIOB` |
+| 変数 | 説明 | 既定値 |
+|-----------------------|-------------------------------------------------------------------------------------------|---------|
+| `I2C1_SCL_PIN` | SCL のピン番号 | `B6` |
+| `I2C1_SDA_PIN` | SDA のピン番号 | `B7` |
ChibiOS I2C ドライバの設定項目は STM32 MCU の種類に依存します。
diff --git a/keyboards/aeboards/constellation/rev2/config.h b/keyboards/aeboards/constellation/rev2/config.h
index 0780c9bf93..de42885b47 100755
--- a/keyboards/aeboards/constellation/rev2/config.h
+++ b/keyboards/aeboards/constellation/rev2/config.h
@@ -47,8 +47,8 @@
#define LOCKING_RESYNC_ENABLE
// I2C setup
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define I2C1_SCL_PAL_MODE 4
#define I2C1_SDA_PAL_MODE 4
#define I2C1_TIMINGR_PRESC 0U
diff --git a/keyboards/aeboards/ext65/rev2/config.h b/keyboards/aeboards/ext65/rev2/config.h
index 778fc3ea6c..498e345ad7 100644
--- a/keyboards/aeboards/ext65/rev2/config.h
+++ b/keyboards/aeboards/ext65/rev2/config.h
@@ -56,8 +56,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define WS2812_EXTERNAL_PULLUP
// I2C OLED defines
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define I2C1_SCL_PAL_MODE 1
#define I2C1_SDA_PAL_MODE 1
diff --git a/keyboards/cannonkeys/satisfaction75/config.h b/keyboards/cannonkeys/satisfaction75/config.h
index e100cc99b1..43a872041c 100644
--- a/keyboards/cannonkeys/satisfaction75/config.h
+++ b/keyboards/cannonkeys/satisfaction75/config.h
@@ -53,9 +53,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// I2C config
#define I2C_DRIVER I2CD1
-#define I2C1_SCL_BANK GPIOB
-#define I2C1_SCL 6
-#define I2C1_SDA 7
+#define I2C1_SCL_PIN B6
+#define I2C1_SDA_PIN B7
#define I2C1_SCL_PAL_MODE 1
#define I2C1_SDA_PAL_MODE 1
#define I2C1_TIMINGR_PRESC 0x00U
diff --git a/keyboards/clueboard/66_hotswap/gen1/config.h b/keyboards/clueboard/66_hotswap/gen1/config.h
index 7e53e0a011..a6205b27bb 100644
--- a/keyboards/clueboard/66_hotswap/gen1/config.h
+++ b/keyboards/clueboard/66_hotswap/gen1/config.h
@@ -77,8 +77,8 @@
// 0b1110101 AD <-> SCL
// 0b1110110 AD <-> SDA
#define LED_DRIVER_ADDR_1 0b1110100
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define LED_DRIVER_COUNT 1
#define DRIVER_LED_TOTAL 71
diff --git a/keyboards/dekunukem/duckypad/config.h b/keyboards/dekunukem/duckypad/config.h
index 2f1b2ef32c..59c6826662 100644
--- a/keyboards/dekunukem/duckypad/config.h
+++ b/keyboards/dekunukem/duckypad/config.h
@@ -46,8 +46,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define I2C1_SCL_PAL_MODE 1
#define I2C1_SDA_PAL_MODE 1
diff --git a/keyboards/ergodox_infinity/config.h b/keyboards/ergodox_infinity/config.h
index fb6f30d459..357ddf6c51 100644
--- a/keyboards/ergodox_infinity/config.h
+++ b/keyboards/ergodox_infinity/config.h
@@ -83,9 +83,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define I2C1_CLOCK_SPEED 400000
#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2
#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2
-#define I2C1_BANK GPIOB
-#define I2C1_SCL 0
-#define I2C1_SDA 1
+#define I2C1_SCL_PIN B0
+#define I2C1_SDA_PIN B1
#ifdef ST7565_ENABLE
/* LCD driver */
diff --git a/keyboards/ez_maker/directpins/teensy_32/config.h b/keyboards/ez_maker/directpins/teensy_32/config.h
index 861ae70e41..c487a84ab1 100644
--- a/keyboards/ez_maker/directpins/teensy_32/config.h
+++ b/keyboards/ez_maker/directpins/teensy_32/config.h
@@ -17,7 +17,7 @@
#pragma once
// i2c_master defines
-#define I2C1_SCL 0 // A2 on pinout = B0
-#define I2C1_SDA 1 // A3 on pinout = B1
+#define I2C1_SCL_PIN B0 // A2 on pinout = B0
+#define I2C1_SDA_PIN B1 // A3 on pinout = B1
#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2
#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2
diff --git a/keyboards/ez_maker/directpins/teensy_lc/config.h b/keyboards/ez_maker/directpins/teensy_lc/config.h
index 861ae70e41..c487a84ab1 100644
--- a/keyboards/ez_maker/directpins/teensy_lc/config.h
+++ b/keyboards/ez_maker/directpins/teensy_lc/config.h
@@ -17,7 +17,7 @@
#pragma once
// i2c_master defines
-#define I2C1_SCL 0 // A2 on pinout = B0
-#define I2C1_SDA 1 // A3 on pinout = B1
+#define I2C1_SCL_PIN B0 // A2 on pinout = B0
+#define I2C1_SDA_PIN B1 // A3 on pinout = B1
#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2
#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2
diff --git a/keyboards/ferris/0_2/config.h b/keyboards/ferris/0_2/config.h
index 89eac7ed16..f51e5dd8f1 100644
--- a/keyboards/ferris/0_2/config.h
+++ b/keyboards/ferris/0_2/config.h
@@ -67,10 +67,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* i2c settings */
#define I2C_DRIVER I2CD2
-#define I2C1_SCL_BANK GPIOB
-#define I2C1_SCL 10
-#define I2C1_SDA_BANK GPIOB
-#define I2C1_SDA 11
+#define I2C1_SCL_PIN B10
+#define I2C1_SDA_PIN B11
#define I2C1_TIMINGR_PRESC 2U
#define I2C1_TIMINGR_SCLDEL 1U
#define I2C1_TIMINGR_SDADEL 0U
diff --git a/keyboards/ferris/0_2/matrix.c b/keyboards/ferris/0_2/matrix.c
index afa8a344cd..ff0e66d65c 100644
--- a/keyboards/ferris/0_2/matrix.c
+++ b/keyboards/ferris/0_2/matrix.c
@@ -59,11 +59,6 @@ extern i2c_status_t mcp23017_status;
bool i2c_initialized = 0;
i2c_status_t mcp23017_status = I2C_ADDR;
-#define I2C2_SCL_BANK GPIOB
-#define I2C2_SCL 10
-#define I2C2_SDA_BANK GPIOB
-#define I2C2_SDA 11
-
uint8_t init_mcp23017(void) {
print("init mcp23017\n");
mcp23017_status = I2C_ADDR;
diff --git a/keyboards/handwired/onekey/blackpill_f401/blackpill_f401.c b/keyboards/handwired/onekey/blackpill_f401/blackpill_f401.c
index 956932329c..1287614a8b 100644
--- a/keyboards/handwired/onekey/blackpill_f401/blackpill_f401.c
+++ b/keyboards/handwired/onekey/blackpill_f401/blackpill_f401.c
@@ -17,7 +17,7 @@
#include QMK_KEYBOARD_H
void board_init(void) {
- // B9 is configured as I2C1_SDA in the board file; that function must be
+ // B9 is configured as I2C1_SDA_PIN in the board file; that function must be
// disabled before using B7 as I2C1_SDA.
setPinInputHigh(B9);
}
diff --git a/keyboards/handwired/onekey/teensy_32/config.h b/keyboards/handwired/onekey/teensy_32/config.h
index 180f324875..e388b01af8 100644
--- a/keyboards/handwired/onekey/teensy_32/config.h
+++ b/keyboards/handwired/onekey/teensy_32/config.h
@@ -26,7 +26,7 @@
#define UNUSED_PINS
// i2c_master defines
-#define I2C1_SCL 0 // A2 on pinout = B0
-#define I2C1_SDA 1 // A3 on pinout = B1
+#define I2C1_SCL_PIN B0 // A2 on pinout = B0
+#define I2C1_SDA_PIN B1 // A3 on pinout = B1
#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2
#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2
diff --git a/keyboards/handwired/onekey/teensy_lc/config.h b/keyboards/handwired/onekey/teensy_lc/config.h
index ad30f969f5..4e594e7d7e 100644
--- a/keyboards/handwired/onekey/teensy_lc/config.h
+++ b/keyboards/handwired/onekey/teensy_lc/config.h
@@ -26,7 +26,7 @@
#define UNUSED_PINS
// i2c_master defines
-#define I2C1_SCL 0 // A2 on pinout = B0
-#define I2C1_SDA 1 // A3 on pinout = B1
+#define I2C1_SCL_PIN B0 // A2 on pinout = B0
+#define I2C1_SDA_PIN B1 // A3 on pinout = B1
#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2
#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h
index 0e5b72c56b..983b7b11b7 100644
--- a/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h
+++ b/keyboards/handwired/tractyl_manuform/5x6_right/f411/config.h
@@ -71,10 +71,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* i2c config for oleds */
#define I2C_DRIVER I2CD1
-#define I2C1_SCL_BANK GPIOB
-#define I2C1_SDA_BANK GPIOB
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define I2C1_SCL_PAL_MODE 4
#define I2C1_SDA_PAL_MODE 4
#define I2C1_CLOCK_SPEED 400000
diff --git a/keyboards/matrix/m20add/config.h b/keyboards/matrix/m20add/config.h
index 3df5d78d55..5d615dbad6 100644
--- a/keyboards/matrix/m20add/config.h
+++ b/keyboards/matrix/m20add/config.h
@@ -82,8 +82,8 @@
#define DEBOUNCE 5
// i2c setting
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define I2C1_CLOCK_SPEED 400000
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
diff --git a/keyboards/matrix/m20add/m20add.c b/keyboards/matrix/m20add/m20add.c
index b38dad27cd..21f4f9b1ba 100644
--- a/keyboards/matrix/m20add/m20add.c
+++ b/keyboards/matrix/m20add/m20add.c
@@ -64,12 +64,12 @@ void i2c_init(void)
}
// Try releasing special pins for a short time
- palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_INPUT);
- palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT);
+ palSetLineMode(I2C1_SCL_PIN, PAL_MODE_INPUT);
+ palSetLineMode(I2C1_SDA_PIN, PAL_MODE_INPUT);
chThdSleepMilliseconds(10);
- palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
- palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
+ palSetLineMode(I2C1_SCL_PIN, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
+ palSetLineMode(I2C1_SDA_PIN, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
}
#define REBOOT_MAGIC 0x41544B42
diff --git a/keyboards/matrix/noah/config.h b/keyboards/matrix/noah/config.h
index f41cad94ce..e5fa4959c8 100644
--- a/keyboards/matrix/noah/config.h
+++ b/keyboards/matrix/noah/config.h
@@ -26,8 +26,8 @@
#define DEBOUNCE 5
// i2c setting
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define I2C1_CLOCK_SPEED 400000
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
#define PAL_MODE_STM32_ALTERNATE_OPENDRAIN (PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN)
diff --git a/keyboards/whitefox/config.h b/keyboards/whitefox/config.h
index 1cdac01d07..d2b6639a30 100644
--- a/keyboards/whitefox/config.h
+++ b/keyboards/whitefox/config.h
@@ -72,9 +72,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define I2C1_CLOCK_SPEED 400000
#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2
#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2
-#define I2C1_BANK GPIOB
-#define I2C1_SCL 0
-#define I2C1_SDA 1
+#define I2C1_SCL_PIN B0
+#define I2C1_SDA_PIN B1
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
* This is useful for the Windows task manager shortcut (ctrl+shift+esc).
diff --git a/keyboards/xelus/kangaroo/config.h b/keyboards/xelus/kangaroo/config.h
index f6b17c24a3..1d746b342e 100644
--- a/keyboards/xelus/kangaroo/config.h
+++ b/keyboards/xelus/kangaroo/config.h
@@ -43,8 +43,8 @@
#define LOCKING_RESYNC_ENABLE
// I2C OLED defines
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define I2C1_SCL_PAL_MODE 1
#define I2C1_SDA_PAL_MODE 1
diff --git a/keyboards/xelus/pachi/rgb/config.h b/keyboards/xelus/pachi/rgb/config.h
index 9378b2c413..3bc7071ec9 100644
--- a/keyboards/xelus/pachi/rgb/config.h
+++ b/keyboards/xelus/pachi/rgb/config.h
@@ -45,8 +45,8 @@
#define LOCKING_RESYNC_ENABLE
// I2C setup
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define I2C1_SCL_PAL_MODE 4
#define I2C1_SDA_PAL_MODE 4
#define I2C1_TIMINGR_PRESC 0U
diff --git a/keyboards/xelus/valor/rev2/config.h b/keyboards/xelus/valor/rev2/config.h
index 2ab581c753..502cc482ec 100644
--- a/keyboards/xelus/valor/rev2/config.h
+++ b/keyboards/xelus/valor/rev2/config.h
@@ -47,8 +47,8 @@
#define LOCKING_RESYNC_ENABLE
// I2C setup
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define I2C1_SCL_PAL_MODE 4
#define I2C1_SDA_PAL_MODE 4
#define I2C1_TIMINGR_PRESC 0U
diff --git a/keyboards/xelus/valor_frl_tkl/config.h b/keyboards/xelus/valor_frl_tkl/config.h
index 5319a95bae..c1c08878c0 100644
--- a/keyboards/xelus/valor_frl_tkl/config.h
+++ b/keyboards/xelus/valor_frl_tkl/config.h
@@ -47,8 +47,8 @@
#define LOCKING_RESYNC_ENABLE
// I2C OLED defines
-#define I2C1_SCL 8
-#define I2C1_SDA 9
+#define I2C1_SCL_PIN B8
+#define I2C1_SDA_PIN B9
#define I2C1_SCL_PAL_MODE 1
#define I2C1_SDA_PAL_MODE 1
diff --git a/platforms/chibios/drivers/i2c_master.c b/platforms/chibios/drivers/i2c_master.c
index fc4bb2ab37..9af5c71c3f 100644
--- a/platforms/chibios/drivers/i2c_master.c
+++ b/platforms/chibios/drivers/i2c_master.c
@@ -63,16 +63,16 @@ __attribute__((weak)) void i2c_init(void) {
is_initialised = true;
// Try releasing special pins for a short time
- palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_INPUT);
- palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT);
+ palSetLineMode(I2C1_SCL_PIN, PAL_MODE_INPUT);
+ palSetLineMode(I2C1_SDA_PIN, PAL_MODE_INPUT);
chThdSleepMilliseconds(10);
#if defined(USE_GPIOV1)
- palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, I2C1_SCL_PAL_MODE);
- palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, I2C1_SDA_PAL_MODE);
+ palSetLineMode(I2C1_SCL_PIN, I2C1_SCL_PAL_MODE);
+ palSetLineMode(I2C1_SDA_PIN, I2C1_SDA_PAL_MODE);
#else
- palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
- palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
+ palSetLineMode(I2C1_SCL_PIN, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
+ palSetLineMode(I2C1_SDA_PIN, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
#endif
}
}
diff --git a/platforms/chibios/drivers/i2c_master.h b/platforms/chibios/drivers/i2c_master.h
index c68109acbd..303aa69907 100644
--- a/platforms/chibios/drivers/i2c_master.h
+++ b/platforms/chibios/drivers/i2c_master.h
@@ -27,24 +27,11 @@
#include <ch.h>
#include <hal.h>
-#ifdef I2C1_BANK
-# define I2C1_SCL_BANK I2C1_BANK
-# define I2C1_SDA_BANK I2C1_BANK
+#ifndef I2C1_SCL_PIN
+# define I2C1_SCL_PIN B6
#endif
-
-#ifndef I2C1_SCL_BANK
-# define I2C1_SCL_BANK GPIOB
-#endif
-
-#ifndef I2C1_SDA_BANK
-# define I2C1_SDA_BANK GPIOB
-#endif
-
-#ifndef I2C1_SCL
-# define I2C1_SCL 6
-#endif
-#ifndef I2C1_SDA
-# define I2C1_SDA 7
+#ifndef I2C1_SDA_PIN
+# define I2C1_SDA_PIN B7
#endif
#ifdef USE_I2CV1