From a4055061108975b41e34602c29ed2185d8a654d1 Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Thu, 25 Apr 2024 16:59:11 -0500 Subject: Commit Prior to testing. --- mcc_generated_files/mssp2_i2c.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'mcc_generated_files/mssp2_i2c.c') diff --git a/mcc_generated_files/mssp2_i2c.c b/mcc_generated_files/mssp2_i2c.c index 67646e1..2a07931 100644 --- a/mcc_generated_files/mssp2_i2c.c +++ b/mcc_generated_files/mssp2_i2c.c @@ -128,6 +128,7 @@ uint8_t yeah; #define ARRAY_CNT 6 // Number of bytes in array uint8_t slaveAddress = 0x30; // 7-bit slave address uint8_t index = 0; // Array pointer +uint8_t I2C_timeout = 0; //Number of timer iterations since clear uint8_t temp = 0; // Temp register uint8_t regAdd = 1; // First data byte was reg add uint8_t i2cArray[ARRAY_CNT] = @@ -187,7 +188,7 @@ void __attribute__((interrupt, no_auto_psv)) _MSSP2Interrupt(void) { } if (SSP2STATbits.R_NOT_W == 0) // Master write (slave receive) { - TMR1 = 0x00; //Reset our timer when a message is received. + I2C_timeout = 0x00; //Reset our counter when a message is received. if (SSP2STATbits.D_NOT_A == 0) // Last byte was an address { _LATB7 = !_LATB7; @@ -223,6 +224,21 @@ void __attribute__((interrupt, no_auto_psv)) _MSSP2Interrupt(void) { _LATB8 = !SSP2CON1bits.SSPOV; } +uint8_t getTimeoutCounter() +{ + return I2C_timeout; +} + +void incrementTimeoutCounter() +{ + I2C_timeout++; +} +uint8_t getI2CArray(uint8_t index) +{ + if(index < 5)return i2cArray[index]; + else return 0; +} + void MSSP2_I2C_ReadPointerSet(uint8_t *p) { p_mssp2_i2c_read_pointer = p; -- cgit v1.2.3