CM_WRCKSUM.c 690 B

123456789101112131415161718192021222324252627282930313233
  1. // Write Checksum
  2. //
  3. // CryptoMemory Library Include Files
  4. #include "CM_LIB.h"
  5. #include "CM_I2C.h"
  6. #include "CM_I2C_L.h"
  7. #include "CM_GPA.h"
  8. uint8_t ucCmdWrChk[4] = {0xb4, 0x02, 0x00, 0x02};
  9. // Send Checksum
  10. uint8_t cm_SendChecksum(uint8_t* pucChkSum)
  11. {
  12. uint8_t ucReturn;
  13. uint8_t ucChkSum[2];
  14. // Get Checksum if required
  15. if(pucChkSum == NULL) cm_CalChecksum(ucChkSum);
  16. else {
  17. ucChkSum[0] = *pucChkSum++;
  18. ucChkSum[1] = *pucChkSum;
  19. }
  20. // Send the command
  21. ucReturn = cm_WriteCommand(ucCmdWrChk, ucChkSum, 2);
  22. // Give the CyrptoMemory some processing time
  23. CM_LOW_LEVEL.WaitClock(50); //5
  24. // Done
  25. return ucReturn;
  26. }