diff options
| author | Joel Challis <git@zvecr.com> | 2019-12-21 18:22:49 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-21 18:22:49 +0000 |
| commit | 376419a4f7e0489111a9ac24acc847342fe9d64d (patch) | |
| tree | 7956534e51eb87d62af3c4ba81f19118a7a04ef9 /drivers/arm/i2c_master.h | |
| parent | 05b479d349aafb8298b43fcbfcddc4440336de9c (diff) | |
| download | qmk_firmware-376419a4f7e0489111a9ac24acc847342fe9d64d.tar.gz qmk_firmware-376419a4f7e0489111a9ac24acc847342fe9d64d.zip | |
Add central location for ChibiOS defines (#7542)
* 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
Diffstat (limited to 'drivers/arm/i2c_master.h')
| -rw-r--r-- | drivers/arm/i2c_master.h | 28 |
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 | |||
| 102 | typedef int16_t i2c_status_t; | 94 | typedef int16_t i2c_status_t; |
| 103 | 95 | ||
| 104 | #define I2C_STATUS_SUCCESS (0) | 96 | #define I2C_STATUS_SUCCESS (0) |
