/*
 * i2c_fram.h
 *
 *  Created on: Aug 5, 2019
 *      Author: tm
 */

#ifndef MPHOX_I2C_FRAM_H_
#define MPHOX_I2C_FRAM_H_



#include <stdint.h>
#include <stdbool.h>

#include "driverlib/i2c.h"
#include "inc/hw_i2c.h"
//#include "global_include.h"


//****************************Function prototypes******************************
#ifdef GENERALCASE
void I2C_Init(uint32_t ui32Base, bool bFast);
void I2C_Write(uint32_t ui32Base, unsigned char uiSlave_add, unsigned char *ucData,
        uint16_t uiCount, unsigned char ucStart_add );
void I2C_Read(uint32_t ui32Base, unsigned char uiSlave_add, unsigned char *ucRec_Data,
        uint16_t uiCount, unsigned char ucStart_add, bool bDummyRead);
#endif

void fram_init(void);
uint32_t fram_read(uint32_t offset, void* pBuf, uint32_t byteCount);
void fram_test(void);

void fram_sys_samp_store(void);
void fram_sys_samp_retrieve(void);
void fram_store(void);
void fram_retrieve(void);

// I2C0_BASE i2c functions
void i2c0_init(bool bFast);
void i2c0_write(unsigned char uiSlave_add, unsigned char *ucData,
        uint16_t uiCount, unsigned char ucStart_add );
void i2c0_read(unsigned char uiSlave_add, unsigned char *ucRec_Data,
        uint16_t uiCount, unsigned char ucStart_add, bool bDummyRead);

uint8_t i2c0_read8(uint16_t device_address, uint16_t device_register);
void i2c0_write8(uint16_t device_address, uint16_t device_register, uint8_t device_data);
//*****************************************************************************


#endif /* I2C_FRAM_H_ */
