/*◄■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ eeMemory.h ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■►*/

/* 
 * File       : eeMemory.h
 * Author     : JWDarsow
 * See        : eeMemory.c for title information
 * Created on : Monday, March 6, 2017
 */

#ifndef EEMEMORY_H
#define	EEMEMORY_H

/*═════════════════════════════════ INCLUDEs ═════════════════════════════════*/
#include <xc.h>
#include "JWD-NHR_Common.h"
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>

/*═══════════════════════════ FUNCTION DECLARATIONS ══════════════════════════*/
// <editor-fold defaultstate="collapsed" desc="Function Declarations">
/*──────────────────────── Internal EEPROM Write Byte ────────────────────────*/
/**
  @Summary
    Writes a data byte to Data EEPROM

  @Description
    This routine writes a data byte to given Data EEPROM location

  @Preconditions
    None

  @Param
    bAdd  - Data EEPROM location to which data to be written
    bData - Data to be written to Data EEPROM location

  @Returns
    None

  @Example
    <code>
    uint16_t dataeeAddr = 0x10;
    uint8_t dataeeData = 0x55;

    DATAEE_WriteByte(dataeeAddr, dataeeData);
    </code>
*/
void eeprom_wr_byte(uint16_t bAdd, uint8_t bData);

/*──────────────────────── Internal EEPROM Read Byte ─────────────────────────*/
/**
  @Summary
    Reads a data byte from Data EEPROM

  @Description
    This routine reads a data byte from given Data EEPROM location

  @Preceeprom_wr_bytene

  @Param
    bAdd  - Data EEPROM location from which data has to be read

  @Returns
    Data byte read from given Data EEPROM location

  @Example
    <code>
    uint16_t dataeeAddr = 0x10;
    uint8_t readData;

    readData = DATAEE_ReadByte(dataeeAddr);
    </code>
*/
Byte eeprom_rd_byte(uint16_t bAdd);

/*─────────────────────────── Write Bytes to EEPROM ──────────────────────────*/
void eeprom_wr_page(uInt16 addr,Byte *data, uInt8 length);

/*──────────────────────── Internal EEPROM Read Bytes ────────────────────────*/
Byte *  eeprom_rd_page(uInt16 addr,Byte *data, uInt8 length);

/*────────────────────────── Put String in EEPROM ────────────────────────────*/
void putEEPROMstr(uInt16 addr, const Char * str);

/*───────────────────────── Get String from EEPROM ───────────────────────────*/
Char * getEEPROMstr(uInt16 addr, Char * str);

// </editor-fold>

#endif	/* EEMEMORY_H */

