]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Add central location for ChibiOS defines (#7542)
authorJoel Challis <git@zvecr.com>
Sat, 21 Dec 2019 18:22:49 +0000 (18:22 +0000)
committerGitHub <noreply@github.com>
Sat, 21 Dec 2019 18:22:49 +0000 (18:22 +0000)
* Add central location for chibios defines

* Add central location for chibios defines - actually add files this time....

* Add Copyright header

* Update include order to resolve i2cv1 build errors

drivers/arm/i2c_master.c
drivers/arm/i2c_master.h
quantum/backlight/backlight_arm.c
quantum/quantum.h
tmk_core/common/chibios/chibios_config.h [new file with mode: 0644]

index b9eff0ad2e8b8524575b26004c9709d3186abed9..21aefd497ccfd654a2043728eb0362934cf2dcc2 100644 (file)
@@ -24,9 +24,8 @@
  * STM32_I2C_USE_I2C1 is TRUE in the mcuconf.h file. Pins B6 and B7 are used
  * but using any other I2C pins should be trivial.
  */
-
-#include "i2c_master.h"
 #include "quantum.h"
+#include "i2c_master.h"
 #include <string.h>
 #include <hal.h>
 
index 31cbfb9774a76dcdec5529a4435f536858cf803f..346513ad8086fe8a3dc61a8cfd2ef37b83a9792e 100644 (file)
 #include "ch.h"
 #include <hal.h>
 
-#if defined(STM32F1XX) || defined(STM32F1xx) || defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32F4XX) || defined(STM32L0xx) || defined(STM32L1xx)
-#    define USE_I2CV1
-#endif
-
 #ifdef I2C1_BANK
 #    define I2C1_SCL_BANK I2C1_BANK
 #    define I2C1_SDA_BANK I2C1_BANK
 #    define I2C1_SDA 7
 #endif
 
-#if defined(STM32F1XX) || defined(STM32F1xx)
-#    define USE_GPIOV1
-#endif
-
-#ifndef USE_GPIOV1
-// The default PAL alternate modes are used to signal that the pins are used for I2C
-#    ifndef I2C1_SCL_PAL_MODE
-#        define I2C1_SCL_PAL_MODE 4
-#    endif
-#    ifndef I2C1_SDA_PAL_MODE
-#        define I2C1_SDA_PAL_MODE 4
-#    endif
-#endif
-
 #ifdef USE_I2CV1
 #    ifndef I2C1_OPMODE
 #        define I2C1_OPMODE OPMODE_I2C
 #    define I2C_DRIVER I2CD1
 #endif
 
+#ifndef USE_GPIOV1
+// The default PAL alternate modes are used to signal that the pins are used for I2C
+#    ifndef I2C1_SCL_PAL_MODE
+#        define I2C1_SCL_PAL_MODE 4
+#    endif
+#    ifndef I2C1_SDA_PAL_MODE
+#        define I2C1_SDA_PAL_MODE 4
+#    endif
+#endif
+
 typedef int16_t i2c_status_t;
 
 #define I2C_STATUS_SUCCESS (0)
index 3f94ccef8ecd05157fab74d6d9521061bfc242a7..8c6909a4ae83c8330403f647eb59c23e4871db3e 100644 (file)
 #        error "Backlight support for STMF072 is not available. Please disable."
 #    endif
 
-#    if defined(STM32F1XX) || defined(STM32F1xx)
-#        define USE_GPIOV1
-#    endif
-
 // GPIOV2 && GPIOV3
 #    ifndef BACKLIGHT_PAL_MODE
 #        define BACKLIGHT_PAL_MODE 2
index b9e7eea24b2c9270bf068a4b83d8feb318713afc..053b33b917c66447125bcd33a782c9015a18176e 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 #if defined(PROTOCOL_CHIBIOS)
 #    include "hal.h"
+#    include "chibios_config.h"
 #endif
 
 #include "wait.h"
diff --git a/tmk_core/common/chibios/chibios_config.h b/tmk_core/common/chibios/chibios_config.h
new file mode 100644 (file)
index 0000000..2725296
--- /dev/null
@@ -0,0 +1,24 @@
+/* Copyright 2019
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#pragma once
+
+#if defined(STM32F1XX)
+#    define USE_GPIOV1
+#endif
+
+#if defined(STM32F1XX) || defined(STM32F2XX) || defined(STM32F4XX) || defined(STM32L1XX)
+#    define USE_I2CV1
+#endif