void getPassword(uint8 array[]) { sint8 i; uint8 key; for (i = 0; i < 5; i++) { key = KeyPad_getPressedKey(); if (key == '*') { LCD_displayStringRowColumn(1, 0, " "); i = -1; continue; } else if ((key >= 0) && (key <= 9)) { array[i] = key; } else { i -= 1; continue; } _delay_ms(BUTTON_DELAY); LCD_goToRowColumn(1, i + 3); LCD_displayCharacter('*'); if (i == 4) { key = KeyPad_getPressedKey(); if (key == 13) { break; } else if (key == '*') { LCD_displayStringRowColumn(1, 0, " "); i = -1; continue; } } } }
uint32 KeyPad_getSeriesOfPressedNumbers(uint8 len) { uint8 SeriesOfpressedKeys[len];/*Only C99,VLA feature*/ uint8 index; /*Used For Looping*/ uint32 value=0; /*The return Number,Only unsigned !*/ for(index=0;index<len;index++) { SeriesOfpressedKeys[index]=KeyPad_getPressedKey(); _delay_ms(300); } for(index=0;index<len;index++) { value+=SeriesOfpressedKeys[len-index-1]*powerOf(10,index); } if(!(value >= 0)) return -1; return value; }