// Write Checksum
//

// CryptoMemory Library Include Files
#include "CM_LIB.h"
#include "CM_I2C.h"
#include "CM_I2C_L.h"
#include "CM_GPA.h"

uint8_t	ucCmdWrChk[4] = {0xb4, 0x02, 0x00, 0x02};

// Send Checksum
uint8_t cm_SendChecksum(uint8_t* pucChkSum)
{
	uint8_t ucReturn;
	uint8_t ucChkSum[2];

    // Get Checksum if required
	if(pucChkSum == NULL) cm_CalChecksum(ucChkSum);
	else {
	   ucChkSum[0] = *pucChkSum++; 
	   ucChkSum[1] = *pucChkSum; 
    } 
	
	// Send the command
	ucReturn = cm_WriteCommand(ucCmdWrChk, ucChkSum, 2);

    // Give the CyrptoMemory some processing time
    CM_LOW_LEVEL.WaitClock(50);	//5
	
	// Done
    return ucReturn;
}
