psgrade.c
JIG_Task:
void JIG_Task(void)
{
static int bytes_out = 0, bytes_in = 0;
... ... //prepare the response
HMACInit(jig_key,20);//place HMAInit here and delete it from main
jig_challenge_res[1]--;
jig_challenge_res[3]++;
... ...
Endpoint_Write_Stream_LE(&jig_challenge_res[bytes_in], 8, NO_STREAM_CALLBACK);
//Fix the bug
}
main:
int main(void)
{
SetupHardware();
//HMACInit(jig_key,20); //move to JIG_Task otherwise cause problem on some boards.
LED(~GREEN);
state = init;
switch_port(5);//modify switch_port(0) to 5, with the same reason.
...... }