// CLEAR // Call LCD_Clear(); // Send "Called "LCD_Clear()" to the PC void OnCLEAR(void) { sendFString(CLEAR_msg); // Stop any scrolling gScrollMode = 0; gScroll = 0; LCD_Clear(); LCD_UpdateRequired(1,0); }
// PUTC,digit,character // Call LCD_putc(digit, character); // Send "Called LCD_putc" to PC. void OnPUTC(char *PUTCstr) { uint8_t digit; sendFString(PUTC_msg); digit = (uint8_t)(PUTCstr[4] - 48);// convert to integer if(digit <= 6) { LCD_putc(digit,PUTCstr[5]); LCD_UpdateRequired(1,0); } }
/***************************************************************************** * * Function name : EnterName * * Returns : char ST_state (to the state-machine) * * Parameters : char input (from joystick) * * Purpose : Lets the user enter a name using the joystick. Pressing the * joystick UP/DOWN will browse the alphabet and NEXT/PREV * will shift between the characters in the name. * *****************************************************************************/ char EnterName(char input) { static char enter = 1; static char temp_index = 0; static char temp_name[6]; char i; if (enter) { LoadEEPROM(Name, index, EEPROM_START + 1); // Load name from EEPROM if(index) index -= 1; //make the last character in name blink enter = 0; } else { temp_index = index; for(i = 5; (i != 255); i--, temp_index--) { if ((Name[temp_index] >= ' ') && (Name[temp_index] <= 'z') && (temp_index != 255)) //check if it's legal character temp_name[i] = Name[temp_index]; else temp_name[i] = ' '; // if not, put in a space } LCD_putc(0, temp_name[0]); LCD_putc(1, temp_name[1]); LCD_putc(2, temp_name[2]); LCD_putc(3, temp_name[3]); LCD_putc(4, temp_name[4]); LCD_putc(5, temp_name[5] | 0x80); //Make this digit blink LCD_putc(6, '\0'); if (input != KEY_NULL) LCD_FlashReset(); LCD_UpdateRequired(TRUE, 0); } if (input != KEY_NULL) LCD_FlashReset(); if (input == KEY_PLUS) { Name[index]--; if( (('!' <= Name[index]) && (Name[index] <= '/')) && (Name[index] != ' ')) Name[index] = ' '; else if( (':' <= Name[index]) && (Name[index] <= '@')) Name[index] = '9'; else if(Name[index] >= '[') Name[index] = 'Z'; else if(Name[index] < ' ') Name[index] = 'Z'; } else if (input == KEY_MINUS) { Name[index]++; if( (('!' <= Name[index]) && (Name[index] <= '/')) && (Name[index] != ' ')) Name[index] = '0'; else if( (':' <= Name[index]) && (Name[index] <= '@')) Name[index] = 'A'; else if(Name[index] >= '[') Name[index] = ' '; else if(Name[index] < ' ') Name[index] = ' '; } else if (input == KEY_PREV) { if(index) { index--; } } else if (input == KEY_NEXT) { if(index < STRLENGHT) { index++; Name[index] = 'A'; } } else if (input == KEY_ENTER) { index++; Name[index] = '\0'; __EEPUT(EEPROM_START, index); //store the length of name in EEPROM StoreEEPROM(Name, index, EEPROM_START + 1); //store the Name in EEPROM enter = 1; return ST_VCARD_FUNC; } return ST_VCARD_ENTER_NAME_FUNC; }