atsam: Enable pullup on i2c SDA line

The internal pullup helps ensure i2c errors are detected properly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-05-23 09:17:50 -04:00
parent 24b1638c25
commit edb679b83d
1 changed files with 4 additions and 4 deletions

View File

@ -34,11 +34,11 @@ i2c_init(Twi *p_twi, uint32_t rate)
{ {
enable_pclock(p_twi == TWI0 ? ID_TWI0 : ID_TWI1); enable_pclock(p_twi == TWI0 ? ID_TWI0 : ID_TWI1);
if (p_twi == TWI0) { if (p_twi == TWI0) {
gpio_peripheral(TWI0_SCL_GPIO, 'A', 0); gpio_peripheral(TWI0_SCL_GPIO, 'A', 1);
gpio_peripheral(TWI0_SDA_GPIO, 'A', 0); gpio_peripheral(TWI0_SDA_GPIO, 'A', 1);
} else { } else {
gpio_peripheral(TWI1_SCL_GPIO, 'A', 0); gpio_peripheral(TWI1_SCL_GPIO, 'A', 1);
gpio_peripheral(TWI1_SDA_GPIO, 'A', 0); gpio_peripheral(TWI1_SDA_GPIO, 'A', 1);
} }
p_twi->TWI_IDR = 0xFFFFFFFF; p_twi->TWI_IDR = 0xFFFFFFFF;
(void)p_twi->TWI_SR; (void)p_twi->TWI_SR;