Skip to content
This repository was archived by the owner on Aug 9, 2022. It is now read-only.

Commit 27bf6e6

Browse files
committed
disable ack checks
1 parent 0ff744d commit 27bf6e6

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/i2c.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ where
7777
// Clear all I2C interrupts
7878
i2c.0.int_clr.write(|w| unsafe { w.bits(0x3FFF) });
7979

80-
// enable I2C_ACK_ERR_INT
81-
i2c.0.int_ena.write(|w| w.ack_err_int_ena().set_bit());
82-
8380
i2c.0.ctr.modify(|_, w| unsafe {
8481
// Clear register
8582
w.bits(0)
@@ -265,7 +262,7 @@ where
265262
w.command1().bits(
266263
Command::Write {
267264
ack_exp: Ack::ACK,
268-
ack_check_en: true,
265+
ack_check_en: false,
269266
length: 1 + bytes.len() as u8
270267
}.into()
271268
)
@@ -311,7 +308,7 @@ where
311308
self.0.comd1.write(|w| unsafe {
312309
w.command1().bits(Command::Write {
313310
ack_exp: Ack::ACK,
314-
ack_check_en: true,
311+
ack_check_en: false,
315312
length: 1,
316313
}.into())
317314
});
@@ -424,7 +421,7 @@ where
424421
self.0.comd1.write(|w| unsafe {
425422
w.command1().bits(Command::Write {
426423
ack_exp: Ack::ACK,
427-
ack_check_en: true,
424+
ack_check_en: false,
428425
length: 1 + bytes.len() as u8,
429426
}.into())
430427
});
@@ -441,7 +438,7 @@ where
441438
self.0.comd3.write(|w| unsafe {
442439
w.command3().bits(Command::Write {
443440
ack_exp: Ack::ACK,
444-
ack_check_en: true,
441+
ack_check_en: false,
445442
length: 1,
446443
}.into())
447444
});
@@ -625,12 +622,11 @@ impl From<Command> for u16 {
625622

626623
let mut cmd: u16 = length.into();
627624

628-
// TODO: Disabling until we figure out how to get the ack checks to work properly
629-
// if ack_check_en {
630-
// cmd |= 1 << 8;
631-
// } else {
632-
// cmd &= !(1 << 8);
633-
// }
625+
if ack_check_en {
626+
cmd |= 1 << 8;
627+
} else {
628+
cmd &= !(1 << 8);
629+
}
634630

635631
if ack_exp == Ack::NACK {
636632
cmd |= 1 << 9;

0 commit comments

Comments
 (0)