From 31f1c2edb03f6d0a821d780f804de4570ee3f3fb Mon Sep 17 00:00:00 2001 From: OctopusZ <928281509@qq.com> Date: Thu, 11 Jan 2024 08:20:00 -0500 Subject: [PATCH] add I2C_CLOCK_SPEED definition add I2C_CLOCK_SPEED definition --- qmk_porting/platforms/ch58x/i2c_master.c | 2 +- qmk_porting/platforms/ch58x/i2c_master.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/qmk_porting/platforms/ch58x/i2c_master.c b/qmk_porting/platforms/ch58x/i2c_master.c index 6b9d0ce5..9575e0fb 100644 --- a/qmk_porting/platforms/ch58x/i2c_master.c +++ b/qmk_porting/platforms/ch58x/i2c_master.c @@ -58,7 +58,7 @@ void i2c_init() setPinInputHigh(B12); setPinInputHigh(B13); #endif - I2C_Init(I2C_Mode_I2C, 400000, I2C_DutyCycle_16_9, I2C_Ack_Enable, I2C_AckAddr_7bit, TxAdderss); + I2C_Init(I2C_Mode_I2C, I2C_CLOCK_SPEED, I2C_DutyCycle_16_9, I2C_Ack_Enable, I2C_AckAddr_7bit, TxAdderss); while (I2C_GetFlagStatus(I2C_FLAG_BUSY)) { __nop(); } diff --git a/qmk_porting/platforms/ch58x/i2c_master.h b/qmk_porting/platforms/ch58x/i2c_master.h index 71fc029b..e958c36c 100644 --- a/qmk_porting/platforms/ch58x/i2c_master.h +++ b/qmk_porting/platforms/ch58x/i2c_master.h @@ -24,6 +24,10 @@ #include #include "gpio.h" +#ifndef I2C_CLOCK_SPEED +#define I2C_CLOCK_SPEED 400000 +#endif + typedef int16_t i2c_status_t; #define TxAdderss 0x52