intiial commit

Dependencies:   MAX8614X USBDevice max32630hsp_test

Revision:
11:ec7998257ec2
Parent:
10:0b940aff3bb8
Child:
12:fc888315e5fd
--- a/main.cpp	Thu Aug 16 19:56:38 2018 +0000
+++ b/main.cpp	Thu Aug 16 20:12:20 2018 +0000
@@ -36,7 +36,7 @@
 #include "max32630hsp.h"
 #include "MAX8614X.h"
 #include "USBSerial.h"
-void executeSha256(uint8_t *challenge, unsigned int challengeLen);
+void executeSha256(MAX8614X &m, uint8_t *challenge, unsigned int challengeLen);
 
 
 MAX32630HSP icarus(MAX32630HSP::VIO_1V8);
@@ -95,11 +95,12 @@
 
     rLED = LED_OFF;
     printf("\r\n\rmax86140 authenication software\r\n");
-//    MAX8614X m(spi,cs,interrupt_pin);
+    MAX8614X m(spi,cs,interrupt_pin);
+    //    MAX8614X m(spi,cs,interrupt_pin);
 //    m.readRegister(MAX8614X::MAX8614X_PART_ID_REG, data, 1);
 //    printf("device id should be 0x24, reg %02X = %02X\r\n", MAX8614X::MAX8614X_PART_ID_REG, data[0]);
 
-    executeSha256(challenge_1, CHALLENGE_SZ_NO_SECRET);
+    executeSha256(m, challenge_1, CHALLENGE_SZ_NO_SECRET);
    //● Compare MAC from MAX86140 wth Host's precalculated MAC.
     //● Check PASS or FAIL.
     //● Disable SHA_EN bit ( Write 0 to SHA_EN bit).     
@@ -142,7 +143,7 @@
 }
 
 
-void executeSha256(uint8_t *challenge, unsigned int challengeLen)
+void executeSha256(MAX8614X &m, uint8_t *challenge, unsigned int challengeLen)
 {
     int i, j, k;
     uint8_t macData[256];
@@ -152,7 +153,7 @@
     uint32_t tmpData;
     const unsigned int responseLen32 = 8;
     uint8_t data[5];
-    MAX8614X m(spi,cs,interrupt_pin);
+
     //● Enable SHA_DONE Interrupt
     m.writeRegister(MAX8614X::MAX8614X_INT_ENABLE2_REG, MAX8614X::MAX8614X_IE_SHA_DONE_EN);