diff options
author | Joel Challis <git@zvecr.com> | 2021-12-02 14:32:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-02 14:32:31 +0000 |
commit | 3bf2403244b035e982dec17680b836afbe5df603 (patch) | |
tree | 440023b7c3d4c69edcfb31969245abf4a173b9af /keyboards | |
parent | 44662618954ee72d3521becc2ffe517b47c10b2d (diff) |
Tidy up existing i2c_master implementations (#15376)
* Move chibios defines out of header
* Make some avr defines internal
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/matrix/m20add/m20add.c | 19 | ||||
-rw-r--r-- | keyboards/yanghu/unicorne/config.h | 6 |
2 files changed, 6 insertions, 19 deletions
diff --git a/keyboards/matrix/m20add/m20add.c b/keyboards/matrix/m20add/m20add.c index 21f4f9b1ba..4d328d6c54 100644 --- a/keyboards/matrix/m20add/m20add.c +++ b/keyboards/matrix/m20add/m20add.c @@ -53,25 +53,6 @@ bool led_update_kb(led_t led_state) { return res; } -// override the default implementation to avoid re-initialization -void i2c_init(void) -{ - static bool initialized = false; - if (initialized) { - return; - } else { - initialized = true; - } - - // Try releasing special pins for a short time - palSetLineMode(I2C1_SCL_PIN, PAL_MODE_INPUT); - palSetLineMode(I2C1_SDA_PIN, PAL_MODE_INPUT); - - chThdSleepMilliseconds(10); - 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 void shutdown_user(void) { diff --git a/keyboards/yanghu/unicorne/config.h b/keyboards/yanghu/unicorne/config.h index 652afeb3b4..27d21c7906 100644 --- a/keyboards/yanghu/unicorne/config.h +++ b/keyboards/yanghu/unicorne/config.h @@ -42,6 +42,12 @@ #define ENCODERS_PAD_B \ { B12, B0 } +/* I2C - required for custom i2c_init */ +#define I2C1_SCL_PIN B6 +#define I2C1_SDA_PIN B7 +#define I2C1_SCL_PAL_MODE 4 +#define I2C1_SDA_PAL_MODE 4 + /* Audio */ #define AUDIO_PIN A8 #define AUDIO_PWM_PAL_MODE 1 |