Skip to content

Commit 0fd6035

Browse files
I2CTester: add address mismatch statistics
1 parent fb58931 commit 0fd6035

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/I2CTester.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,16 @@ uint8_t I2CTester::state_num()
7979

8080
uint8_t I2CTester::num_dev_addr_matches()
8181
{
82-
uint8_t num_correct = 0;
83-
read(TESTER_I2C_NUMBER_DEV_ADDR_MATCHES, &num_correct, sizeof(num_correct));
84-
return num_correct;
82+
uint8_t num_dev_addr_matches = 0;
83+
read(TESTER_I2C_NUMBER_DEV_ADDR_MATCHES, &num_dev_addr_matches, sizeof(num_dev_addr_matches));
84+
return num_dev_addr_matches;
85+
}
86+
87+
uint8_t I2CTester::num_dev_addr_mismatches()
88+
{
89+
uint8_t num_dev_addr_mismatches = 0;
90+
read(TESTER_I2C_NUMBER_DEV_ADDR_MISMATCHES, &num_dev_addr_mismatches, sizeof(num_dev_addr_mismatches));
91+
return num_dev_addr_mismatches;
8592
}
8693

8794
void I2CTester::set_device_address(uint16_t addr)

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/I2CTester.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ class I2CTester: public MbedTester {
9696
*/
9797
uint8_t num_dev_addr_matches();
9898

99+
/**
100+
* Get the number of times the device address has been sent incorrectly
101+
*
102+
* @return The number of times the device address has been sent incorrectly
103+
*/
104+
uint8_t num_dev_addr_mismatches();
105+
99106
/**
100107
* Set the I2C slave device address
101108
*

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/fpga_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,4 @@
194194
#define TESTER_I2C_NUM_READS (0x018 + 0x00105000)
195195
#define TESTER_I2C_FROM_SLAVE_CHECKSUM (0x01A + 0x00105000)
196196
#define TESTER_I2C_FROM_SLAVE_CHECKSUM_SIZE 4
197+
#define TESTER_I2C_NUMBER_DEV_ADDR_MISMATCHES (0x01E + 0x00105000)

0 commit comments

Comments
 (0)