/*
 * GTCP_I2C.h
 */

#ifndef GTCP_I2C_H_
#define GTCP_I2C_H_

//#include <msp430.h>
#ifdef __MSP430F5529__
#include <msp430F5529.h>
#elif defined __MSP430FR6989__
#include <msp430fr6989.h>
#endif

#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include "Interface.h"

unsigned char *PTxData;
unsigned char *PRxData;
int TXByteCtr;
char TXData;
int RXByteCtr;
char RXData;
unsigned char RXDataArray[RX_BUFFER_SIZE];

int TRDYFlag;

//Function Prototypes
void initI2C();
void resetUSCIStateMachine_I2C();
void initUSCIStateMachine_I2C();
void configureI2C();
void configureI2CGPIO();
void checkStop();
void checkStart();
void sendWriteStart();
void sendReadStart();
void sendStop();
void RX_Int(char enable);
void TX_Int(char enable);
void readI2C(uint8_t length);
void readMultipleI2CNI();
void writeI2C(unsigned char data);
void writeMultipleI2C(unsigned char* data);
void writeArrayI2C(unsigned char* data, int size);

__interrupt void USCI_B1_ISR(void);

#ifdef __MSP430F5529__
__interrupt void Port_2(void);
#elif defined __MSP430FR6989__
__interrupt void Port_1(void);
#endif

#endif /* GTCP_I2C_H_ */
