mirror of https://github.com/ARMmbed/mbed-os.git
FPGA: Free up I2C pins to avoid interference with following I2C tests
The most suitable place to free up I2C pins is in i2c_free(). Due to i2c_free() not available in I2C HAL, we free up I2C pins manually by configuring them back to GPIO. Without free-up of I2C pins, SDA/SCL pins of the same I2C peripheral may share by multiple ports due to 'all ports' tests here, and the following I2C tests would be subject to interference by shared ports.pull/11152/head
parent
0e092603df
commit
1bf6d898b0
|
@ -51,6 +51,19 @@ void test_i2c_init_free(PinName sda, PinName scl)
|
|||
memset(&obj, 0, sizeof(obj));
|
||||
i2c_init(&obj, sda, scl);
|
||||
i2c_frequency(&obj, 100000);
|
||||
|
||||
/* Free up I2C pins
|
||||
*
|
||||
* The most suitable place to free up I2C pins is in i2c_free(). Due to
|
||||
* i2c_free() not available in I2C HAL, we free up I2C pins manually by
|
||||
* configuring them back to GPIO.
|
||||
*
|
||||
* Without free-up of I2C pins, SDA/SCL pins of the same I2C peripheral may
|
||||
* share by multiple ports due to 'all ports' tests here, and the following
|
||||
* I2C tests would be subject to interference by shared ports.
|
||||
*/
|
||||
gpio_set(sda);
|
||||
gpio_set(scl);
|
||||
}
|
||||
|
||||
void i2c_test_write(PinName sda, PinName scl)
|
||||
|
|
Loading…
Reference in New Issue