Open AndrewCapon opened 1 month ago
151 tests ±0 151 :white_check_mark: ±0 0s :stopwatch: ±0s 16 suites ±0 0 :zzz: ±0 1 files ±0 0 :x: ±0
Results for commit b1c10b68. ± Comparison against base commit f7727edb.
Unable to confirm this works. Tested on the daisy field, replaced I2C1 with I2C4, which should work since they share pins, but it stops working. More digging may be needed.
I don't think they share pins, is the field different to the seed?
This works here for both i2c1 and i2c4 on the seed:
#define TEST_I2C 4
int main(void)
{
hw.Init();
I2CHandle i2c;
I2CHandle::Config i2c_config;
#if TEST_I2C == 4
i2c_config.periph = I2CHandle::Config::Peripheral::I2C_4;
i2c_config.speed = I2CHandle::Config::Speed::I2C_100KHZ;
i2c_config.mode = I2CHandle::Config::Mode::I2C_MASTER;
i2c_config.pin_config.scl = hw.GetPin(13);
i2c_config.pin_config.sda = hw.GetPin(14);
i2c_config.address = 0x3C;
#else
i2c_config.periph = I2CHandle::Config::Peripheral::I2C_1;
i2c_config.speed = I2CHandle::Config::Speed::I2C_100KHZ;
i2c_config.mode = I2CHandle::Config::Mode::I2C_MASTER;
i2c_config.pin_config.scl = hw.GetPin(11);
i2c_config.pin_config.sda = hw.GetPin(12);
i2c_config.address = 0x3C;
#endif
i2c.Init(i2c_config);
uint8_t data;
while(1)
i2c.TransmitBlocking(i2c_config.address, &data, 1, 1000);
return 0;
}
Sorry for the back and forth, I was able to retest and confirm this is working. Thanks for your contribution!
Use GPIO_AF6_I2C4 for alternate function