i2c - allow slave stretching SCL (just loop and check) (#1589)

This commit is contained in:
zelll 2016-11-13 23:16:07 +08:00 committed by Philip Gladstone
parent a168449619
commit 798759950f
1 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,8 @@ LOCAL uint8 pinSCL = 15;
LOCAL void ICACHE_FLASH_ATTR
i2c_master_setDC(uint8 SDA, uint8 SCL)
{
uint8 sclLevel;
SDA &= 0x01;
SCL &= 0x01;
m_nLastSDA = SDA;
@ -47,6 +49,11 @@ i2c_master_setDC(uint8 SDA, uint8 SCL)
} else {
I2C_MASTER_SDA_HIGH_SCL_HIGH();
}
if(1 == SCL) {
do {
sclLevel = GPIO_INPUT_GET(GPIO_ID_PIN(I2C_MASTER_SCL_GPIO));
} while(sclLevel == 0);
}
}
/******************************************************************************