Skip to content

Commit f980ec2

Browse files
authored
Merge pull request #732 from awjackson/fix_731
Make X24C02 only enter read/write state if I2C address matches; fixes #731
2 parents e6efd7f + 38bb5b1 commit f980ec2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/boards/bandai.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,12 @@ static void x24c02_write(uint8 data) {
178178
x24c02_addr <<= 1;
179179
x24c02_addr |= sda;
180180
} else {
181-
if (sda) // READ COMMAND
181+
if ((x24c02_addr & 0x78) != 0x50) { // WRONG DEVICE ADDRESS
182+
x24c02_out = 1;
183+
x24c02_state = X24C0X_STANDBY;
184+
} else if (sda) // READ COMMAND
182185
x24c02_state = X24C0X_READ;
183-
else // WRITE COMMAND
186+
else // WRITE COMMAND
184187
x24c02_state = X24C0X_WORD;
185188
}
186189
x24c02_bitcount++;

0 commit comments

Comments
 (0)