Merge pull request #85 from shawnferry/tenbit_i2c

Corrected 10 bit address mask
This commit is contained in:
Agustín Gimenez Bernad 2023-10-12 13:47:51 +02:00 committed by GitHub
commit 0db87d8797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,9 +79,9 @@ namespace I2CProtocolAnalyzer
{
addressByte = false;
segment.Value += $"\r\nOp: {((value & 1) == 1 ? "Read" : "Write") }";
segment.Value += $"\r\nOp: {((value & 1) == 1 ? "Read" : "Write")}";
if ((value & 0xf8) == 0xf7)
if ((value & 0xf8) == 0xf0)
{
address10 = true;
firstAddressByte = value;
@ -105,7 +105,7 @@ namespace I2CProtocolAnalyzer
if (pos == -1)
break;
if(foundStartStop)
if (foundStartStop)
segments.Add(new ProtocolAnalyzerDataSegment { FirstSample = startPosition, LastSample = endPosition, Value = isStart ? "START" : "STOP" });
if (foundStartStop && !isStart)
@ -216,7 +216,7 @@ namespace I2CProtocolAnalyzer
private int ReadByte(int pos, ProtocolAnalyzerSelectedChannel scl, ProtocolAnalyzerSelectedChannel sda, out int byteStart, out int byteEnd, out byte value, out bool ack, out bool frameError)
{
byteStart = 0; byteEnd = 0; value = 0; ack = false; frameError= false;
byteStart = 0; byteEnd = 0; value = 0; ack = false; frameError = false;
while (pos < scl.Samples.Length && scl.Samples[pos] == 1) //Find next low clock
pos++;