/* Writes the credential */ void crd_printDetail(uint8_t start, uint8_t stop){ position = 0; counter = 0; crdStart = start; crdStop = stop; crd_apply(); }
void printUpdate(void) { char ascii = 0; if(strBuf[actString].info != EMPTY) { if(strBuf[actString].info == RAM) { ascii = *(strBuf[actString].strPtr); //READ CHAR } else if(strBuf[actString].info == FLASH) { ascii = pgm_read_byte(strBuf[actString].strPtr);//READ CHAR } } switch(kbd_status) { case INIT: //Initial debouncing if(debounceCount < INIT_DEBOUNCE) { releaseKeys(); debounceCount++; } else { kbd_status=RELEASED; debounceCount = 0; } break; case PRESSED: //We release releaseKeys(); kbd_status = RELEASED; if(strBuf[actString].len > 0) strBuf[actString].len--; break; case RELEASED: //We can PROCESS CHAR if( (strBuf[actString].callback == 0) && (ascii == 0) )//EOS { EOS=1; strBuf[actString].info = EMPTY; actString = (actString+1)%5; } else if( (strBuf[actString].callback != 0) && (strBuf[actString].len == 0) ) { strBuf[actString].info = EMPTY; crd_apply(); if(strBuf[actString].info == EMPTY) { EOS=1; } } else { strBuf[actString].strPtr++; //Increment pointer //Do we have to enter IDLE state? if(ascii == SYNCHRONOUS_IDLE_KEY) { kbd_status = IDLE; } else { pressKeyByChar(ascii); if(EOS==0) { //not first char cCount++;//new char to delete } else { //first char of string EOS=0; cCount = 1; } kbd_status = PRESSED; } } break; case IDLE: if(debounceCount < IDLE_TIMEOUT) { releaseKeys(); debounceCount++; } else { kbd_status=RELEASED; debounceCount = 0; } break; case DELETE: if(cCount > 0) { //DELETING pressKeyByChar(0x08); cCount--; kbd_status=DELETE_PRESSED; } else { //DONE ERASING releaseKeys(); //strBuf[actString].info = EMPTY; kbd_status=RELEASED; if(EOS==0) //if half word printing { EOS=1; //INVALIDATE CURRENT TYPING strBuf[actString].info = EMPTY; actString = (actString+1)%5; } } break; case DELETE_PRESSED: releaseKeys(); kbd_status=DELETE; break; } }