I2CTester: add address mismatch statistics

pull/10944/head
Maciej Bocianski 2019-07-02 15:20:34 +02:00
parent fb589319bf
commit b65d93e5ef
3 changed files with 19 additions and 3 deletions

View File

@ -79,9 +79,16 @@ uint8_t I2CTester::state_num()
uint8_t I2CTester::num_dev_addr_matches() uint8_t I2CTester::num_dev_addr_matches()
{ {
uint8_t num_correct = 0; uint8_t num_dev_addr_matches = 0;
read(TESTER_I2C_NUMBER_DEV_ADDR_MATCHES, &num_correct, sizeof(num_correct)); read(TESTER_I2C_NUMBER_DEV_ADDR_MATCHES, &num_dev_addr_matches, sizeof(num_dev_addr_matches));
return num_correct; return num_dev_addr_matches;
}
uint8_t I2CTester::num_dev_addr_mismatches()
{
uint8_t num_dev_addr_mismatches = 0;
read(TESTER_I2C_NUMBER_DEV_ADDR_MISMATCHES, &num_dev_addr_mismatches, sizeof(num_dev_addr_mismatches));
return num_dev_addr_mismatches;
} }
void I2CTester::set_device_address(uint16_t addr) void I2CTester::set_device_address(uint16_t addr)

View File

@ -96,6 +96,13 @@ public:
*/ */
uint8_t num_dev_addr_matches(); uint8_t num_dev_addr_matches();
/**
* Get the number of times the device address has been sent incorrectly
*
* @return The number of times the device address has been sent incorrectly
*/
uint8_t num_dev_addr_mismatches();
/** /**
* Set the I2C slave device address * Set the I2C slave device address
* *

View File

@ -194,3 +194,5 @@
#define TESTER_I2C_NUM_READS (0x018 + 0x00105000) #define TESTER_I2C_NUM_READS (0x018 + 0x00105000)
#define TESTER_I2C_FROM_SLAVE_CHECKSUM (0x01A + 0x00105000) #define TESTER_I2C_FROM_SLAVE_CHECKSUM (0x01A + 0x00105000)
#define TESTER_I2C_FROM_SLAVE_CHECKSUM_SIZE 4 #define TESTER_I2C_FROM_SLAVE_CHECKSUM_SIZE 4
#define TESTER_I2C_NUMBER_DEV_ADDR_MISMATCHES (0x01E + 0x00105000)
#define TESTER_I2C_NUMBER_DEV_ADDR_MISMATCHES_SIZE 1