UART로 Terminal 만들기
출처:http://blog.paran.com/clinux/23942264
UART로 Terminal 만들기
unsigned char temp;
temp = UDR0;
switch(temp){
case 0x08 : //Back Space
if( CommandBufPos != 0 ){
CommandBuf[--CommandBufPos] = NULL;
usart_printf( "\b \b" );
}
break;
case 0x0D : //Enter(CR)
if( CommandBufPos != 0 ){
CommandBuf[CommandBufPos] = NULL;
CommandBufPos = 0;
FlagCommandBufFull = 1;
usart_printf( "\n\r" );
}
else{
usart_printf( "\n\r%s" , ptPrompt );
}
break;
case 0x7F : //Del
break;
default :
CommandBuf[CommandBufPos++] = temp;
usart_putch( temp );
break;
}