diff options
Diffstat (limited to 'mcc_generated_files')
-rw-r--r-- | mcc_generated_files/mssp2_i2c.c | 9 | ||||
-rw-r--r-- | mcc_generated_files/mssp2_i2c.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/mcc_generated_files/mssp2_i2c.c b/mcc_generated_files/mssp2_i2c.c index 2a07931..dabd9a9 100644 --- a/mcc_generated_files/mssp2_i2c.c +++ b/mcc_generated_files/mssp2_i2c.c @@ -128,7 +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 I2C_timeout = 10; //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] =
@@ -188,9 +188,10 @@ void __attribute__((interrupt, no_auto_psv)) _MSSP2Interrupt(void) { }
if (SSP2STATbits.R_NOT_W == 0) // Master write (slave receive)
{
- I2C_timeout = 0x00; //Reset our counter when a message is received.
+
if (SSP2STATbits.D_NOT_A == 0) // Last byte was an address
- {
+ {
+ I2C_timeout = 0; //Reset our counter when a message is received.
_LATB7 = !_LATB7;
regAdd = 1; // Next byte register address
temp = SSP2BUF; // Clear BF
@@ -233,7 +234,7 @@ void incrementTimeoutCounter() {
I2C_timeout++;
}
-uint8_t getI2CArray(uint8_t index)
+uint8_t getI2CArray(int index)
{
if(index < 5)return i2cArray[index];
else return 0;
diff --git a/mcc_generated_files/mssp2_i2c.h b/mcc_generated_files/mssp2_i2c.h index 5937b45..f76d48c 100644 --- a/mcc_generated_files/mssp2_i2c.h +++ b/mcc_generated_files/mssp2_i2c.h @@ -345,7 +345,7 @@ uint8_t *MSSP2_I2C_ReadPointerGet(void); </code>
*/
-uint8_t getI2CArray(uint8_t);
+uint8_t getI2CArray(int);
uint8_t *MSSP2_I2C_WritePointerGet(void);
|