pic_term.c File Reference

Include dependency graph for pic_term.c:

Functions

void term_init ()
void term_process ()

Variables

uns8 buffer_len
uns8 term_buffer [TERM_BUFFER_SIZE]

Function Documentation

void term_init (  ) 

00082                  {
00083     
00084     term_buffer[0] = '\0';
00085     buffer_len = 0;
00086 
00087 }

void term_process (  ) 

00043                     {
00044     
00045     uns8 len,   // length of string
00046          rec;   // received character
00047     
00048     if (serial_rx_avail()) {
00049     
00050         rec = serial_getc();    // get the character from the fifo
00051     
00052         #ifdef TERM_ALLOW_BOOSTBLOADER
00053             if (rec == MAGIC_BOOSTBLOADER_REQUEST) {
00054                 boostbloader();
00055             }
00056         #endif
00057         
00058         
00059         if (rec == '\r') {  // did we press return?
00060             
00061             if (buffer_len > 0) {
00062                 term_entry_callback(term_buffer);
00063             }
00064             term_buffer[0] = '\0';  // clear the buffer
00065             buffer_len = 0;
00066             #ifdef TERM_ECHO_INPUT
00067                 serial_putc('\n');  // print new line
00068                 serial_putc('>');   // print the prompt
00069             #endif  
00070         } else {
00071             if (buffer_len < TERM_BUFFER_SIZE + 2) {    // space for null and new character
00072                 #ifdef TERM_ECHO_INPUT
00073                     serial_putc(rec);   // print it out so we can see what we typed
00074                 #endif
00075                 term_buffer[buffer_len++] = rec;
00076                 term_buffer[buffer_len] = '\0';
00077             }
00078         }
00079     }   
00080 }

Here is the call graph for this function:


Variable Documentation

uns8 buffer_len
uns8 term_buffer[TERM_BUFFER_SIZE]

Generated on Fri Aug 19 09:08:41 2011 for Pic Pack Library by  doxygen 1.6.1