summaryrefslogtreecommitdiff
path: root/mcc_generated_files
diff options
context:
space:
mode:
Diffstat (limited to 'mcc_generated_files')
-rw-r--r--mcc_generated_files/mssp1_spi.c1
-rw-r--r--mcc_generated_files/mssp2_i2c.c18
-rw-r--r--mcc_generated_files/mssp2_i2c.h4
-rw-r--r--mcc_generated_files/tmr1.c3
4 files changed, 21 insertions, 5 deletions
diff --git a/mcc_generated_files/mssp1_spi.c b/mcc_generated_files/mssp1_spi.c
index d776f9e..6fa74bb 100644
--- a/mcc_generated_files/mssp1_spi.c
+++ b/mcc_generated_files/mssp1_spi.c
@@ -142,7 +142,6 @@ void SPI_slaveDeselect(void)
{
_LATB15 = 1;
}
-
/**
End of File
*/
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;
diff --git a/mcc_generated_files/mssp2_i2c.h b/mcc_generated_files/mssp2_i2c.h
index 3fbd36c..5937b45 100644
--- a/mcc_generated_files/mssp2_i2c.h
+++ b/mcc_generated_files/mssp2_i2c.h
@@ -149,7 +149,8 @@ typedef enum
</code>
*/
-
+uint8_t getTimeoutCounter(void);
+void incrementTimeoutCounter(void);
void MSSP2_I2C_Initialize(void);
@@ -344,6 +345,7 @@ uint8_t *MSSP2_I2C_ReadPointerGet(void);
</code>
*/
+uint8_t getI2CArray(uint8_t);
uint8_t *MSSP2_I2C_WritePointerGet(void);
diff --git a/mcc_generated_files/tmr1.c b/mcc_generated_files/tmr1.c
index 25bc139..1cb4180 100644
--- a/mcc_generated_files/tmr1.c
+++ b/mcc_generated_files/tmr1.c
@@ -159,8 +159,7 @@ uint16_t TMR1_Counter16BitGet( void )
void __attribute__ ((weak)) TMR1_CallBack(void)
{
- _LATB8 = 0;
- _LATB7 = 1;
+
}
void TMR1_SetInterruptHandler(void (* InterruptHandler)(void))