/**************************************************

 * File: input.c        Project by: David Hodgdon *

 * Class: ECE476        Instructor: Bruce Land    *         

 *************************************************/
#include <stdio.h>
#include "scan.h"
#include "input.h"
#include "serial.h"      
#include "lcd.h"

#define INPUTSTRSIZE 20
static char inputStr[INPUTSTRSIZE+1];


char* InputGetString() {
#ifndef ATMEL
	gets(inputStr);
	return inputStr;
#else

#if 0
	init_kb();
	while(eol==0);
	stop_kb();
	return kb_buffer;
#endif

	char i;                           
	for(i=0;i<INPUTSTRSIZE;i++) {
		putchar(SerialRequestInput);          
		inputStr[i]=getchar();                
		sprintf(lcd_buffer, "%c", inputStr[i]);
		if(inputStr[i]==0x8) {   
//  			ScanDebug("Hi");

		 	LCDBackspace();
		 	i=i-2;
		} 
		else {
			LCDPrintString(lcd_buffer);
			if(inputStr[i]=='\n' || inputStr[i]=='\r') {
				inputStr[i]='\0';
				break;
			}     
		}                                 
	}                 
	LCDNewLine();
	return inputStr;
#endif

}